/* Skanda Robotics — legal documents (privacy.html, terms.html).
 *
 * STANDALONE. These pages deliberately do not load assets/style.css: that
 * sheet pins the body to a non-scrolling fullscreen hero (`overflow: hidden`,
 * `position: fixed` HUD), which is exactly wrong for a long document. The
 * tokens below are copied from it so the two surfaces stay one family.
 *
 * No web fonts, no external anything — the CSP is `default-src 'none'`.
 *
 * Contrast, computed against --bg #0a0a0b (WCAG 2.x, sRGB):
 *   --ink       #f0ebe1            16.7:1  headings, links, body emphasis
 *   --ink-body  cream @ 0.86       12.3:1  body copy            (AA + AAA)
 *   --ink-2     cream @ 0.58        5.9:1  secondary/meta text  (AA only)
 *   --ink-3     cream @ 0.32        2.5:1  RULES ONLY — never text, never focus
 *   --ink-4     cream @ 0.14        1.4:1  hairlines
 *   --flag      #ffb84d            11.5:1  unfilled-placeholder warning
 */

:root {
  --bg: #0a0a0b;
  --bg-raised: #121214;
  --ink: #f0ebe1;
  --ink-body: rgba(240, 235, 225, 0.86);
  --ink-2: rgba(240, 235, 225, 0.58);
  --ink-3: rgba(240, 235, 225, 0.32);
  --ink-4: rgba(240, 235, 225, 0.14);

  /* Deliberate break from the monochrome palette: an unfilled placeholder must
     be impossible to mistake for finished copy. It disappears with the last
     placeholder. */
  --flag: #ffb84d;
  --flag-dim: rgba(255, 184, 77, 0.4);
  --flag-wash: rgba(255, 184, 77, 0.08);

  --pad: clamp(1rem, 3.2vw, 2.5rem);
  /* 1ch is a full advance in monospace, so this is a true ~70-character
     measure: roughly 42em, or 672px at a 16px root. */
  --measure: 70ch;
  --head-h: 3.75rem;

  --mono: ui-monospace, "SFMono-Regular", "SF Mono", "Cascadia Mono", "JetBrains Mono",
          Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --step--1: clamp(0.76rem, 0.72rem + 0.18vw, 0.86rem);
  --step-0: clamp(0.94rem, 0.89rem + 0.24vw, 1.06rem);
  --step-1: clamp(1.02rem, 0.95rem + 0.34vw, 1.2rem);
  --step-2: clamp(1.14rem, 1.02rem + 0.6vw, 1.5rem);
  --step-3: clamp(1.5rem, 1.2rem + 1.6vw, 2.6rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  /* Anchored clauses must clear the sticky header. */
  scroll-padding-top: calc(var(--head-h) + 1rem);
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink-body);
  font-family: var(--mono);
  font-size: var(--step-0);
  /* Monospace at long-form needs more leading than the hero's 1.5, and far
     less tracking — the wide letter-spacing is kept for labels only. */
  line-height: 1.75;
  letter-spacing: 0.01em;
  /* Long URLs and bracketed placeholders must never force a sideways scroll
     on a 280px screen. */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* ── Shared shell ─────────────────────────────────────────────────────────── */

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + var(--pad) * 2);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--bg);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip:focus { left: 0; }

/* ── Focus ────────────────────────────────────────────────────────────────── */

/* Full-strength cream at 16.7:1 against the page — comfortably past the 3:1
   floor for non-text UI, and it stays visible over the flag-coloured banner. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 1px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── Header ───────────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  border-bottom: 1px solid var(--ink-4);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  min-height: var(--head-h);
}

.home {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  min-height: 44px;
  padding-right: 0.5rem;
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.home:hover { text-decoration: underline; text-underline-offset: 0.4em; }

.home__dot {
  width: 0.42em;
  height: 0.42em;
  background: var(--ink);
  border-radius: 50%;
  flex: none;
}

.docnav ul {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.docnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* 44x44 minimum tap target. */
  min-height: 44px;
  min-width: 44px;
  padding-inline: 0.7rem;
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}
.docnav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.4em; }
.docnav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid var(--ink); }

/* ── Document body ────────────────────────────────────────────────────────── */

main { display: block; padding-block: clamp(1.75rem, 5vw, 3.25rem) clamp(2.5rem, 7vw, 5rem); }

h1 {
  font-size: var(--step-3);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: 0.12em;
  color: var(--ink);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

h2 {
  font-size: var(--step-2);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-transform: uppercase;
  margin-bottom: 0.9rem;
}

h3 {
  font-size: var(--step-1);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: var(--ink);
  margin: 1.75rem 0 0.7rem;
}

/* Body-sized on purpose. A fourth level only appears inside 4.3, where it
   labels the parts of one subsection rather than opening a new one — so it
   separates by weight and colour and stays out of the size scale entirely. */
h4 {
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 1.4rem 0 0.5rem;
}

.doc-section { margin-top: clamp(2.25rem, 6vw, 3.5rem); scroll-margin-top: calc(var(--head-h) + 1rem); }

/* A clause arrived at by link marks itself, and not by colour alone — the rule
   thickens and the block indents. */
.doc-section:target { border-left: 2px solid var(--ink); padding-left: 1rem; margin-left: -1rem; }

p { margin-bottom: 1.1em; }
p:last-child, ul:last-child, ol:last-child, dl:last-child { margin-bottom: 0; }

ul, ol { margin: 0 0 1.1em; padding-left: 1.6em; }
li { margin-bottom: 0.5em; }
li > ul, li > ol { margin-top: 0.5em; margin-bottom: 0; }
li::marker { color: var(--ink-3); }

a { color: var(--ink); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

/* Bold, not underlined: an underline here would be indistinguishable from a
   link, and emphasis must not read as navigation. */
strong { font-weight: 700; color: var(--ink); }
abbr { text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
code { font-family: inherit; color: var(--ink); background: var(--bg-raised); padding: 0.05em 0.4em; border: 1px solid var(--ink-4); }
hr { border: 0; border-top: 1px solid var(--ink-4); margin-block: clamp(2rem, 5vw, 3rem); }

/* ── Definition lists ─────────────────────────────────────────────────────── */

.defs { margin-bottom: 1.1em; }
.defs dt {
  color: var(--ink);
  letter-spacing: 0.08em;
  margin-top: 1.2em;
  padding-top: 1.2em;
  border-top: 1px solid var(--ink-4);
}
.defs dt:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.defs dd { margin: 0.4em 0 0; color: var(--ink-body); }

/* Compact key/value strip for the document metadata block. */
.meta { display: grid; gap: 0.6rem 2rem; margin-bottom: clamp(1.5rem, 4vw, 2.25rem); }
.meta > div { display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.meta dt { font-size: var(--step--1); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); min-width: 9em; }
.meta dd { font-size: var(--step--1); letter-spacing: 0.08em; color: var(--ink); }

/* ── Template banner + placeholders ───────────────────────────────────────── */

.banner {
  border: 1px solid var(--flag-dim);
  border-left: 3px solid var(--flag);
  background: var(--flag-wash);
  padding: clamp(1rem, 3vw, 1.5rem);
  margin-bottom: clamp(1.75rem, 5vw, 2.75rem);
}

.banner__title {
  font-size: var(--step--1);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--flag);
  margin-bottom: 0.9em;
}

.banner p { color: var(--ink); }
.banner ul { margin-bottom: 0; }
.banner li { color: var(--ink-body); }

/* An unfilled value. Bracketed in the text as well as coloured, so the warning
   survives greyscale, colour-blindness and print. */
.ph {
  background: var(--flag-wash);
  color: var(--flag);
  border: 1px dashed var(--flag-dim);
  border-radius: 2px;
  padding: 0.05em 0.4em;
  font-size: 0.94em;
  letter-spacing: 0.06em;
}

/* ── Contents ─────────────────────────────────────────────────────────────── */

.toc { border: 1px solid var(--ink-4); padding: clamp(1rem, 3vw, 1.5rem); }
.toc h2 { font-size: var(--step--1); letter-spacing: 0.2em; margin-bottom: 0.5rem; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.toc li { margin: 0; }
.toc a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0.4rem;
  font-size: var(--step--1);
  letter-spacing: 0.06em;
  color: var(--ink-body);
  text-decoration: none;
}
.toc a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.3em; }

/* ── Footer ───────────────────────────────────────────────────────────────── */

.docfoot { border-top: 1px solid var(--ink-4); padding-block: clamp(1.5rem, 4vw, 2.25rem) clamp(2rem, 6vw, 3rem); }
.docfoot ul { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; list-style: none; margin: 0 0 1rem; padding: 0; }
.docfoot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  padding-inline: 0.7rem 0.7rem;
  padding-left: 0;
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}
.docfoot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.4em; }
.docfoot p { font-size: var(--step--1); letter-spacing: 0.1em; color: var(--ink-2); margin: 0; }

/* ── Motion ───────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Narrow / short viewports ─────────────────────────────────────────────── */

@media (max-width: 30rem) {
  .topbar__inner { min-height: 0; padding-block: 0.25rem; }
  .docnav a { padding-inline: 0.55rem; letter-spacing: 0.12em; }
  .meta dt { min-width: 0; width: 100%; }
  .doc-section:target { padding-left: 0.7rem; margin-left: -0.7rem; }
}

/* Landscape phones: a sticky bar would eat a third of the viewport. */
@media (max-height: 26rem) {
  .topbar { position: static; }
  html { scroll-padding-top: 1rem; }
  .doc-section { scroll-margin-top: 1rem; }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

@media print {
  :root { --ink: #000; --ink-body: #000; --ink-2: #333; --ink-3: #999; --ink-4: #ccc; --flag: #7a4a00; }
  html, body { background: #fff; color: #000; font-size: 10.5pt; }
  .topbar { position: static; border-bottom: 1px solid #000; }
  .skip, .toc, .docnav { display: none; }
  .banner { border: 2px solid #7a4a00; background: none; }
  .ph { background: none; border: 1px solid #7a4a00; }
  h1, h2, h3, h4 { break-after: avoid; }
  .doc-section { break-inside: auto; }
  a { color: #000; }
}
