/* ===========================================================================
   Legal document stylesheet — uncommonweather.com
   ===========================================================================

   The 53 documents under /legal/ are hash-recorded in an append-only ledger:
   their bytes are quoted in acceptance receipts already issued to real users,
   so not one of them can be edited. They were authored expecting a stylesheet
   at /styles.css and a mark at /assets/uncommon-weather-mark-{32,64}.png. On
   the v3 deploy those paths 404'd, which is why every terms page, privacy
   policy and product schedule — the pages the App Store, Chrome Web Store and
   Gumroad link to — rendered as raw unstyled HTML with a broken image.

   So this file is written to fit the markup they already contain, rather than
   the markup being changed to fit a new design. It is the one lever that moves
   all 53 without touching a hashed byte.

   Their markup is genuinely good: .legal-hero, .legal-layout > .legal-copy +
   .legal-nav, .eyebrow, .lead, .legal-meta. It only ever needed dressing.
   =========================================================================== */

/* --- Fonts: the same faces the rest of the site serves --------------------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/fraunces-var.woff2') format('woff2');
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 100%;
  font-display: swap;
  src: url('/assets/fonts/archivo-var.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/plex-mono-400.woff2') format('woff2');
}

:root {
  --bg-0: #080806;
  --bg-1: #0e0d0b;
  --bg-2: #161411;
  --ink-0: #eaeef4;
  --ink-1: rgba(234, 238, 244, 0.72);
  --ink-2: rgba(234, 238, 244, 0.54);
  --line: rgba(234, 238, 244, 0.10);
  --line-strong: rgba(234, 238, 244, 0.18);
  --teal: #79a8a3;
  --copper: #cf9663;
  --copper-bright: #e2ad78;

  --font-display: 'Fraunces', Georgia, serif;
  --font-ui: 'Archivo', system-ui, -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;

  --shell: 74rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

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

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

/* Anchored headings must clear the sticky header when jumped to. */
[id] { scroll-margin-top: 6rem; }

body {
  background: var(--bg-0);
  color: var(--ink-0);
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

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

::selection { background: #2c4d4a; color: var(--ink-0); }

.shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* --- Header ---------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 0.9rem;
  max-width: none;
  background: color-mix(in srgb, var(--bg-0) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
/* .nav is also .shell, so re-apply the measure to its contents via padding. */
.nav > * { max-width: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
}
.brand img { width: 34px; height: 34px; }
.brand-lockup {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  font-weight: 560;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
}
.brand-lockup small {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 400;
}

.nav-links { display: flex; gap: clamp(1rem, 2.5vw, 2.25rem); }
.nav-links a {
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 480;
  color: var(--ink-1);
  letter-spacing: 0.02em;
  transition: color 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-links a:hover { color: var(--ink-0); }
.nav-links a.active {
  color: var(--ink-0);
  border-bottom: 1px solid var(--teal);
  padding-bottom: 2px;
}

/* --- Document hero --------------------------------------------------------- */
.legal-hero {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 1.25rem;
}
.legal-hero h1 {
  font-family: var(--font-display);
  font-weight: 380;
  font-size: clamp(2.25rem, 1.3rem + 3.4vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.015em;
  margin: 0;
}
.legal-hero .lead {
  max-width: 44ch;
  margin: 1.5rem 0 0;
  font-size: 1.1875rem;
  color: var(--ink-1);
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.5rem;
  margin-top: 2rem;
}
.legal-meta span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-top: 0.55rem;
  border-top: 1px solid var(--line-strong);
  min-width: 10rem;
}

/* --- Two-column reading layout --------------------------------------------- */
.legal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 15rem;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

.legal-copy { max-width: 68ch; }

.legal-copy h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 3.25rem 0 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--line);
}
.legal-copy h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.legal-copy h3 {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1.0625rem;
  margin: 2rem 0 0.5rem;
}

.legal-copy p { margin: 0 0 1.15rem; color: var(--ink-1); }
.legal-copy p strong { color: var(--ink-0); font-weight: 600; }

.legal-copy ul, .legal-copy ol { margin: 0 0 1.15rem; padding-left: 1.25rem; color: var(--ink-1); }
.legal-copy li { margin-bottom: 0.5rem; }

.legal-copy a {
  color: var(--ink-0);
  text-decoration: underline;
  text-decoration-color: var(--teal);
  text-underline-offset: 3px;
  transition: text-decoration-color 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.legal-copy a:hover { text-decoration-color: var(--copper-bright); }

.legal-copy table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.9375rem;
}
.legal-copy th, .legal-copy td {
  text-align: left;
  padding: 0.7rem 0.9rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-1);
}
.legal-copy th {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 400;
}

.legal-copy code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-2);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  overflow-wrap: anywhere;
}

/* --- Section index --------------------------------------------------------- */
.legal-nav {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-left: 1.5rem;
  border-left: 1px solid var(--line);
  font-size: 0.875rem;
}
.legal-nav strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.9rem;
}
.legal-nav a {
  text-decoration: none;
  color: var(--ink-1);
  padding-block: 0.4rem;
  transition: color 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
.legal-nav a:hover { color: var(--copper-bright); }

/* --- Footer ---------------------------------------------------------------- */
.footer {
  padding-block: clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.footer a { color: var(--ink-1); text-decoration: none; }
.footer a:hover { color: var(--copper-bright); }
.footer p { margin: 0.4rem 0; }

/* --- Redirect stubs -------------------------------------------------------- */
/* /legal/terms.html and friends are one-line meta-refresh documents. A reader
   with JS or refresh disabled lands on a bare link, so give it a landing. */
body > p:only-child {
  max-width: 34rem;
  margin: 20vh auto;
  padding-inline: var(--gutter);
  text-align: center;
  font-size: 1.125rem;
}
body > p:only-child a { color: var(--copper-bright); }

/* --- Narrow screens -------------------------------------------------------- */
@media (max-width: 62rem) {
  .legal-layout { grid-template-columns: minmax(0, 1fr); }
  .legal-nav {
    position: static;
    order: -1;
    padding: 1.25rem 1.5rem;
    border-left: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--bg-1);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.2rem 1rem;
  }
  .legal-nav strong { grid-column: 1 / -1; }
}
@media (max-width: 34rem) {
  .nav { padding-block: 0.75rem; }
  .nav-links { width: 100%; justify-content: space-between; gap: 0.75rem; }
}

/* --- Print ------------------------------------------------------------------ */
/* People print and archive legal documents. Give them a clean black-on-white
   copy with the section index and chrome removed, and expand link targets so a
   paper copy is still verifiable. */
@media print {
  :root { --ink-0: #000; --ink-1: #1a1a1a; --ink-2: #555; --line: #ccc; }
  body { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.5; }
  .nav, .legal-nav { display: none; }
  .shell { max-width: none; padding: 0; }
  .legal-hero { border-bottom: 1px solid #ccc; padding-block: 0 1.25rem; }
  .legal-copy { max-width: none; }
  .legal-copy h2 { break-after: avoid; page-break-after: avoid; border-top: 1px solid #ccc; }
  .legal-copy p, .legal-copy li { orphans: 3; widows: 3; }
  .legal-copy a { text-decoration: none; color: #000; }
  .legal-copy a[href^='http']::after { content: ' (' attr(href) ')'; font-size: 9pt; color: #555; }
  .footer { border-top: 1px solid #ccc; text-transform: none; }
}
