/*
 * The legal pages' stylesheet (docs/design/screens.md §13): their layout,
 * the policy text and the navy footer. Their nav comes from site.css.
 *
 * Hand-written, deliberately. This file shares nothing with the React app:
 * no Tailwind, no shadcn, none of the app's CSS variables. The values below
 * come from the brand palette in docs/design/foundation.md, restated here so
 * the site can never drift because someone retuned an app token.
 */

:root {
  --navy-deep: #081a38;
  --ink: #0b2149;
  --ink-soft: #5c6f8a;
  --muted: #f1f6fa;
  --rule: #dde6ef;
  --on-navy-quiet: #9db2ce;
  --link: #0b6fbf;

  --font-wordmark: "Vollkorn", Georgia, serif;
  /* Section titles (--font-marketing-heading; screens.md §13). */
  --font-heading: "Crimson Text", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  --gutter: 56px;
  --measure: 1240px;
  --nav-height: 78px;
}

@media (max-width: 900px) {
  :root {
    --gutter: 32px;
  }
}

@media (max-width: 600px) {
  :root {
    --gutter: 20px;
  }
}

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

html {
  scroll-behavior: smooth;
  /* The nav is fixed only in spirit; anchors still need to clear it. */
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  /* A marketing page that scrolls sideways on a phone is a broken one. */
  overflow-x: hidden;
  /* Nav, main, footer stack top to bottom and main takes whatever is
     left, so a short page (a draft legal page is one line) still puts
     the footer at the bottom of the viewport instead of mid-screen. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

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

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid #0ea5f0;
  outline-offset: 3px;
  border-radius: 4px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo__mark {
  width: 18px;
  height: 25px;
  flex: none;
}

.logo__word {
  font-family: var(--font-wordmark);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: #fff;
}

/* ---------------------------------------------------------------- footer */

.footer {
  background: var(--navy-deep);
  padding: 40px var(--gutter) 44px;
}

.footer__inner {
  max-width: var(--measure);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.footer__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer__links {
  display: flex;
  align-items: center;
  gap: 26px;
}

.footer__link {
  font-size: 14px;
  color: var(--on-navy-quiet);
  text-decoration: none;
}

.footer__link:hover {
  color: #fff;
}

.footer__rule {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.footer__fine {
  font-size: 13px;
  color: var(--on-navy-quiet);
}

.footer .logo__word {
  color: #f2f7fb;
}

/* The phone frame stacks the lockup over the links. */
@media (max-width: 600px) {
  .footer__row--top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer__links {
    flex-wrap: wrap;
    gap: 12px 24px;
  }
}

/* ---------------------------------------------------------------------------
 * Legal pages: /privacy and /terms.
 *
 * Long-form text rather than a landing page, so the measure narrows to
 * something readable and the table of contents sits above the body on a
 * phone and beside it from 1000px up.
 * ------------------------------------------------------------------------ */

.legal {
  padding: 56px var(--gutter) 96px;
}

.legal__inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: grid;
  gap: 40px;
  grid-template-columns: minmax(0, 1fr);
}

.legal__head {
  grid-column: 1 / -1;
}

.legal__title {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 44px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.legal__dates {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.legal__dates span + span {
  margin-left: 8px;
}

.legal__pending {
  margin: 16px 0 0;
  max-width: 52ch;
  color: var(--ink-soft);
  font-size: 17px;
  line-height: 1.6;
}

.legal__toc {
  align-self: start;
  padding: 20px 22px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--muted);
}

.legal__toc-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.legal__toc-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 15px;
}

.legal__toc-link {
  color: var(--link);
  text-decoration: none;
}

.legal__toc-link:hover {
  text-decoration: underline;
}

.legal__body {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  /* An anchored heading clears the fixed nav instead of hiding under it. */
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

.legal__body h2 {
  margin: 40px 0 12px;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: -0.01em;
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

.legal__body h3 {
  margin: 28px 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.legal__body p,
.legal__body li {
  margin: 0 0 14px;
  max-width: 68ch;
}

.legal__body ul,
.legal__body ol {
  margin: 0 0 14px;
  padding-left: 22px;
}

.legal__body a {
  color: var(--link);
}

.legal__body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 20px;
  font-size: 15px;
}

.legal__body th,
.legal__body td {
  border: 1px solid var(--rule);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

@media (min-width: 1000px) {
  .legal__inner {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 48px;
  }

  .legal__toc {
    position: sticky;
    top: calc(var(--nav-height) + 24px);
  }
}

@media (max-width: 900px) {
  .legal {
    padding: 32px var(--gutter) 64px;
  }

  .legal__title {
    font-size: 32px;
  }

  .legal__body {
    font-size: 16px;
  }
}

/* A policy is something people print and file. */
@media print {
  .nav,
  .footer,
  .legal__toc,
  .legal__pending {
    display: none !important;
  }

  .legal {
    padding: 0;
  }

  .legal__body {
    font-size: 11pt;
    line-height: 1.5;
    color: #000;
  }

  .legal__body h2 {
    /* Never leave a heading stranded at the foot of a page. */
    break-after: avoid;
    page-break-after: avoid;
  }

  .legal__body a {
    color: #000;
    text-decoration: underline;
  }

  /* Print the destination of any link that leaves the page. */
  .legal__body a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
  }
}
