/* ============================================================================
   ARVO — the website (landing + documentation)

   A faithful copy of cognition.com, measured from the live site:
   - a 1312px frame, centred; hairline rules (6% black) at its left edge, +262,
     +962 and +1224, with 8px tick marks (56% grey) at the top of each, plus
     short rules at +350 and +1050 above the first section
   - #f7f6f5 page, #edeceb panels, cards outlined in 6% black
   - headings in a neutral grotesk (36px hero, 20px sections), reading text in a
     serif at 16/24, 10px serif section numbers in a gutter column
   - square buttons (15px, padding 0 10px 1px): #191919 filled and 1px outlined
   Geist and Source Serif 4 stand in for NB International and STK Bureau Serif.

   What makes it Arvo's rather than Cognition's comes from the Rationality site
   (~/dev/rationality): its liquid-chrome and toxic-green shader (/arvo/chrome.js)
   as the backdrop of the phone panel and as the covers in the card row, and its
   green in place of Cognition's blue and orange: a deep green for the current
   link and inline actions, the toxic green for data bars and button hovers.
   ========================================================================== */

:root {
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;

  --bg: #f7f6f5;
  --panel: #edeceb;
  --ink: #000;
  --ink-2: rgba(25, 25, 25, 0.56);
  --rule: rgba(0, 0, 0, 0.06);
  --tick: rgba(25, 25, 25, 0.56);
  --accent: #2b7a0b;   /* deep green, readable on the page */
  --green: #86f520;    /* Rationality's toxic green */
  --track: rgba(0, 0, 0, 0.05);

  --frame: 1312px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 40px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/24px var(--serif);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--sans); font-weight: 400; }

/* ---------------------------------------------------------------- the frame and its rules */
.frame { width: var(--frame); margin: 0 auto; position: relative; }
.rules { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.rules .frame { height: 100%; }
.rules i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.rules i.short { bottom: auto; height: 160px; }
.rules i:nth-child(1) { left: 0; }
.rules i:nth-child(2) { left: 262px; }
.rules i:nth-child(3) { left: 350px; }
.rules i:nth-child(4) { display: none; }
.rules i:nth-child(5) { left: 1050px; }
.rules i:nth-child(6) { left: 1224px; }

.site { position: relative; }
.page { position: relative; z-index: 1; display: grid; grid-template-columns: 262px 88px 700px 174px; }

/* ---------------------------------------------------------------- sidebar */
.side { grid-row: 1 / span 30; }
.side-in { position: sticky; top: 0; padding-top: 148px; }
.mark { display: block; width: 20px; }
.mark img { width: 20px; height: 20px; filter: grayscale(1) contrast(1.6) brightness(.55); }
.side nav { margin-top: 20px; display: grid; font: 400 15px/21.5px var(--sans); }
.side nav a { position: relative; width: fit-content; }
.side nav a:hover { color: var(--accent); }
.side nav a[aria-current] { color: var(--ink); }
.side nav a[aria-current]::before { content: ""; position: absolute; left: -13px; top: 7px; width: 6px; height: 6px; background: var(--green); box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.side nav .sub { padding-left: 12px; font-size: 13px; line-height: 19.5px; color: var(--ink-2); }
.side nav .sub:hover { color: var(--accent); }
.side nav .sub[aria-current] { color: var(--accent); }
.side nav .sub[aria-current]::before { left: 0; top: 7px; width: 5px; height: 5px; }
.side nav .gap { height: 10px; }
.box { display: inline-block; margin-top: 18px; padding: 0 10px 1px; background: #191919; color: var(--bg); font: 400 14px/28px var(--sans); }
.box:hover { background: var(--green); color: #000; }

/* ---------------------------------------------------------------- sections */
.sec { grid-column: 2 / 5; display: grid; grid-template-columns: 88px 700px 174px; padding-top: 48px; }
.sec.first { padding-top: 180px; }
.num { font: 400 10px/15px var(--serif); color: var(--ink-2); }
.sec > .body { grid-column: 2; }
.sec > .wide { grid-column: 2 / 4; }
h1 { font-size: 36px; line-height: 39.6px; letter-spacing: -0.02em; }
h1 a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; text-decoration-color: rgba(0,0,0,.35); }
h2 { font-size: 20px; line-height: 26px; letter-spacing: -0.01em; }
h1 + .prose { margin-top: 30px; }
.lede { margin-top: 14px; max-width: 560px; font-size: 18px; line-height: 27px; color: var(--ink-2); }
h1 + .lede { margin-top: 22px; font-size: 19px; line-height: 28px; }
.num { display: none; }
.prose { max-width: 600px; }
h2 + .prose { margin-top: 2px; }
.prose p + p { margin-top: 18px; }
.prose a, a.u { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(0,0,0,.35); }
.prose a:hover, a.u:hover { text-decoration-color: var(--ink); }
.prose ul { margin: 12px 0 0; padding-left: 20px; }
.prose li + li { margin-top: 6px; }
.prose strong { font-weight: 600; }
.prose h3 { font-size: 16px; line-height: 22px; margin-top: 26px; }
.prose h3 + p { margin-top: 2px; }
.small { font-size: 13px; line-height: 19.5px; color: var(--ink-2); }

/* ---------------------------------------------------------------- buttons */
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.btn { display: inline-block; padding: 0 10px 1px; border: 1px solid var(--ink); font: 400 15px/30px var(--sans); }
.btn-dark { background: #191919; border-color: #191919; color: var(--bg); }
.btn-dark:hover { background: var(--green); border-color: var(--green); color: #000; }
.btn-line:hover { background: var(--ink); color: var(--bg); }

/* ---------------------------------------------------------------- panels */
.panel { background: var(--panel); }
/* a live chrome field from the Rationality site, behind whatever stands in the panel */
.chrome { position: relative; overflow: hidden; background: #e4e6e3; isolation: isolate; }
.chrome > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -1; }

/* ---------------------------------------------------------------- data card */
.card { margin-top: 26px; border: 1px solid var(--rule); padding: 12px; font-family: var(--sans); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 4px 10px; }
.card-head b { font-weight: 500; font-size: 15px; }
.card-head a { color: var(--accent); font-size: 15px; line-height: 22.5px; }
.card-head a:hover { text-decoration: underline; }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: 22px 9px minmax(0, 1fr) 110px 52px; align-items: center; gap: 8px; padding: 8px 4px 9px; font-size: 13px; line-height: 19.5px; }
.bars li + li { border-top: 1px solid var(--rule); }
.bars .i { color: var(--ink-2); text-align: center; }
.bars .sw { width: 9px; height: 9px; background: var(--green); }
.bars .l small { color: var(--ink-2); font-size: 11px; margin-left: 6px; }
.bars .t { height: 9px; background: var(--track); position: relative; }
.bars .t i { position: absolute; inset: 0 auto 0 0; background: var(--green); }
.bars .v { text-align: right; font-variant-numeric: tabular-nums; }
.bars .alt .sw, .bars .alt .t i { background: #191919; }
.bars .sw, .bars .t i { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* ---------------------------------------------------------------- card row ("05. Articles") */
.row { position: relative; z-index: 1; padding-top: 70px; }
.row-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 26px; }
.row-head .lbl { font: 400 10px/15px var(--serif); color: var(--ink-2); padding-left: 8px; position: relative; }
.row-head h2 { font-size: 20px; }
.row-head .lbl::before { content: ""; position: absolute; left: 0; top: 2px; width: 1px; height: 11px; background: var(--tick); }
.arrows { display: flex; gap: 4px; }
.arrows button { width: 32px; height: 32px; border: 0; padding: 0; background: var(--panel); cursor: pointer; display: grid; place-items: center; color: var(--ink); }
.arrows button:hover { background: #e2e1df; }
.arrows svg { width: 16px; height: 16px; }
.cards { display: grid; grid-auto-flow: column; grid-auto-columns: 350px; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-right: calc((1312px - 100vw) / 2); }
.cards::-webkit-scrollbar { display: none; }
.cards a { scroll-snap-align: start; }
.cards .im { aspect-ratio: 350 / 197; background: var(--panel); position: relative; overflow: hidden; }
.cards .im canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.cards a:hover .im canvas { transform: scale(1.04); }
.cards .im span { position: absolute; left: 14px; bottom: 10px; font: 400 44px/1 var(--sans); letter-spacing: -0.03em; color: #000; mix-blend-mode: multiply; opacity: .8; }
/* the film under the hero: its first clip as the preview, and a square play button in the site's style */
.watch { position: relative; aspect-ratio: 16 / 9; background: #e4e6e3; overflow: hidden; }
.watch video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.watch-play { position: absolute; left: 18px; bottom: 18px; display: inline-flex; align-items: center; gap: 12px; padding: 0 16px 0 0; height: 48px; border: 0; background: #191919; color: var(--bg); cursor: pointer; font: 400 16px/1 var(--sans); }
.watch-play[hidden] { display: none; }
.watch-play i { position: relative; width: 48px; height: 48px; background: var(--green); flex: none; }
.watch-play i::after { content: ""; position: absolute; left: 19px; top: 16px; border-left: 13px solid #000; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.watch-play small { font: 400 13px/1 var(--sans); color: rgba(247,246,245,.6); }
.watch-play:hover { background: #000; }
.watch-play:hover i { background: #fff; }

/* 01: the launch film, its silent loop as the cover */
.cards .im video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.cards a:hover .im video { transform: scale(1.04); }
.cards .im .play { position: absolute; right: 12px; bottom: 12px; width: 40px; height: 40px; background: #191919; transition: background .15s; }
.cards .im .play::after { content: ""; position: absolute; left: 16px; top: 12px; border-left: 12px solid var(--bg); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.cards a:hover .im .play { background: var(--green); }
.cards a:hover .im .play::after { border-left-color: #000; }
.film { padding: 0; border: 0; background: transparent; width: min(1280px, 92vw, calc((100svh - 140px) * 16 / 9)); max-width: none; max-height: none; overflow: visible; }
.film::backdrop { background: rgba(10,10,10,.86); }
.film video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; }
.film-close { position: absolute; right: 0; top: -40px; padding: 0 10px 1px; border: 1px solid rgba(255,255,255,.7); background: transparent; color: #fff; font: 400 14px/26px var(--sans); cursor: pointer; }
.film-close:hover { background: #fff; color: #000; }
.cards .tt { margin-top: 15px; font: 400 16px/22.5px var(--serif); }
.cards a:hover .tt { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cards .mt { font: 400 15px/22.5px var(--serif); color: var(--ink-2); }

/* ---------------------------------------------------------------- footer */
.foot { position: relative; z-index: 1; margin-top: 70px; padding-bottom: 80px; }
.foot .frame { border-top: 1px solid var(--rule); padding-top: 38px; display: grid; grid-template-columns: 350px 262px 438px 262px; }
.foot .logo img { height: 21px; width: auto; filter: grayscale(1) contrast(1.6) brightness(.55); }
.foot ul { list-style: none; margin: 0; padding: 0; font: 400 12px/17.5px var(--serif); color: var(--ink-2); }
.foot ul a:hover { color: var(--ink); }
.legal { grid-column: 2 / 4; margin-top: 40px; max-width: 615px; font: 400 12px/17.5px var(--serif); color: var(--ink-2); }
.legal p + p { margin-top: 8px; }
.legal strong { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- phone-only and desktop-only copy */
.m-only { display: none; }
.lede-m { font-size: 17px; line-height: 25px; color: var(--ink-2); margin-top: 12px; }
.foot details summary { list-style: none; cursor: pointer; }
.foot details summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1340px) {
  :root { --frame: calc(100vw - 32px); }
  .rules { display: none; }
  .page { grid-template-columns: 200px minmax(0, 1fr); }
  .sec { grid-column: 2; grid-template-columns: 56px minmax(0, 1fr); }
  .sec > .wide { grid-column: 2; }
  .sec > .body { max-width: 700px; }
  .cards { margin-right: 0; }
  .arrows { margin-right: 0; }
  .foot .frame { grid-template-columns: 200px 1fr 1fr 1fr; }
  .legal { grid-column: 2 / 5; }
}
@media (max-width: 760px) {
  /* a top bar: the mark, the links on one scrolling line, and the Arvo box */
  .page { grid-template-columns: minmax(0, 1fr); }
  .side { grid-row: auto; position: sticky; top: 0; z-index: 10; background: rgba(247,246,245,.92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); margin: 0 -16px; padding: 0 16px; }
  .side-in { position: static; padding: 0; height: 52px; display: flex; align-items: center; gap: 14px; }
  .side nav { margin: 0; flex: 1; min-width: 0; display: flex; gap: 16px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .side nav::-webkit-scrollbar { display: none; }
  .side nav .sub, .side nav .gap { display: none; }
  .side nav a[aria-current]::before { display: none; }
  .side nav a[aria-current] { box-shadow: inset 0 -1.5px 0 var(--accent); }
  .box { margin: 0; flex: none; }
  .sec, .sec.first { grid-column: 1; grid-template-columns: minmax(0, 1fr); padding-top: 44px !important; }
  .sec.first { padding-top: 34px !important; }
  .sec > .body, .sec > .wide { grid-column: 1; }
  .num { margin-bottom: 8px; }
  h1 { font-size: 30px; line-height: 1.1; letter-spacing: -0.025em; }
  h1 + .prose { margin-top: 20px; }
  body { font-size: 16px; line-height: 25px; }
  .btns .btn { flex: 1 1 auto; text-align: center; line-height: 40px; }
  .wide.panel, .wide.chrome, .wide.watch { margin: 0 -16px; }
  .card { padding: 8px; }
  .bars li { grid-template-columns: 14px 8px minmax(0, 1fr) 54px 42px; gap: 6px; font-size: 12.5px; padding: 8px 2px; }
  .bars .l small { display: none; }
  .row { padding-top: 48px; }
  .cards { grid-auto-columns: 82%; margin: 0 -16px; padding: 0 16px; scroll-padding: 0 16px; }
  .arrows { display: none; }
  .foot { margin-top: 48px; }
  .foot .frame { grid-template-columns: 1fr 1fr; gap: 24px 16px; }
  .foot .logo { grid-column: 1 / -1; }
  .legal { grid-column: 1 / -1; margin-top: 8px; }
  /* less to read on a phone: short lines stand in for paragraphs */
  .m-hide { display: none !important; }
  .m-only { display: block; }
  .lede, h1 + .lede { font-size: 17px; line-height: 25px; }
  .side nav a[aria-current]::before { display: none; }
  h2 { font-size: 22px; line-height: 28px; }
  .sec { padding-top: 40px !important; }
  .card { margin-top: 18px; }
  .screens figcaption { margin-top: 8px; }
  .row-head { margin-bottom: 14px; }
  .cards .tt { margin-top: 10px; }
  .legal { font-size: 11px; line-height: 16px; }
}

/* shown inside Perrin's page: room between the frame's edge and Arvo's sidebar marker */
@media (min-width: 861px) { body { padding-left: 56px; box-sizing: border-box; } }
