/*
  Pebbleback marketing site.
  The home page is laid out as a Trail: one vertical line with a time and a
  pebble per event, the same record the extension keeps. Tokens derive from
  the extension's brand assets (assets/pebbleback-logo.svg, -mark.svg): pebble
  green carries the brand, clay marks checkpoints and "now". Contrast pairs
  meet WCAG 2.1 AA in both schemes.
*/

@font-face {
  font-family: "Bricolage";
  src: url("./assets/BricolageGrotesque-Variable.ttf") format("truetype");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("./assets/Newsreader-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("./assets/Newsreader-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("./assets/Newsreader-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("./assets/Newsreader-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./assets/JetBrainsMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("./assets/JetBrainsMono-Medium.woff2") format("woff2");
  font-weight: 500 600;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* stone ground, tinted toward the brand's green hue */
  --paper: oklch(92.3% 0.008 135);
  --surface: oklch(96.6% 0.006 125);
  --raised: oklch(98.8% 0.004 120);
  --ink: oklch(22.2% 0.012 145);
  --muted: oklch(40% 0.016 145);
  --line: oklch(83% 0.014 138);

  /* pebble green, sampled from the mark */
  --pebble: oklch(43.8% 0.0935 143.4);
  --pebble-deep: oklch(30% 0.075 143);
  --pebble-soft: oklch(88.5% 0.022 139);

  /* clay, the second pebble colour in the mark; -text is the AA text tone */
  --clay: oklch(58% 0.1359 40.2);
  --clay-text: oklch(44% 0.125 40);

  --on-dark: oklch(98.5% 0.0054 95.1);

  --serif: "Newsreader", Georgia, serif;
  --sans: "Bricolage", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;

  --max: 1120px;
  --ease-out-expo: cubic-bezier(.16, 1, .3, 1);
  --ease-out-quart: cubic-bezier(.25, 1, .5, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: oklch(15% 0.008 145);
    --surface: oklch(19% 0.009 145);
    --raised: oklch(22.5% 0.01 145);
    --ink: oklch(90% 0.014 142);
    --muted: oklch(71% 0.018 142);
    --line: oklch(31% 0.012 145);

    --pebble: oklch(77% 0.1042 141);
    --pebble-deep: oklch(84% 0.08 141);
    --pebble-soft: oklch(24% 0.03 141);

    --clay: oklch(70.7% 0.1091 45);
    --clay-text: oklch(78% 0.09 45);

    --on-dark: oklch(15% 0.008 145);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; scroll-padding-top: 24px; }
body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
img { display: block; max-width: 100%; }
button, input, textarea, pre, code { font: inherit; }
pre, code { font-family: var(--mono); }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 4px; }
.wrap { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; }
.eyebrow {
  margin: 0 0 18px;
  color: var(--pebble);
  font: 600 12px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
h1, h2, h3 { margin: 0; font-family: var(--sans); line-height: 1.1; letter-spacing: -.02em; font-weight: 620; }
p { text-wrap: pretty; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  z-index: 100;
  top: -48px;
  left: 12px;
  padding: 12px 16px;
  background: var(--pebble);
  color: var(--on-dark);
  text-decoration: none;
  font: 13px var(--mono);
  transition: top 160ms var(--ease-out-quart);
}
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.02em;
  color: var(--ink);
}
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  color: var(--muted);
  font: 15px var(--sans);
  text-decoration: none;
}
.nav-links a:hover { color: var(--ink); }
.nav-links .cloudzzy { color: var(--clay-text); }

/* ---------- shared pieces ---------- */
.lead {
  max-width: 58ch;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 1.65vw, 21px);
}
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin-top: 32px; }
.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  color: var(--ink);
  text-decoration: none;
  font: 600 16px var(--sans);
  transition: transform 180ms var(--ease-out-quart), background-color 180ms var(--ease-out-quart), color 180ms var(--ease-out-quart);
}
.button svg { fill: currentColor; }
.button:hover { transform: translateY(-2px); }
.button.primary { border-color: var(--pebble); background: var(--pebble); color: var(--on-dark); }
.button.primary:hover { background: var(--pebble-deep); border-color: var(--pebble-deep); }
.button.ghost:hover { background: var(--ink); color: var(--paper); }
.quiet-link { color: var(--muted); font-size: 17px; }
.quiet-link:hover { color: var(--ink); }

/* ---------- the Trail ---------- */
.trail { --time-w: 124px; --rail-w: 44px; --rail-x: calc(var(--time-w) + var(--rail-w) / 2 - 1px); }

.ev {
  position: relative;
  display: grid;
  grid-template-columns: var(--time-w) var(--rail-w) minmax(0, 1fr);
}
/* the line: a resting segment per event, and a laid segment drawn over it */
.ev::before,
.ev::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--rail-x);
  width: 2px;
  background: var(--line);
}
.ev::after {
  background: var(--pebble);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .7s var(--ease-out-quart);
}
.ev.is-passed::after { transform: scaleY(1); }
.ev-hero::before { width: 0; background: none; border-left: 2px dashed var(--line); }
.ev-hero::after { content: none; }
.ev-now::before, .ev-now::after { bottom: auto; height: 14px; }

.ev-mark {
  position: relative;
  z-index: 1;
  grid-column: 1 / 3;
  align-self: start;
  display: grid;
  grid-template-columns: var(--time-w) var(--rail-w);
  margin: 0;
  color: var(--ink);
  text-decoration: none;
}
.ev-time {
  min-height: 44px;
  padding: 4px 16px 0 0;
  text-align: right;
  font: 12.5px/1.5 var(--mono);
  transition: color 200ms var(--ease-out-quart), opacity 450ms var(--ease-out-quart);
}
.ev-kind { display: block; color: var(--muted); }
.ev-checkpoint .ev-kind { color: var(--clay-text); }
a.ev-mark:hover .ev-time { color: var(--pebble-deep); }
.ev-peb { display: flex; justify-content: center; align-items: flex-start; padding-top: 6px; }

.pebble {
  --peb: var(--pebble);
  --peb-fill: var(--peb);
  display: block;
  width: var(--w);
  height: var(--h);
  margin-top: calc(8px - var(--h) / 2);
  border: 2px solid var(--peb);
  border-radius: 50%;
  background: var(--peb-fill);
  box-shadow: 0 0 0 5px var(--paper);
  transform: rotate(var(--r));
  transition: transform 300ms var(--ease-out-expo), background-color 450ms var(--ease-out-quart), border-color 450ms var(--ease-out-quart), box-shadow 450ms var(--ease-out-quart);
}
.pebble-clay { --peb: var(--clay); }
.pebble-gap { --peb: var(--muted); --peb-fill: var(--paper); }
a.ev-mark:hover .pebble { transform: rotate(var(--r)) scale(1.28); }
a.ev-mark:active .pebble { transform: rotate(var(--r)) scale(.92); }
a.ev-mark:focus-visible { outline: none; }
a.ev-mark:focus-visible .ev-time { outline: 3px solid var(--clay); outline-offset: 2px; }
.ev.is-current .pebble { box-shadow: 0 0 0 5px var(--paper), 0 0 0 7px var(--clay); }

.ev-body {
  grid-column: 3;
  min-width: 0;
  padding: 0 0 84px 24px;
  transition: opacity 600ms var(--ease-out-quart), transform 600ms var(--ease-out-quart);
}
.ev-hero .ev-body { padding-top: 60px; padding-bottom: 88px; }
.ev-hero .ev-time { padding-top: 70px; color: var(--muted); }
.ev-hero .ev-kind { color: inherit; }
.ev-now .ev-body, .ev:nth-last-child(2) .ev-body { padding-bottom: 96px; }
.ev-now .ev-time { padding-top: 10px; }
.ev-now .ev-peb { padding-top: 10px; }
.ev-split { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 56px; align-items: start; }

/* not yet laid (script only), and events after the point you stand at */
.js .ev[data-ev]:not(.is-laid) .ev-body { opacity: .18; transform: translateY(10px); }
.js .ev[data-ev]:not(.is-laid) .pebble,
.ev.is-after .pebble { background: var(--paper); border-color: var(--line); }
.ev.is-after .ev-body { opacity: .28; }
.ev.is-after .ev-time { opacity: .55; }
.js-only { display: none; }
.js .js-only { display: inline; }

.ev-hero h1 {
  max-width: 15ch;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(42px, 5.7vw, 72px);
  line-height: 1;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.ev-hero h1 em { color: var(--pebble); }
.hero-note { margin: 18px 0 0; color: var(--muted); font-size: 15.5px; }

.ev-body h2 { max-width: 26ch; font-size: clamp(22px, 2.1vw, 27px); line-height: 1.12; }
.ev-text { max-width: 60ch; margin: 12px 0 0; color: var(--muted); }
.ev-body .now-title {
  max-width: 20ch;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 3.6vw, 46px);
  line-height: 1.04;
  text-wrap: balance;
}
.ev-now .lead { margin-top: 18px; font-size: clamp(17.5px, 1.5vw, 19px); max-width: 60ch; }

/* evidence panels */
.panel { border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }
.panel-note { margin: 0; padding: 14px 18px 16px; color: var(--muted); font-size: 15.5px; }
.panel-after { margin: 14px 0 0; color: var(--muted); font-size: 15.5px; }

.sr-radio { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.tab-list { margin: 0; padding: 0; border: 0; min-width: 0; }
.tabrow {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 180ms var(--ease-out-quart);
}
.tabrow:hover { background: var(--raised); }
.tabrow:has(:focus-visible) { outline: 3px solid var(--clay); outline-offset: -3px; }
.tabrow:has(:checked) { box-shadow: inset 3px 0 0 var(--pebble); }
.tab-num, .tab-host, .tab-tags, .row-host, .mark, .manifest-key, .manifest-state, .note figcaption { font: 12px var(--mono); }
.tab-num, .tab-host, .row-host { color: var(--muted); }
.tab-host, .row-host { display: block; margin-top: 2px; }
.tab-tags { display: flex; gap: 8px; }
.tag-pinned { color: var(--clay-text); }
.tag-active { color: var(--pebble-deep); visibility: hidden; }
.tabrow:has(:checked) .tag-active { visibility: visible; }

.facts { display: grid; margin: 4px 0 0; border-top: 1px solid var(--line); }
.facts div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.facts dt { font: 600 16px var(--sans); }
.facts dd { margin: 0; color: var(--muted); }

.note { margin: 4px 0 0; padding: 0 0 0 26px; border-left: 2px solid var(--clay); }
.note blockquote { max-width: 18ch; margin: 0; font-style: italic; font-size: clamp(24px, 2.4vw, 30px); line-height: 1.18; letter-spacing: -.01em; }
.note figcaption { margin-top: 16px; color: var(--muted); }

/* switches: compare views and Context Pack formats (radio-driven, no script) */
.switch-track { display: flex; flex-wrap: wrap; gap: 4px 22px; border-bottom: 1px solid var(--line); }
.switch-label {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: -1px;
  padding: 0 2px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font: 600 15px var(--sans);
  transition: color 160ms var(--ease-out-quart), border-color 160ms var(--ease-out-quart);
}
.switch-label:hover { color: var(--ink); }
.switch-label:has(:checked) { color: var(--ink); border-color: var(--pebble); }
.switch-label:has(:focus-visible) { outline: 3px solid var(--clay); outline-offset: 2px; }

.compare { min-height: 330px; }
.diff-rows { display: none; list-style: none; margin: 0; padding: 0; }
.diff-rows li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.mark { padding-top: 4px; color: var(--muted); }
.mark-open { color: var(--pebble-deep); }
.mark-gone { color: var(--clay-text); }
.compare:has(#compare-changes:checked) #compare-panel-changes,
.compare:has(#compare-uncertain:checked) #compare-panel-uncertain { display: grid; }

.pack-switch { margin-top: 26px; }
.format-track { gap: 4px 24px; padding: 0 22px; }
.format-label { min-height: 46px; font: 12.5px var(--mono); }
.format-panels { min-height: 290px; }
.format-panel {
  display: none;
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.65;
}
.pack-switch:has(#format-1:checked) #format-panel-1,
.pack-switch:has(#format-2:checked) #format-panel-2,
.pack-switch:has(#format-3:checked) #format-panel-3,
.pack-switch:has(#format-4:checked) #format-panel-4,
.pack-switch:has(#format-5:checked) #format-panel-5 { display: block; }

/* without :has() nothing can switch, so show every view */
@supports not selector(:has(*)) {
  .diff-rows { display: grid; }
  .format-panel { display: block; border-bottom: 1px solid var(--line); }
  .tag-active { visibility: visible; }
}

.manifest-list { list-style: none; margin: 4px 0 0; padding: 0; border-top: 2px solid var(--ink); }
.manifest-list li {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.manifest-key { color: var(--muted); }
.manifest-state { color: var(--pebble-deep); }
.manifest-not { color: var(--muted); }
.manifest-not .manifest-state { color: var(--clay-text); }

/* shown while you stand at a point in the Trail */
.stand-bar {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(100% - 32px);
  padding: 6px 8px 6px 18px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--raised);
  font: 12.5px var(--mono);
  box-shadow: 0 14px 36px oklch(20% 0.02 143 / .18);
}
.stand-bar[hidden] { display: none; }
.stand-bar button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  font: 600 14px var(--sans);
}

/* ---------- page intro / content pages ---------- */
.page-intro { padding: clamp(60px, 8vw, 100px) 0 56px; border-bottom: 1px solid var(--line); background: var(--paper); }
.page-intro h1 { max-width: 15ch; font-family: var(--serif); font-weight: 500; font-size: clamp(40px, 5.7vw, 72px); line-height: 1; letter-spacing: -.025em; text-wrap: balance; }
.page-intro .eyebrow { margin-bottom: 26px; }
.page-intro p:not(.eyebrow) { max-width: 62ch; margin: 22px 0 0; color: var(--muted); font-size: 18px; }
.content {
  width: min(calc(100% - 40px), 780px);
  margin: 0 auto;
  padding: 64px 0 100px;
  background: var(--paper);
}
.content h2 { margin: 46px 0 12px; font-size: 25px; }
.content h2:first-child { margin-top: 0; }
.content p, .content li { color: var(--muted); }
.content strong { color: var(--ink); }
.content a { color: var(--pebble-deep); }
.content ul, .content ol { padding-left: 22px; }
.content code {
  padding: 2px 6px;
  background: var(--pebble-soft);
  color: var(--pebble-deep);
  font-size: 14px;
  border-radius: 3px;
}
.contact-box { margin: 32px 0; padding: 26px; border: 1px solid var(--line); background: var(--surface); }
.contact-box a { font: 16px var(--mono); }
.notice { margin: 22px 0; padding: 18px 20px; border: 1px solid var(--line); background: var(--pebble-soft); color: var(--pebble-deep); }

.permissions-table { width: 100%; margin: 18px 0 32px; border-collapse: collapse; font-size: 15px; }
.permissions-table th, .permissions-table td { padding: 13px 15px; text-align: left; vertical-align: top; border: 1px solid var(--line); }
.permissions-table thead th { background: var(--surface); color: var(--ink); font: 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.permissions-table td:first-child { font: 14px var(--mono); color: var(--pebble-deep); white-space: nowrap; }
.permissions-table td:nth-child(2) { color: var(--ink); font-weight: 600; white-space: nowrap; }

/* ---------- footer ---------- */
.site-footer { padding: 28px 0 44px; border-top: 1px solid var(--line); background: var(--paper); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; }
.footer-row, .footer-row a { color: var(--muted); font: 12px var(--mono); }
.footer-links { display: flex; flex-wrap: wrap; gap: 20px; }
.footer-links a:hover { color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .ev-split { grid-template-columns: 1fr; gap: 28px; }
  .compare, .format-panels { min-height: 0; }
}

@media (max-width: 780px) {
  .wrap { width: min(calc(100% - 32px), var(--max)); }
  .nav-links a:not(.cloudzzy) { display: none; }

  /* the time moves above each event; the rail hugs the left edge */
  .trail { --time-w: 0px; --rail-w: 34px; --rail-x: 16px; }
  .ev { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .ev-mark { grid-column: 1 / 3; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .ev-peb { order: -1; }
  .ev-time { display: flex; gap: 10px; align-items: baseline; padding: 4px 0 0 10px; text-align: left; }
  .ev-kind { display: inline; }
  /* the mark keeps its 44px target; the body tucks up under it */
  .ev-body { grid-column: 2; margin-top: -10px; padding: 0 0 64px 10px; }
  .ev-hero .ev-body { padding-top: 8px; padding-bottom: 64px; }
  .ev-hero .ev-time { padding-top: 36px; }
  .ev-now .ev-body, .ev:nth-last-child(2) .ev-body { padding-bottom: 72px; }
  .ev-now .ev-time, .ev-now .ev-peb { padding-top: 6px; }

  .facts div { grid-template-columns: 1fr; gap: 3px; }
  .manifest-list li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .manifest-key { grid-column: 1 / -1; }
  .format-track { padding: 0 14px; gap: 0 18px; }
  .format-panel { padding: 18px 14px; font-size: 12.5px; }
  .permissions-table { display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
  .tabrow { grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; padding: 13px 14px; }
  .tab-tags { flex-direction: column; align-items: flex-end; gap: 2px; }
  .diff-rows li { grid-template-columns: 1fr; gap: 2px; }
  .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .ev[data-ev]:not(.is-laid) .ev-body { transform: none; }
}
