/* ============================================================
   English Grammar — Design System (design code)
   Dark, monospace-forward, aspect-color-coded.
   Inspired by the story-cards: present/past/future mind-map,
   timelines, color per aspect.
   ============================================================ */

:root {
  /* --- surfaces --- */
  --bg:          #0a0b10;   /* page background (near-black, faint blue) */
  --bg-1:        #0e1017;   /* raised panel */
  --bg-2:        #14161f;   /* card */
  --bg-3:        #1b1e29;   /* card hover / inset */
  --grid:        rgba(255, 255, 255, 0.028);
  --hairline:    rgba(255, 255, 255, 0.07);
  --hairline-2:  rgba(255, 255, 255, 0.12);

  /* --- text --- */
  --text:        #f3f4f8;
  --text-soft:   #b9bdca;
  --text-dim:    #7d8294;
  --text-faint:  #565b6b;

  /* --- aspect colors (the core of the system) --- */
  --simple:      #5f8bff;   /* Simple      — blue    */
  --continuous:  #35d488;   /* Continuous  — green   */
  --perfect:     #f5a63b;   /* Perfect     — orange  */
  --perfcont:    #ac8cf6;   /* Perf. Cont. — purple  */

  --simple-dim:      #5f8bff26;
  --continuous-dim:  #35d48826;
  --perfect-dim:     #f5a63b26;
  --perfcont-dim:    #ac8cf626;

  /* --- semantic accents --- */
  --now:         #ffd233;   /* "now" marker on timelines */
  --past:        #f5a63b;   /* past tense group tint     */
  --future:      #ac8cf6;   /* future tense group tint   */
  --good:        #35d488;
  --bad:         #ff6b6b;

  /* --- type --- */
  --font-sans: -apple-system, "SF Pro Display", "SF Pro Text", "Inter",
               system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Fira Code", ui-monospace,
               Menlo, Monaco, "Cascadia Code", monospace;

  /* --- radius --- */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* --- spacing scale --- */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px;  --s-6: 32px;  --s-7: 48px;  --s-8: 64px;  --s-9: 96px;

  /* --- shadows / glows --- */
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --glow-simple: 0 0 0 1px #5f8bff44, 0 0 34px -6px #5f8bff55;

  --maxw: 1120px;
}

/* ============================================================
   Reset / base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px),
    radial-gradient(1200px 700px at 15% -5%, #171a2740, transparent 60%),
    radial-gradient(1000px 600px at 100% 0%, #1a142640, transparent 55%);
  background-size: 44px 44px, 44px 44px, auto, auto;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

::selection { background: #5f8bff44; }

/* thin dark scrollbar */
* { scrollbar-width: thin; scrollbar-color: #2a2e3b transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2a2e3b; border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }

/* ============================================================
   Layout
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--s-6); }
.section { padding: var(--s-9) 0; }
.section + .section { border-top: 1px solid var(--hairline); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 var(--s-3);
}

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; margin: 0; }
h1 { font-size: clamp(38px, 6vw, 68px); line-height: 1.02; }
h2 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.08; }
h3 { font-size: 20px; }

.lede { color: var(--text-soft); font-size: 18px; max-width: 62ch; }

/* ============================================================
   Top navigation
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--hairline);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px var(--s-6);
  display: flex; align-items: center; gap: var(--s-5);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -0.02em; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%;
  background: conic-gradient(var(--simple), var(--continuous), var(--perfect), var(--perfcont), var(--simple));
  box-shadow: 0 0 14px -1px #5f8bff88; }
.nav-links { margin-left: auto; display: flex; gap: 4px; }
.nav-links a {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-dim);
  padding: 8px 12px; border-radius: var(--r-pill); transition: .18s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-2); }
.nav-links a.active { color: var(--text); background: var(--bg-3); }

/* ============================================================
   Aspect badge / pill
   ============================================================ */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.22em;
  text-transform: uppercase; padding: 6px 14px; border-radius: var(--r-pill);
  border: 1px solid currentColor;
}
.pill .num { color: var(--text-dim); letter-spacing: 0; }
.pill.simple      { color: var(--simple); }
.pill.continuous  { color: var(--continuous); }
.pill.perfect     { color: var(--perfect); }
.pill.perfcont    { color: var(--perfcont); }

/* ============================================================
   TENSE TREE  (the signature mind-map)
   ============================================================ */
.tree-group {
  display: grid;
  grid-template-columns: 150px 148px 1fr;
  align-items: center;
  margin: 0 0 var(--s-7);
}

.tense-node {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 15px; font-weight: 600;
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--hairline-2);
  position: relative;
}
.tense-node.present { box-shadow: var(--glow-simple); border-color: #5f8bff55; }

.tree-connectors { width: 148px; height: 404px; }

.aspect-rows { display: flex; flex-direction: column; }
.aspect-row {
  height: 101px; display: flex; flex-direction: column; justify-content: center;
}
.aspect-tag {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-dim);
  margin-bottom: 6px;
}
.aspect-tag .bead { width: 7px; height: 7px; border-radius: 50%; }
.row-simple     .bead { background: var(--simple); }
.row-continuous .bead { background: var(--continuous); }
.row-perfect    .bead { background: var(--perfect); }
.row-perfcont   .bead { background: var(--perfcont); }

.form {
  font-family: var(--font-mono);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 500; letter-spacing: -0.01em; color: var(--text);
}
.k-simple     { color: var(--simple); }
.k-continuous { color: var(--continuous); }
.k-perfect    { color: var(--perfect); }
.k-perfcont   { color: var(--perfcont); }
.hint { font-family: var(--font-sans); font-size: 14px; color: var(--text-dim); margin-top: 4px; }

/* ============================================================
   TIMELINE  (past — now — future)
   ============================================================ */
.timeline {
  position: relative; height: 150px; margin: var(--s-6) 0;
}
.timeline .axis {
  position: absolute; left: 0; right: 0; top: 50%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--hairline-2) 8%, var(--hairline-2) 92%, transparent);
}
.timeline .axis::after {
  content: ""; position: absolute; right: -2px; top: -4px;
  border-left: 9px solid var(--hairline-2); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.timeline .now {
  position: absolute; left: 50%; top: 8px; bottom: 8px; transform: translateX(-50%);
  border-left: 2px dotted var(--now);
}
.timeline .now-label {
  position: absolute; left: 50%; top: -6px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  color: var(--now); white-space: nowrap;
}
.timeline .marker {
  position: absolute; top: 50%; width: 13px; height: 13px; transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 3px;
}
.timeline .caption {
  position: absolute; top: calc(50% + 20px); transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 13px; white-space: nowrap;
}
.timeline .ends {
  position: absolute; bottom: 0; width: 100%;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.24em; color: var(--text-faint);
}
.m-simple     { background: var(--continuous); box-shadow: 0 0 16px -2px var(--continuous); }
.m-blue       { background: var(--simple);     box-shadow: 0 0 16px -2px var(--simple); }
.m-orange     { background: var(--perfect);    box-shadow: 0 0 16px -2px var(--perfect); }
.m-purple     { background: var(--perfcont);   box-shadow: 0 0 16px -2px var(--perfcont); }

/* ============================================================
   EXAMPLE card  (English sentence + RU translation)
   ============================================================ */
.example {
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: var(--s-6); text-align: center;
}
.example .en {
  font-family: var(--font-mono); font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 500; color: var(--text-soft);
}
.example .en b { color: var(--text); font-weight: 500; position: relative; }
.example .en .u {
  color: var(--continuous); font-weight: 600;
  border-bottom: 2px solid var(--continuous); padding-bottom: 1px;
}
.example .ru { margin-top: 14px; color: var(--text-dim); font-style: italic; font-size: 16px; }

/* progress dots */
.dots { display: flex; gap: 7px; justify-content: center; margin-top: var(--s-6); }
.dots i { width: 26px; height: 4px; border-radius: 3px; background: var(--bg-3); display: block; }
.dots i.on { background: var(--continuous); }
.dots i.end { background: #6b3a4a; }

/* ============================================================
   TIME SCALE  (yesterday / today / tomorrow ladder)
   ============================================================ */
.scale { display: grid; gap: 2px; font-family: var(--font-mono); max-width: 620px; }
.scale-row {
  display: grid; grid-template-columns: 64px 1fr auto; align-items: baseline;
  gap: var(--s-4); padding: 12px 4px; border-radius: var(--r-sm);
}
.scale-row .delta { color: var(--text-faint); font-size: 20px; text-align: right; }
.scale-row .en { color: var(--text-faint); font-size: 22px; }
.scale-row .ru { color: var(--text-faint); font-size: 14px; text-align: right; }
.scale-row.today  .delta { color: var(--simple); }
.scale-row.today  .en { color: var(--simple); font-weight: 700; }
.scale-row.today  .ru { color: var(--text-soft); }
.scale-row.mark   { background: #f5a63b12; }
.scale-row.mark   .delta { color: var(--perfect); }
.scale-row.mark   .en { color: var(--perfect); font-weight: 700; }
.scale-row.mark   .ru { color: var(--text); font-weight: 600; }

/* headline word chip (big highlighted term) */
.term {
  display: inline-block; font-family: var(--font-mono); font-weight: 800;
  font-size: clamp(34px, 6vw, 56px); color: var(--perfect);
  background: #f5a63b16; border: 1px solid #f5a63b33;
  padding: 6px 22px; border-radius: var(--r-md);
}

/* ============================================================
   CARD grid (topic tiles for the home hub)
   ============================================================ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s-4); }
.card {
  display: block; background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--hairline); border-radius: var(--r-lg);
  padding: var(--s-5); transition: .2s; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); border-color: var(--hairline-2); box-shadow: var(--shadow); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent, var(--simple)); opacity: .8; }
.card .kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; color: var(--text-dim); }
.card h3 { margin: 8px 0 6px; }
.card p { margin: 0; color: var(--text-dim); font-size: 14px; }
.card.a-simple    { --accent: var(--simple); }
.card.a-continuous{ --accent: var(--continuous); }
.card.a-perfect   { --accent: var(--perfect); }
.card.a-perfcont  { --accent: var(--perfcont); }

/* small utilities */
.mono { font-family: var(--font-mono); }
.dim  { color: var(--text-dim); }
.center { text-align: center; }
.stack > * + * { margin-top: var(--s-4); }
.tag-legend { display: flex; flex-wrap: wrap; gap: 18px; font-family: var(--font-mono); font-size: 13px; color: var(--text-soft); }
.tag-legend span { display: inline-flex; align-items: center; gap: 8px; }
.tag-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }

footer.site { padding: var(--s-7) 0; color: var(--text-faint); font-family: var(--font-mono); font-size: 13px; }

/* ============================================================
   LESSON LAYOUT  (sidebar + content)
   ============================================================ */
.shell { display: grid; grid-template-columns: 300px 1fr; align-items: start; max-width: 1240px; margin: 0 auto; }

.sidebar {
  position: sticky; top: 57px; align-self: start;
  height: calc(100vh - 57px); overflow-y: auto;
  padding: var(--s-6) var(--s-4) var(--s-6) var(--s-6);
  border-right: 1px solid var(--hairline);
}
.side-brand { font-weight: 800; letter-spacing: -.02em; margin-bottom: var(--s-5); display:flex; align-items:center; gap:10px; }
.side-block { font-family: var(--font-mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-faint); margin: var(--s-5) 0 var(--s-2); }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--text-soft); font-size: 14px; transition: .15s; position: relative;
}
.side-link:hover { background: var(--bg-2); color: var(--text); }
.side-link.active { background: var(--bg-3); color: var(--text); }
.side-link .no { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); width: 18px; }
.side-link .bead { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.content { padding: var(--s-7) var(--s-8); min-width: 0; max-width: 820px; }

/* lesson header */
.lesson-head { margin-bottom: var(--s-7); }
.lesson-head h1 { font-size: clamp(32px, 4vw, 52px); margin: 16px 0 10px; }
.lesson-sub { font-size: 20px; font-weight: 600; }
.sub-simple{color:var(--simple)} .sub-continuous{color:var(--continuous)}
.sub-perfect{color:var(--perfect)} .sub-perfcont{color:var(--perfcont)}

/* block heading inside lesson */
.blk { font-family: var(--font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-dim); margin: var(--s-7) 0 var(--s-4); display:flex; align-items:center; gap:10px; }
.blk::after { content:""; flex:1; height:1px; background: var(--hairline); }

/* FORMULA block */
.formula {
  font-family: var(--font-mono); font-size: clamp(16px, 2vw, 21px);
  background: var(--bg-1); border: 1px solid var(--hairline); border-radius: var(--r-md);
  padding: 16px 20px; margin: var(--s-3) 0; color: var(--text-soft); overflow-x:auto; white-space:nowrap;
}
.formula .op { color: var(--text-faint); margin: 0 6px; }
.formula .slot { color: var(--text); }
.formula .lbl { color: var(--text-dim); font-size: 13px; margin-left: 10px; }

/* IDEA callout */
.idea {
  border-left: 3px solid var(--accent, var(--simple)); background: var(--bg-1);
  padding: 14px 18px; border-radius: 0 var(--r-md) var(--r-md) 0; font-size: 17px; color: var(--text);
}

/* marker chips (time words) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--font-mono); font-size: 14px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--hairline-2); border-radius: var(--r-pill);
  padding: 6px 14px;
}
.chip small { color: var(--text-dim); margin-left: 6px; }

/* MISTAKE rows */
.mistake { display: grid; gap: 10px; }
.mrow {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: center;
  font-family: var(--font-mono); font-size: 16px;
}
.mrow .bad  { color: var(--text-dim); text-decoration: line-through; text-decoration-color: var(--bad); }
.mrow .good { color: var(--text); }
.mrow .good::before { content: "→ "; color: var(--good); }
.mrow .why { grid-column: 1/-1; font-family: var(--font-sans); font-size: 13px; color: var(--text-dim); margin-top: -4px; }

/* NOTE */
.note {
  background: #ffd23310; border: 1px solid #ffd23330; border-radius: var(--r-md);
  padding: 14px 18px; font-size: 15px; color: var(--text-soft);
}
.note b { color: var(--now); }

/* mini comparison (two aspects side by side) */
.vs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.vs-card { background: var(--bg-1); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: var(--s-5); }
.vs-card .en { font-family: var(--font-mono); font-size: 19px; color: var(--text); }
.vs-card .ru { color: var(--text-dim); font-size: 14px; margin-top: 8px; }
.vs-card .tg { font-family: var(--font-mono); font-size: 12px; letter-spacing:.12em; text-transform:uppercase; margin-bottom: 12px; }

/* prev / next */
.pager { display: flex; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-8);
  border-top: 1px solid var(--hairline); padding-top: var(--s-5); }
.pager a { display: block; padding: 14px 18px; border: 1px solid var(--hairline); border-radius: var(--r-md);
  background: var(--bg-1); transition:.18s; min-width: 200px; }
.pager a:hover { border-color: var(--hairline-2); background: var(--bg-2); }
.pager .lbl { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); letter-spacing:.1em; }
.pager .ttl { font-weight: 600; margin-top: 4px; }
.pager .next { text-align: right; margin-left: auto; }

/* examples list (multiple) */
.ex-list { display: grid; gap: 12px; }
.ex-list .example { text-align: left; padding: 18px 22px; }
.ex-list .example .en { font-size: 20px; }
.ex-list .example .ru { margin-top: 8px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content { padding: var(--s-6) var(--s-5); }
  .vs, .mrow { grid-template-columns: 1fr; }
}
