/*
 * The Gotcha! policy site. Tokens, type and spacing come from the design
 * system (app/lib/app/theme/ carries the same values). Light is the
 * fallback; dark follows the device setting. No scripts, no third-party
 * requests: the fonts are the app's own files.
 */

@font-face {
  font-family: "Bowlby One";
  src: url("/fonts/BowlbyOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Archivo";
  src: url("/fonts/Archivo-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("/fonts/SpaceMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Mono";
  src: url("/fonts/SpaceMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Light: the design system's light set, and the fallback. */
:root {
  color-scheme: light dark;
  --surface: #F4EAD5;
  --surface-raised: #FBF5E8;
  --surface-sunken: #EEE3CB;
  --ink: #221B16;
  --ink-muted: #685847;
  --line: #DCCBAB;
  --line-strong: #8A7660;
  --brand: #AD3119;
  --accent: #126B6B;
  --focus: #126B6B;
  --shadow: #1B1714;

  --font-display: "Bowlby One", "Arial Black", sans-serif;
  --font-sans: "Archivo", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 18px;
}

/* Dark: the design system's dark set, when the device asks for it. */
@media (prefers-color-scheme: dark) {
  :root {
    --surface: #1B1714;
    --surface-raised: #27211C;
    --surface-sunken: #120F0D;
    --ink: #F4EAD5;
    --ink-muted: #B8A991;
    --line: #3A312A;
    --line-strong: #857462;
    --brand: #FF6B4F;
    --accent: #3FB6AD;
    --focus: #F2B53A;
    --shadow: #000000;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  overflow-wrap: break-word;
}

/* One column, 16 px gutters, so 320 px wide never scrolls sideways. */
.wrap {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

/* Focus: a 2 px ring in `focus`, 2 px off the element, everywhere. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

.skip {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--surface-raised);
  color: var(--ink);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-md);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* Header: the wordmark and the four pages. */
.site-header {
  border-bottom: 1px solid var(--line);
  padding-block: var(--space-4);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
}

.wordmark {
  display: inline-block;
  line-height: 0;
  border-radius: var(--radius-sm);
}

.wordmark img {
  display: block;
  height: 2.25rem;
  width: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  padding-block: var(--space-1);
  font-weight: 700;
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration-thickness: 3px;
}

/* Type: the design system's scale. */
main {
  padding-block: var(--space-6) var(--space-7);
}

h1 {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.75rem;
  line-height: 2rem;
}

h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: 1.25rem;
  line-height: 1.625rem;
  font-weight: 700;
}

h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 700;
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
}

ul,
ol {
  padding-left: var(--space-5);
}

li + li {
  margin-top: var(--space-2);
}

.lead {
  font-size: 1.125rem;
  line-height: 1.75rem;
}

.muted {
  color: var(--ink-muted);
}

/* Readouts: dates and labels in Space Mono. */
.readout {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.125rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-5);
}

section {
  scroll-margin-top: var(--space-4);
}

/* A raised card with the hard offset shadow, for what matters most. */
.card {
  margin-block: var(--space-6);
  padding: var(--space-4);
  background: var(--surface-raised);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 4px 4px 0 var(--shadow);
}

.card h2 {
  margin-top: 0;
}

.card > :last-child {
  margin-bottom: 0;
}

/* The page links on the home page. */
.page-links {
  list-style: none;
  padding: 0;
}

.page-links li + li {
  margin-top: var(--space-4);
}

.page-links a {
  font-weight: 700;
  font-size: 1.125rem;
}

/* The data table. Wide screens get a table; narrow ones get one card
 * per row, with each cell labelled. The ARIA roles keep it a table for
 * screen readers when the display changes, and the visible labels are
 * hidden from them because the column headers already say it. */
.table-wrap {
  margin-block: var(--space-5);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

caption {
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.5rem;
  padding-bottom: var(--space-2);
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3);
  border-bottom: 1px solid var(--line);
}

/* The design system's `label` style: Archivo 700, 12/16, 0.08em. */
thead th {
  font-weight: 700;
  font-size: 0.75rem;
  line-height: 1rem;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--line-strong);
}

tbody th {
  font-weight: 700;
}

td p {
  margin: var(--space-2) 0 0;
}

.cell-label {
  display: none;
}

@media (max-width: 40rem) {
  table,
  caption,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  tbody tr {
    margin-bottom: var(--space-4);
    background: var(--surface-raised);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius-md);
  }

  th,
  td {
    padding: var(--space-2) var(--space-3);
  }

  tbody th {
    font-size: 1rem;
    line-height: 1.5rem;
    padding-top: var(--space-3);
  }

  tbody td:last-child {
    border-bottom: 0;
    padding-bottom: var(--space-3);
  }

  .cell-label {
    display: block;
    font-weight: 700;
    font-size: 0.75rem;
    line-height: 1rem;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
  }
}

/* Footer. */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: var(--space-5) var(--space-6);
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--ink-muted);
}

.site-footer p {
  margin: 0;
}

@media (min-width: 40rem) {
  h1 {
    font-size: 2.5rem;
    line-height: 2.75rem;
  }

  .card {
    padding: var(--space-5);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .skip {
    transition: transform 0.15s ease-out;
  }
}
