/* The story page (/). Builds on style.css: its tokens, header, fonts and dark mode. */
.story-page .top-right { display: flex; align-items: center; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 18px; border-radius: 999px;
  background: var(--green); color: var(--paper); font-weight: 600; text-decoration: none; border: 1px solid var(--green); }
.btn:hover { background: var(--green-2); border-color: var(--green-2); }
.btn.ghost { background: transparent; color: var(--green); }
.btn.ghost:hover { background: var(--saffron-soft); }
.top .btn { min-height: 36px; padding: 6px 14px; font-size: 14px; }

.s-hero { padding: 64px 0 40px; background: radial-gradient(circle at 85% 10%, var(--saffron-soft), transparent 55%); }
.kicker { margin: 0 0 12px; color: var(--green-2); font-weight: 600; letter-spacing: 0.02em; }
.s-hero h1 { font-size: clamp(34px, 6vw, 64px); line-height: 1.05; max-width: 16ch; }
.s-hero .lede { font-size: clamp(17px, 2vw, 20px); max-width: 60ch; color: var(--muted); margin: 18px 0 26px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 40px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: grid; gap: 4px; }
.stat b { font-family: var(--display); font-size: clamp(34px, 5vw, 48px); line-height: 1; color: var(--green); }
.stat.hot b { color: var(--saffron); }
.stat small { color: var(--muted); }

.s { padding: 64px 0; scroll-margin-top: 64px; }
.s.alt { background: var(--card); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.narrow { max-width: 860px; }
.num { margin: 0 0 6px; font-weight: 600; color: var(--saffron); letter-spacing: 0.08em; }
.s h2 { font-size: clamp(26px, 3.6vw, 40px); line-height: 1.1; max-width: 26ch; }
.s p { max-width: 70ch; }
.sub { color: var(--muted); font-size: 17px; margin: 12px 0 28px; }
.note { color: var(--muted); margin-top: 22px; }

.stackbar { display: flex; height: 22px; border-radius: 999px; overflow: hidden; margin: 22px 0 14px; border: 1px solid var(--line); }
.stackbar i { display: block; height: 100%; }
.legend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.legend-list li { display: flex; gap: 10px; align-items: baseline; }
.legend-list i { width: 12px; height: 12px; border-radius: 3px; flex: none; transform: translateY(1px); }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; counter-reset: step; }
.steps li { counter-increment: step; background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--saffron); border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; align-content: start; }
.steps li::before { content: counter(step, decimal-leading-zero); font-weight: 600; color: var(--saffron); font-size: 13px; }
.steps li.code { border-top-color: var(--muted); }
.steps li.code::before { color: var(--muted); }
.steps b { font-family: var(--display); font-size: 20px; }
.steps span { color: var(--muted); }

.rules-list { margin: 18px 0 0; padding-left: 20px; display: grid; gap: 10px; font-size: 17px; }

.chart-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); max-width: 860px; }
.chart-card h3 { font-size: 20px; margin-bottom: 14px; }
.bars-big { display: grid; gap: 14px; }
.brow { display: grid; grid-template-columns: 140px 1fr; gap: 12px; align-items: center; }
.brow .lbl { font-weight: 600; }
.bpair { display: grid; gap: 6px; }
.bbar { position: relative; height: 26px; background: color-mix(in srgb, var(--line) 50%, transparent); border-radius: 6px; overflow: hidden; }
.bbar i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; width: 0; transition: width 0.9s ease-out; }
.bbar i.today { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.bbar i.jev { background: var(--saffron); }
.bbar span { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-weight: 600; font-size: 13px; }
.legend-inline { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 14px; color: var(--muted); font-size: 14px; }
.legend-inline i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.k-today { background: color-mix(in srgb, var(--muted) 55%, transparent); }
.k-jev { background: var(--saffron); }
@media (prefers-reduced-motion: reduce) { .bbar i { transition: none; } }

.table-wrap { overflow-x: auto; margin-top: 22px; max-width: 860px; }
.res-table { width: 100%; border-collapse: collapse; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.res-table th, .res-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.res-table th { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--card); }
.res-table td:not(:first-child), .res-table th:not(:first-child) { white-space: nowrap; }
.res-table.limits td:not(:first-child) { white-space: normal; color: var(--muted); }
.res-table tr:last-child td { border-bottom: 0; }

.story-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.story-card { display: grid; gap: 6px; align-content: start; padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform 0.15s, border-color 0.15s; }
.story-card:hover { transform: translateY(-2px); border-color: var(--saffron); }
.story-card b { font-family: var(--display); font-size: 18px; }
.story-card span { color: var(--muted); }
.story-card em { font-style: normal; color: var(--green-2); font-weight: 600; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .story-card { transition: none; } .story-card:hover { transform: none; } }

.cards6 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cards4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.card { display: grid; gap: 6px; align-content: start; padding: 18px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.s:not(.alt) .card { background: var(--card); }
.card b { font-family: var(--display); font-size: 19px; }
.card span { color: var(--muted); }

.s-cta { padding: 64px 0; text-align: center; background: var(--green); color: var(--paper); }
.s-cta h2 { color: var(--paper); font-size: clamp(26px, 3.6vw, 40px); margin-bottom: 18px; }
.s-cta .btn { background: var(--saffron); border-color: var(--saffron); color: #1d2a24; }

@media (max-width: 1000px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .story-grid, .cards4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .s-hero { padding: 40px 0 28px; }
  .s { padding: 44px 0; }
  .stats, .steps, .story-grid, .cards4, .cards6 { grid-template-columns: 1fr; }
  .brow { grid-template-columns: 1fr; gap: 6px; }
  .story-page .top .btn { display: none; }
}
