/*
  THESIS: the product page is the product. The reading-room world of the extension
  panel (ink-umber ground, parchment sheets, hairline rules, one brass accent,
  Literata catalog lettering) continues here, and every photograph on the page is
  behind the extension's filter until the visitor reveals it.
  RULES: one measure-bound text column; a filing card that controls the live demo;
  radii stay near-crisp (3px) — paper, not glass. No gradient cards, no glow, no
  equal-weight pills, no stock "landing page" hero gradient.
  SIGNATURE: the hero claim is proven three lines below it, by the page itself.
*/

@font-face {
  font-family: 'Literata';
  src: url('assets/font/literata-latin-var.woff2') format('woff2-variations');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --ground: #14110e;
  --ground-lift: #1a1713;
  --sheet: #201c17;
  --sheet-raised: #262019;
  --sheet-hover: #2d251c;
  --rule: #332c23;
  --rule-strong: #4a4032;

  --ink: #eee6d8;
  --ink-quiet: #b0a390;
  --ink-faint: #96897a;

  --brass: #cba463;
  --brass-quiet: #8d7240;
  --brass-wash: rgba(203, 164, 99, 0.13);

  --stamp: #c4705a;
  --stamp-wash: rgba(196, 112, 90, 0.12);

  --serif: 'Literata', 'Iowan Old Style', Palatino, Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  --measure: 34rem;
  --page: 46rem;
  --frame: 68rem; /* rail + gap + page */
  --radius: 3px;
  --focus: 0 0 0 2px var(--ground), 0 0 0 4px var(--brass);

  /* driven by demo.js */
  --demo-blur: 50px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }
/* thin scrollbars with a rule-strong thumb, matching the extension panel */
* { scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass-quiet); }

body {
  background:
    linear-gradient(180deg, var(--ground-lift) 0%, var(--ground) 640px) fixed,
    var(--ground);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 4rem;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('assets/paper-ink.jpg') center / cover;
  opacity: 0.16;
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

a { color: var(--ink); text-underline-offset: 3px; text-decoration-color: var(--brass-quiet); }
a:hover { text-decoration-color: var(--brass); }

/* unmistakable keyboard focus — outline stays independent of box-shadow */
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* selection picks up the brass wash, not the browser blue */
::selection { background: var(--brass-wash); color: var(--ink); }
::-moz-selection { background: var(--brass-wash); color: var(--ink); }

code, kbd, pre { font-family: var(--mono); }
code { font-size: 0.86em; color: var(--brass); }
kbd {
  font-size: 0.8em;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 1px 5px;
  color: var(--ink-quiet);
}

.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 1rem; top: 1rem; background: var(--sheet-raised); padding: 0.5rem 1rem; }

/* ---------- shared blocks ---------- */

.legend {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 400;
}

/* page frame: one body column, plus a rail column once there is room for it */
main {
  display: grid;
  justify-content: center;
  grid-template-columns: minmax(0, var(--page));
  column-gap: 3rem;
}

section, article { max-width: var(--page); width: 100%; margin: 0 auto; padding: 0 1.5rem; }

/* ---------- masthead ---------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--frame);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}

.masthead__mark { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.masthead__name { font-weight: 600; font-size: 1rem; }
.masthead__nav { display: flex; gap: 1.1rem; font-size: 0.82rem; color: var(--ink-quiet); }
.masthead__nav a { text-decoration: none; color: var(--ink-quiet); }
.masthead__nav a:hover { color: var(--ink); }

/* ---------- hero ---------- */

.hero { padding-top: 4.5rem; padding-bottom: 2.5rem; }

.hero__title {
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0.9rem 0 1.2rem;
}

.lede { font-size: 1.12rem; color: var(--ink-quiet); max-width: var(--measure); }
.hero__note { margin-top: 1.4rem; color: var(--ink-faint); font-size: 0.95rem; max-width: var(--measure); }
.hero__note strong { color: var(--ink); font-weight: 600; }

/* ---------- store buttons ---------- */

.install-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  margin-top: 2rem;
}

.store {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0.6rem 1rem;
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  text-decoration: none;
}
.store:hover { background: var(--sheet-hover); }
.store:active { transform: translateY(1px); background: var(--sheet-raised); }
.store__action {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--brass);
}
.store__browser { font-weight: 600; }
.store__state { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

.install-row--big .store { padding: 0.85rem 1.1rem; }

/* ---------- media plates: the real effect ---------- */

.plate { margin: 0; }
/* draw keyboard focus on the unfiltered figure, not the blurred img — the ring stays crisp */
.plate:focus-within { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: var(--radius); }
.plate img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  /* the pointer cursor is the only reveal affordance, exactly as in the extension */
  cursor: pointer;
}
/* the img's own outline is smeared by its blur filter; the plate carries the ring instead */
.plate img:focus-visible { outline: none; }
.plate figcaption { margin-top: 0.5rem; font-size: 0.82rem; color: var(--ink-faint); }

[data-media] {
  filter: blur(var(--demo-blur)) brightness(0.3);
  transition: filter 0.2s ease, transform 0.2s ease;
}
/* revealed/peek: crisp, slight lift — the extension's reveal feel */
[data-media][data-revealed] { filter: blur(0) brightness(1); transform: scale(1.01); }
[data-media][data-peek] { filter: blur(0) brightness(1) saturate(1.05); transform: scale(1.01); }

.strip { padding-top: 1rem; padding-bottom: 2.5rem; }
.strip__row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.9rem;
}
.strip__row .plate img { aspect-ratio: 4 / 3; object-fit: cover; }
.strip__foot { margin-top: 0.9rem; font-size: 0.85rem; color: var(--ink-faint); }

/* ---------- the control card ---------- */

.card {
  background: var(--sheet);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  max-width: 21rem;
  margin: 0 auto 3rem;
}
.card__logo {
  display: block;
  width: 100%;
  max-width: 11rem;
  height: auto;
  margin: 0 auto 1rem;
  pointer-events: none;
  user-select: none;
}
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--rule-strong);
}
.card__title { font-weight: 600; }
.card__foot { margin-top: 0.6rem; font-size: 0.78rem; color: var(--ink-faint); }

.state-line {
  display: flex; gap: 0.5rem; align-items: baseline;
  margin: 0.8rem 0 1rem; font-size: 0.98rem;
}
.state-line::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--brass); flex: none; translate: 0 -2px;
}
.card[data-paused] .state-line::before { background: var(--stamp); }
/* paused reads clearly: stamp-coloured left rule on the card, not colour alone */
.card[data-paused] { border-left: 2px solid var(--stamp); }

.field { margin-top: 1rem; }
.field__label {
  display: block;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.4rem;
}
.field__value { float: right; font-family: var(--mono); font-size: 0.8rem; color: var(--brass); }
.field__scale {
  display: flex; justify-content: space-between;
  font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px;
}

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule-strong); border-radius: var(--radius); }
.seg button {
  background: transparent; border: 0; border-right: 1px solid var(--rule);
  color: var(--ink-quiet); font-family: var(--serif); font-size: 0.85rem;
  padding: 0.5rem 0.15rem; cursor: pointer; white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--sheet-hover); color: var(--ink); }
.seg button:active { background: var(--sheet-raised); }
.seg button[aria-checked='true'] {
  background: var(--brass-wash); color: var(--ink); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brass);
}

.btn {
  background: var(--sheet-raised); color: var(--ink);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  font-family: var(--serif); font-size: 0.88rem; padding: 0.45rem 0.9rem; cursor: pointer;
}
.btn:hover { background: var(--sheet-hover); }
.btn:active { transform: translateY(1px); background: var(--sheet-raised); }
.btn--wide { display: block; width: 100%; margin-top: 1.1rem; padding: 0.6rem; }
.btn[aria-pressed='true'], .btn[data-held] {
  background: var(--stamp-wash); border-color: var(--stamp); color: var(--ink);
}

input[type='range'] { width: 100%; accent-color: var(--brass); }

@media (min-width: 1240px) {
  main { grid-template-columns: 19rem minmax(0, var(--page)); }
  main > :not(.rail) { grid-column: 2; }
  .rail {
    grid-column: 1;
    grid-row: 1 / -1;
    position: sticky;
    top: 5.5rem;
    align-self: start;
    width: 19rem;
    margin: 4.5rem 0 0;
  }
}

/* ---------- long form ---------- */

.prose { padding-top: 1rem; }
.prose > * { max-width: var(--measure); }
.prose h2 {
  font-size: 1.45rem; font-weight: 600; letter-spacing: -0.01em;
  margin: 3rem 0 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--rule);
}
.prose h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.5rem; }
.prose p { margin-bottom: 1rem; color: var(--ink-quiet); }
.prose p strong, .prose li strong { color: var(--ink); font-weight: 600; }
.prose em { color: var(--ink); font-style: italic; }

.aside {
  border-left: 2px solid var(--rule-strong);
  padding-left: 1rem;
  font-size: 0.92rem;
  color: var(--ink-faint) !important;
}

.ledger { list-style: none; margin-bottom: 1.2rem; }
.ledger li {
  padding: 0.6rem 0; border-bottom: 1px dotted var(--rule-strong); color: var(--ink-quiet);
}
.ledger--neg li::before { content: '\00B7'; color: var(--stamp); margin-right: 0.6rem; }

.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: none;
  margin: 1.5rem 0 2rem;
}
.mode {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.9rem; max-width: none;
}
.mode h3 { margin-bottom: 0.6rem; }
.mode p { font-size: 0.86rem; margin: 0.7rem 0 0; }
/* samples stay legible as blurred photographs at card size */
.plate--sm { --demo-blur: 20px; }
.plate--sm img { aspect-ratio: 16 / 10; object-fit: cover; }

.precedence { list-style: none; counter-reset: p; max-width: none; margin-bottom: 1.4rem; }
.precedence li {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1rem; align-items: baseline;
  padding: 0.7rem 0.9rem;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-strong);
  margin-bottom: 0.3rem;
}
.precedence li:first-child { border-left-color: var(--brass); }
.precedence__k { font-weight: 600; }
.precedence__v { color: var(--ink-faint); font-size: 0.9rem; }

.keys { border-collapse: collapse; width: 100%; margin-bottom: 1.2rem; }
.keys th {
  text-align: left; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint); font-weight: 400;
  padding-bottom: 0.4rem; border-bottom: 1px solid var(--rule-strong);
}
.keys td { padding: 0.55rem 0.25rem 0.55rem 0; border-bottom: 1px dotted var(--rule); color: var(--ink-quiet); }
.keys td:last-child, .keys th:last-child { text-align: right; padding-right: 0; }

/* ---------- video ---------- */

.watch { padding-top: 3.5rem; }
.video {
  position: relative; margin-top: 0.9rem;
  border: 1px solid var(--rule-strong); border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 10; background: var(--sheet);
}
.video img { width: 100%; height: 100%; object-fit: cover; object-position: top center; filter: brightness(0.5); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video__play {
  position: absolute; inset: 0; margin: auto; height: fit-content; width: fit-content;
  display: grid; justify-items: center; gap: 0.3rem;
  background: var(--sheet-raised); color: var(--ink);
  border: 1px solid var(--brass-quiet); border-radius: var(--radius);
  padding: 1rem 1.6rem; cursor: pointer; font-family: var(--serif); font-size: 1rem;
}
.video__play:hover { background: var(--sheet-hover); border-color: var(--brass); }
.video__play:active { transform: translateY(1px); }
.video__play small { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-faint); }

/* ---------- screenshots ---------- */

.shots { padding-top: 3.5rem; }
.shots__rail {
  display: flex; gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0.9rem 1.5rem 1.2rem;
}
.shots__rail figure { flex: 0 0 min(42rem, 82vw); scroll-snap-align: center; margin: 0; }
.shots__rail figure img {
  width: 100%; height: auto; border: 1px solid var(--rule-strong); border-radius: var(--radius);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
/* hover affordance: brass border and a small lift toward the viewer */
.shots__rail figure:hover img { border-color: var(--brass); transform: translateY(-2px); }
.shots__rail figcaption { margin-top: 0.5rem; font-size: 0.82rem; color: var(--ink-faint); }

/* ---------- install ---------- */

.install { padding-top: 3.5rem; }
.install__lede { color: var(--ink-quiet); max-width: var(--measure); margin-top: 0.8rem; }
.build { margin-top: 2.5rem; }
.build h3 { font-weight: 600; margin-bottom: 0.6rem; }
.build pre {
  background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.8rem; line-height: 1.7;
}
.build pre code { color: var(--ink-quiet); }
.build p { margin-top: 0.8rem; font-size: 0.9rem; color: var(--ink-faint); max-width: var(--measure); }

/* ---------- colophon ---------- */

.colophon {
  max-width: var(--frame); margin: 4.5rem auto 0; padding: 2rem 1.5rem 0;
  border-top: 1px solid var(--rule-strong);
}
.colophon__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; }
/* footer grid children are <section>, but they should not inherit the generic section padding/margin/max-width */
.colophon__grid > section { max-width: none; margin: 0; padding: 0; }
.colophon ul { list-style: none; margin-top: 0.7rem; }
.colophon li { padding: 0.25rem 0; font-size: 0.9rem; }
.colophon__note { margin-top: 0.7rem; font-size: 0.85rem; color: var(--ink-faint); }
.colophon__rule {
  margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-faint);
}

/* ---------- responsive ---------- */

/* mid screens: three-up grids get tight before the single-column collapse */
@media (max-width: 900px) {
  .strip__row, .modes { grid-template-columns: repeat(2, 1fr); }
  .colophon__grid { grid-template-columns: 1fr 1fr; }
}

/* narrow phones: everything stacks, nav keeps the two most useful links */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .strip__row, .modes, .colophon__grid { grid-template-columns: 1fr; }
  .masthead__nav { gap: 0.9rem; }
  .masthead__nav a:not(:first-child):not(:last-child) { display: none; }
  .precedence li { grid-template-columns: 1fr; gap: 0.2rem; }
  /* let keyboard chip rows wrap instead of clipping the last key */
  .keys td:last-child { white-space: normal; }
  .card__logo { max-width: 6rem; }
}

/* phones: install cards keep their 2x2 grid down to here, then stack */
@media (max-width: 560px) {
  .install-row { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-media],
  [data-media][data-revealed],
  [data-media][data-peek] { transition: none; transform: none; }
  .shots__rail figure img,
  .shots__rail figure:hover img { transition: none; transform: none; }
  .store:active, .btn:active, .video__play:active { transform: none; }
}
