/* WordKept - coming soon.

   A centred, type-only announcement. There is one message and one action, so
   the composition is symmetrical on purpose: the page is a title card, not a
   layout. Hierarchy comes from scale, weight, leading and space alone.

   Both faces are self-hosted. Playfair Display is the display voice the iOS
   app already ships; Karla carries the body. Self-hosting keeps the
   promise the page makes: no third-party request, nothing for anyone else to
   log.

   Contrast ratios in the token block are computed, not estimated. Recompute
   them if you touch a colour: an earlier revision shipped a comment claiming
   4.6:1 on a token that actually measured 4.25:1, and it read as fine. */

@font-face {
  font-family: "Playfair Display";
  font-style: normal;
  font-weight: 400 900;          /* variable: one file covers the range */
  font-display: swap;
  src: url("fonts/playfair-display-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Karla";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/karla-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                 U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark light;

  --bg:         #0B0B0D;
  --surface:    #131316;
  --text:       #F5F2EC;  /* 17.6:1 on --bg */
  --muted:      #A8A29A;  /* 7.77:1 on --bg */
  --faint:      #837D73;  /* 4.82:1 on --bg, 4.55:1 on --surface */
  --gold-text:  #E7C169;  /* 11.5:1 on --bg */
  --gold-fill:  #D6A954;
  --gold-hover: #E3BE72;  /* lighter than fill: hover reads as a lift */
  --on-gold:    #0B0B0B;  /* 9.06:1 on --gold-fill */
  --line:       #26262B;  /* decorative rules only, never a control boundary */
  --field-line: #6A6A73;  /* 3.67:1 on --bg, 3.46:1 on --surface (1.4.11) */
  --ambient:    8%;

  --step--1: clamp(0.8125rem, 0.79rem + 0.11vw, 0.875rem);
  --step-0:  clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --step-1:  clamp(1.0625rem, 1.01rem + 0.28vw, 1.25rem);
  --step-2:  clamp(1.375rem, 1.28rem + 0.48vw, 1.75rem);
  --step-3:  clamp(1.75rem, 1.55rem + 1vw, 2.5rem);
  --step-5:  clamp(2.25rem, 1.6rem + 3.4vw, 5.25rem);

  --gutter: clamp(1.375rem, 1rem + 3vw, 2.5rem);

  --display: "Playfair Display", Georgia, serif;
  --sans: "Karla", ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #F6F5F3;
    --surface:    #FFFFFF;
    --text:       #17161A;  /* 16.5:1 on --bg */
    --muted:      #55524C;  /* 7.15:1 on --bg */
    --faint:      #6E6A63;  /* 4.94:1 on --bg */
    --gold-text:  #7D5B14;  /* 5.71:1 on --bg */
    --gold-fill:  #C79A3E;
    --gold-hover: #B98A2E;  /* darker than fill: same lift, inverted ground */
    --on-gold:    #17161A;  /* 6.97:1 on --gold-fill */
    --line:       #E1DFDA;
    --field-line: #8E8A82;  /* 3.15:1 on --bg */
    --ambient:    11%;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;   /* stop iOS inflating type in landscape */
  -webkit-tap-highlight-color: transparent; /* the button has its own :active */
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

/* One soft light above the title. A flat near-black field reads as absence;
   this gives it somewhere to fall away to. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    58% 42% at 50% -6%,
    color-mix(in srgb, var(--gold-fill) var(--ambient), transparent),
    transparent 70%
  );
}

::selection { background: var(--gold-fill); color: var(--on-gold); }

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

main { flex: 1; }

/* Every section shares one centred column, so the vertical axis never moves.
   The gutter takes the notch into account: on a landscape iPhone the safe-area
   inset is wider than the gutter, and without max() the text runs under it. */
section {
  width: 100%;
  max-width: 43rem;
  margin-inline: auto;
  padding-inline:
    max(var(--gutter), env(safe-area-inset-left))
    max(var(--gutter), env(safe-area-inset-right));
  text-align: center;
}

/* ---------------------------------------------------------- hero */

.hero {
  min-height: 100vh;
  min-height: 100dvh;   /* dvh excludes the mobile address bar; vh is the fallback */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-block: clamp(4rem, 10vw, 7rem);
}

/* A landscape phone is only ~360-430px tall, so the title card has to give up
   its full-viewport height AND its display scale, or the button lands below
   the fold on the one screen where it should be closest to hand. Measured: at
   740x360 the whole hero now ends around 337px. */
@media (orientation: landscape) and (max-height: 560px) {
  .hero {
    min-height: auto;
    padding-block: clamp(2rem, 7vh, 3rem);
  }
  .wordmark { font-size: var(--step-1); }
  .hero h1 {
    margin-top: 1rem;
    font-size: clamp(1.75rem, 5.5vh, 2.5rem);
  }
  .lede {
    margin-top: 0.875rem;
    font-size: var(--step-0);
    max-width: 54ch;
  }
  form { margin-top: 1.25rem; }
  .promise { margin-top: 0.75rem; }
}

/* A logotype, not a label. Deliberately not the small tracked caps that would
   turn it into an eyebrow over the headline. */
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  font-size: var(--step-2);
  letter-spacing: -0.01em;
  color: var(--gold-text);
}

h1 {
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-5);
  line-height: 1.05;         /* leading tightens as size grows, but not to 1.0:
                                at 320px the headline wraps and 1.0 collides */
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  margin-top: clamp(1.375rem, 3vw, 1.875rem);
  max-width: 38ch;
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------------------------------------------------------- form
   Field and action share one capsule and focus as a unit, so the pair reads
   as a single control rather than two objects sitting next to each other. */

form {
  margin-top: clamp(2.25rem, 5vw, 3rem);
  width: 100%;
  max-width: 27rem;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--field-line);
  border-radius: 999px;
  padding: 0.3125rem 0.3125rem 0.3125rem 1.25rem;
}
.field:focus-within { border-color: var(--gold-fill); }

input[type="email"] {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;  /* 44px: the Apple touch-target floor */
  font-family: inherit;
  font-size: 1rem; /* under 16px, iOS Safari zooms the viewport on focus */
  color: var(--text);
  background: none;
  border: 0;
  padding: 0.6875rem 0;
}
input[type="email"]::placeholder { color: var(--faint); opacity: 1; }
input[type="email"]:focus { outline: none; }

button {
  flex: none;
  min-height: 2.75rem;  /* 44px: the Apple touch-target floor */
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--on-gold);
  background: var(--gold-fill);
  border: 0;
  border-radius: 999px;
  padding: 0.6875rem 1.25rem;
  cursor: pointer;
  touch-action: manipulation; /* drops the legacy 300ms tap delay */
}

/* Gated so a tap on a touch screen cannot leave the hover state stuck on. */
@media (hover: hover) {
  button:hover:not([aria-disabled="true"]) { background: var(--gold-hover); }
}

/* Press feedback lives outside the reduced-motion block on purpose. The tap
   highlight is cleared and the scale below is motion-gated, so without this a
   user with Reduce Motion on would get no confirmation of a tap at all. */
button:active:not([aria-disabled="true"]) { background: var(--gold-hover); }

/* aria-disabled rather than the disabled property: a disabled control loses
   focus, and in a one-field form focus is still on the input at submit. */
button[aria-disabled="true"] {
  opacity: 0.55;
  cursor: default;
}

.status-line {
  margin-top: 1rem;
  font-size: var(--step--1);
  line-height: 1.5;
  color: var(--muted);
}
.status-line:empty { display: none; }
.status-line.ok  { color: var(--gold-text); }
.status-line.bad { color: #E38A7A; }  /* 7.67:1 on --bg */

@media (prefers-color-scheme: light) {
  .status-line.bad { color: #96341F; }  /* 6.87:1 on --bg */
}

.promise {
  margin-top: 1rem;
  font-size: var(--step--1);
  color: var(--faint);
}

@media (max-width: 480px) {
  .field {
    flex-direction: column;
    align-items: stretch;
    border-radius: 1.5rem;
    padding: 0.3125rem;
  }
  input[type="email"] { padding: 0.6875rem 1rem; text-align: center; }
  button { width: 100%; padding: 0.75rem 1rem; }
}

/* ---------------------------------------------------------- how it works */

/* One value owns the gap between the hero and the first beat: the beat's own
   top padding. The section adds none. */
.how { padding-block: 0 clamp(4rem, 10vw, 7rem); }

.beats { list-style: none; }

.beat { position: relative; padding-block: clamp(2rem, 5vw, 2.75rem); }

/* Rules group the list; sections are separated by their own border. Its own
   element rather than a border so it can be drawn on approach. */
.beat + .beat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--line);
  transform-origin: center;
}

.beat h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-2);
  line-height: 1.2;
  letter-spacing: -0.022em;
  margin-bottom: 0.625rem;
}

.beat p {
  max-width: 40ch;
  margin-inline: auto;
  color: var(--muted);
  text-wrap: pretty;
}

/* ---------------------------------------------------------- privacy
   This is the argument that earns the email on a privacy-first product, so it
   outranks the how-it-works subheads rather than sitting below them as fine
   print. */

.privacy {
  padding-block: clamp(3.5rem, 9vw, 6rem);
  border-top: 1px solid var(--line);
}

.privacy-lead {
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.026em;
  max-width: 20ch;
  margin-inline: auto;
}

.privacy-body {
  margin-top: 1.375rem;
  max-width: 52ch;
  margin-inline: auto;
  color: var(--muted);
  text-wrap: pretty;
}

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

footer {
  padding-block: 1.75rem max(2.5rem, env(safe-area-inset-bottom));
  padding-inline:
    max(var(--gutter), env(safe-area-inset-left))
    max(var(--gutter), env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: var(--step--1);
  letter-spacing: 0.12em;   /* small text wants tracking opened, not closed */
  text-transform: uppercase;
  color: var(--faint);
}

/* ---------------------------------------------------------- utility */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.trap {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

/* ---------------------------------------------------------- motion
   One authored moment: the title card settles in, in reading order. Below the
   fold the only motion is each rule drawing itself as you reach it, which is
   a different mechanic on purpose rather than the same entrance repeated per
   section. Press feedback lands on pointer-down, never on release. */

@media (prefers-reduced-motion: no-preference) {

  @keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
  }

  @keyframes draw {
    from { transform: scaleX(0); opacity: 0; }
    to   { transform: scaleX(1); opacity: 1; }
  }

  .hero > * { animation: rise 0.8s var(--ease-out) both; }

  .hero > h1    { animation-delay: 0.07s; }
  .hero > .lede { animation-delay: 0.15s; }
  .hero > form  { animation-delay: 0.23s; }

  button, input[type="email"], .field {
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.1s ease-out;
  }
  button:active:not([aria-disabled="true"]) { transform: scale(0.97); }

  @supports (animation-timeline: view()) {
    .beat + .beat::before {
      animation: draw linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 60%;
    }
  }
}

/* ---------------------------------------------------------- environment */

@media (prefers-contrast: more) {
  :root { --muted: var(--text); --faint: var(--text); --ambient: 0%; }
  .field { border-color: var(--text); }
  .beat + .beat::before { background: var(--text); }
}

@media (forced-colors: active) {
  .field { border: 1px solid CanvasText; }
  button { border: 1px solid ButtonText; }
  .beat + .beat::before { background: CanvasText; }
  body::before { display: none; }
}
