/* twise.pl hub — shared stylesheet.
   Design direction 1a: #fbfbfa ground, Helvetica for prose, ui-monospace for
   metadata and URLs, one red accent used only as a marker.
   No build step. No JS — the block cursor blinks in CSS. */

:root {
  --ground:  #fbfbfa;
  --surface: #ffffff;
  --ink:     #141412;
  --body:    #4a4a44;
  --muted:   #6b6b64;
  --faint:   #8a8a82;
  --fainter: #9a9a92;
  --rule:    #e3e3dd;
  --edge:    #e0e0d9;
  --edge-2:  #d3d3cc;
  --accent:  #c8402f;

  --live-ink:  #2f6b45;
  --live-bg:   #e8f2ea;
  --live-edge: #cfe3d5;
  --soon-ink:  #8a8a80;
  --soon-bg:   #f1f1ee;
  --soon-edge: #e2e2db;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --face: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --pad: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.5 var(--face);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

/* ── page column ────────────────────────────────────────────────────────── */

.wrap { max-width: 980px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* Every horizontal rule on the site aligns to this column, never to the
   viewport edge — the design doc's 980px frame is the page. */

/* ── publisher mark ─────────────────────────────────────────────────────── */

.mark {
  margin: 0;
  font: 400 30px/1 var(--mono);
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
}

.cur {
  display: inline-block;
  width: .5em;
  height: .95em;
  margin-left: .08em;
  vertical-align: -.08em;
  background: currentColor;
  animation: blink 1.1s steps(1, end) infinite;
}

@keyframes blink { 0%, 49% { opacity: 1 } 50%, 100% { opacity: 0 } }

@media (prefers-reduced-motion: reduce) { .cur { animation: none } }

/* ── header bar (legal pages, 404) ──────────────────────────────────────── */

.bar > .wrap {
  display: flex;
  align-items: baseline;
  gap: 18px;
  padding-top: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.bar .mark { font-size: 19px; }

.bar-label {
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fainter);
}

/* ── home hero ──────────────────────────────────────────────────────────── */

.hero {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 56px;
  padding-bottom: 20px;
}

.tagline { margin: 0; font-size: 15px; line-height: 1.4; color: var(--muted); }

/* ── section rule ───────────────────────────────────────────────────────── */

.sec {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 18px 0 22px;
}

.sec-label {
  font: 500 11px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fainter);
}

.sec-rule { flex: 1; height: 1px; background: var(--rule); }

/* ── app grid ───────────────────────────────────────────────────────────── */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
  padding-bottom: 40px;
}

.card {
  container-type: inline-size;
  display: block;
  overflow: hidden;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

a.card:hover {
  border-color: #c9c9c0;
  box-shadow: 0 2px 10px -4px rgba(20, 20, 18, .18);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
}

.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.card-name { margin: 0; font: 500 17px/1.2 var(--face); color: var(--ink); }

.card-desc { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

.card-meta { padding-top: 2px; font: 400 11.5px/1 var(--mono); color: var(--fainter); }

.badge {
  padding: 4px 6px;
  border: 1px solid;
  border-radius: 3px;
  font: 500 9.5px/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge--live { color: var(--live-ink); background: var(--live-bg); border-color: var(--live-edge); }
.badge--soon { color: var(--soon-ink); background: var(--soon-bg); border-color: var(--soon-edge); }

/* ── tiles ──────────────────────────────────────────────────────────────────
   Each app supplies its own cover art in its own aesthetic; the hub never
   restyles it. Tile type scales with the card, not the viewport, so the grid
   survives going from 2 columns to 3 without a redesign. */

.tile {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  font-size: 16px;
  font-size: 4cqw;
}

/* Teleprompter — broadcast prompter, mid-scroll, on its reading marker. */

.tile--tp {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .73em;
  padding: 0 2.06em;
  background: #0a0a0a;
  font-family: var(--mono);
  font-weight: 400;
}

.tp-line { line-height: 1.4; }
.tp-line--lit { font-size: 1.34em; color: #f2f2f2; }
.tp-line--past { font-size: .91em; line-height: 1.5; color: #3a3a3a; }
.tp-line--next { font-size: .91em; line-height: 1.5; color: #4a4a4a; }

.tp-marker {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: var(--accent);
  opacity: .85;
}

.tp-fade { position: absolute; left: 0; right: 0; height: 34%; }
.tp-fade--top { top: 0; background: linear-gradient(#0a0a0a, rgba(10, 10, 10, 0)); }
.tp-fade--bottom { bottom: 0; background: linear-gradient(rgba(10, 10, 10, 0), #0a0a0a); }

/* MDtoPDF — markdown source on the left, typeset page on the right. */

.tile--md { display: flex; background: #f4f4f2; }

.md-src {
  width: 44%;
  display: flex;
  flex-direction: column;
  gap: .55em;
  padding: 1.33em 1.09em;
  background: #fafaf8;
  border-right: 1px solid #e4e4de;
}

.md-tok { font: 400 .67em/1 var(--mono); color: #7a8fa6; }
.md-bar { height: .36em; border-radius: 2px; background: #dedede; }
.md-bar--faint { background: #e4e4e4; }

.md-out {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .61em;
  padding: 1.33em 1.58em;
  background: #fff;
}

.md-h { font: 500 .91em/1.2 Georgia, "Times New Roman", serif; color: #1a1a18; }
.md-h--sub { font-size: .7em; padding-top: .25em; }
.md-line { height: .3em; border-radius: 2px; background: #ececec; }
.md-line--faint { background: #f0f0f0; }

/* ── legal document ─────────────────────────────────────────────────────── */

.doc {
  display: flex;
  align-items: flex-start;
  gap: 56px;
  padding-top: 56px;
  padding-bottom: 20px;
}

.toc {
  width: 170px;
  flex: none;
  position: sticky;
  top: 24px;
  font: 400 11.5px/1.8 var(--mono);
}

.toc-head { padding-bottom: 12px; color: var(--ink); letter-spacing: .04em; text-transform: uppercase; }

.toc-list { display: flex; flex-direction: column; gap: 7px; }

.toc-list a { color: var(--faint); text-decoration: none; }
.toc-list a:hover { color: var(--ink); }

/* Zero-JS current-section highlight: works once a §-link has been followed. */
body:has(#s1:target) .toc-list a[href="#s1"],
body:has(#s2:target) .toc-list a[href="#s2"],
body:has(#s3:target) .toc-list a[href="#s3"],
body:has(#s4:target) .toc-list a[href="#s4"],
body:has(#s5:target) .toc-list a[href="#s5"] { color: var(--ink); }

.prose { flex: 1; min-width: 0; max-width: 62ch; }

.prose h1 {
  margin: 0;
  font: 500 34px/1.2 var(--face);
  letter-spacing: -.015em;
  color: var(--ink);
}

.doc-meta {
  margin-top: 16px;
  font: 400 11.5px/1 var(--mono);
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--fainter);
}

.prose section { scroll-margin-top: 24px; }

.prose section + section { margin-top: 30px; }

.sections { margin-top: 38px; }

.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font: 500 17px/1.4 var(--face);
  color: var(--ink);
}

.prose h2 .num { font: 500 11.5px/1.4 var(--mono); color: var(--accent); }

.prose p {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--body);
  text-wrap: pretty;
}

.prose ul { margin: 10px 0 0; padding-left: 1.2em; }

.prose li {
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--body);
  text-wrap: pretty;
}

.prose a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--edge-2); }

.prose code { font: 400 .93em/1 var(--mono); white-space: nowrap; color: var(--ink); }

.note {
  margin-top: 14px;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--edge);
  font: 400 13.5px/1.7 var(--mono);
  color: var(--muted);
}

/* ── 404 ────────────────────────────────────────────────────────────────── */

.miss {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-top: 96px;
  padding-bottom: 88px;
}

.miss h1 { display: flex; flex-direction: column; gap: 26px; margin: 0; font-weight: 400; }

.miss-tag {
  font: 500 11px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.miss-url { font: 400 34px/1.3 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.miss-url .path { color: #b5b5ac; }
.miss-url .cur { vertical-align: -.06em; height: .9em; }

.miss p { max-width: 46ch; margin: 22px 0 0; font-size: 17px; line-height: 1.6; color: var(--muted); }
.miss p.miss-en { margin-top: 10px; font-size: 15px; color: var(--faint); }

.actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 34px; }

.btn {
  padding: 13px 20px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--ground);
  font: 500 13.5px/1 var(--face);
  text-align: center;
  text-decoration: none;
}

.btn--ghost { border-color: var(--edge-2); background: var(--surface); color: var(--ink); }

/* ── footer ─────────────────────────────────────────────────────────────── */

.foot > .wrap {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 22px;
  padding-bottom: 30px;
  border-top: 1px solid var(--rule);
  font: 400 11.5px/1.7 var(--mono);
  color: var(--faint);
}

.doc + .foot > .wrap { margin-top: 44px; }

.foot a { color: var(--faint); text-decoration: none; }
.foot a:hover { color: var(--ink); }

.foot .who a { color: var(--ink); border-bottom: 1px solid var(--edge-2); }

.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }

.foot [aria-current="page"] { color: var(--ink); }

.lang .is-current { color: var(--ink); }

/* ── narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  :root { --pad: 22px; }

  .mark { font-size: 24px; }
  .bar .mark { font-size: 17px; }
  .bar > .wrap { padding-top: 18px; padding-bottom: 18px; }
  .bar-label { font-size: 10px; }

  .hero { flex-direction: column; gap: 12px; padding-top: 36px; padding-bottom: 14px; }
  .tagline { font-size: 14px; line-height: 1.45; }

  .sec { padding: 16px 0 18px; }
  .sec-label { font-size: 10px; }

  .grid { grid-template-columns: minmax(0, 1fr); gap: 18px; padding-bottom: 28px; }

  .card-body { padding: 14px 16px 16px; gap: 7px; }
  .card-name { font-size: 16px; }
  .card-desc { font-size: 13px; }
  .card-meta { font-size: 11px; }
  .badge { font-size: 9px; padding: 4px 6px; }

  .doc { flex-direction: column; gap: 0; padding-top: 32px; }

  .toc {
    width: 100%;
    position: static;
    padding: 14px 16px;
    border: 1px solid var(--edge);
    border-radius: 6px;
    background: var(--surface);
    font-size: 11.5px;
    line-height: 1.9;
    order: 2;
    margin-top: 22px;
  }

  .toc-head { padding-bottom: 8px; color: var(--fainter); }
  .toc-list { gap: 5px; }

  .prose { order: 1; max-width: none; }
  .prose h1 { font-size: 26px; line-height: 1.25; }
  .doc-meta { margin-top: 14px; font-size: 11px; }
  .sections { margin-top: 30px; }
  .prose section + section { margin-top: 26px; }
  .prose h2 { gap: 10px; font-size: 16px; }
  .prose h2 .num { font-size: 11px; }
  .prose p, .prose li { font-size: 14.5px; }
  .note { padding-left: 14px; font-size: 13px; }

  .miss { padding-top: 60px; padding-bottom: 56px; }
  .miss h1 { gap: 20px; }
  .miss-tag { font-size: 10px; }
  .miss-url { font-size: 22px; line-height: 1.35; }
  .miss p { font-size: 15px; margin-top: 18px; }
  .miss p.miss-en { font-size: 14px; }
  .actions { flex-direction: column; gap: 10px; margin-top: 28px; align-self: stretch; }
  .btn { padding: 15px 18px; font-size: 14px; }

  .foot > .wrap { flex-direction: column; gap: 8px; padding-top: 18px; padding-bottom: 24px; font-size: 11px; }
  .doc + .foot > .wrap { margin-top: 34px; }
  .foot-links { gap: 14px; }
}

/* The document TOC only needs sticky positioning where it sits beside the
   text; ordering above keeps the heading first on a phone. */
