/*
Theme Name: Next AI Media
Theme URI: https://example.com/
Author: Next AI
Author URI: https://example.com/
Description: A calm, mobile-first WordPress media theme for AI tools, ChatGPT guides, affiliate articles, and AdSense-friendly layouts.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.6
Requires PHP: 7.4
Text Domain: next-ai-media
*/

:root {
  --nai-brand: #20c76f;
  --nai-soft: #edf8f2;
  --nai-pale: #f8fcfa;
  --nai-ink: #22222a;
  --nai-text: #33343b;
  --nai-muted: #777985;
  --nai-line: #e8e9ee;
  --nai-bg: #f8f8f9;
  --nai-paper: #fff;
  --nai-radius: 6px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--nai-bg);
  color: var(--nai-text);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  line-height: 1.82;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

.site-container {
  width: min(1120px, calc(100% - 20px));
  margin: 0 auto;
}

.site-topbar {
  display: none;
  background: #f0f1f3;
  color: var(--nai-muted);
  font-size: 13px;
}

.site-topbar .site-container {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--nai-line);
}

.site-header__inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-brand img {
  width: 38px;
  height: 38px;
  border-radius: var(--nai-radius);
  object-fit: cover;
}

.site-brand__name {
  display: block;
  color: var(--nai-ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
}

.site-brand__tagline {
  display: none;
}

.site-search {
  display: none;
}

.site-nav {
  background: #fff;
  border-bottom: 1px solid var(--nai-line);
}

.site-nav .menu {
  width: 100%;
  display: flex;
  gap: 2px;
  margin: 0;
  padding: 0 10px;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}

.site-nav .menu::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  display: block;
  padding: 11px 13px;
  color: var(--nai-ink);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.site-nav .current-menu-item > a,
.site-nav a:hover {
  background: #f1f3f4;
}

.site-main-layout {
  width: min(1120px, calc(100% - 20px));
  margin: 16px auto 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.content-panel,
.widget,
.post-card,
.hero-panel,
.toc-box,
.summary-box,
.affiliate-box,
.faq-box {
  border: 1px solid var(--nai-line);
  border-radius: var(--nai-radius);
  background: #fff;
}

.hero-panel {
  margin: 16px auto 0;
  padding: 20px 16px;
}

.hero-panel__copy {
  padding-left: 14px;
  border-left: 4px solid var(--nai-brand);
}

.hero-panel__label {
  margin: 0 0 6px;
  color: #3f8c62;
  font-size: 13px;
  font-weight: 800;
}

.hero-panel h1 {
  margin: 0;
  color: var(--nai-ink);
  font-size: 28px;
  line-height: 1.42;
}

.hero-panel p {
  margin: 10px 0 0;
  color: var(--nai-muted);
  font-size: 14px;
}

.content-panel {
  padding: 16px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--nai-line);
}

.section-title {
  margin: 0;
  padding-left: 10px;
  border-left: 4px solid var(--nai-brand);
  color: var(--nai-ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.4;
}

.more-link {
  padding-top: 3px;
  color: var(--nai-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.category-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.category-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--nai-line);
  border-radius: var(--nai-radius);
  background: #fff;
}

.category-card__label,
.post-card__cat,
.cat-links a,
.tag-links a {
  display: inline-flex;
  margin-bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f3f4;
  color: var(--nai-muted);
  font-size: 11px;
  font-weight: 800;
}

.category-card h3 {
  margin: 0;
  color: var(--nai-ink);
  font-size: 16px;
  line-height: 1.45;
}

.category-card p {
  margin: 6px 0 0;
  color: var(--nai-muted);
  font-size: 13px;
  line-height: 1.65;
}

.post-list {
  display: grid;
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 12px;
}

.post-card__thumb {
  min-height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--nai-radius);
  background: linear-gradient(135deg, rgba(32, 199, 111, 0.16), rgba(255, 255, 255, 0.75)), #f1f3f4;
  color: var(--nai-ink);
  text-align: center;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  overflow: hidden;
}

.post-card__thumb img {
  width: 100%;
  height: 100%;
  min-height: 96px;
  object-fit: cover;
}

.post-card h2,
.post-card h3 {
  margin: 0;
  color: var(--nai-ink);
  font-size: 17px;
  line-height: 1.5;
}

.post-card p {
  margin: 7px 0 0;
  color: var(--nai-muted);
  font-size: 13px;
  line-height: 1.7;
}

.post-meta {
  margin-top: 7px;
  color: var(--nai-muted);
  font-size: 12px;
}

.rank-list {
  counter-reset: rank;
  display: grid;
  gap: 10px;
}

.rank-item {
  counter-increment: rank;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
}

.rank-item::before {
  content: counter(rank);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--nai-soft);
  color: var(--nai-ink);
  font-size: 13px;
  font-weight: 900;
}

.rank-item strong {
  display: block;
  color: var(--nai-ink);
  font-size: 14px;
  line-height: 1.5;
}

.rank-item span {
  display: block;
  color: var(--nai-muted);
  font-size: 12px;
}

.entry-article {
  padding: 20px 18px;
}

.breadcrumbs {
  margin-bottom: 12px;
  color: var(--nai-muted);
  font-size: 12px;
}

.entry-title {
  margin: 0;
  color: var(--nai-ink);
  font-size: 25px;
  font-weight: 900;
  line-height: 1.46;
}

.entry-meta {
  display: grid;
  gap: 3px;
  margin-top: 12px;
  color: var(--nai-muted);
  font-size: 12px;
}

.entry-content {
  margin-top: 18px;
}

.entry-content p {
  margin: 0 0 1.1em;
}

.entry-content h2 {
  margin: 2em 0 0.7em;
  padding: 0 0 0.4em 0.62em;
  border-left: 4px solid var(--nai-brand);
  border-bottom: 1px solid var(--nai-line);
  color: var(--nai-ink);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.45;
}

.entry-content h3 {
  margin: 1.6em 0 0.55em;
  color: var(--nai-ink);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.5;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.entry-content th,
.entry-content td {
  padding: 10px;
  border: 1px solid var(--nai-line);
  text-align: left;
  vertical-align: top;
}

.entry-content th {
  background: #f1f3f4;
  color: var(--nai-ink);
}

.article-eyecatch {
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--nai-line);
  border-radius: var(--nai-radius);
}

.article-eyecatch img {
  width: 100%;
  display: block;
}

.post-taxonomy {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.table-scroll {
  margin-right: -18px;
  margin-left: -18px;
  overflow-x: auto;
}

.table-scroll table {
  min-width: 620px;
}

.toc-box,
.summary-box,
.affiliate-box,
.faq-box {
  margin: 16px 0;
  padding: 14px;
}

.toc-box {
  background: #fafafa;
}

.summary-box {
  border-left: 4px solid var(--nai-brand);
  background: var(--nai-pale);
}

.toc-box h2,
.summary-box h2,
.affiliate-box h2,
.affiliate-box h3 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font-size: 18px;
}

.affiliate-box {
  border-left: 4px solid var(--nai-brand);
}

.button-row {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.button,
.wp-block-button__link {
  width: 100%;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border: 1px solid #cfe7da;
  border-radius: var(--nai-radius);
  background: var(--nai-soft);
  color: var(--nai-ink);
  font-weight: 900;
  line-height: 1.2;
}

.ad-slot {
  min-height: 76px;
  display: grid;
  place-items: center;
  margin: 16px 0;
  border: 1px dashed #d6d8df;
  border-radius: var(--nai-radius);
  background: #fafafa;
  color: var(--nai-muted);
  font-size: 13px;
}

.sidebar {
  display: none;
}

.widget {
  margin-bottom: 18px;
  padding: 18px;
}

.widget-title {
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--nai-brand);
  color: var(--nai-ink);
  font-size: 18px;
}

.site-footer {
  margin-top: 28px;
  padding: 24px 0;
  border-top: 1px solid var(--nai-line);
  background: #fff;
  color: var(--nai-muted);
  font-size: 13px;
}

.pagination,
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.page-numbers,
.nav-links a {
  padding: 7px 10px;
  border: 1px solid var(--nai-line);
  border-radius: var(--nai-radius);
  background: #fff;
  color: var(--nai-ink);
  font-size: 13px;
  font-weight: 700;
}

@media (min-width: 720px) {
  .site-topbar {
    display: block;
  }

  .site-brand img {
    width: 44px;
    height: 44px;
  }

  .site-brand__name {
    font-size: 24px;
  }

  .site-brand__tagline {
    display: block;
    margin-top: 3px;
    color: var(--nai-muted);
    font-size: 12px;
  }

  .site-search {
    width: min(360px, 40vw);
    display: flex;
    border: 1px solid var(--nai-line);
    border-radius: 999px;
    overflow: hidden;
    background: #fff;
  }

  .site-search input {
    min-width: 0;
    flex: 1;
    border: 0;
    padding: 10px 14px;
    font: inherit;
    font-size: 14px;
  }

  .site-search button {
    border: 0;
    padding: 0 16px;
    background: var(--nai-soft);
    color: var(--nai-ink);
    font-weight: 700;
  }

  .site-nav .menu {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 0;
  }

  .hero-panel {
    padding: 28px 22px;
  }

  .hero-panel h1 {
    font-size: 38px;
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .post-card {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    padding: 0 0 16px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .post-card:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }

  .entry-title {
    font-size: 38px;
  }
}

@media (min-width: 960px) {
  .site-main-layout {
    width: min(1120px, calc(100% - 28px));
    margin-top: 28px;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 28px;
  }

  .content-panel {
    padding: 22px;
  }

  .entry-article {
    padding: 30px 34px;
  }

  .sidebar {
    display: block;
  }

  .button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .button,
  .wp-block-button__link {
    width: auto;
  }
}

@media (max-width: 420px) {
  .site-container,
  .site-main-layout {
    width: min(100% - 16px, 1120px);
  }

  .entry-article {
    padding: 18px 14px;
  }

  .entry-title {
    font-size: 23px;
  }

  .table-scroll {
    margin-right: -14px;
    margin-left: -14px;
  }
}
