:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --muted: #5f6368;
  --line: #e2e2e2;
  --link: #1846c7;
  --accent: #2b4cff;
  --dot: #b9bcc4;
  --header-bg: rgba(255, 255, 255, 0.85);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --text: #e6e6e6;
    --muted: #a0a0a0;
    --line: #2e2e2e;
    --link: #8fb1ff;
    --accent: #6f8cff;
    --dot: #4a4d55;
    --header-bg: rgba(18, 18, 18, 0.85);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: text-decoration-thickness 0.15s ease, text-underline-offset 0.15s ease;
}
a:hover { text-decoration-thickness: 2px; text-underline-offset: 4px; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }

.wrap { max-width: 60rem; margin: 0 auto; padding: 0 16px; }
main p, main ul { max-width: 42rem; }

/* ---- Header ------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.header-inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 14px; padding-bottom: 14px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.brand img { border-radius: 6px; }

/* Logo mark draws itself on load */
.brand-mark { flex: none; }
.mark-bg { fill: #101218; }
.mark-y {
  fill: none; stroke: #f4f2ec; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: mark-draw 0.9s 0.15s cubic-bezier(0.65, 0, 0.35, 1) both;
}
.mark-dot { fill: var(--accent); transform-origin: 16px 16px; animation: mark-pop 0.4s 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@media (prefers-color-scheme: dark) {
  .mark-bg { fill: #f4f2ec; }
  .mark-y { stroke: #101218; }
}
@keyframes mark-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes mark-pop { from { transform: scale(0); } to { transform: scale(1); } }

/* Nav underline slides in */
.site-header nav { display: flex; gap: 22px; }
.site-header nav a { position: relative; color: var(--text); text-decoration: none; padding: 2px 0; }
.site-header nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleX(0); transform-origin: right; transition: transform 0.25s ease;
}
.site-header nav a:hover::after, .site-header nav a:focus-visible::after { transform: scaleX(1); transform-origin: left; }

/* ---- Hero --------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(68vh, 560px);
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  touch-action: pan-y;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-inner { position: relative; width: 100%; padding-top: 64px; padding-bottom: 64px; pointer-events: none; }
.hero-inner a { pointer-events: auto; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); letter-spacing: -0.02em; line-height: 1.05; margin-bottom: 0.4em; }
.hero p { font-size: 1.15rem; max-width: 26rem; }

/* ---- Sections ----------------------------------------------------------- */
main section { padding: 48px 0; border-bottom: 1px solid var(--line); }
main section:last-child { border-bottom: 0; }

.product { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.product h3 { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75em; }
.product h3 img { border-radius: 9px; }
.note { color: var(--muted); margin-top: 1.5em; }

main section h3 { margin-top: 1.5em; }
.product h3 { margin-top: 0.5em; }
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }


/* ---- RotaFlux rota illustration ---------------------------------------- */
.rota-figure { margin: 0; }
.rota-figure figcaption { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.rota {
  background: #fffbf5; color: #3d2418;
  border: 1px solid #ecdfcc; border-radius: 14px;
  padding: 18px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.75rem;
}
.rota-top, .rota-foot { display: flex; justify-content: space-between; align-items: baseline; color: rgba(61, 36, 24, 0.7); }
.rota-top { margin-bottom: 14px; }
.rota-foot { margin-top: 14px; padding-top: 12px; border-top: 1px dashed rgba(61, 36, 24, 0.2); }
.rota-foot b { color: #3d2418; }
.rota-cost { font-family: Georgia, serif; font-weight: 900; font-size: 1.4rem; color: #3d2418; font-variant-numeric: tabular-nums; }
.rota-grid {
  display: grid; grid-template-columns: 48px repeat(7, 1fr); gap: 5px; align-items: center;
  text-align: center; color: rgba(61, 36, 24, 0.55);
}
.rota-grid .who { text-align: left; color: #3d2418; font-weight: 600; }
.rota-grid i { display: block; height: 22px; border-radius: 6px; background: rgba(61, 36, 24, 0.05); }
.rota-grid i.s1 { background: #f26b1d; }
.rota-grid i.s2 { background: #e9a23b; }
.rota-grid i.s3 { background: #7a4b32; }
.rota-grid i.s4 { background: #c4572a; }
.rota-grid i.s5 { background: #3d2418; }

.js .rota.is-waiting .s { opacity: 0; transform: scale(0.4); }
.rota.is-playing .s { animation: shift-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes shift-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 32px; font-size: 0.875rem; color: var(--muted); }
.site-footer p { margin: 0 0 0.5em; }

/* ---- Plain text pages (privacy, 404) ----------------------------------- */
.page { padding: 40px 0 56px; max-width: 44rem; }
.page h2 { margin-top: 1.75em; }
.page ul { padding-left: 1.25em; }
.page .updated { color: var(--muted); }

/* ---- Small screens ------------------------------------------------------ */
@media (max-width: 760px) {
  .hero { min-height: 0; align-items: flex-start; }
  .hero-inner { padding-top: 40px; padding-bottom: 280px; }
  .product { grid-template-columns: 1fr; gap: 24px; }
}
@media (max-width: 480px) {
  .rota { padding: 14px; }
  .rota-grid { grid-template-columns: 40px repeat(7, 1fr); gap: 4px; }
  .rota-grid i { height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .mark-y, .mark-dot { animation: none; }
  a, .site-header nav a::after { transition: none; }
}
