/* Spokenote release notes, a WeScribe proof of concept.
   Tokens first, then frame, release page, index, responsive. */

:root {
  --accent: #0094ce;          /* Spokenote blue */
  --logo: #005677;            /* Spokenote wordmark fill */
  --button: var(--accent);    /* primary button background */
  --button-ink: #ffffff;
  --badge-bg: rgba(255, 255, 255, 0.92);
  --badge-ink: #15201b;
  --accent-ink: #007bb0;      /* same blue, darkened for text on light */
  --accent-soft: #e6f4fb;
  --bg: #ffffff;
  --surface: #f5f8f6;
  --text: #15201b;
  --muted: #5e6d66;
  --border: #e1e7e4;
  --border-strong: #c9d3ce;
  --note-bg: #f5f8f6;  --note-edge: #8a9a92;
  --tip-bg: #e9f5fb;   --tip-edge: #0094ce;
  --warn-bg: #fdf4e3;  --warn-edge: #d98c1f;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 6px;
  --content: 720px;
  --rail: 200px;
  --page: 980px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --logo: #ffffff;
  --badge-bg: rgba(14, 20, 17, 0.85);
  --badge-ink: #e7eee9;
  --accent: #5cc0ee;
  --accent-ink: #7fd0f5;
  --accent-soft: #10303f;
  --bg: #0e1411;
  --surface: #151d18;
  --text: #e7eee9;
  --muted: #94a39b;
  --border: #243029;
  --border-strong: #35453c;
  --note-bg: #151d18;  --note-edge: #6f7f77;
  --tip-bg: #0f2a38;   --tip-edge: #5cc0ee;
  --warn-bg: #2b2112;  --warn-edge: #f0b35a;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --logo: #ffffff;
    --badge-bg: rgba(14, 20, 17, 0.85);
    --badge-ink: #e7eee9;
    --accent: #5cc0ee;
    --accent-ink: #7fd0f5;
    --accent-soft: #10303f;
    --bg: #0e1411;
    --surface: #151d18;
    --text: #e7eee9;
    --muted: #94a39b;
    --border: #243029;
    --border-strong: #35453c;
    --note-bg: #151d18;  --note-edge: #6f7f77;
    --tip-bg: #0f2a38;   --tip-edge: #5cc0ee;
    --warn-bg: #2b2112;  --warn-edge: #f0b35a;
    color-scheme: dark;
  }
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.015em; color: var(--text); }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: 0.35em 0; }
li::marker { color: var(--muted); }
strong { font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.1em 0.35em; }
pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; overflow-x: auto; }
pre code { border: 0; background: none; padding: 0; }
blockquote { margin: 0 0 1em; padding-left: 16px; border-left: 3px solid var(--border-strong); color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
table { border-collapse: collapse; width: 100%; margin: 0 0 1em; font-size: 0.95em; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

/* Frame */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.wordmark { color: var(--logo); display: flex; align-items: center; gap: 12px; }
.logo { height: 22px; width: auto; display: block; }
.wordmark:hover { text-decoration: none; }
.wordmark-sub { color: var(--muted); font-weight: 500; font-size: 14px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg); color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

main { max-width: var(--page); margin: 0 auto; padding: 40px 24px 64px; }

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* Shared text pieces */
.eyebrow { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.headline { font-size: 40px; font-weight: 700; letter-spacing: -0.025em; max-width: 20ch; }
.lead { font-size: 20px; line-height: 1.5; color: var(--muted); margin: 14px 0 0; max-width: 60ch; }
.lead p:last-child { margin-bottom: 0; }

/* Release page */
.page {
  display: grid;
  grid-template-columns: minmax(0, var(--content)) var(--rail);
  gap: 48px;
  align-items: start;
}
.release { min-width: 0; }
.hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.release-head { margin: 32px 0 40px; }
.version { margin: 16px 0 0; }
.version-pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 500; line-height: 1.4;
}

.content > * + h2, .content > * + .columns, .columns > .column > * + h2 { margin-top: 44px; }
.content h2 { font-size: 24px; font-weight: 650; padding-top: 8px; margin-bottom: 12px; scroll-margin-top: 80px; }
.content h3 { font-size: 18px; font-weight: 600; margin: 24px 0 6px; }
.content img { border-radius: var(--radius); border: 1px solid var(--border); margin: 4px 0 16px; }
.content > p:first-child, .content > ul:first-child { margin-top: 0; }

/* Sections and blocks */
.columns { display: grid; gap: 32px; align-items: start; }
.columns-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.column { min-width: 0; }
.column > :first-child { margin-top: 0; }
.column > :last-child { margin-bottom: 0; }

.callout {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 16px 0;
  border: 1px solid var(--border);
  border-left: 3px solid var(--note-edge);
  background: var(--note-bg);
  font-size: 16px;
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout h2 { font-size: 18px; margin: 0 0 10px; padding: 0; }
.callout-tip { background: var(--tip-bg); border-left-color: var(--tip-edge); }
.callout-warning { background: var(--warn-bg); border-left-color: var(--warn-edge); }

.directive-unknown { outline: 2px dashed #dc2626; outline-offset: 4px; margin: 16px 0; }
.directive-unknown::before { content: "Unknown block type"; display: block; color: #dc2626; font-size: 13px; font-weight: 600; margin-bottom: 4px; }

/* Feedback prompt at the end of the content column */
.feedback {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 48px; padding: 14px 20px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg);
}
.feedback-question { margin: 0; color: var(--muted); font-size: 17px; }
.feedback-actions { display: flex; gap: 6px; margin-left: auto; }
.feedback-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 8px; border: 1px solid transparent; background: none;
  color: var(--text); font: inherit; font-size: 16px; font-weight: 500; cursor: pointer;
}
.feedback-btn svg { color: var(--muted); }
.feedback-btn:hover { background: var(--surface); }
.feedback-btn:hover svg { color: var(--text); }
.feedback-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.feedback-btn[aria-pressed="true"] svg { color: var(--accent); }
.feedback-thanks { margin: 0; flex-basis: 100%; color: var(--muted); font-size: 14px; }
.feedback-thanks[hidden] { display: none; }

/* Rail */
.rail { position: sticky; top: 80px; font-size: 14px; }
.rail-title { color: var(--text); font-weight: 600; margin: 0 0 10px; font-size: 14px; }
.rail ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.rail li { margin: 0; }
.rail nav a { display: block; color: var(--muted); padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; line-height: 1.4; }
.rail nav a:hover { color: var(--text); text-decoration: none; }
.rail nav a.active { color: var(--button); border-left-color: var(--button); }
.rail-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 20px; }
.rail-actions .export-link, .share-toggle, .actions-toggle {
  display: inline-block; padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: none; color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1.3; cursor: pointer;
}
.rail-actions .export-link:hover, .share-toggle:hover, .share-toggle[aria-expanded="true"],
.actions-toggle:hover, .actions-toggle[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.share-toggle, .actions-toggle { display: inline-flex; align-items: center; gap: 6px; }
.share-toggle svg, .actions-toggle svg { transition: transform 150ms ease; }
.share-toggle[aria-expanded="true"] svg, .actions-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.actions { position: relative; }
.actions-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 5;
  min-width: 280px; margin: 0; padding: 6px; list-style: none;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.actions-menu[hidden] { display: none; }
.actions-menu li { margin: 0; }
.actions-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 6px; color: var(--text); }
.actions-item:hover, .actions-item:focus-visible { background: var(--surface); text-decoration: none; outline: none; }
.actions-icon { display: inline-flex; width: 18px; height: 18px; color: var(--text); flex: none; }
.actions-icon svg { width: 18px; height: 18px; }
.actions-text { display: flex; flex-direction: column; min-width: 0; }
.actions-title { font-size: 14px; font-weight: 500; line-height: 1.3; }
.actions-sub { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.actions-ext { margin-left: auto; color: var(--muted); display: inline-flex; flex: none; }
.actions-item:hover .actions-ext { color: var(--accent); }
.share { position: relative; }
.share-menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 5;
  min-width: 180px; margin: 0; padding: 6px; list-style: none;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.share-menu[hidden] { display: none; }
.share-menu li { margin: 0; }
.share-menu a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; color: var(--text); font-size: 14px; }
.share-icon { display: inline-flex; width: 16px; height: 16px; color: var(--muted); flex: none; }
.share-icon svg { width: 16px; height: 16px; }
.share-menu a:hover .share-icon, .share-menu a:focus-visible .share-icon { color: var(--accent); }
.share-menu a:hover, .share-menu a:focus-visible { background: var(--surface); color: var(--accent); text-decoration: none; outline: none; }

/* What's new row */
.whats-new { margin-top: 64px; padding-top: 32px; border-top: 1px solid var(--border); }
.whats-new-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.whats-new-title { font-size: 22px; font-weight: 650; }
.all-releases { font-size: 15px; }

/* Carousel (What's new): two cards per view, one card per step, no looping */
.carousel { position: relative; --carousel-gap: 24px; --per-view: 2; container-type: inline-size; }
.carousel-viewport { overflow: hidden; }
.carousel-track { display: flex; gap: var(--carousel-gap); transition: transform 320ms ease; will-change: transform; }
.carousel-track > .card { flex: 0 0 calc((100% - var(--carousel-gap) * (var(--per-view) - 1)) / var(--per-view)); }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg); color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12); cursor: pointer;
}
.carousel-btn:hover { color: var(--accent); border-color: var(--accent); }
.carousel-btn[hidden] { display: none; }
.carousel-prev { left: -22px; }
.carousel-next { right: -22px; }
@media (prefers-reduced-motion: reduce) { .carousel-track { transition: none; } }

/* Cards */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.card:hover { border-color: var(--border-strong); }
.card-image { aspect-ratio: 16 / 9; width: 100%; object-fit: cover; }
.card-body { padding: 16px 18px 20px; }
.card-body .eyebrow { margin-bottom: 6px; font-size: 13px; }
.card-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.card-title a { color: var(--text); }
.card-summary { color: var(--muted); font-size: 15px; margin: 0 0 12px; }
.card-link { display: inline-block; color: var(--button); font-weight: 600; font-size: 15px; }

/* Index */
.hero-card {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 32px;
  background: var(--surface);
}
.hero-card:hover { border-color: var(--border-strong); }
.hero-card-image-link { position: relative; display: block; }
.hero-card-image { width: 100%; height: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.hero-card-badge {
  position: absolute; left: 16px; bottom: 16px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--badge-bg); color: var(--badge-ink);
  font-size: 13px; font-weight: 600; line-height: 1.2; letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
}
.hero-card-body { padding: 28px 32px; display: flex; flex-direction: column; justify-content: center; }
.hero-card-title { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
.hero-card-title a { color: var(--text); }
.hero-card-summary { color: var(--muted); font-size: 17px; margin-bottom: 18px; }
.read-more {
  display: inline-block; align-self: flex-start;
  padding: 10px 20px; border-radius: 999px;
  background: var(--button); color: var(--button-ink);
  font-weight: 600; font-size: 15px; line-height: 1.2;
}
.read-more:hover { text-decoration: none; filter: brightness(1.08); }
.read-more:focus-visible { outline-color: var(--button); }
.empty { color: var(--muted); }

/* Responsive: columns stack, rail hides, grids go single */
@media (max-width: 900px) {
  main { padding: 24px 16px 48px; }
  .topbar { padding: 0 16px; }
  .page { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rail { display: none; }
  .columns-2, .columns-3, .card-grid, .hero-card { grid-template-columns: minmax(0, 1fr); }
  /* Rail actions relocated into the release header by theme.js */
  .release-head .rail-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; position: relative; }
  .release-head .share, .release-head .actions { position: static; }
  .release-head .share-menu, .release-head .actions-menu { left: 0; right: auto; max-width: 100%; }
  .feedback { gap: 10px; padding: 14px 16px; }
  .feedback-actions { margin-left: 0; }
  .carousel { --per-view: 1; }
  /* One card fills the carousel width, so its 16:9 cover is 100cqw * 9/16 tall.
     Center the arrows on that cover rather than on the whole card. */
  .carousel-btn { top: calc(100cqw * 9 / 32); }
  .carousel-prev { left: 12px; }
  .carousel-next { right: 12px; }
  .headline { font-size: 32px; }
  .lead { font-size: 18px; }
  .hero-card-body { padding: 20px; }
  .hero-card-title { font-size: 24px; }
  /* Stacked cards read like the hero card: same type sizes once they are full width. */
  .card-body { padding: 20px; }
  .card-body .eyebrow { font-size: 14px; }
  .card-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 10px; }
  .card-summary { font-size: 17px; }
  .card-link { font-size: 15px; }
  .release-head { margin: 24px 0 32px; }
  .content > * + h2, .content > * + .columns, .columns > .column > * + h2 { margin-top: 36px; }
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
