/* Colors come only from colors.css (generated from the real palettes), so no hex values here. */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  font: 17px/1.6 var(--sans);
  color: var(--ui-fg);
  background:
    radial-gradient(60rem 36rem at 90% -8rem, color-mix(in oklab, var(--p-orange) 14%, transparent), transparent 70%),
    radial-gradient(50rem 32rem at -10% 18rem, color-mix(in oklab, var(--p-blue) 11%, transparent), transparent 70%),
    var(--p-mantle);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--ui-accent); text-underline-offset: 3px; }
code { font-family: var(--mono); font-size: 0.9em; }
::selection { background: var(--ui-bg-visual); }
/* Switcher buttons and cards carry their own data-style, so pin the ring to the page's accent. */
html { --focus: var(--ui-accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button { font: inherit; color: inherit; cursor: pointer; }

@media (prefers-reduced-motion: no-preference) {
  *, *::before, *::after { transition: background-color 0.35s, color 0.35s, border-color 0.35s; }
}

.wrap { width: min(1160px, 100% - 2.5rem); margin-inline: auto; }
.dim { color: var(--ui-fg-dim); }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 0;
  backdrop-filter: blur(12px);
  background: color-mix(in oklab, var(--p-mantle) 82%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--ui-border) 60%, transparent);
  padding-inline: max(1.25rem, (100% - 1160px) / 2);
}
.brand { display: flex; align-items: center; gap: 0.6rem; font: 600 1.15rem var(--serif); color: var(--ui-fg); text-decoration: none; }
.brand img { border-radius: 7px; }
.nav nav { display: flex; gap: 1.6rem; font-size: 0.95rem; }
.nav nav a { color: var(--ui-fg-dim); text-decoration: none; }
.nav nav a:hover { color: var(--ui-fg); }
.nav .gh { color: var(--ui-fg); }

/* type */
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; color: var(--ui-fg); }
h1 { font-size: clamp(2.3rem, 4.6vw, 3.2rem); line-height: 1.06; margin: 0.4rem 0 1.2rem; }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); line-height: 1.15; margin: 0.2rem 0 0.8rem; }
.accent { color: var(--p-orange); }
/* fg-dim, not the comment color: comments sit under 4.5:1 on mantle in morning */
.eyebrow { font: italic 0.95rem var(--mono); color: var(--ui-fg-dim); margin: 0; }
.hero .eyebrow { font-style: normal; color: var(--p-orange); letter-spacing: 0.02em; }
.lede { font-size: 1.15rem; color: var(--ui-fg-dim); max-width: 34rem; margin: 0 0 2rem; }
.sub { color: var(--ui-fg-dim); max-width: 44rem; margin: 0 0 2.2rem; }

/* hero */
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 3.5rem; align-items: center;
  padding: clamp(2rem, 6vw, 5rem) 0 2rem;
}
@media (min-width: 1000px) { .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* the siphon still life from the social preview (scripts/social_scene.py) */
.photo {
  width: 100%; aspect-ratio: 11 / 10; object-fit: cover; object-position: 50% 60%;
  /* dark styles: fade the edges so the scene sinks into the page */
  -webkit-mask-image: linear-gradient(to right, transparent, black 32%, black 68%, transparent), linear-gradient(to bottom, transparent, black 28%, black 70%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, black 32%, black 68%, transparent), linear-gradient(to bottom, transparent, black 28%, black 70%, transparent);
  mask-composite: intersect;
}
/* a night scene can't fade into a light page, so morning shows it as a framed print */
[data-style="morning"] .photo {
  -webkit-mask-image: none; mask-image: none;
  border-radius: var(--radius); border: 1px solid var(--ui-border);
  box-shadow: 0 30px 70px -35px color-mix(in oklab, var(--p-crust) 90%, transparent);
}
@media (max-width: 999px) { .photo { order: -1; aspect-ratio: 16 / 10; } }

.demo { display: grid; justify-items: center; gap: 0.9rem; padding-bottom: 2rem; }
.demo .editor { width: min(900px, 100%); margin-top: 0.6rem; }
.demo .hint { margin: 0; }

.cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2.2rem; }
.btn {
  display: inline-block; padding: 0.75rem 1.4rem; border-radius: 999px;
  border: 1px solid var(--ui-border); color: var(--ui-fg); text-decoration: none; font-weight: 600;
}
.btn:hover { border-color: var(--ui-accent); }
.btn.primary { background: var(--ui-accent); border-color: var(--ui-accent); color: var(--ui-on-badge); }
.btn.primary:hover { filter: brightness(1.08); }

.switcher, .hint, .tablist, .copy { display: none; }
.js .switcher { display: inline-flex; }
.js .hint { display: block; }
.js .tablist { display: flex; }
.js .copy { display: block; }

.switcher {
  flex-wrap: wrap; justify-content: center; gap: 4px; padding: 4px;
  border: 1px solid var(--ui-border); border-radius: 12px; background: var(--p-crust);
}
.switcher button {
  border: 0; border-radius: 9px; padding: 0.45rem 0.85rem;
  font: 0.85rem var(--mono); background: var(--ui-bg); color: var(--ui-fg);
}
.switcher button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--ui-accent); }
.hint { font-size: 0.85rem; color: var(--ui-fg-dim); margin: 0.6rem 0 0; }

/* editor mock */
.editor {
  border-radius: var(--radius); overflow: hidden;
  background: var(--ui-bg); border: 1px solid var(--ui-border);
  box-shadow: 0 30px 80px -30px color-mix(in oklab, var(--p-crust) 85%, transparent), 0 0 0 1px color-mix(in oklab, var(--p-crust) 40%, transparent);
  min-width: 0;
}
.titlebar { display: flex; align-items: center; gap: 0.25rem; padding: 0.55rem 0.9rem; background: var(--p-crust); font: 0.8rem var(--mono); }
.dots { display: flex; gap: 7px; margin-right: 1rem; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--p-red); }
.dots i:nth-child(2) { background: var(--p-yellow); }
.dots i:nth-child(3) { background: var(--p-green); }
.tab { padding: 0.25rem 0.8rem; border-radius: 6px; color: var(--ui-fg-dim); }
.tab.active { background: var(--ui-bg); color: var(--ui-fg); }

pre { margin: 0; overflow-x: auto; font: 13.5px/1.65 var(--mono); }
.editor pre { padding: 0.9rem 0; counter-reset: line; }
/* grid drops the whitespace-only text between lines, so the source newlines do not double up */
/* max-content so the cursorline spans the full line when the code scrolls sideways */
.editor code { display: grid; width: max-content; min-width: 100%; }
.line { display: block; position: relative; padding: 0 1.2rem 0 4.4rem; min-height: 1.65em; white-space: pre; }
.line::before {
  counter-increment: line; content: counter(line);
  position: absolute; left: 0; width: 2.6rem; text-align: right; color: var(--ui-fg-gutter);
}
.line.cur { background: var(--ui-bg-cursorline); }
.line.cur::before { color: var(--ui-fg-gutter-cur); }
.line.add::after, .line.chg::after { content: ""; position: absolute; left: 3.2rem; top: 0.15em; bottom: 0.15em; width: 3px; border-radius: 2px; background: var(--git-add); }
.line.chg::after { background: var(--git-change); }
.cursor { background: var(--ui-fg); color: var(--ui-bg); }
@media (prefers-reduced-motion: no-preference) {
  .cursor { animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { background: transparent; color: var(--syn-punct); } }
}

.statusline { display: flex; align-items: center; font: 0.78rem var(--mono); background: var(--ui-bg-statusline); color: var(--ui-fg-dim); }
.statusline .mode { padding: 0.3rem 0.8rem; background: var(--ui-accent); color: var(--ui-on-badge); font-weight: 700; }
.statusline .seg { padding: 0.3rem 0.8rem; }
.statusline .file { color: var(--ui-fg); }
.statusline .spacer { flex: 1; }
.statusline .pos { background: var(--p-surface1); color: var(--ui-fg); }

/* syntax: one class per kissaten role */
.c { color: var(--syn-comment); font-style: italic; }
.kd { color: var(--syn-keyword); }
.kw { color: var(--syn-keyword); font-style: italic; }
.fn { color: var(--syn-func); }
.fb { color: var(--syn-func-builtin); }
.s { color: var(--syn-string); }
.e { color: var(--syn-escape); }
.n { color: var(--syn-number); }
.b { color: var(--syn-boolean); }
.k { color: var(--syn-constant); }
.t { color: var(--syn-type); }
.pa { color: var(--syn-parameter); }
.pr { color: var(--syn-property); }
.m { color: var(--syn-module); }
.op { color: var(--syn-operator); }
.pu { color: var(--syn-punct); }
.v { color: var(--syn-variable); }

/* sections */
section[id] { padding: 4.5rem 0; }

.shot { margin: 0 0 1.5rem; }
.shot img { border-radius: var(--radius); border: 1px solid var(--ui-border); box-shadow: 0 30px 70px -35px color-mix(in oklab, var(--p-crust) 90%, transparent); }
.shot figcaption { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: baseline; margin-top: 0.9rem; color: var(--ui-fg-dim); }
.shot figcaption code { color: var(--ui-fg); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; }
.card {
  display: flex; flex-direction: column; gap: 0.35rem; text-align: left;
  padding: 1rem 1.1rem 1.1rem; border-radius: 12px;
  background: var(--ui-bg); color: var(--ui-fg); border: 1px solid var(--ui-border);
}
.card:hover { transform: translateY(-2px); }
.card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ui-accent); border-color: transparent; }
.card code { font-size: 0.8rem; margin: 0.4rem 0 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card strong { font: 600 1rem var(--mono); }
.card .desc { font-size: 0.85rem; color: var(--ui-fg-dim); }
.swatches { display: flex; gap: 5px; }
.swatches i { width: 14px; height: 14px; border-radius: 50%; background: var(--p-red); }
.swatches i:nth-child(2) { background: var(--p-orange); }
.swatches i:nth-child(3) { background: var(--p-yellow); }
.swatches i:nth-child(4) { background: var(--p-green); }
.swatches i:nth-child(5) { background: var(--p-blue); }
.swatches i:nth-child(6) { background: var(--p-purple); }

/* why */
.why { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3rem; align-items: start; }
@media (min-width: 960px) { .why { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.05rem; }
.reasons li { position: relative; padding-left: 1.6rem; color: var(--ui-fg-dim); }
.reasons li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 9px; height: 9px; border-radius: 50%; background: var(--p-red); }
.reasons li:nth-child(2)::before { background: var(--p-orange); }
.reasons li:nth-child(3)::before { background: var(--p-yellow); }
.reasons li:nth-child(4)::before { background: var(--p-green); }
.reasons li:nth-child(5)::before { background: var(--p-teal); }
.reasons li:nth-child(6)::before { background: var(--p-blue); }
.reasons li:nth-child(7)::before { background: var(--p-purple); }
.reasons strong { color: var(--ui-fg); }

.contrast { margin: 0; padding: 1.5rem; border-radius: var(--radius); background: var(--ui-bg); border: 1px solid var(--ui-border); }
.contrast figcaption { font-weight: 600; margin-bottom: 0.4rem; }
.bars { position: relative; display: grid; gap: 0.7rem; padding-top: 1.8rem; font: 0.85rem var(--mono); }
.bar { position: relative; display: flex; justify-content: space-between; align-items: center; height: 2.4rem; padding: 0 0.8rem; border-radius: 8px; background: var(--p-surface0); }
.bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--r) / 8 * 100%); border-radius: 8px; background: var(--p-surface2); }
.bar.best::before { background: color-mix(in oklab, var(--p-green) 40%, var(--p-surface0)); }
.bar span { position: relative; }
.bar .val { font-weight: 700; }
.aa { position: absolute; top: 0; bottom: -0.3rem; left: calc(4.5 / 8 * 100%); border-left: 2px dashed var(--diag-warn); padding-left: 0.4rem; font-size: 0.75rem; color: var(--diag-warn); line-height: 1.2; }
.note { font-size: 0.82rem; color: var(--ui-fg-dim); margin: 1rem 0 0; }

/* features */
.features { list-style: none; margin: 0 0 3rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.9rem; }
.features li { padding: 1rem 1.15rem; border-radius: 12px; background: var(--ui-bg); border: 1px solid var(--ui-border); color: var(--ui-fg-dim); font-size: 0.92rem; }
.features strong { display: block; color: var(--ui-fg); font-size: 1rem; margin-bottom: 0.2rem; }

.tools-label { font: italic 0.95rem var(--mono); color: var(--ui-fg-dim); margin: 0 0 0.8rem; }
.tools { list-style: none; margin: 0 0 3rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tools li { padding: 0.3rem 0.85rem; border-radius: 999px; border: 1px solid var(--ui-border); font: 0.85rem var(--mono); color: var(--ui-fg-dim); }

.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.gallery figure { margin: 0; }
.gallery img { border-radius: 10px; border: 1px solid var(--ui-border); }
.gallery figcaption { font-size: 0.85rem; color: var(--ui-fg-dim); margin-top: 0.5rem; }
.zoom { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: 10px; cursor: zoom-in; }
.zoom:hover img { border-color: var(--ui-accent); }
#lightbox { max-width: none; max-height: none; padding: 0; border: 0; background: none; color: var(--ui-fg); cursor: zoom-out; }
#lightbox::backdrop { background: color-mix(in oklab, var(--p-crust) 85%, transparent); }
/* contain keeps the aspect ratio while filling 80% of whichever viewport side runs out first */
#lightbox img { width: 80vw; height: 80vh; object-fit: contain; }
#lightbox p { margin: 0.6rem 0 0; text-align: center; font-size: 0.9rem; }
html:has(#lightbox[open]) { overflow: hidden; }

/* try it */
.install { max-width: 52rem; }
.tablist { gap: 0.4rem; margin-bottom: 0.7rem; }
.tablist button { border: 1px solid var(--ui-border); background: transparent; border-radius: 999px; padding: 0.4rem 1rem; font: 0.85rem var(--mono); color: var(--ui-fg-dim); }
.tablist button[aria-selected="true"] { background: var(--ui-accent); border-color: var(--ui-accent); color: var(--ui-on-badge); }
.panel { position: relative; margin-bottom: 0.8rem; border-radius: var(--radius); background: var(--ui-bg); border: 1px solid var(--ui-border); }
.panel pre { padding: 1.2rem 1.4rem; }
.copy { position: absolute; top: 0.7rem; right: 0.7rem; padding: 0.3rem 0.75rem; border-radius: 8px; border: 1px solid var(--ui-border); background: var(--p-surface0); font: 0.78rem var(--mono); }
.copy:hover { border-color: var(--ui-accent); }
.star { color: var(--ui-fg-dim); margin-top: 2rem; }

footer { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; justify-content: space-between; padding: 2rem 0 3rem; border-top: 1px solid var(--ui-border); font-size: 0.88rem; color: var(--ui-fg-dim); }

@media (max-width: 680px) {
  body { font-size: 16px; }
  .nav nav a:not(.gh):not([href="#try"]) { display: none; }
  .line { padding-left: 3.4rem; }
  .line::before { width: 2rem; }
  .line.add::after, .line.chg::after { left: 2.5rem; }
  pre { font-size: 12.5px; }
  .panel pre { padding-top: 3rem; }
}
