/* SPDX-License-Identifier: MIT — the site's chrome (DESIGN.md, site v2: 17-site-brief §2, 17-brand.md): what
   every page shares, the app's pages included: type, buttons and links, the sticky header (the name, two
   pages, the light switch, Make my drive), the footer, the section rhythm (two surfaces, a hairline and a
   ruler at each seam), the four sides of a file, the tTARI box, reading blocks, forms and tables.
   home.css, how.css and pages.css add the rest. Builds on /shared/tokens.css and base.css. */
html { scroll-padding-top: 72px; }   /* anchors land below the sticky header */

/* ---------- type ---------- */
h1, .h1 { font: var(--t-hero); letter-spacing: -.02em; }
h2 { font: var(--t-h2); letter-spacing: -.015em; }
h3 { font: var(--t-h3); }
.say { font: var(--t-say); }
.lede { font: var(--t-say); color: var(--fg-2); max-width: 40ch; }
.muted, .caption { color: var(--fg-2); }
.caption, .small { font: var(--t-small); }
.direction { font: var(--t-small); color: var(--fg-2); }
.brand { font-weight: 800; letter-spacing: -.01em; }
.chain-word { color: var(--tari-text); }
code, .code { font: var(--t-code); font-size: max(13px, .9em); overflow-wrap: anywhere; }
kbd { font: var(--t-code); font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--bg-sunken); }
.nowrap { white-space: nowrap; }

/* ---------- controls: one primary per screen (the drive's buttons: radius md) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: var(--tap);
  padding: 10px 18px; border: 0; border-radius: var(--r-input); font: var(--t-ui); text-decoration: none;
  background: var(--act); color: var(--on-act); white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), scale var(--dur-1) var(--ease-out);
}
.btn:hover { background: var(--act-hover); }
.btn:active, .quiet:active { scale: .97; }
.btn:disabled { opacity: .55; cursor: default; }
.quiet {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 10px 18px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--bg-raised);
  font: var(--t-ui); color: var(--fg); text-decoration: none;
  transition: background-color var(--dur-1) var(--ease-out), scale var(--dur-1) var(--ease-out);
}
.quiet:hover { background: var(--bg-sunken); }
.textlink {
  font: var(--t-ui); background: none; border: 0; padding: 12px 6px; min-height: 44px;
  text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1.5px; color: var(--fg);
}
/* inline, so a long label wraps and its arrow follows the last word */
.more { display: inline; padding-block: 3px; font-weight: 650; }
.icon { width: 1.2em; height: 1.2em; flex: none; }
.more .icon { display: inline; width: 18px; height: 18px; vertical-align: -3px; margin-left: .25em; }
.btn .icon { width: 18px; height: 18px; }
.copy-row { display: flex; flex-wrap: wrap; align-items: stretch; gap: var(--s-2); }
.copy-row code {
  display: flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-4); border-radius: var(--r-input);
  background: var(--bg-sunken); overflow-x: auto; white-space: nowrap; min-width: 0; flex: 1 1 auto; overflow-wrap: normal;
}

/* badges: the rule of a file, as the drive draws it (the home's slice, the reading pages' stills) */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--r-pill);
  font: 500 12px/1.4 var(--font); white-space: nowrap; border: 1px solid transparent;
  background: var(--bg-sunken); color: var(--fg);
}
.badge .icon { width: 12px; height: 12px; }
.badge[data-variant="outline"] { background: transparent; border-color: var(--hair); }
.badge[data-variant="tari"] { background: color-mix(in srgb, var(--tari) 9%, transparent); color: var(--pay-text); }

/* ---------- layout ---------- */
.wrap { width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* the brand fill (17-brand.md, "The Lime Is Yours Rule"): only Open your drive, which makes or opens your
   drive; every other primary stays ink (.btn). On light pages a lime-700 edge outlines it (lime on white is
   1.21:1). Its arrow turns to the corner on hover (site v3). Outline and ghost are shadcn's. */
.btn-brand, .btn-outline, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 8px 16px;
  border: 0; border-radius: var(--r-input); font: var(--t-ui); text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur-1) var(--ease-out), scale var(--dur-1) var(--ease-out);
}
.btn-brand { background: var(--brand-solid); color: var(--on-brand); box-shadow: inset 0 0 0 1px var(--brand-edge); font-weight: 600; }
.go { transition: rotate var(--dur-2) var(--ease-out); }
a:hover > .go { rotate: -45deg; }
.btn-brand:hover { background: var(--brand-solid-hover); }
.btn-outline { border: 1px solid var(--line); background: var(--bg-raised); color: var(--fg); }
.btn-ghost { background: transparent; color: var(--fg); }
.btn-outline:hover, .btn-ghost:hover { background: var(--bg-sunken); }
:is(.btn-brand, .btn-outline, .btn-ghost) .icon { width: 16px; height: 16px; }
:is(.btn-brand, .btn-outline, .btn-ghost):active { scale: .97; }
@media (pointer: coarse) { :is(.btn-brand, .btn-outline, .btn-ghost) { min-height: var(--tap); } }

/* ---------- header: sticky and opaque (no blur, no glass) ---------- */
.site-header { position: sticky; top: 0; z-index: var(--z-header); border-bottom: 1px solid var(--hair); background: var(--bg); }
.top { display: flex; align-items: center; gap: var(--s-3); min-height: 60px; }
.wm { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; padding: 4px; margin: 0 var(--s-2) 0 -4px; border-radius: var(--r-input); color: var(--fg); }
/* the mark, the open box (docs/review/home-v3.md): lime on an ink tile in both themes. The tile stays ink on light pages,
   since the lime alone on white is 1.21:1; lime on ink is 16.32:1. */
.wm-tile { display: grid; place-items: center; width: 30px; height: 30px; border-radius: var(--r-input); background: #0A0A0A; color: var(--brand-solid); }
.wm-tile .icon { width: 20px; height: 20px; }
.wm-name { font: 650 17px/1 var(--font); letter-spacing: -.02em; }
.top-nav { display: none; gap: 2px; }
.top-nav a { color: var(--fg-2); text-decoration: none; font: var(--t-small); padding: 8px 10px; border-radius: var(--r-input); }
.top-nav a:hover { color: var(--fg); background: var(--bg-sunken); }
.top-nav a[aria-current="page"] { color: var(--fg); font-weight: 500; }
@media (min-width: 720px) { .top-nav { display: flex; } }
.top-end { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }
/* the light switch: its name stays "Lights", its state is aria-pressed (pressed = lights on); the GitHub link
   (site/share) is the same icon button, before it */
.lights, .gh {
  inline-size: 36px; block-size: 36px; display: grid; place-items: center; border: 0; padding: 0;
  background: transparent; border-radius: var(--r-input); color: var(--fg); transition: background-color var(--dur-1) var(--ease-out);
}
.lights:hover, .gh:hover { background: var(--bg-sunken); }
:is(.lights, .gh) .icon { width: 18px; height: 18px; }
.lights .i-moon, :root[data-theme="dark"] .lights .i-sun { display: none; }
:root[data-theme="dark"] .lights .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lights .i-sun { display: none; }
  :root:not([data-theme="light"]) .lights .i-moon { display: block; }
}
@media (pointer: coarse) { .lights, .gh { inline-size: var(--tap); block-size: var(--tap); } }
/* Open your drive, always on (site v3): one label, two targets. It makes a drive (/drive?make) in a browser
   without one and opens it (/drive) where theme.js already painted data-has-drive. */
.head-cta { padding: 8px 12px 8px 14px; }
:root[data-has-drive] .head-make, :root:not([data-has-drive]) .head-open { display: none; }
/* phones (site/share): the gaps close up and Open your drive drops its arrow, so the GitHub link fits at 390 px;
   under 380 px the link steps aside, and the wordmark, the switch and Open your drive stay */
@media (max-width: 439.98px) {
  .top { gap: 8px; } .wm { margin-right: 0; } .top-end { gap: 4px; }
  .head-cta { padding-inline: 12px; } .head-cta .go { display: none; }
}
@media (max-width: 379.98px) { .gh { display: none; } }

/* ---------- site v3 motion (the motion module, docs/review/site-v3.md): only on what was below the fold when it ran,
   only until it has arrived, never without JavaScript or with reduced motion (site.js never loads it) ---------- */
.mo-h { opacity: 0; translate: 0 var(--mo-y, 20px); scale: var(--mo-s, 1); filter: var(--mo-f, none); }
.mo-head { --mo-f: blur(8px); --mo-d: .7s; }
.mo-card { --mo-y: 40px; --mo-d: .7s; }
.mo-pic { --mo-y: 40px; --mo-s: .97; --mo-d: .7s; }
.mo-row { --mo-y: 12px; --mo-d: .5s; }
.mo-badge { --mo-y: 0px; --mo-s: .9; --mo-f: blur(4px); --mo-d: .4s; }
.mo-h.mo-in {
  opacity: 1; translate: none; scale: none; filter: none;
  transition: opacity var(--mo-d, .6s) var(--ease-out), translate var(--mo-d, .6s) var(--ease-out),
    scale var(--mo-d, .6s) var(--ease-out), filter var(--mo-d, .6s) var(--ease-out);
}
.mo-ws .mo-w { display: inline-block; opacity: .15; filter: blur(8px); transition: opacity .5s var(--ease-out), filter .5s var(--ease-out); }
.mo-ws.mo-in .mo-w { opacity: 1; filter: none; }
/* a decode: the words wait unseen (.dc-c) under an aria-hidden layer of hex noise that resolves into them */
.dc-box { position: relative; }
.dc-c { opacity: 0; }
.dc-c.dc-ok { opacity: 1; transition: opacity .16s var(--ease-out); }
.dc-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.dc-layer span { position: absolute; overflow: hidden; white-space: pre; color: var(--fg-2); }
.dc-layer .dc-ok { opacity: 0; transition: opacity .16s var(--ease-out); }
@media print { .mo-h, .mo-w, .dc-c { opacity: 1 !important; translate: none !important; scale: none !important; filter: none !important; } .dc-layer { display: none; } }
::selection { background: var(--brand-solid); color: var(--on-brand); }

/* ---------- sections: two surfaces that alternate; each seam a hairline and the ruler (5 px ticks on the
   field's 48 px grid, centred like it, faded toward both edges). Never a coloured band. ---------- */
.sec { position: relative; padding-block: var(--sec-pad); border-top: 1px solid var(--hair); }
.sec.alt { background: var(--bg-alt); }
.sec::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 5px; pointer-events: none;
  background: linear-gradient(to right, var(--tick) 1px, transparent 1px) calc(50% + 24px) 0 / var(--grid) 5px repeat-x;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
          mask-image: linear-gradient(to right, transparent, #000 18%, #000 82%, transparent);
}
.sec-head { display: grid; gap: 10px; margin-bottom: var(--s-6); max-width: 40rem; }
.sec-head h2 { font: 650 clamp(26px, 3vw, 36px)/1.15 var(--font); letter-spacing: -.03em; }
.sec-head p { font: var(--t-say); font-size: clamp(16px, 1.4vw, 18px); color: var(--fg-2); }
.sec-head.center { margin-inline: auto; text-align: center; justify-items: center; }
@media (min-width: 1024px) { .sec-head { margin-bottom: var(--s-7); } }
.icon-tile { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: var(--r-btn); background: var(--bg-sunken); color: var(--fg); }
.icon-tile .icon { width: 20px; height: 20px; }
.icon-tile.chain { background: color-mix(in srgb, var(--tari) 9%, transparent); color: var(--pay-text); }
.icon-tile.yours { background: var(--brand-tile); color: var(--brand-text); }

/* ---------- who sees what: four sides of every file (the home, /how) ---------- */
.sides { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-3); }
@media (min-width: 640px) { .sides { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .sides { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.side { display: grid; align-content: start; gap: var(--s-4); padding: var(--s-5); border: 1px solid var(--hair); border-radius: var(--r-panel); background: var(--bg-raised); }
.side.yours { background: var(--brand-subtle); border-color: var(--brand-border); }
.side-top { display: flex; align-items: center; gap: 12px; }
.side-top h3 { font: 600 17px/1.25 var(--font); letter-spacing: -.01em; }
.seen { display: grid; gap: 4px; margin: 0; font: var(--t-small); }
.seen dt { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1.4 var(--font); color: var(--fg-2); }
.seen dt .icon { width: 14px; height: 14px; }
.seen dd { margin: 0 0 var(--s-3); color: var(--fg); }
.seen dd:last-child { margin-bottom: 0; }
.sides-foot { margin-top: var(--s-5); font: var(--t-small); color: var(--fg-2); max-width: 62ch; }
.sides-foot a { color: var(--fg); font-weight: 500; }

/* ---------- What's tTARI? (the box on the home and /how) ---------- */
.coin-box { display: grid; gap: var(--s-3); padding: var(--s-5); border: 1px solid var(--hair); border-radius: var(--r-panel); background: var(--bg); font: var(--t-small); font-size: 15px; }
.coin-top { display: flex; align-items: center; gap: 12px; }
.coin-top h3 { font: 600 18px/1.25 var(--font); }
.coin-box ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.coin-box li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; }
.coin-box li[hidden] { display: none; }
.coin-box li .icon { width: 16px; height: 16px; margin-top: 3px; color: var(--fg-2); }
.coin-box a { color: var(--fg); font-weight: 500; }
.coin-box .status-line { font: var(--t-small); color: var(--fg-2); padding-top: var(--s-3); border-top: 1px solid var(--hair); }

/* ---------- footer: everything else, on the second surface ---------- */
.site-footer { border-top: 1px solid var(--hair); background: var(--bg-alt); }
.foot { padding-block: var(--s-7) var(--s-6); color: var(--fg-2); font: var(--t-small); display: grid; gap: var(--s-2); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 0 20px; margin-left: -4px; }
.foot-nav a { color: var(--fg); display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; text-decoration: none; }
.foot-nav a:hover { text-decoration: underline; }
.foot-legal { font-size: 13px; line-height: 1.5; max-width: 72ch; }
.site-footer { transition: opacity var(--dur-2) var(--ease-out); }

/* ---------- reading ---------- */
.prose { max-width: var(--read); }
.prose > * + * { margin-top: var(--s-4); }
.prose h2 { margin-top: var(--s-7); }
.prose h3 { margin-top: var(--s-5); }
.prose ul, .prose ol { padding-left: 1.25em; display: grid; gap: var(--s-2); }
.link-list { list-style: none; padding-left: 0; }
.detail dt { font-weight: 750; margin-top: var(--s-4); }
.detail dd { margin-top: var(--s-1); }
.terminal {
  font: var(--t-code); padding: var(--s-4); border-radius: var(--r-input); background: var(--night-sunken); color: var(--moon);
  overflow-x: auto; white-space: pre;
}
.terminal span { color: var(--moon-dim); user-select: none; }

/* tables: one hairline under each group, never a rule under every row; on a phone each row stacks,
   every cell under its column's name (data-cue) */
.table-wrap { overflow-x: auto; margin-block: var(--s-4); }
.data-table { width: 100%; min-width: 560px; font: var(--t-small); border-collapse: separate; border-spacing: 0; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: var(--s-3) var(--s-4) var(--s-3) 0; }
.data-table thead th { font-weight: 750; color: var(--fg); border-bottom: 2px solid var(--line); }
.data-table tbody th { font-weight: 700; color: var(--fg); }
.data-table tbody td { color: var(--fg-2); }
.data-table tbody tr:nth-child(odd) > * { background: var(--bg-sunken); }
.data-table tbody tr > :first-child { padding-left: var(--s-3); border-radius: 10px 0 0 10px; }
.data-table tbody tr > :last-child { border-radius: 0 10px 10px 0; }
@media (max-width: 639.98px) {
  .data-table, .data-table tbody, .data-table tr, .data-table th, .data-table td { display: block; min-width: 0; }
  .data-table thead { display: none; }
  .data-table tbody tr { padding: var(--s-3); border-radius: var(--r-input); }
  .data-table tbody tr > * { background: none !important; padding: var(--s-1) 0 !important; border-radius: 0 !important; }
  .data-table tbody tr:nth-child(odd) { background: var(--bg-sunken); }
  .data-table tbody th { font: var(--t-h3); font-size: 18px; }
  .data-table td::before { content: attr(data-cue); display: block; font-weight: 700; color: var(--fg); }
}

/* forms */
.form { display: grid; gap: var(--s-5); max-width: 640px; }
.field { display: grid; gap: var(--s-2); }
.field label, .field legend { font: var(--t-ui); }
.field .hint, .hint { font: var(--t-small); color: var(--fg-2); }
.field input[type="url"], .field input[type="text"], .field textarea, .field select {
  min-height: var(--tap); padding: 10px 14px; border: 2px solid var(--line); border-radius: var(--r-input);
  background: var(--bg-raised); width: 100%;
}
.field textarea { min-height: 7em; resize: vertical; }
.field :is(input, textarea, select):focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: var(--s-3); align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--act); }
.form-status { font: var(--t-ui); min-height: 1.5em; }
.form-status.error { color: var(--exit-text); }
.box-note { padding: var(--s-4); border-radius: var(--r-input); background: var(--bg-sunken); }
.noscript { padding-block: var(--s-4); color: var(--fg-2); }
