/* COSYlanguages · Level C1 Communication Manual Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,600;0,700;0,800;0,900;1,600&family=Poppins:wght@600;700;800&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --teal-900: var(--accent-900, #0c3f38);
  --teal-800: var(--accent-800, #0f5c50);
  --teal-700: var(--accent-700, #157c6c);
  --teal-600: var(--accent-600, #1c9483);
  --teal-500: var(--accent-500, #25a894);
  --teal-100: var(--accent-100, #e4f4f0);
  --teal-050: var(--accent-050, #f2faf8);

  --ink: #132321;
  --ink-soft: #3c5450;
  --paper: #faf8f3;
  --panel: #ffffff;
  --line: #e6e2d8;

  --why-bg: #fdf3d6;
  --why-line: #c99a1f;
  --why-ink: #7a5b0c;

  --mistake-bg: #fdf0f0;
  --mistake-line: #e55353;
  --mistake-ink: #9c1c1c;

  --mint-bg: #eaf6f1;
  --mint-line: #1c9483;
  --mint-ink: #0f5c50;

  --comm-start: #0e7490;
  --comm-continue: #4338ca;
  --comm-react: #be185d;
  --comm-ask: #c2410c;
  --comm-close: #4c1d95;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 24px;
  --shadow-card: 0 2px 4px rgba(19,35,33,.03), 0 10px 28px -8px rgba(19,35,33,.12);
  --shadow-hover: 0 4px 8px rgba(19,35,33,.05), 0 16px 36px -8px rgba(19,35,33,.20);

  --font-display: 'Nunito', 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); line-height: 1.65; font-size: 16px; }
a { color: var(--teal-700); transition: color .15s ease; text-decoration: none; }
a:hover { color: var(--teal-900); }

.container { max-width: 980px; margin: 0 auto; padding: 0 24px; }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--teal-900); color: #eafaf5; border-bottom: 1px solid rgba(255,255,255,.1); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #eafaf5; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--panel, #fff); color: var(--teal-900); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 800; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.brand-name em { font-style: italic; opacity: .88; }
.topbar-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar-nav a { color: #cdece4; text-decoration: none; font-size: 12.5px; font-weight: 700; padding: 5px 9px; border-radius: 99px; }
.topbar-nav a:hover, .topbar-nav a.active { background: rgba(255,255,255,.16); color: #fff; }

/* Page Head */
.page-head { padding: 36px 0 20px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--teal-700); background: var(--teal-100); padding: 6px 14px; border-radius: 99px; margin-bottom: 14px; }
.page-head h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(30px, 5vw, 44px); margin: 0 0 8px; color: var(--ink); line-height: 1.2; }
.page-head .subtitle { font-style: italic; color: var(--ink-soft); font-size: 18px; margin: 0; }
.rule { border: none; border-top: 2px solid var(--ink); margin: 20px 0 0; opacity: .85; }

/* Callout Box & Components */
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px 24px; margin: 24px 0; box-shadow: var(--shadow-card); }
.box.why { background: var(--why-bg); border-color: #f0db96; color: var(--why-ink); }
.box.why strong { color: #573e02; }

.notice-box { background: #e0f2fe; border-left: 4px solid #0284c7; padding: 18px 22px; border-radius: var(--radius-s); margin: 24px 0; color: #0369a1; }
.notice-box h4 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }
.mindset-box { background: #f3e8ff; border-left: 4px solid #7e22ce; padding: 18px 22px; border-radius: var(--radius-s); margin: 24px 0; color: #581c87; }
.mindset-box h4 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }
.memory-box { background: #fef3c7; border-left: 4px solid #d97706; padding: 18px 22px; border-radius: var(--radius-s); margin: 24px 0; color: #92400e; }
.memory-box h4 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }
.connect-box { background: #ecfdf5; border-left: 4px solid #059669; padding: 18px 22px; border-radius: var(--radius-s); margin: 24px 0; color: #065f46; }
.connect-box h4 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }

/* Building Blocks & Chips */
.building-blocks { background: #f4f8f7; border: 1px solid #d2e5e1; border-radius: var(--radius-m); padding: 22px; margin: 24px 0; }
.building-blocks h3 { margin: 0 0 14px; font-family: var(--font-display); color: var(--teal-900); font-size: 18px; font-weight: 800; }
.chip-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.chip { display: inline-flex; align-items: center; padding: 8px 16px; background: var(--panel, #fff); border: 1px solid var(--line); border-radius: 99px; font-weight: 700; font-size: 14.5px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.chip.block-start { background: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.chip.block-continue { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }
.chip.block-react { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
.chip.block-ask { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.chip.block-close { background: #f3e8ff; color: #581c87; border-color: #e9d5ff; }

/* Conversation Maps */
.conversation-map { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; margin: 24px 0; box-shadow: var(--shadow-card); }
.conversation-map h3 { margin: 0 0 16px; font-family: var(--font-display); color: var(--teal-900); font-size: 18px; font-weight: 800; }
.map-step { display: flex; gap: 14px; margin-bottom: 12px; align-items: flex-start; }
.map-step:last-child { margin-bottom: 0; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--teal-700); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-mono); font-weight: 800; font-size: 13px; flex-shrink: 0; margin-top: 2px; }
.step-text { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 14px; flex-grow: 1; font-size: 15px; }

/* Dialogue Box */
.dialogue-box { background: var(--mint-bg); border-left: 4px solid var(--mint-line); padding: 18px 22px; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin: 24px 0; }
.dialogue-box h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 17px; color: var(--mint-ink); }
.dialogue-box .line { margin-bottom: 8px; font-size: 15.5px; }
.dialogue-box .line strong { color: var(--mint-ink); font-family: var(--font-mono); }

/* Natural Speech Addon */
.natural-speech { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: var(--radius-m); padding: 20px; margin: 24px 0; }
.natural-speech h3 { margin: 0 0 14px; font-family: var(--font-display); color: #166534; font-size: 17px; }
.speech-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media(max-width: 600px){ .speech-compare { grid-template-columns: 1fr; } }
.stiff-card { background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-s); padding: 12px 16px; color: #991b1b; }
.natural-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-s); padding: 12px 16px; color: #1e40af; }

/* Mistakes */
.mistakes { margin: 24px 0; }
.mistakes .m-title { font-family: var(--font-display); font-weight: 800; font-size: 15.5px; color: var(--mistake-ink); margin-bottom: 12px; }
.mflip { background: var(--mistake-bg); border: 1px solid #f4c6c6; border-radius: var(--radius-m); padding: 14px 18px; margin-bottom: 12px; cursor: pointer; user-select: none; }
.mflip .wrong-line { display: flex; gap: 10px; font-size: 15.5px; }
.mflip .wrong-text { text-decoration: line-through; color: #8a3b3b; }
.mflip .right-line { display: none; gap: 10px; font-size: 15.5px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed #f0b8b8; }
.mflip.flipped .right-line { display: flex; }
.mflip .hint { font-family: var(--font-mono); font-size: 11px; color: #b56060; margin-top: 4px; display: block; }
.mflip.flipped .hint { display: none; }

/* Examples */
.examples { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 22px; margin: 24px 0; box-shadow: var(--shadow-card); }
.examples .label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--teal-700); font-weight: 700; display: block; margin-bottom: 10px; }
.examples ul { margin: 0; padding-left: 20px; }
.examples li { margin-bottom: 8px; font-size: 15.5px; }

/* Celebration */
.celebration-box { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border: 1px solid #f59e0b; border-radius: var(--radius-m); padding: 18px 22px; margin: 24px 0; color: #78350f; text-align: center; font-weight: 700; font-size: 16px; }

/* Checklist & Quiz */
.checklist { background: var(--mint-bg); border: 1px solid #b8e2d4; border-radius: var(--radius-m); padding: 20px 22px; margin: 28px 0; }
.checklist h3 { margin: 0 0 12px; font-family: var(--font-display); font-size: 15.5px; color: var(--mint-ink); font-weight: 800; }
.check-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15.5px; cursor: pointer; }
.check-item input { width: 18px; height: 18px; accent-color: var(--teal-700); }
.check-item.done span { text-decoration: line-through; opacity: .8; }
.check-progress { font-family: var(--font-mono); font-size: 12px; color: var(--mint-ink); font-weight: 600; margin-top: 12px; }

.quiz-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 28px; margin: 36px 0; box-shadow: var(--shadow-card); }
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.quiz-head h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; margin: 0; }
.quiz-score { font-family: var(--font-mono); font-size: 13.5px; background: var(--teal-100); color: var(--teal-800); padding: 6px 14px; border-radius: 99px; font-weight: 700; }
.qitem { border-top: 1px solid var(--line); padding: 20px 0; }
.qitem:first-of-type { border-top: none; }
.qtext { font-family: var(--font-display); font-weight: 800; font-size: 16.5px; margin-bottom: 14px; }
.qopts { display: flex; flex-direction: column; gap: 10px; }
.qopt { text-align: left; border: 1.5px solid var(--line); background: var(--paper); border-radius: var(--radius-s); padding: 12px 16px; font-size: 15.5px; cursor: pointer; color: var(--ink); }
.qopt:hover { border-color: var(--teal-500); }
.qopt.correct { border-color: #1c8f56; background: #e6f6ec; font-weight: 700; }
.qopt.incorrect { border-color: var(--mistake-line); background: var(--mistake-bg); }
.qexplain { display: none; margin-top: 12px; font-size: 14.5px; background: var(--teal-050); border-left: 4px solid var(--teal-600); padding: 12px 16px; border-radius: 8px; }
.qexplain.show { display: block; }
.quiz-reset { margin-top: 18px; background: none; border: 1.5px solid var(--ink); color: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 700; padding: 9px 18px; border-radius: 99px; cursor: pointer; }

/* Grid Cards & Hero */
.hero { background: var(--teal-900); color: #eafaf5; padding: 64px 0 56px; }
.hero-kicker { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: #8fd6c4; font-weight: 600; }
.hero h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(34px, 6vw, 54px); margin: 14px 0 12px; line-height: 1.18; }
.hero p.lead { max-width: 580px; color: #cdeee5; font-size: 18px; line-height: 1.6; }

.parts-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 32px 0 12px; }
.part-card { display: block; text-decoration: none; color: var(--ink); background: var(--panel); border-radius: var(--radius-l); padding: 24px 24px 22px; border: 1px solid var(--line); box-shadow: var(--shadow-card); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.part-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--teal-600); }
.part-card .pnum { font-family: var(--font-mono); font-size: 12px; color: var(--teal-700); font-weight: 700; }
.part-card h2 { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin: 6px 0 8px; }
.part-card p { margin: 0 0 16px; color: var(--ink-soft); font-size: 15px; }
.part-card .stripe { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }

.pager { display: flex; justify-content: space-between; gap: 16px; margin: 44px 0 12px; flex-wrap: wrap; }
.pager a { flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px 20px; text-decoration: none; color: var(--ink); background: var(--panel); box-shadow: var(--shadow-card); }
.pager a .dir { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--teal-700); text-transform: uppercase; font-weight: 700; }
.pager a .ttl { display: block; font-family: var(--font-display); font-weight: 800; font-size: 16.5px; margin-top: 4px; }
.pager a.next { text-align: right; }

footer.site { background: var(--ink); color: #c9d8d4; padding: 36px 0; margin-top: 64px; font-size: 14px; }
footer.site a { color: #eafaf5; }
footer.site .container { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }




/* Dark theme: the palette above is light-only, so the same role
   tokens are re-derived over a dark base when the OS prefers dark
   or an explicit theme is set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --teal-100: color-mix(in srgb, #e4f4f0 14%, #151a16);
  --teal-050: color-mix(in srgb, #f2faf8 14%, #151a16);
  --ink: #e8f0e9;
  --ink-soft: #c8d8c9;
  --paper: #151a16;
  --panel: #1e241f;
  --line: color-mix(in srgb, #e6e2d8 42%, #151a16);
  --why-bg: color-mix(in srgb, #fdf3d6 16%, #151a16);
  --why-line: color-mix(in srgb, #c99a1f 42%, #151a16);
  --why-ink: color-mix(in srgb, #7a5b0c 45%, #ffffff);
  --mistake-bg: color-mix(in srgb, #fdf0f0 16%, #151a16);
  --mistake-line: color-mix(in srgb, #e55353 42%, #151a16);
  --mistake-ink: color-mix(in srgb, #9c1c1c 45%, #ffffff);
  --mint-bg: color-mix(in srgb, #eaf6f1 16%, #151a16);
  --mint-line: color-mix(in srgb, #1c9483 42%, #151a16);
  --mint-ink: color-mix(in srgb, #0f5c50 45%, #ffffff);
  /* table headers paint --ink as a fill, which turns light in dark mode */
  --thead-fill: color-mix(in srgb, var(--ink) 16%, #151a16);
  }
  :root:not([data-theme="light"]) thead th {
    background: var(--thead-fill) !important; color: var(--ink) !important;
  }
}
html[data-theme="dark"], body.theme-dark {
  --teal-100: color-mix(in srgb, #e4f4f0 14%, #151a16);
  --teal-050: color-mix(in srgb, #f2faf8 14%, #151a16);
  --ink: #e8f0e9;
  --ink-soft: #c8d8c9;
  --paper: #151a16;
  --panel: #1e241f;
  --line: color-mix(in srgb, #e6e2d8 42%, #151a16);
  --why-bg: color-mix(in srgb, #fdf3d6 16%, #151a16);
  --why-line: color-mix(in srgb, #c99a1f 42%, #151a16);
  --why-ink: color-mix(in srgb, #7a5b0c 45%, #ffffff);
  --mistake-bg: color-mix(in srgb, #fdf0f0 16%, #151a16);
  --mistake-line: color-mix(in srgb, #e55353 42%, #151a16);
  --mistake-ink: color-mix(in srgb, #9c1c1c 45%, #ffffff);
  --mint-bg: color-mix(in srgb, #eaf6f1 16%, #151a16);
  --mint-line: color-mix(in srgb, #1c9483 42%, #151a16);
  --mint-ink: color-mix(in srgb, #0f5c50 45%, #ffffff);
  /* table headers paint --ink as a fill, which turns light in dark mode */
  --thead-fill: color-mix(in srgb, var(--ink) 16%, #151a16);
}
html[data-theme="dark"] thead th, body.theme-dark thead th {
  background: var(--thead-fill) !important; color: var(--ink) !important;
}
