/* ============================================================
   THE AI ADOPTION GAP — Shared Design System
   Editorial Parchment aesthetic: warm-light, literary, crimson accent
   ============================================================ */

/* --- Variables -------------------------------------------- */
:root {
  --bg:      #f7f3ed;
  --bg2:     #ede8df;
  --bg3:     #e4ddd2;
  --text:    #1c1914;
  --muted:   #8a7d72;
  --dim:     #c2b8ac;
  --accent:  #9e2b25;
  --accent2: #7a1e19;
  --line:    #d8d0c6;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Libre Baskerville', Georgia, serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --max-width: 680px;
  --gap-page-max: 780px;
}

/* --- Reset & Base ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}
a:hover { opacity: 0.75; text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

p { margin-bottom: 1.2em; }
p:last-child { margin-bottom: 0; }

/* --- Progress Bar ----------------------------------------- */
#progress {
  position: fixed;
  top: 0; left: 0;
  height: 1px;
  width: 0%;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* --- Language Switcher ------------------------------------ */
#lang-switch {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  z-index: 150;
  display: flex;
}

#lang-switch button {
  background: none;
  border: 0.5px solid var(--dim);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s;
}

#lang-switch button:first-child { border-radius: 2px 0 0 2px; }
#lang-switch button:last-child  { border-radius: 0 2px 2px 0; border-left: none; }

#lang-switch button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #f7f3ed;
}

#lang-switch button:not(.on):hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Bilingual Visibility --------------------------------- */
.ru { display: none; }
body.ru-on .en { display: none; }
body.ru-on .ru { display: block; }
body.ru-on span.ru { display: inline; }
body.ru-on span.en { display: none; }
body.ru-on td.ru { display: table-cell; }
body.ru-on td.en { display: none; }
body.ru-on th.ru { display: table-cell; }
body.ru-on th.en { display: none; }

/* --- Section Labels --------------------------------------- */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 1.5rem;
}

/* --- Scroll Reveal ---------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* --- Pull Quotes ------------------------------------------ */
.pull-quote {
  border-left: 1px solid var(--accent);
  padding-left: 1.75rem;
  margin: 2.5rem 0;
}

.pull-quote blockquote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text);
  line-height: 1.6;
}

.pull-quote cite {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-top: 0.6rem;
  font-style: normal;
}

/* --- Callout Box ------------------------------------------ */
.callout {
  border-left: 2px solid var(--accent);
  background: var(--bg3);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 0 4px 4px 0;
}

.callout p {
  font-style: italic;
  color: var(--text);
  margin-bottom: 0;
}

/* --- Tables ----------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.5rem 0;
  background: var(--bg2);
}

thead tr {
  border-bottom: 1px solid var(--accent2);
}

thead th {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 500;
}

tbody tr {
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}

tbody tr:hover { background: var(--bg3); }

tbody td {
  padding: 0.65rem 1rem;
  color: var(--text);
  vertical-align: top;
  line-height: 1.5;
}

tbody td strong {
  font-family: var(--font-mono);
  color: var(--accent);
}

tbody td:last-child {
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Expandable Cause Sections (details/summary) ---------- */
details {
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 0.75rem;
  background: var(--bg2);
}

details[open] {
  border-color: var(--dim);
}

summary {
  cursor: pointer;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

summary::-webkit-details-marker { display: none; }

summary::after {
  content: '+';
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

details[open] summary::after { content: '−'; }

.details-body {
  padding: 0.5rem 1.1rem 1.1rem;
  border-top: 1px solid var(--line);
}

.details-body p, .details-body ul, .details-body li {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.7;
}

.details-body ul { padding-left: 1.5rem; margin: 0.5rem 0; }
.details-body li { margin-bottom: 0.4rem; }
.details-body cite {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Gap Cards (index page) ------------------------------- */
.gap-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 0.5px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2.5rem;
}

.gap-card {
  background: var(--bg2);
  border: none;
  padding: 2rem;
  display: block;
  text-decoration: none;
  transition: background 0.2s;
  position: relative;
}

.gap-card:hover {
  background: var(--bg3);
  transform: none;
  border: none;
  text-decoration: none;
}

.gap-card-num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.gap-card-stat {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.gap-card-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.gap-card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.gap-card-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.gap-card-link {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

/* --- Note Cards (index page) ------------------------------ */
.note-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 0.5px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 2.5rem;
}

.note-card {
  background: var(--bg3);
  border: none;
  padding: 1.75rem 1.5rem;
}

.note-card-num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.note-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.note-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 0;
}

/* --- Report Title Card ------------------------------------ */
.report-title-card {
  background: var(--bg2);
  padding: 8rem 0;
  text-align: center;
  border-top: 0.5px solid var(--line);
  border-bottom: 0.5px solid var(--line);
}

.report-title-card .tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.report-title-card h2 {
  font-size: 2.5rem;
  margin-bottom: 0.4rem;
}

.report-title-card .subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.report-title-card .byline {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* --- Layout Containers ------------------------------------ */
.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-wide {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-narrow {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 2rem;
}

.container-gap {
  max-width: var(--gap-page-max);
  margin: 0 auto;
  padding: 0 2rem;
}

section {
  padding: 4rem 0;
  border-bottom: 0.5px solid var(--line);
}

section:last-of-type { border-bottom: none; }

/* --- Hero ------------------------------------------------- */
.hero {
  padding: 10rem 0 7rem;
  border-bottom: 0.5px solid var(--line);
}

.hero-issue {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 4rem;
}

.hero-issue span {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.hero-issue::after {
  content: '';
  flex: 1;
  border-top: 0.5px solid var(--dim);
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.15;
  margin-bottom: 1rem;
}

.hero h1 em {
  color: var(--accent);
  font-style: italic;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.hero-byline {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.hero-byline span {
  color: var(--accent);
  margin: 0 0.4em;
}

.hero-byline .byline-label {
  display: block;
  color: var(--muted);
  font-size: 0.575rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 0.45em 0;
}

.hero-byline .byline-dims {
  color: var(--accent);
  letter-spacing: 0.09em;
  margin: 0;
}

/* --- Gap Page Hero ---------------------------------------- */
.gap-hero {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}

.gap-hero-back {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 2rem;
  transition: color 0.2s;
}

.gap-hero-back:hover { color: var(--accent); text-decoration: none; }

.gap-num {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.gap-hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 0.4rem;
}

.gap-hero .sub {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}

.gap-headline-stat {
  margin-top: 2rem;
}

.gap-headline-stat .stat {
  font-family: var(--font-mono);
  font-size: clamp(3rem, 7vw, 5.5rem);
  color: var(--accent);
  line-height: 1;
  font-weight: 500;
}

.gap-headline-stat .stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.4rem;
}

.gap-headline-stat .stat-source {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--muted);
  margin-top: 0.2rem;
  letter-spacing: 0.04em;
}

/* --- Gap Page Layout with Right Navigator ----------------- */
.gap-layout {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 3rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  align-items: start;
}

.gap-content {
  min-width: 0;
}

.gap-content section {
  padding: 3rem 0;
}

/* --- Right-side Section Navigator ------------------------- */
.section-nav {
  position: sticky;
  top: 3rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
}

.section-nav-title {
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.section-nav a {
  display: block;
  color: var(--dim);
  letter-spacing: 0.08em;
  padding: 0.25rem 0;
  transition: color 0.2s;
  font-size: 0.6rem;
  line-height: 1.5;
  border-left: 2px solid transparent;
  padding-left: 0.6rem;
}

.section-nav a:hover { color: var(--muted); text-decoration: none; }
.section-nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}


/* --- Exec Summary ----------------------------------------- */
.exec-summary {
  background: var(--bg2);
  border: 1px solid var(--line);
  padding: 1.75rem 2rem;
  margin-bottom: 2rem;
}

.exec-summary ul {
  list-style: none;
  padding: 0;
}

.exec-summary li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  padding-left: 1.25rem;
  position: relative;
}

.exec-summary li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

.exec-summary li:last-child { border-bottom: none; }

/* --- Part Headers ----------------------------------------- */
.part-header {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--accent2);
  margin-bottom: 2rem;
}

/* --- Section Headers in Gap Pages ------------------------- */
.gap-content h2 {
  font-size: 1.5rem;
  margin-bottom: 0.3rem;
  padding-top: 0.5rem;
}

.gap-content h3 {
  font-size: 1.125rem;
  margin-bottom: 0.4rem;
  margin-top: 1.4rem;
  color: var(--text);
}

.gap-content h4 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  margin-top: 1.2rem;
}

/* --- Evidence Quality Labels ------------------------------ */
.evidence-quality {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--dim);
  padding: 2px 7px;
  border-radius: 2px;
  display: inline-block;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* --- Source Tooltip --------------------------------------- */
.source-ref {
  cursor: help;
  border-bottom: 1px dotted var(--muted);
  position: relative;
  display: inline;
}

.source-ref .tooltip {
  display: none;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  border: 1px solid var(--text);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  padding: 0.4rem 0.6rem;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

.source-ref:hover .tooltip { display: block; }

/* --- Prev/Next Navigation --------------------------------- */
.gap-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.5rem 0;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}

.gap-nav a {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  transition: color 0.2s;
}

.gap-nav a:hover { color: var(--accent); text-decoration: none; }
.gap-nav .spacer { flex: 1; }

/* --- Sources Section -------------------------------------- */
.sources-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.sources-section table {
  font-size: 0.85rem;
}

.sources-section tbody td {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.sources-section tbody td:last-child {
  color: var(--text);
  font-size: 0.85rem;
}

/* --- Footer ----------------------------------------------- */
footer {
  padding: 3rem 0;
  border-top: 0.5px solid var(--line);
  margin-top: 0;
}

footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

footer a { color: var(--muted); border-bottom: 0.5px solid var(--dim); }
footer a:hover { color: var(--accent); }

.footer-center {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-sep { color: var(--dim); }

/* --- Divider ---------------------------------------------- */
.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

/* --- Kyrgyz context note ---------------------------------- */
.kyrgyz-note {
  border-left: 1px solid var(--dim);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1100px) {
  .gap-layout {
    grid-template-columns: 1fr;
  }
  .section-nav { display: none; }
}

/* ── Discussion links ── */
.discuss-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.discuss-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--dim);
  border-radius: 4px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}

.discuss-link:hover {
  border-color: var(--accent);
  background: var(--bg3);
}

.discuss-link-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  min-width: 2rem;
}

.discuss-link-text {
  flex: 1;
  font-size: 0.95rem;
  color: var(--muted);
}

.discuss-link:hover .discuss-link-text {
  color: var(--text);
}

.discuss-link-arrow {
  color: var(--accent);
  font-size: 1rem;
}

@media (max-width: 680px) {
  body { font-size: 1rem; }
  .container, .container-narrow, .container-gap { padding: 0 1.25rem; }
  .hero { padding: 5rem 0 3rem; }
  .hero h1 { font-size: 1.9rem; }
  .gap-hero { padding: 4rem 0 2.5rem; }
  .gap-layout { padding: 0 1.25rem; }
  .gap-cards { grid-template-columns: 1fr 1fr; }
  .note-cards { grid-template-columns: 1fr; }
  .report-title-card h2 { font-size: 1.8rem; }
  .report-title-card { padding: 3rem 1.5rem; }
  table { font-size: 0.8rem; }
  thead th, tbody td { padding: 0.5rem 0.6rem; }
  .gap-nav { flex-direction: column; gap: 1rem; align-items: flex-start; }
  #lang-switch { top: 0.75rem; right: 1rem; }
}

@media (max-width: 400px) {
  .gap-cards { grid-template-columns: 1fr; }
}
