@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --ground: #ffffff;
  --ink: #111111;
  --quiet: #6b6b6b;      /* 5.3:1 on white */
  --field: #8c8c8c;      /* field border, 3.3:1 on white */
  --error: #8a1c1c;

  --gutter: clamp(1.5rem, 8vw, 9rem);
  --block: 21.25rem;     /* 340px: form width, block measure */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-calm: cubic-bezier(0.25, 0.1, 0.25, 1);

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Public Sans", "Helvetica Neue", Arial, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  caret-color: var(--ink);
}

::selection { background: var(--ink); color: var(--ground); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
  transition: text-decoration-color 200ms ease, color 200ms ease;
}
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-color: currentColor; color: var(--ink); }
}

:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- Page: one screen ---------- */

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
  touch-action: manipulation;
}

.letter {
  align-self: center;
  width: 100%;
  max-width: var(--block);
  padding-block: 3.5rem 2.5rem;
}

/* ---------- Logo ---------- */

.logo {
  display: block;
  width: clamp(12.5rem, 18vw + 2rem, 16.875rem);   /* ~200px phone, 270px desktop */
  margin: 0 0 3.5rem;
  color: var(--ink);
}
.logo img { display: block; width: 100%; height: auto; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Statement ---------- */

.statement {
  margin: 0;
  font-size: 1.1875rem;   /* 19px */
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.status {
  margin: 0.375rem 0 0;
  color: var(--quiet);
}

/* ---------- Request access ---------- */

.access { margin-top: 4rem; }

.access__line { margin: 0 0 1rem; }

.field {
  display: block;
  width: 100%;
  height: 3rem;
  margin: 0 0 0.75rem;
  padding: 0 1rem;
  border: 1px solid var(--field);
  border-radius: 0;
  background: var(--ground);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;        /* 16px: no zoom on iOS */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 200ms ease;
}
.field::placeholder { color: var(--quiet); opacity: 1; }
.field:focus { outline: none; border-color: var(--ink); }
.field:focus-visible { outline: 1px solid var(--ink); outline-offset: 0; }
.field[aria-invalid="true"] { border-color: var(--error); }
.field:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 40px var(--ground) inset;
  -webkit-text-fill-color: var(--ink);
}

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 3rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ground);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ink); color: var(--ground); }
}
.button:active { transform: scale(0.98); }
.button:focus-visible { outline-offset: 3px; }
.button[disabled] { cursor: progress; }
.button__label { transition: opacity 200ms ease, filter 200ms ease; }
[data-state="sending"] .button__label { opacity: 0.55; }

.privacy {
  margin: 1rem 0 0;
  font-size: 0.78125rem;  /* 12.5px */
  color: var(--quiet);
}

.status-msg {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  min-height: 1.3em;
}
.status-msg:empty { display: none; }
[data-state="error"] .status-msg { color: var(--error); }

/* Thank-you replaces the fields in place */
.thanks {
  margin: 0;
  display: none;
}
.thanks:focus { outline: none; }
[data-state="done"] .fields { display: none; }
[data-state="done"] .thanks { display: block; }
[data-state="done"] .status-msg { display: none; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

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

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem 1.5rem;
  font-size: 0.75rem;
  color: var(--quiet);
}
.footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer a { text-decoration-color: transparent; }

/* ---------- Motion: one quiet entrance ---------- */

@media (prefers-reduced-motion: no-preference) {
  .enter {
    animation: enter 900ms var(--ease-calm) both;
  }
  .enter:nth-child(1) { animation-delay: 100ms; }
  .enter:nth-child(2) { animation-delay: 220ms; }
  .enter:nth-child(3) { animation-delay: 340ms; }
  .footer.enter { animation-delay: 500ms; }
  @keyframes enter {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
  .thanks { animation: settle 500ms var(--ease-calm) both; }
  @keyframes settle {
    from { opacity: 0; filter: blur(2px); }
    to   { opacity: 1; filter: blur(0); }
  }
}
@media (prefers-reduced-motion: reduce) {
  .enter { animation: fade 400ms ease both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- Later: own photograph beside the letter ----------
   Add class "has-visual" to .page and a <figure class="visual"> with the image
   after the .letter block. On wide screens the photo takes the right half. */
.visual { display: none; }
@media (min-width: 64rem) {
  .page.has-visual {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--gutter);
    padding-right: 0;
  }
  .page.has-visual .visual {
    display: block;
    grid-row: 1 / span 2;
    grid-column: 2;
    margin: 0;
    height: 100svh;
    position: sticky;
    top: 0;
  }
  .page.has-visual .visual img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .page.has-visual .footer { grid-column: 1; }
}

/* ---------- Legal pages ---------- */

.legal-page { min-height: 100svh; padding-inline: var(--gutter); display: grid; grid-template-rows: auto 1fr auto; }
.legal-head { padding-block: 2.5rem 0; }
.legal-head .logo { width: 10rem; margin: 0; }
.legal { max-width: 38rem; padding-block: 4rem 5rem; }
.legal h1 { margin: 0 0 2.5rem; font-size: 1.1875rem; font-weight: 400; }
.legal h2 { margin: 2.25rem 0 0.5rem; font-size: 0.9375rem; font-weight: 600; }
.legal p, .legal address { margin: 0 0 1rem; font-style: normal; }
.todo { background: #f1f1ef; padding: 0.05em 0.3em; }

/* Long legal text (privacy policy) */
.legal--long { max-width: 42rem; line-height: 1.6; overflow-wrap: anywhere; }
.legal--long h2 { margin-top: 3rem; scroll-margin-top: 1.5rem; }
.legal--long h3 { margin: 1.75rem 0 0.5rem; font-size: 0.9375rem; font-weight: 400; color: var(--quiet); }
.legal--long ul { margin: 0 0 1.25rem; padding-left: 1.1rem; }
.legal--long li { margin: 0 0 0.5rem; }
.legal--long li::marker { color: var(--quiet); }
.legal--long ul.index { list-style: none; padding-left: 0; }
.legal--long ul.index li { margin-bottom: 0.25rem; }
.legal--long strong { font-weight: 600; }
.legal--long .seal { margin-top: 3rem; font-size: 0.75rem; color: var(--quiet); }
