/* =============================================================
   AIFRONTIER.JP — Main Stylesheet
   Design system based on the paper-ink editorial aesthetic.
   ============================================================= */

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --ink:          #1a1714;
  --ink-light:    #3d3a36;
  --paper:        #faf8f4;
  --paper-warm:   #f3efe8;
  --accent:       #c8401a;
  --accent-muted: #e8cfc4;
  --border:       #d9d4cc;
  --highlight:    #f0e8b8;

  --mono:  'Space Mono', monospace;
  --serif: 'Noto Serif JP', serif;
  --sans:  'Noto Sans JP', sans-serif;

  --radius: 0px;          /* editorial: no rounded corners */
  --max-w:  820px;
  --side-w: 280px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
img { max-width: 100%; height: auto; display: block; }
a   { color: inherit; }

/* ── Global overflow prevention ─────────────────────────────── */
html, body { overflow-x: hidden; max-width: 100%; }

/* Prevent any child element from causing horizontal scroll */
.article-body,
.article-wrap,
.home-wrap,
.page-wrap,
.nl-page-wrap {
  overflow-x: hidden;
  max-width: 100%;
}

/* All direct content elements cap at full width */
.article-body > * {
  max-width: 100%;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ── Scrollable tables ──────────────────────────────────────── */
/* Wrapper: horizontal scroll with touch support */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin: 28px 0;
  /* subtle scroll hint on mobile */
  background:
    linear-gradient(to right,  var(--paper) 20%, transparent 100%) left  center / 24px 100% no-repeat,
    linear-gradient(to left,   var(--paper) 20%, transparent 100%) right center / 24px 100% no-repeat,
    linear-gradient(to right,  rgba(0,0,0,.08) 0%, transparent 100%) left  center / 8px  100% no-repeat,
    linear-gradient(to left,   rgba(0,0,0,.08) 0%, transparent 100%) right center / 8px  100% no-repeat;
  background-attachment: local, local, scroll, scroll;
}

/* Table itself stays at natural width — wrapper scrolls */
.table-wrap .compare-table,
.table-wrap table {
  min-width: 480px;
  margin: 0;
}

/* Bare tables (not inside .table-wrap) — JS will auto-wrap, but CSS fallback */
.article-body > table,
.article-body p > table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* ── Base ───────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background:  var(--paper);
  color:       var(--ink);
  font-size:   17px;
  line-height: 1.9;
}

/* ── Reading progress bar ────────────────────────────────────── */
#reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  width: 0%;
  z-index: 200;
  transition: width 0.1s linear;
}

/* =============================================================
   SITE HEADER
   ============================================================= */
.site-header {
  background: var(--ink);
  padding: 14px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-logo {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--paper);
  letter-spacing: 0.08em;
  text-decoration: none;
}
.site-logo span { color: var(--accent); }

.site-nav { display: flex; gap: 0; }

.site-nav .nav-list {
  list-style: none;
  display: flex;
  gap: 24px;
}

.site-nav .nav-list a {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(250,248,244,.6);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color .2s;
}
.site-nav .nav-list a:hover { color: var(--paper); }

/* ── Hamburger toggle (hidden on desktop) ───────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(250,248,244,.7);
  border-radius: 1px;
  transition: transform .2s, opacity .2s;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 640px) {
  .nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--ink);
    border-top: 1px solid rgba(255,255,255,.08);
    z-index: 99;
  }
  .site-nav.open { display: block; }

  .site-nav .nav-list {
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
  }
  .site-nav .nav-list li { border-bottom: 1px solid rgba(255,255,255,.06); }
  .site-nav .nav-list a {
    display: block;
    padding: 14px 5%;
    font-size: 13px;
    white-space: nowrap;
  }
}

/* =============================================================
   BREADCRUMB
   ============================================================= */
.breadcrumb {
  background: var(--paper-warm);
  border-bottom: 1px solid var(--border);
  padding: 10px 5%;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-light);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--ink-light); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--border); }

/* =============================================================
   HERO
   ============================================================= */
.hero {
  position: relative;
  background: var(--ink);
  overflow: hidden;
  min-height: 320px; /* ensures title shows even when no featured image */
}

.hero-image {
  width: 100%;
  height: 420px;
  object-fit: cover;
  opacity: 0.35;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 48px 5%;
  background: linear-gradient(to top,
    rgba(26,23,20,.95) 0%,
    rgba(26,23,20,.30) 60%,
    transparent 100%);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 5px 12px;
  margin-bottom: 20px;
  width: fit-content;
  text-decoration: none;
  transition: background .2s;
}
.category-badge:hover { background: rgba(200,64,26,.15); }

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(22px, 3.8vw, 40px);
  font-weight: 700;
  line-height: 1.4;
  max-width: 820px;
  margin-bottom: 16px;
  color: var(--paper);
}

.hero-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(250,248,244,.6);
  font-family: var(--mono);
}

/* =============================================================
   PAGE HERO (homepage)
   ============================================================= */
.page-hero {
  background: var(--ink);
  padding: 64px 5%;
  text-align: center;
}
.page-hero-sub {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 12px;
}
.page-hero-title {
  font-family: var(--mono);
  font-size: clamp(28px, 5vw, 52px);
  color: var(--paper);
  letter-spacing: 0.05em;
}
.page-hero-title span { color: var(--accent); }

/* =============================================================
   ARCHIVE HEADER
   ============================================================= */
.archive-header {
  background: var(--paper-warm);
  border-bottom: 2px solid var(--ink);
  padding: 40px 5%;
}
.archive-type {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.archive-title {
  font-family: var(--serif);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
}

/* =============================================================
   LAYOUT: ARTICLE PAGE
   ============================================================= */
.article-wrap {
  display: grid;
  grid-template-columns: 1fr var(--side-w);
  gap: 48px;
  max-width: 1140px;
  margin: 56px auto 80px;
  padding: 0 24px;
  align-items: start;
}

/* ── Narrow screen: split sidebar widgets into ordered flow ──── */
@media (max-width: 1024px) {
  .article-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 32px;
  }

  /* Article body sits between TOC and newsletter */
  .article-body { order: 2; }

  /* display:contents makes sidebar itself invisible as a box;
     its children join the flex container directly */
  .sidebar {
    display: contents;
  }

  /* 1. TOC above article */
  .toc-widget {
    order: 1;
    position: static;
    margin-bottom: 24px;
  }

  /* 3. Newsletter below article */
  .newsletter-widget {
    order: 3;
    margin-top: 32px;
  }

  /* 4. Latest posts at the bottom */
  .latest-posts-widget {
    order: 4;
    margin-top: 16px;
    margin-bottom: 40px;
  }
}

/* =============================================================
   LAYOUT: HOME / ARCHIVE
   ============================================================= */
.home-wrap {
  max-width: 1140px;
  margin: 48px auto 80px;
  padding: 0 24px;
}

/* Featured post */
.featured-post {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  border: 1px solid var(--border);
  margin-bottom: 56px;
  overflow: hidden;
}
@media (max-width: 760px) {
  .featured-post { grid-template-columns: 1fr; }
}

.featured-post-img-wrap img {
  width: 100%;
  height: 360px;
  object-fit: cover;
}

.featured-post-body {
  padding: 32px 32px 32px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
@media (max-width: 760px) {
  .featured-post-body { padding: 24px; }
}

.featured-badge {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.featured-post-title {
  font-family: var(--serif);
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 16px;
}
.featured-post-title a { text-decoration: none; }
.featured-post-title a:hover { color: var(--accent); }

.featured-post-excerpt {
  font-size: 14.5px;
  color: var(--ink-light);
  margin-bottom: 20px;
  line-height: 1.8;
}

.featured-post-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-light);
}

.cat-badge {
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10px;
}

/* Article grid */
.section-heading {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}

.articles-section { margin-top: 56px; }

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 28px;
  margin-bottom: 40px;
}

.article-card {
  border: 1px solid var(--border);
  transition: border-color .2s, box-shadow .2s;
}
.article-card:hover {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.card-img-wrap { display: block; overflow: hidden; }
.card-img-wrap img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform .4s;
}
.article-card:hover .card-img-wrap img { transform: scale(1.03); }

.card-body { padding: 20px; }

.card-cat {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  display: block;
}

.card-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  margin-bottom: 12px;
}
.card-title a { text-decoration: none; }
.card-title a:hover { color: var(--accent); }

.card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-light);
  display: flex;
  gap: 14px;
}

/* Pagination */
.pagination { text-align: center; margin-top: 40px; }
.pagination .page-numbers {
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink-light);
  margin: 0 4px;
  display: inline-block;
  transition: all .2s;
}
.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* =============================================================
   ARTICLE BODY
   ============================================================= */
.article-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin: 52px 0 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  position: relative;
}
.article-body h2::before {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 60px; height: 2px;
  background: var(--accent);
}

.article-body h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  margin: 36px 0 12px;
  color: var(--ink-light);
}

.article-body p  { margin-bottom: 20px; color: var(--ink-light); }
.article-body li { color: var(--ink-light); margin-bottom: 6px; }
.article-body strong { color: var(--ink); font-weight: 600; }

.article-body a:not(.cta-btn):not(.internal-link) {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* Article images */
.article-body figure { margin: 32px 0; }
.article-body figure img { width: 100%; }
.article-body figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-light);
  margin-top: 8px;
  padding-left: 4px;
  border-left: 2px solid var(--border);
}

/* ── Lead ───────────────────────────────────────────────────── */
.article-lead {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.9;
  color: var(--ink);
  padding: 24px 28px;
  border-left: 4px solid var(--accent);
  background: var(--accent-muted);
  margin-bottom: 40px;
}

/* ── Summary box ─────────────────────────────────────────────── */
.summary-box {
  background: var(--paper-warm);
  border: 1px solid var(--border);
  padding: 28px 32px;
  margin: 32px 0;
}

.summary-title {
  font-family: var(--mono);
  font-size: 11px !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px !important;
}

.summary-box ul {
  list-style: none;
  padding: 0;
}
.summary-box ul li {
  padding: 7px 0 7px 20px;
  position: relative;
  border-bottom: 1px dashed var(--border);
  font-size: 15.5px;
  color: var(--ink-light);
}
.summary-box ul li:last-child { border-bottom: none; }
.summary-box ul li::before {
  content: '▶';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 9px;
  top: 12px;
}

/* ── Stat cards ──────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: var(--ink);
  color: var(--paper);
  padding: 24px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 60px; height: 60px;
  background: var(--accent);
  opacity: .2;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.stat-num {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: bold;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 13px;
  line-height: 1.5;
  color: rgba(250,248,244,.75);
}

.stat-source {
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(250,248,244,.4);
  margin-top: 8px;
}

/* ── Comparison table ────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 28px 0; }

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.compare-table thead tr { background: var(--ink); color: #ffffff; }
.compare-table th {
  padding: 14px 18px;
  text-align: left;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: #ffffff;
}
.compare-table td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-light);
  vertical-align: top;
}
.compare-table tr:hover td { background: var(--paper-warm); }

.tag-new {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Blockquote ──────────────────────────────────────────────── */
.article-body blockquote {
  border-left: 4px solid var(--accent);
  padding: 16px 24px;
  margin: 28px 0;
  background: var(--paper-warm);
  font-style: italic;
  color: var(--ink-light);
}

/* ── CTA box ─────────────────────────────────────────────────── */
.cta-box {
  background: var(--ink);
  color: var(--paper);
  padding: 28px 32px;
  margin: 40px 0;
  border-left: 4px solid var(--accent);
}

/* Links inside dark boxes need bright color for contrast */
.cta-box p a,
.cta-box p strong {
  color: #f5a982;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cta-title {
  font-family: var(--mono);
  font-size: 12px !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px !important;
}

.cta-box p { color: #dedad4 !important; font-size: 15px; }

.cta-btn {
  display: inline-block;
  margin-top: 16px;
  background: var(--accent);
  color: #fff !important;
  padding: 12px 28px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-decoration: none !important;
  transition: background .2s;
}
.cta-btn:hover { background: #a83214; }

/* ── Internal link ───────────────────────────────────────────── */
.internal-link {
  display: inline-block;
  padding: 2px 8px 2px 20px;
  background: var(--highlight);
  border-left: 3px solid var(--accent);
  font-size: 14.5px;
  text-decoration: none !important;
  color: var(--ink) !important;
  margin: 4px 0;
}
.internal-link::before {
  content: '→ ';
  color: var(--accent);
  font-weight: bold;
}
.internal-link:hover { background: var(--accent-muted); }

/* ── Sources ─────────────────────────────────────────────────── */
.article-sources {
  margin: 40px 0;
  padding: 24px;
  background: var(--paper-warm);
  border: 1px solid var(--border);
}

.sources-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
  color: var(--ink-light);
}

.sources-list {
  list-style: decimal;
  padding-left: 20px;
}
.sources-list li {
  font-size: 13px;
  padding: 5px 0;
  color: var(--ink-light);
  border-bottom: 1px dashed var(--border);
}
.sources-list li:last-child { border-bottom: none; }
.sources-list a { color: var(--accent); text-decoration: none; }
.sources-list a:hover { text-decoration: underline; }

/* ── Tags ────────────────────────────────────────────────────── */
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 40px 0 16px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  color: var(--ink-light);
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: all .2s;
}
.tag:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ── Related posts (end of article) ─────────────────────────── */
.related-posts-section { margin-top: 56px; }
.related-posts-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.related-card {
  border: 1px solid var(--border);
  text-decoration: none;
  display: block;
  transition: box-shadow .2s;
}
.related-card:hover { box-shadow: 3px 3px 0 var(--ink); }
.related-card img { width: 100%; height: 140px; object-fit: cover; }
.related-card-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  color: var(--ink);
  line-height: 1.5;
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar { position: sticky; top: 80px; }

.sidebar-widget {
  border: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: hidden;
}

.widget-label {
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* TOC */
#toc-container { padding: 0; }
#toc-container ul { list-style: none; padding: 0; }
#toc-container li { border-bottom: 1px dashed var(--border); }
#toc-container li:last-child { border-bottom: none; }
#toc-container a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 16px;
  font-size: 13px;
  color: var(--ink-light);
  text-decoration: none;
  line-height: 1.4;
  transition: color .2s, background .2s;
}
#toc-container a:hover { color: var(--accent); background: var(--paper-warm); }
#toc-container a .toc-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 3px;
}

/* Newsletter */
.newsletter-widget .newsletter-text {
  padding: 14px 16px 0;
  font-size: 13px;
  color: var(--ink-light);
}
.newsletter-form {
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.newsletter-form input[type="email"],
.newsletter-form input[type="text"],
.newsletter-form input[type="date"] {
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  width: 100%;
}
.newsletter-form input:focus { border-color: var(--accent); }
.newsletter-form button[type="submit"] {
  padding: 9px 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background .2s;
}
.newsletter-form button[type="submit"]:hover { background: #a83214; }

/* Sidebar newsletter CTA button */
.newsletter-cta-btn {
  display: block;
  margin: 12px 16px 16px;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: center;
  transition: background .2s;
}
.newsletter-cta-btn:hover { background: #a83214; }

/* Optional fields toggle */
.nl-toggle {
  background: none;
  border: 1px dashed var(--border);
  color: var(--ink-light);
  font-size: 12px;
  padding: 7px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  transition: border-color .2s;
}
.nl-toggle:hover { border-color: var(--accent); color: var(--accent); }
.nl-toggle[aria-expanded="true"] .nl-toggle-icon { transform: rotate(45deg); }
.nl-toggle-icon { transition: transform .2s; display: inline-block; }

.nl-optional {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.nl-optional[hidden] { display: none; }

.nl-interests { border: none; padding: 0; margin: 0; }
.nl-interests legend {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-light);
  margin-bottom: 6px;
}
.nl-interests label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-light);
  padding: 3px 0;
  cursor: pointer;
}
.nl-interests input[type="checkbox"] { flex-shrink: 0; accent-color: var(--accent); }

.nl-message {
  font-size: 12px;
  margin: 0;
  min-height: 18px;
  text-align: center;
}
.nl-message.success { color: #059669; }
.nl-message.error   { color: var(--accent); }

/* Sidebar post list */
.sidebar-post-list { list-style: none; }
.sidebar-post-list li { border-bottom: 1px dashed var(--border); }
.sidebar-post-list li:last-child { border-bottom: none; }
.sidebar-post-list a {
  display: block;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink-light);
  text-decoration: none;
  line-height: 1.4;
  transition: color .2s;
}
.sidebar-post-list a:hover { color: var(--accent); }

/* =============================================================
   STATIC PAGES
   ============================================================= */
.page-wrap {
  max-width: var(--max-w);
  margin: 56px auto 80px;
  padding: 0 24px;
}
.page-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink);
}
.page-header h1 {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 8px;
}
.page-date {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-light);
}
.page-body { color: var(--ink-light); line-height: 1.9; }
.page-body h2 { font-family: var(--serif); font-size: 22px; margin: 40px 0 14px; }
.page-body h3 { font-family: var(--serif); font-size: 18px; margin: 28px 0 10px; }
.page-body p  { margin-bottom: 18px; }
.page-body ul,
.page-body ol { padding-left: 24px; margin-bottom: 18px; }
.page-body li { margin-bottom: 8px; }

/* =============================================================
   404 PAGE
   ============================================================= */
.error-404-wrap {
  text-align: center;
  padding: 96px 24px;
}
.error-code {
  font-family: var(--mono);
  font-size: 96px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 16px;
}
.error-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}
.error-text {
  color: var(--ink-light);
  margin-bottom: 32px;
}
.error-home-btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: 14px 32px;
  font-family: var(--mono);
  font-size: 13px;
  text-decoration: none;
  letter-spacing: 0.06em;
  transition: background .2s;
}
.error-home-btn:hover { background: var(--accent); }

/* =============================================================
   CONCEPT BAR
   ============================================================= */
.site-concept {
  background: #0f1217;
  border-bottom: 1px solid rgba(255,255,255,.06);
  padding: 7px 5%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.concept-label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #00c896;
  border: 1px solid rgba(0,200,150,.4);
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.concept-text {
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(255,255,255,.38);
  letter-spacing: 0.03em;
}

/* =============================================================
   TECH FLOW BOX
   ============================================================= */
.flow-box {
  background: var(--ink);
  border: 1px solid rgba(255,255,255,.07);
  padding: 24px 20px;
  margin: 28px 0;
  font-family: var(--mono);
  overflow-x: hidden;
  max-width: 100%;
}

.flow-box .flow-title {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.flow-steps { list-style: none; padding: 0; }

.flow-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.flow-step:last-child { border-bottom: none; }

.step-num {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content { flex: 1; }

.step-label {
  font-size: 13px;
  color: #ffffff !important;
  margin-bottom: 4px;
  font-weight: 600;
}

.step-detail {
  font-size: 11.5px;
  color: #c8c4bc !important;
  line-height: 1.6;
  font-family: var(--sans);
}

/* =============================================================
   WARN BOX
   ============================================================= */
.warn-box {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-left: 3px solid #f59e0b;
  padding: 16px 20px;
  margin: 24px 0;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.warn-box .wi {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.warn-box p {
  font-size: 14px !important;
  margin: 0 !important;
  color: #78350f !important;
  line-height: 1.65;
}

/* =============================================================
   BLOCKQUOTE WITH CITE
   ============================================================= */
.article-body blockquote {
  margin: 28px 0;
  padding: 18px 24px;
  background: var(--paper-warm);
  border-left: 4px solid var(--accent);
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.85;
}

.article-body blockquote cite {
  display: block;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-light);
  margin-top: 10px;
  font-style: normal;
  letter-spacing: 0.03em;
}

/* =============================================================
   SPOKE NAVIGATION
   ============================================================= */
.spoke-nav {
  background: var(--ink);
  border: 1px solid rgba(255,255,255,.07);
  padding: 24px 26px;
  margin: 44px 0;
}

.spoke-nav-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.spoke-nav-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.spoke-nav-desc {
  font-family: var(--sans);
  font-size: 12px;
  color: rgba(250,248,244,.85) !important;
}

.spoke-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.spoke-item a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  transition: background .15s, border-color .15s;
}

.spoke-item a:hover {
  background: rgba(200,64,26,.1);
  border-color: rgba(200,64,26,.3);
}

.spoke-item .s-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
}

.spoke-item .s-text {
  font-size: 13px;
  color: rgba(250,248,244,.7);
  line-height: 1.5;
}

/* =============================================================
   NEWSLETTER REGISTRATION PAGE (/newsletter/)
   ============================================================= */
.nl-page-wrap {
  max-width: 640px;
  margin: 56px auto 80px;
  padding: 0 24px;
}

.nl-page-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 2px solid var(--ink);
}

.nl-page-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 10px;
}

.nl-page-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 12px;
}

.nl-page-desc {
  font-size: 15px;
  color: var(--ink-light);
  line-height: 1.7;
}

/* Form layout */
.nl-page-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.nl-field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nl-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 480px) {
  .nl-field-row { grid-template-columns: 1fr; }
}

.nl-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  text-transform: uppercase;
}

.nl-required {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.nl-input {
  padding: 11px 14px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  outline: none;
  width: 100%;
  transition: border-color .2s;
}

.nl-input:focus { border-color: var(--accent); }

/* Select elements */
.nl-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233d3a36' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

/* Birth date row: 年・月・日 side by side */
.nl-birth-row {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr;
  gap: 10px;
}
.nl-birth-item { display: flex; flex-direction: column; }
.nl-birth-select { min-width: 0; }

@media (max-width: 420px) {
  .nl-birth-row { grid-template-columns: 1fr 1fr 1fr; }
}

/* 「その他」テキストボックス */
.nl-other-box { margin-top: 6px; }
.nl-other-input { background: var(--paper-warm); }

/* Other label spacing */
.nl-other-label { margin-top: 4px; }

/* Optional section divider + label */
.nl-divider {
  border: none;
  border-top: 1px dashed var(--border);
  margin: 8px 0;
}

.nl-optional-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin: 0;
}

.nl-field-error {
  color: var(--accent);
  font-size: 12px;
  margin: 4px 0 0;
}

/* Checkboxes */
.nl-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 480px) {
  .nl-checkboxes { grid-template-columns: 1fr; }
}

.nl-checkboxes label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-light);
  cursor: pointer;
}

.nl-checkboxes input[type="checkbox"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* Submit */
.nl-submit-btn {
  padding: 15px 32px;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background .2s;
  align-self: flex-start;
}

.nl-submit-btn:hover  { background: #a83214; }
.nl-submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Contact page extras */
.ct-textarea {
  resize: vertical;
  min-height: 160px;
  font-family: var(--sans);
  line-height: 1.7;
}

select.nl-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%233d3a36' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.ct-success {
  text-align: center;
  padding: 48px 0;
}
.ct-success-icon {
  font-size: 40px;
  color: var(--accent);
  font-family: var(--mono);
  margin-bottom: 16px;
}
.ct-success-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.ct-success-msg {
  color: var(--ink-light);
  font-size: 15px;
}

.nl-error-msg {
  color: var(--accent);
  font-size: 13px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  background: #fff5f3;
}

.nl-note {
  font-size: 12px;
  color: var(--ink-light);
  line-height: 1.65;
}

/* =============================================================
   NEWSLETTER THANKS PAGE (/newsletter-thanks/)
   ============================================================= */
.nl-thanks-wrap {
  max-width: 560px;
  margin: 80px auto 100px;
  padding: 0 24px;
  text-align: center;
}

.nl-thanks-icon {
  width: 64px;
  height: 64px;
  background: var(--ink);
  color: var(--accent);
  font-size: 32px;
  line-height: 64px;
  margin: 0 auto 28px;
  font-family: var(--mono);
}

.nl-thanks-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 20px;
}

.nl-thanks-msg {
  font-size: 15px;
  color: var(--ink-light);
  line-height: 1.8;
  margin-bottom: 40px;
}

.nl-thanks-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.nl-thanks-btn {
  display: inline-block;
  padding: 13px 28px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-decoration: none;
  transition: all .2s;
}

.nl-thanks-btn.primary {
  background: var(--ink);
  color: var(--paper);
}

.nl-thanks-btn.primary:hover { background: var(--accent); }

.nl-thanks-btn.secondary {
  border: 1px solid var(--border);
  color: var(--ink-light);
}

.nl-thanks-btn.secondary:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* =============================================================
   SITE FOOTER
   ============================================================= */
.site-footer {
  background: var(--ink);
  color: rgba(250,248,244,.6);
  margin-top: 80px;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 40px;
  flex-wrap: wrap;
}

.footer-logo {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: block;
}
.footer-logo span { color: var(--accent); }

.footer-tagline {
  font-size: 13px;
  color: rgba(250,248,244,.5);
  margin-top: 8px;
}

.footer-nav-list {
  list-style: none;
  display: flex;
  gap: 0;
  flex-direction: column;
}
.footer-nav-list a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(250,248,244,.5);
  text-decoration: none;
  padding: 5px 0;
  display: block;
  transition: color .2s;
}
.footer-nav-list a:hover { color: var(--paper); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center;
  padding: 18px 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: rgba(250,248,244,.3);
}

/* =============================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================= */
@media (max-width: 640px) {
  /* ── Base font size ─────────────────────────────────────── */
  body { font-size: 15px; line-height: 1.85; }

  /* ── Article headings ───────────────────────────────────── */
  .article-body h2 { font-size: 20px; margin-top: 40px; }
  .article-body h3 { font-size: 17px; margin-top: 28px; }
  .article-body p  { margin-bottom: 16px; }

  /* ── Lead / summary ─────────────────────────────────────── */
  .article-lead  { font-size: 16px; padding: 18px 20px; }
  .summary-box   { padding: 18px 20px; }
  .summary-box ul li { font-size: 14.5px; }

  /* ── Stat cards ─────────────────────────────────────────── */
  .stat-num   { font-size: 28px; }
  .stat-label { font-size: 12px; }
  .stat-grid  { grid-template-columns: 1fr 1fr; }

  /* ── Tables ─────────────────────────────────────────────── */
  .compare-table th,
  .compare-table td { padding: 10px 12px; font-size: 13.5px; }

  /* ── Flow box ───────────────────────────────────────────── */
  .step-label  { font-size: 12px; }
  .step-detail { font-size: 11px; }

  /* ── CTA / warn ─────────────────────────────────────────── */
  .cta-box   { padding: 18px; }
  .cta-box p { font-size: 14px !important; }
  .warn-box p { font-size: 13px !important; }

  /* ── Hero ───────────────────────────────────────────────── */
  .hero-image    { height: 240px; }
  .hero-overlay  { padding: 28px 5%; }
  .hero h1       { font-size: clamp(18px, 5.5vw, 26px); }

  /* ── Cards (home/archive) ───────────────────────────────── */
  .article-grid  { grid-template-columns: 1fr; }
  .card-title    { font-size: 14.5px; }
  .card-meta     { font-size: 10.5px; }

  /* ── Spoke-nav ──────────────────────────────────────────── */
  .spoke-item .s-text { font-size: 12px; }

  /* ── Sources ────────────────────────────────────────────── */
  .sources-list li { font-size: 12px; }
}

/* =============================================================
   AUTHOR BOX
   ============================================================= */
.article-author-box {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 40px 0 32px;
  padding: 20px 24px;
  background: var(--color-bg-secondary, #f8f7f4);
  border-left: 4px solid var(--color-accent, #c0392b);
  border-radius: 4px;
}
.author-avatar {
  flex-shrink: 0;
  width: 52px;
  height: 52px;
  background: var(--color-text, #1a1a1a);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-serif, 'Noto Serif JP', serif);
  letter-spacing: 0;
}
.author-info { flex: 1; }
.author-name {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text, #1a1a1a);
}
.author-name a {
  color: inherit;
  text-decoration: none;
}
.author-name a:hover { text-decoration: underline; }
.author-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--color-text-muted, #555);
}
.author-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .article-author-box { flex-direction: column; gap: 12px; padding: 16px; }
  .author-avatar       { width: 44px; height: 44px; font-size: 15px; }
  .author-name         { font-size: 14px; }
  .author-desc         { font-size: 12px; }
}
