:root {
  color-scheme: light dark;
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Hiragino Sans',
    'Noto Sans JP', sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;

  --bg: #ffffff;
  --surface: #ffffff;
  --soft: #f5f6f8;
  --text: #0d0f14;
  --muted: #667085;
  --border: #e8eaed;
  --border-strong: #d6d9de;
  --accent: #6d5efc;
  --accent-2: #c850f2;
  --grad: linear-gradient(120deg, #6d5efc 0%, #8b5cf6 50%, #d150f2 100%);
  --shadow: 0 10px 30px rgba(15, 18, 30, 0.08);
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0b0f;
    --surface: #121319;
    --soft: #15171f;
    --text: #f1f2f5;
    --muted: #99a0ad;
    --border: #23262f;
    --border-strong: #2e323d;
    --accent: #8b8cff;
    --accent-2: #e07cff;
    --grad: linear-gradient(120deg, #8b8cff 0%, #a78bfa 50%, #e07cff 100%);
    --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
img {
  display: block;
  max-width: 100%;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tagline {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.nav {
  display: flex;
  gap: 4px;
}
.nav-link {
  color: var(--muted);
  font-size: 14px;
  padding: 7px 14px;
  border-radius: 9999px;
  transition: background 0.18s, color 0.18s;
}
.nav-link:hover {
  background: var(--soft);
  color: var(--text);
}
.nav-link.active {
  color: #fff;
  background: var(--accent);
}

/* ===== Layout ===== */
.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 32px 22px 72px;
}
.section-label {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 44px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.page-title {
  font-size: clamp(22px, 4vw, 30px);
  letter-spacing: -0.02em;
  margin: 6px 0 24px;
}
.empty {
  color: var(--muted);
}

/* ===== Masthead ===== */
.masthead {
  padding: 14px 0 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.masthead-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 7vw, 58px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.masthead-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(14px, 2.4vw, 17px);
}

/* ===== Featured ===== */
.featured {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 8px;
}
.featured-thumb {
  display: block;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--grad);
  box-shadow: var(--shadow);
}
.featured-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.featured:hover .featured-thumb img {
  transform: scale(1.04);
}
.featured-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.02em;
}
.kicker {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 10px;
}
.featured-title {
  font-size: clamp(22px, 3.2vw, 32px);
  line-height: 1.32;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.featured-title a:hover {
  color: var(--accent);
}
.featured-lead {
  color: var(--muted);
  font-size: 15px;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.featured-meta {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Card grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.card-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--grad);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}
.card:hover .card-thumb img {
  transform: scale(1.05);
}
.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.88);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.12em;
}
.card-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-meta {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.card-title {
  font-size: 16.5px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin: 0;
}
.card-title a:hover {
  color: var(--accent);
}
.card-lead {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ===== Tags ===== */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 9999px;
  color: var(--accent);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  transition: background 0.18s, border-color 0.18s;
}
.tag:hover {
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: var(--accent);
}
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.tag-lg {
  font-size: 14px;
  padding: 7px 16px;
}
.tag-count {
  color: var(--muted);
  font-size: 11px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 48px;
}
.page-btn {
  border: 1px solid var(--border-strong);
  border-radius: 9999px;
  padding: 9px 18px;
  font-size: 14px;
  transition: background 0.18s, color 0.18s;
}
.page-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.page-btn.disabled {
  color: var(--muted);
  border-color: var(--border);
  opacity: 0.5;
}
.page-status {
  font-size: 13px;
  color: var(--muted);
}

/* ===== Article ===== */
.article {
  max-width: 720px;
  margin: 0 auto;
}
.article-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}
.article-title {
  font-size: clamp(26px, 4.5vw, 38px);
  line-height: 1.3;
  letter-spacing: -0.025em;
  margin: 6px 0 12px;
}
.article-meta {
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 18px;
}
.article-meta a {
  color: var(--accent);
}
.article-lead {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text);
  font-weight: 500;
  padding-left: 16px;
  border-left: 3px solid var(--accent);
}
.article-body {
  font-size: 17px;
  line-height: 1.95;
}
.article-body :is(h2, h3) {
  margin-top: 1.9em;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.article-body img {
  border-radius: 10px;
  margin: 1.2em 0;
}
.article-body blockquote {
  margin: 1.4em 0;
  padding: 4px 18px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.about-lead {
  font-size: 17px;
  line-height: 2;
  color: var(--text);
  padding: 8px 0 8px 18px;
  border-left: 3px solid var(--accent);
}
.article-tags {
  margin-top: 28px;
}
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0 18px;
}
.citation {
  color: var(--muted);
  font-size: 13px;
}
.citation a {
  color: var(--accent);
}
.back {
  margin-top: 8px;
}
.back a {
  color: var(--accent);
  font-size: 14px;
}

/* ===== Insight badge ===== */
.kind-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--grad);
  border-radius: 9999px;
  padding: 4px 14px;
  margin-bottom: 12px;
}
.kind-badge.sm {
  font-size: 10px;
  padding: 1px 8px;
  margin: 0 6px 0 0;
  vertical-align: middle;
}

/* ===== Related ===== */
.related {
  margin-top: 56px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--soft);
  margin-top: 56px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 34px 22px;
  color: var(--muted);
  font-size: 12.5px;
}
.footer-signature {
  margin-bottom: 18px;
  line-height: 1.6;
}
.sig-jp {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
}
.sig-en {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.sig-tagline {
  font-size: 13px;
  color: var(--text);
  margin-top: 4px;
}
.sig-domain {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--accent);
  margin-top: 2px;
}
.footer-nav {
  display: flex;
  gap: 18px;
  margin-bottom: 12px;
}
.footer-nav a:hover {
  color: var(--text);
}
.copyright {
  margin: 10px 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

/* ===== Responsive ===== */
@media (max-width: 860px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .featured {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .featured-thumb {
    aspect-ratio: 16 / 9;
  }
}
@media (max-width: 560px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .header-inner {
    padding: 12px 16px;
  }
  .container {
    padding: 24px 16px 56px;
  }
  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto;
  }
}
