/* legal.css — shared styles for Privacy, Terms, Contact (E-MB Helper) */

/* ---- Self-hosted fonts (Latin subset, font-display: swap) ----------------
   Paths are relative to this stylesheet (marketing/legal/legal.css), so they
   step up one level into marketing/assets/fonts/. Editorial mode (the default
   on every legal page) uses IBM Plex Sans / Serif / Mono; the JetBrains Mono
   and Fraunces faces back the alternate console / bureaucratic modes declared
   in legal-modes.css.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/ibm-plex-serif-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/ibm-plex-serif-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: italic; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/ibm-plex-serif-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: italic; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/ibm-plex-serif-latin-500-italic.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal; font-weight: 600; font-display: swap;
  src: url('../assets/fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/fraunces-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic; font-weight: 500; font-display: swap;
  src: url('../assets/fonts/fraunces-latin-500-italic.woff2') format('woff2');
}

:root {
  --bg: #fff8ec;
  --bgAlt: #fbf1de;
  --ink: #1a3a2e;
  --inkSoft: #3a5a4e;
  --muted: #6e7a6e;
  --rule: #dccfb1;
  --surface: #ffffff;
  --accent: #c9622e;
  --accentInk: #fff8ec;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: var(--accentInk); }

a { color: inherit; text-decoration: none; }

.mono {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-feature-settings: 'tnum';
}

.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width: 720px) { .wrap { padding: 0 20px; } }

.eyebrow {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- Nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid var(--rule);
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-weight: 560;
  letter-spacing: -.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
  color: var(--inkSoft);
}

.nav-links a:hover { color: var(--ink); }

/* Install pill — moved here from the inline style= on the nav anchor */
.nav-install {
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 8px 16px;
  border-radius: 999px;
  transition: border-color .15s, color .15s;
}
.nav-install:hover { color: var(--ink); border-color: var(--ink); }

@media (max-width: 880px) { .nav-links { display: none; } }

/* ---- Page frame ---- */

main.legal {
  padding: 80px 0 96px;
}

@media (max-width: 720px) {
  main.legal { padding: 56px 0 72px; }
}

.legal-header {
  max-width: 720px;
  margin: 0 auto 48px;
}

.legal-header .eyebrow { margin-bottom: 14px; }

.legal-header h1 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: clamp(40px, 5.6vw, 64px);
  line-height: 1.02;
  font-weight: 520;
  letter-spacing: -.024em;
  color: var(--ink);
  text-wrap: balance;
}

.legal-header h1 em {
  font-family: 'IBM Plex Serif', serif;
  font-style: italic;
  font-weight: 480;
  color: var(--accent);
}

.legal-header .meta {
  margin-top: 18px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--muted);
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.legal-header .meta span::before {
  content: "·";
  margin-right: 18px;
  color: var(--rule);
}
.legal-header .meta span:first-child::before { content: ""; margin: 0; }

/* ---- Body layout: TOC sidebar + content ---- */

.legal-body {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  align-items: start;
}

@media (max-width: 880px) {
  .legal-body { grid-template-columns: 1fr; gap: 32px; }
}

.toc {
  position: sticky;
  top: 96px;
  align-self: start;
  border-left: 1px solid var(--rule);
  padding-left: 18px;
}

@media (max-width: 880px) {
  .toc {
    position: static;
    border-left: none;
    border-top: 1px solid var(--rule);
    padding: 18px 0 0;
  }
}

.toc .eyebrow { margin-bottom: 16px; display: block; }

.toc ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
  counter-reset: toc;
}

.toc a {
  font-size: 13.5px;
  color: var(--inkSoft);
  line-height: 1.4;
  display: block;
  transition: color .15s;
}

.toc a:hover { color: var(--ink); }

.toc .num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  margin-right: 10px;
}

.content {
  max-width: 680px;
}

.content section {
  padding: 32px 0 36px;
  border-top: 1px solid var(--rule);
}

.content section:first-of-type { padding-top: 0; border-top: none; }

.content h2 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 26px;
  line-height: 1.18;
  font-weight: 520;
  letter-spacing: -.014em;
  color: var(--ink);
  margin-bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.content h2 .num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--accent);
  font-weight: 400;
  letter-spacing: .02em;
  flex-shrink: 0;
  width: 32px;
}

.content h3 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 16px;
  font-weight: 540;
  color: var(--ink);
  margin: 22px 0 8px;
}

.content p {
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--inkSoft);
  margin-bottom: 14px;
  text-wrap: pretty;
  max-width: 60ch;
}

.content p:last-child { margin-bottom: 0; }

.content a {
  color: var(--ink);
  border-bottom: 1px solid var(--accent);
  transition: background .15s;
}

.content a:hover {
  background: color-mix(in oklab, var(--accent) 15%, transparent);
}

.content ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 14px;
}

.content ul li {
  font-size: 15px;
  line-height: 1.55;
  color: var(--inkSoft);
  padding-left: 22px;
  position: relative;
}

.content ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 10px;
  height: 1px;
  background: var(--accent);
}

.content .callout {
  background: var(--bgAlt);
  border-left: 3px solid var(--accent);
  padding: 18px 22px;
  margin: 18px 0;
  border-radius: 2px;
}

.content .callout p {
  font-size: 14.5px;
  color: var(--ink);
  margin: 0;
}

.content .callout .label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

/* ---- Identity card (contact page) ---- */

.identity-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 28px 30px;
  margin-top: 18px;
  max-width: 480px;
}

.identity-card .row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 14.5px;
}

.identity-card .row:last-child { border-bottom: none; }

.identity-card .row .k {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 1px;
}

.identity-card .row .v {
  color: var(--ink);
  line-height: 1.5;
}

.identity-card .row .v.placeholder {
  color: var(--muted);
  font-style: italic;
}

/* Email link inside the identity card — moved here from inline style= */
.identity-mail {
  border-bottom: 1px solid var(--accent);
}

.mailto-block {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #d97757;
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  margin: 8px 0 18px;
  transition: background .15s;
  border-bottom: none !important;
}

.mailto-block:hover {
  background: #c2613f;
  color: #fff;
}

.mailto-block svg { flex-shrink: 0; }

/* ---- Footer ---- */

footer.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0 48px;
  margin-top: 48px;
}

footer.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 16px;
}

footer.site-footer .links {
  display: flex;
  gap: 18px;
}

footer.site-footer .links a {
  color: var(--muted);
  transition: color .15s;
}

footer.site-footer .links a:hover { color: var(--ink); }

footer.site-footer .links a.current { color: var(--ink); }

/* ---- Responsive type ---- */

@media (max-width: 560px) {
  .content h2 { font-size: 22px; }
  .content h2 .num { width: 28px; font-size: 12px; }
  .content p { font-size: 15px; }
}

/* ---- Mobile portrait (<= 480px) — full responsive polish ---- */

@media (max-width: 480px) {
  html, body { overflow-x: hidden; }

  .wrap { padding: 0 16px; }

  .nav .wrap { height: 56px; }
  .brand-name { font-size: 14px; }

  /* Stick the Install button on its own line if needed; allow wrap */
  .nav-links {
    display: none; /* match the 880px rule but enforce on small */
  }

  main.legal { padding: 40px 0 56px; }

  .legal-header { margin-bottom: 32px; }
  .legal-header h1 { font-size: clamp(28px, 9vw, 40px); line-height: 1.06; }

  .legal-body { gap: 24px; }

  /* TOC is helpful but takes a lot of room; show as a small block */
  .toc {
    margin-top: 16px;
    padding: 14px 0 0;
  }
  .toc ol { gap: 8px; }
  .toc a { font-size: 13px; }

  .content section { padding: 24px 0 28px; }
  .content h2 {
    font-size: 20px;
    gap: 10px;
    align-items: flex-start;
  }
  .content h2 .num { width: 24px; font-size: 11px; padding-top: 4px; }
  .content p { font-size: 14.5px; line-height: 1.6; }
  .content ul li { font-size: 14px; }

  .content .callout { padding: 14px 16px; margin: 14px 0; }

  /* Identity card: stack key/value vertically */
  .identity-card { padding: 20px 18px; max-width: 100%; }
  .identity-card .row {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
    font-size: 14px;
  }
  .identity-card .row .k { padding-top: 0; }

  .mailto-block {
    width: 100%;
    justify-content: center;
    padding: 14px 18px;
    min-height: 44px;
    box-sizing: border-box;
  }

  footer.site-footer {
    padding: 32px 0 36px;
    margin-top: 32px;
  }
  footer.site-footer .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  footer.site-footer .links { flex-wrap: wrap; gap: 14px; }
}

/* ---- Touch target enforcement (mobile) ---- */
@media (max-width: 720px) {
  .nav-links a,
  .toc a,
  .content a {
    /* Links inside paragraphs are inline — keep them; only enforce on
       primary navigation/TOC anchors. */
  }
  .nav-links > a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* ---- Density-aware mobile readability tweaks ---- */
@media (max-width: 480px) {
  html[data-density="compact"] .legal-header h1 {
    font-size: clamp(26px, 8vw, 36px);
  }
  html[data-density="roomy"] .legal-header { margin-bottom: 36px; }
}
