/* ---------------------------------------------------------------------------
   Lamplight, on the web.

   The app's surface (Roommates/Shared/Lamplight.swift) in a stylesheet, so the
   privacy policy and terms read as part of the app rather than as a generic
   legal page bolted to the side of it. Three things carry over verbatim:

     • The palette is OKLCH, not hex — same numbers as Lamplight's `Color.mode`
       pairs, so a hue is a hue in both places. Browsers have shipped oklch()
       since 2023; a hex fallback sits above each one for anything older.
     • Schibsted Grotesk for everything readable, Martian Mono for eyebrows —
       the same static per-weight cuts the app bundles, converted to woff2.
     • Light and dark are peers, chosen by the reader's system.
--------------------------------------------------------------------------- */

/* ---- Type ---------------------------------------------------------------- */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/SchibstedGrotesk-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/SchibstedGrotesk-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/SchibstedGrotesk-SemiBold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/fonts/SchibstedGrotesk-Bold.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/MartianMono-Medium.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ---- Palette ------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --page:      #F6F1E8;
  --surface:   #FFFDF8;
  --raised:    #F0EADE;
  --ink:       #221D16;
  --ink2:      #6B6153;
  --ink3:      #756C5E;
  --hairline:  rgba(52, 38, 18, 0.11);
  --hairline-strong: rgba(52, 38, 18, 0.20);

  /* The Overview tab's amber — the app's own "home" hue. */
  --accent:      oklch(0.58 0.13 68);
  --accent-wash: oklch(0.58 0.13 68 / 0.10);
  --accent-edge: oklch(0.58 0.13 68 / 0.22);

  --radius: 16px;
  --measure: 68ch;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page:      #191510;
    --surface:   #221D17;
    --raised:    #2B251E;
    --ink:       #F7F1E5;
    --ink2:      #B0A695;
    --ink3:      #968B79;
    --hairline:  rgba(247, 240, 228, 0.09);
    --hairline-strong: rgba(247, 240, 228, 0.16);

    --accent:      oklch(0.80 0.13 78);
    --accent-wash: oklch(0.80 0.13 78 / 0.12);
    --accent-edge: oklch(0.80 0.13 78 / 0.26);
  }
}

/* ---- Base ---------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* The lamplight wash: one soft pool of the accent at the top of the page,
   the same gesture the app draws behind its tab shell. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 60vh;
  pointer-events: none;
  background: radial-gradient(ellipse 120% 100% at 50% 0%,
                              var(--accent-wash), transparent 70%);
  z-index: 0;
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 40px 24px 96px;
}

/* ---- Masthead ------------------------------------------------------------ */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 52px;
  text-decoration: none;
  color: inherit;
  width: fit-content;
}
.brand .icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--accent);
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
}
.brand strong { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }

.eyebrow {
  font-family: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(30px, 6vw, 40px);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0 0 12px;
}

.meta {
  font-size: 14px;
  color: var(--ink3);
  margin: 0 0 34px;
}

.lede {
  font-size: 19px;
  line-height: 1.55;
  color: var(--ink2);
  margin: 0 0 40px;
}

/* ---- Sections ------------------------------------------------------------ */

h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 52px 0 14px;
  scroll-margin-top: 24px;
}
h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 30px 0 8px;
}

p { margin: 0 0 16px; }
p:last-child { margin-bottom: 0; }

ul { padding-left: 0; margin: 0 0 16px; list-style: none; }
li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 11px;
}
li::before {
  content: "";
  position: absolute;
  left: 4px; top: 0.68em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}
li:last-child { margin-bottom: 0; }

strong { font-weight: 600; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
}
a:hover { text-decoration-thickness: 2px; }

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

/* ---- Contents ------------------------------------------------------------ */

.toc {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px 22px;
  margin-bottom: 8px;
}
.toc-title {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink3);
  margin: 0 0 12px;
}
.toc ol {
  margin: 0; padding: 0;
  list-style: none;
  counter-reset: toc;
  columns: 2;
  column-gap: 28px;
}
.toc li {
  padding-left: 26px;
  margin-bottom: 8px;
  break-inside: avoid;
  font-size: 15px;
}
.toc li::before {
  counter-increment: toc;
  content: counter(toc);
  position: absolute;
  left: 0; top: 0;
  width: auto; height: auto;
  border-radius: 0;
  background: none;
  opacity: 1;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--ink3);
  line-height: 1.9;
}
.toc a { color: var(--ink); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 560px) {
  .toc ol { columns: 1; }
}

/* ---- At-a-glance table --------------------------------------------------- */

.glance {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin: 0 0 8px;
}
.glance-head {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--accent-wash);
}
.glance-head p {
  margin: 6px 0 0;
  font-size: 14.5px;
  color: var(--ink2);
}
.glance-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  min-width: 460px;
  /* Fixed layout so the "what" column can't be squeezed into one word per
     line by a long sentence in the column beside it. */
  table-layout: fixed;
}
th:nth-child(1), td:nth-child(1) { width: 23%; }
th:nth-child(2), td:nth-child(2) { width: 40%; }
th:nth-child(3), td:nth-child(3) { width: 37%; }
td em { font-style: normal; color: var(--ink3); }
th {
  text-align: left;
  font-family: "Martian Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink3);
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  color: var(--ink2);
}
td:first-child { color: var(--ink); font-weight: 500; }
tr:last-child td { border-bottom: none; }

/* ---- Callout ------------------------------------------------------------- */

.callout {
  border: 1px solid var(--accent-edge);
  background: var(--accent-wash);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 24px 0;
}
.callout p { font-size: 15.5px; }
.callout .label {
  font-family: "Martian Mono", ui-monospace, monospace;
  font-weight: 500;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 7px;
}

/* ---- Contact ------------------------------------------------------------- */

.contact {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 22px;
  margin-top: 20px;
}
.contact a { font-weight: 500; }

/* ---- Footer -------------------------------------------------------------- */

.footer {
  margin-top: 72px;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
  font-size: 14px;
}
.footer a { color: var(--ink2); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }
.footer .spacer { flex: 1 1 auto; }
.footer .copyright { color: var(--ink3); font-size: 13px; }

/* ---- Print --------------------------------------------------------------- */

@media print {
  body::before { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .wrap { max-width: none; padding: 0; }
  .toc, .footer { display: none; }
  .glance, .callout, .contact { border: 1px solid #ccc; background: none; }
  a { color: #000; }
  h2 { page-break-after: avoid; }
}
