/* ==========================================================================
   v2-pages.css: manual, terminal, privacy, 404 (body.p-pages and friends).
   Loaded AFTER v2.css. Nothing here leaks to other pages: every rule is scoped
   by a body class (p-pages, p-manual, p-terminal, p-privacy, p-404).
   ========================================================================== */

/* shared page head ---------------------------------------------------------- */
.p-pages .page-head {
  position: relative; padding: clamp(48px, 8vw, 88px) 0 clamp(32px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(70% 120% at 85% -20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%),
    var(--bg);
}
.p-pages .page-head h1 { margin: 12px 0 16px; max-width: 18ch; }
.p-pages .page-head .lead { max-width: 62ch; margin-bottom: 0; }
.p-pages .page-head .meta { margin-top: 20px; }
.p-pages main { min-height: 50vh; }
.p-pages .page-body { padding-block: clamp(40px, 6vw, 72px) var(--section-y); }

/* ===== manual ============================================================ */
.docs { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.toc { position: sticky; top: calc(var(--header-h) + 24px); }
.toc-title { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 0 0 12px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line-2); }
.toc li + li { margin-top: 2px; }
.toc a {
  display: block; padding: 7px 14px; margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; font-size: .95rem; line-height: 1.35;
}
.toc a:hover { color: var(--text); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); }
.toc .toc-sub { display: block; font-size: .8rem; color: var(--dim); }

.doc > section { scroll-margin-top: calc(var(--header-h) + 24px); }
.doc > section + section { margin-top: clamp(48px, 7vw, 80px); }
.doc h2 { font-size: clamp(1.5rem, 2.4vw, 2rem); margin: 0 0 12px; }
.doc .lead { max-width: 62ch; }
.doc-note { max-width: 66ch; color: var(--muted); }
.callout {
  display: grid; gap: 6px; padding: 20px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); max-width: 66ch;
}
.callout h3 { margin: 0; font-size: 1.05rem; }
.callout p { margin: 0; color: var(--muted); }
.callout--nc { border-color: color-mix(in srgb, var(--nc) 40%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--nc) 9%, var(--surface)), var(--surface)); }
.callout--nc a { color: var(--nc); }
.callout--sg { border-color: color-mix(in srgb, var(--sg) 38%, transparent); }

.manual-grid {
  display: grid; gap: 18px; list-style: none; margin: 24px 0 0; padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr));
}
.manual-grid .shot {
  position: relative; display: block; aspect-ratio: 380 / 493; overflow: hidden;
  border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s var(--ease), border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.manual-grid .shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.manual-grid .shot:hover, .manual-grid .shot:focus-visible { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--shadow); }
.manual-grid .pg {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 8px; text-align: center;
  font-family: var(--font-mono); font-size: .72rem; letter-spacing: .14em; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .82)); pointer-events: none;
}
.doc-end { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); }

@media (max-width: 960px) {
  .docs { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; gap: 8px; border: 0; }
  .toc li + li { margin: 0; }
  .toc a { margin: 0; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-pill); font-size: .9rem; }
  .toc a.is-active { border-color: var(--accent); }
  .toc .toc-sub { display: none; }
}

/* ===== privacy =========================================================== */
.p-privacy .prose-wrap { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.p-privacy .prose { max-width: 70ch; }
.p-privacy .prose h2 { margin-top: 2.2em; padding-top: 1.2em; border-top: 1px solid var(--line); }
.p-privacy .prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.p-privacy .prose h3 { font-size: 1.15rem; }
.p-privacy .prose li strong, .p-privacy .prose li b { color: var(--text); }
.p-privacy .summary { margin: 0 0 40px; padding: 0; list-style: none; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.p-privacy .summary li { padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-weight: 500; font-size: .95rem; display: flex; gap: 10px; align-items: center; }
.p-privacy .summary svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 960px) {
  .p-privacy .prose-wrap { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .p-privacy .toc ol { border: 0; }
}

/* ===== terminal ========================================================== */
.p-terminal .term-section { padding-block: clamp(28px, 4vw, 48px) var(--section-y); }
.term-intro { max-width: 66ch; margin: 0 0 24px; color: var(--muted); }
.term-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; align-items: center; }
.term-chips .micro { margin-right: 4px; }
.term-chip {
  appearance: none; cursor: pointer; font: 500 .8rem/1 var(--font-mono); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-pill); padding: 9px 14px;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.term-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }

/* The terminal is allowed to look like a terminal. The page around it is not. */
.p-terminal .crt {
  --t-fg: #b8ffcf; --t-dim: #6fa583; --t-key: #7bff9e; --t-warn: #ffb347; --t-err: #ff7a7a;
  border-radius: 12px; overflow: hidden; background: #050c07;
  border: 1px solid rgba(123, 255, 158, .28);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, .6), 0 0 60px -20px rgba(123, 255, 158, .35), inset 0 0 80px rgba(123, 255, 158, .04);
}
.p-terminal .crt .bar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #0a160d;
  border-bottom: 1px solid rgba(123, 255, 158, .2);
  font: 500 .7rem/1.2 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--t-dim);
}
.p-terminal .crt .bar i { width: 10px; height: 10px; border-radius: 50%; background: #2a4733; flex: none; }
.p-terminal .crt .bar i:nth-child(1) { background: #ff6b6b; }
.p-terminal .crt .bar i:nth-child(2) { background: #ffb347; }
.p-terminal .crt .bar i:nth-child(3) { background: #7bff9e; }
.p-terminal .crt .bar span { margin-left: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-terminal .crt .screen {
  position: relative; height: min(62vh, 520px); min-height: 320px; overflow-y: auto; padding: 18px 20px 10px;
  font: 500 .88rem/1.65 var(--font-mono); color: var(--t-fg); cursor: text;
  scrollbar-color: rgba(123, 255, 158, .35) transparent;
}
.p-terminal .crt .screen::after {
  content: ""; position: sticky; display: block; left: 0; right: 0; bottom: 0; height: 0; pointer-events: none;
}
.p-terminal .crt .screen::before {   /* faint scanlines, inside the window only */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
}
@media (prefers-reduced-motion: reduce) { .p-terminal .crt .screen::before { display: none; } }
.p-terminal .crt p { margin: 0 0 2px; white-space: pre-wrap; word-break: break-word; }
.p-terminal .crt .c { color: var(--t-dim); }
.p-terminal .crt .k { color: var(--t-key); font-weight: 600; }
.p-terminal .crt .w { color: var(--t-warn); }
.p-terminal .crt .e { color: var(--t-err); }
.p-terminal .crt a { color: var(--t-key); text-decoration: underline; }
.p-terminal .crt .inline { display: flex; gap: 8px; align-items: baseline; position: relative; z-index: 1; }
.p-terminal .crt .prompt { color: var(--t-dim); white-space: nowrap; }
.p-terminal .crt input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #e6fff0;
  font: inherit; caret-color: var(--t-key); padding: 0; border-radius: 0; box-shadow: none;
}
.p-terminal .crt:focus-within { border-color: rgba(123, 255, 158, .55); }
.p-terminal .crt pre { margin: 0; padding: 16px; color: var(--t-fg); font: inherit; white-space: pre-wrap; }
.p-terminal .loadgrid { margin: 8px 0 4px; font-family: var(--font-mono); font-size: .72rem; line-height: 1.06; letter-spacing: .6px; white-space: pre; overflow: hidden; }
.p-terminal .loadgrid .off { color: #1b3324; }
.p-terminal .loadgrid .cool { color: #36a05f; }
.p-terminal .loadgrid .hot { color: #ffb347; }
.p-terminal .loadgrid .head { color: #fff8ee; text-shadow: 0 0 9px #ffb347, 0 0 18px #ff8a2b; }
.p-terminal .loadstat { margin: 0 0 8px; color: var(--t-dim); font: 500 .76rem/1.4 var(--font-mono); }
.p-terminal .loadstat b { color: #b8ffcf; font-weight: 600; }
.p-terminal .loadstat .pct { color: #ffb347; font-variant-numeric: tabular-nums; }

/* The TempleOS window (assets/temple.js builds it under the terminal). It is
   white, square and flat on purpose: sixteen colours, no gradients, no radius. */
.p-terminal .temple {
  margin: 24px 0 0; padding: 0; background: #fff; color: #000; border: 3px solid #000; border-radius: 0; box-shadow: none;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1rem; line-height: normal;
  transform-origin: 50% 0; transform: scaleY(.02); opacity: 0;
  transition: transform .34s cubic-bezier(.2, 1.5, .4, 1), opacity .18s linear;
}
.p-terminal .temple.up { transform: scaleY(1); opacity: 1; }
.p-terminal .temple.settled { transition: none; transform: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .p-terminal .temple { transition: none; transform: none; opacity: 1; } }
.p-terminal .temple .tbleed { display: flex; align-items: center; gap: 8px; background: #0000aa; color: #fff; padding: 5px 10px; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; border-bottom: 3px solid #000; }
.p-terminal .temple .tbar { display: flex; align-items: center; gap: 14px; padding: 4px 8px; background: #aaa; border-bottom: 3px solid #000; font-size: .82rem; }
.p-terminal .temple .tmenu { color: #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-terminal .temple .tgrow { flex: 1; }
.p-terminal .temple .tx { background: #fff; color: #000; border: 2px solid #000; font: inherit; font-weight: 700; line-height: 1; padding: 2px 9px; cursor: pointer; border-radius: 0; }
.p-terminal .temple .tx:hover { background: #ff5; }
.p-terminal .temple .tx:focus-visible { outline: 3px solid #00a; outline-offset: 2px; border-radius: 0; }
.p-terminal .temple .tstage { background: #000; border-bottom: 3px solid #000; line-height: 0; display: flex; justify-content: center; }
.p-terminal .temple .tstage[hidden] { display: none; }
.p-terminal .temple .tstage canvas { width: 100%; max-width: 640px; height: auto; display: block; image-rendering: pixelated; image-rendering: crisp-edges; outline: 0; }
.p-terminal .temple .tscreen { height: min(50vh, 400px); overflow-y: auto; padding: 12px 14px 10px; background: #fff; font-size: .84rem; line-height: 1.5; scrollbar-color: #555 #fff; }
.p-terminal .temple.playing .tscreen { height: 150px; }
.p-terminal .temple .tscreen::-webkit-scrollbar { width: 14px; }
.p-terminal .temple .tscreen::-webkit-scrollbar-track { background: #aaa; }
.p-terminal .temple .tscreen::-webkit-scrollbar-thumb { background: #000; border-radius: 0; border: 0; }
.p-terminal .temple .tscreen p { margin: 0 0 1px; white-space: pre-wrap; word-break: break-word; }
.p-terminal .temple b { font-weight: 700; color: inherit; }
.p-terminal .temple .tk { color: #00a; }
.p-terminal .temple .tc { color: #555; }
.p-terminal .temple .te { color: #a00; }
.p-terminal .temple .tw { color: #a50; }
.p-terminal .temple .tp { color: #00a; font-weight: 700; }
.p-terminal .temple .tgo { color: #00a; font-weight: 700; }
.p-terminal .temple .tno { color: #555; }
.p-terminal .temple .tgod { color: #a0a; font-weight: 700; font-size: 1.5rem; letter-spacing: .06em; }
.p-terminal .temple .talice { color: #a00; background: #ff5; padding: 2px 6px; margin: 4px 0; }
.p-terminal .temple .tal { color: #000; }
.p-terminal .temple .tsw { display: inline-block; width: 22px; height: 14px; border: 1px solid #000; vertical-align: -2px; margin-right: 5px; }
.p-terminal .temple .tswl { display: inline-block; width: 118px; color: #000; }
.p-terminal .temple .tline { display: flex; gap: 8px; align-items: baseline; }
.p-terminal .temple .tline input { flex: 1; min-width: 0; background: #ff5; border: 2px solid #000; border-radius: 0; outline: 0; color: #000; font: inherit; padding: 1px 6px; caret-color: #a00; box-shadow: none; }
.p-terminal .temple .tline input:focus { background: #fff; border-color: #00a; }
.p-terminal .temple .tstatus { background: #000; color: #fff; padding: 5px 10px; font-size: .7rem; letter-spacing: .06em; border-top: 3px solid #000; }
.p-terminal .temple .tstatus b { color: #ff5; }
@media (max-width: 620px) {
  .p-terminal .crt .screen { font-size: .8rem; padding: 14px 14px 8px; }
  .p-terminal .temple .tscreen { font-size: .76rem; height: min(46vh, 320px); }
  .p-terminal .temple .tmenu { font-size: .7rem; }
  .p-terminal .temple .tswl { width: 96px; font-size: .72rem; }
  .p-terminal .temple .tgod { font-size: 1.15rem; }
  .p-terminal .crt .bar span { font-size: .62rem; }
}

.term-notes { margin-top: 40px; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }
.term-note { padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.term-note h2 { font-size: 1.05rem; margin: 0 0 6px; }
.term-note p { margin: 0; color: var(--muted); font-size: .95rem; }
.term-note code { font-family: var(--font-mono); font-size: .86em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; color: var(--text); }

/* ===== 404 =============================================================== */
.p-404 .nf { position: relative; isolation: isolate; overflow: hidden; padding: clamp(56px, 11vw, 128px) 0 clamp(64px, 10vw, 112px); min-height: calc(100vh - var(--header-h) - 120px); display: flex; align-items: center; }
.p-404 .nf-bg { position: absolute; inset: 0; z-index: -2; margin: 0; }
.p-404 .nf-bg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-404 .nf-scrim { position: absolute; inset: 0; z-index: -1; background:
  linear-gradient(180deg, rgba(11, 13, 16, .5), rgba(11, 13, 16, .86)),
  radial-gradient(70% 90% at 15% 35%, rgba(11, 13, 16, .55), rgba(11, 13, 16, 0)); }
.p-404 .nf-code { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .14em; color: var(--accent); margin: 0 0 12px; }
.p-404 h1 { margin: 0 0 16px; max-width: 14ch; }
.p-404 .lead { max-width: 52ch; color: #cdd5de; }
.p-404 .nf-links { margin: 36px 0 0; padding: 0; list-style: none; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); max-width: 980px; }
.p-404 .nf-link {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px; border-radius: var(--radius); height: 100%;
  background: rgba(22, 27, 34, .78); border: 1px solid var(--line-2); color: var(--text); text-decoration: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: transform .25s var(--ease), border-color .25s var(--ease), background .25s var(--ease);
}
.p-404 .nf-link:hover, .p-404 .nf-link:focus-visible { transform: translateY(-3px); border-color: var(--lc, var(--accent)); background: rgba(29, 36, 45, .9); }
.p-404 .nf-link b { font: 600 1.1rem/1.2 var(--font-head); }
.p-404 .nf-link span { color: var(--muted); font-size: .9rem; }
.p-404 .nf-link--nc { --lc: var(--nc); }
.p-404 .nf-link--sg { --lc: var(--sg); }
.p-404 .nf-link--home { --lc: var(--studio); }
.p-404 .nf-credit { margin: 28px 0 0; color: var(--dim); font-size: .85rem; }
@media (prefers-reduced-motion: reduce) { .p-404 .nf-link, .manual-grid .shot { transition: none; } .p-404 .nf-link:hover, .manual-grid .shot:hover { transform: none; } }
