/* Offline Luxury — two colours, nothing else.
   The design lives in spacing and tracking, not in letterforms. */

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

:root {
  --ink:   #12110F;                 /* off-black, warmed */
  --paper: #F4F2EC;                 /* off-white, warmed */

  /* The site sits on off-black. */
  --fg: var(--paper);
  --bg: var(--ink);

  /* Off-white on off-black needs a touch more presence than the reverse —
     light-on-dark hairlines read thinner than they measure. */
  --hair: color-mix(in srgb, var(--fg) 26%, transparent);
  --mute: color-mix(in srgb, var(--fg) 52%, transparent);

  --pad: clamp(20px, 4.5vw, 48px);
  --stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue",
           Helvetica, Arial, sans-serif;

  color-scheme: dark;
}

/* The lockout page is the same two colours, inverted. Nothing else changes —
   the site going pale is the whole signal that it has shut. */
[data-invert] {
  --fg: var(--ink);
  --bg: var(--paper);
  --hair: color-mix(in srgb, var(--fg) 22%, transparent);
  --mute: color-mix(in srgb, var(--fg) 48%, transparent);
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--stack);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* lvh, never dvh/svh: it is the only unit that never resolves shorter than
     what is actually on screen, and it does not resize as the mobile toolbar
     retracts. See reference_mobile_viewport_units. */
  min-height: 100vh;
  min-height: 100lvh;

  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- timer -- */

.timer {
  flex: none;
  padding: var(--pad) var(--pad) 0;
  display: flex;
  justify-content: center;
}

.timer__value {
  font-size: clamp(1.15rem, 2.8vw, 1.6rem);
  font-weight: 300;
  /* Big tracked figures need less air than small ones, or the pairs stop
     reading as a single value. */
  letter-spacing: 0.2em;
  /* Tabular figures, or the countdown jitters horizontally every tick. */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: color-mix(in srgb, var(--fg) 80%, transparent);
  /* Compensate the trailing letter-space so the value is optically centred. */
  margin-right: -0.2em;
  transition: color .5s ease;
}

/* The last ten seconds: full contrast, and a slow breath so it catches the
   eye without ever becoming an alarm. Killed by the reduced-motion rule. */
.timer__value[data-state="urgent"] {
  color: var(--fg);
  animation: timer-breathe 1s ease-in-out infinite;
}

.timer__value[data-state="done"] {
  font-size: clamp(0.8rem, 1.8vw, 0.95rem);
  letter-spacing: 0.28em;
  margin-right: -0.28em;
  color: var(--mute);
}

@keyframes timer-breathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: .5; }
}

/* ----------------------------------------------------------------- main -- */

main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* The address form is tall enough to overflow a laptop window. Plain
     `center` would then clip the top of it PAST the scroll origin, putting the
     first field permanently out of reach. `safe` falls back to flex-start the
     moment the content stops fitting. */
  justify-content: safe center;
  gap: clamp(36px, 7vh, 72px);
  padding: clamp(28px, 6vh, 64px) var(--pad);
  text-align: center;
}

.wordmark {
  margin: 0;
  font-size: clamp(1.9rem, 8.5vw, 4.75rem);
  font-weight: 200;
  line-height: 1;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  margin-right: -0.17em;
}

.lede {
  margin: 0;
  max-width: 30ch;
  font-size: clamp(0.95rem, 2.4vw, 1.15rem);
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.02em;
  text-wrap: balance;
}

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--mute);
  margin-right: -0.3em;
}

/* -------------------------------------------------------------- actions -- */

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(12px, 2.4vw, 18px);
}

.btn {
  appearance: none;
  display: inline-block;
  border: 1px solid var(--hair);
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1.15em 2.6em;
  margin-right: -0.24em;          /* optical centring of the tracked label */
  cursor: pointer;
  transition: background-color .35s ease, color .35s ease, border-color .35s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn[disabled] { opacity: .38; pointer-events: none; }

/* ----------------------------------------------------------------- form -- */

.form {
  width: min(100%, 30rem);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 3.4vh, 30px);
  text-align: left;
}

.field { display: flex; flex-direction: column; gap: 0.7em; }

.field__label {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--mute);
}

.field__input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  line-height: 1.6;
  padding: 0.35em 0 0.6em;
  transition: border-color .3s ease;
}

textarea.field__input { resize: none; min-height: 5.4em; }

.field__input::placeholder { color: color-mix(in srgb, var(--fg) 30%, transparent); }
.field__input:focus { outline: none; border-bottom-color: var(--fg); }

/* Native date chrome is the one thing that will not obey a two-colour rule. */
.field__input::-webkit-calendar-picker-indicator {
  filter: grayscale(1);
  opacity: .45;
  cursor: pointer;
}
.field__input::-webkit-calendar-picker-indicator:hover { opacity: 1; }

/* `appearance: none` strips the native arrow along with the native chrome, so
   the chevron has to come back as a background image. Hard-coded to the paper
   colour rather than a token: a data URI cannot read a custom property, and
   this control only ever appears on the off-black ground. */
select.field__input {
  cursor: pointer;
  padding-right: 1.6em;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 8"><path d="M1 1.5l5 5 5-5" fill="none" stroke="%23F4F2EC" stroke-width="1.3"/></svg>');
  background-repeat: no-repeat;
  background-position: right 1px center;
  background-size: 11px auto;
}

/* The open dropdown is drawn by the OS on Windows and Linux and inherits
   nothing useful — without this the options are off-white on off-white. */
select.field__input option {
  background: var(--ink);
  color: var(--paper);
}

/* -------------------------------------------------------- suggestions -- */

.suggest {
  list-style: none;
  margin: 0.55em 0 0;
  padding: 0;
  border: 1px solid var(--hair);
}

/* No results, no empty box. */
.suggest:empty { display: none; }

.suggest li + li { border-top: 1px solid var(--hair); }

.suggest button {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 300;
  line-height: 1.45;
  padding: 0.7em 0.85em;
  cursor: pointer;
}

.suggest button:hover,
.suggest button:focus-visible {
  background: var(--fg);
  color: var(--bg);
  outline: none;
}

.suggest .suggest__sub {
  display: block;
  font-size: 0.78rem;
  color: var(--mute);
}

.suggest button:hover .suggest__sub,
.suggest button:focus-visible .suggest__sub {
  color: inherit;
  opacity: .7;
}

.form__note {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.7;
  letter-spacing: 0.04em;
  color: var(--mute);
}

.form__hint {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.03em;
  color: var(--mute);
}

.form__actions { display: flex; justify-content: flex-start; }

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

.foot {
  flex: none;
  padding: 0 var(--pad) var(--pad);
  display: flex;
  justify-content: center;
}

.foot a {
  color: var(--mute);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  margin-right: -0.26em;
  transition: color .3s ease;
}

.foot a:hover, .foot a:focus-visible { color: var(--fg); }

/* --------------------------------------------------- short viewports -- */

/* A landscape phone leaves ~375px of height. At the default rhythm the Submit
   button lands below the fold — which, with a 59 second clock running, is the
   worst possible thing to hide. Tighten the vertical spacing instead of asking
   the reader to scroll for it. Keyed on height, not width: a phone in landscape
   is wider than any sensible mobile breakpoint. */
@media (max-height: 620px) {
  main {
    gap: clamp(18px, 3.5vh, 32px);
    padding-block: clamp(14px, 3vh, 28px);
  }
  .timer { padding-top: clamp(12px, 2.5vh, 24px); }
  .foot  { padding-bottom: clamp(12px, 2.5vh, 24px); }

  /* The enlarged clock costs height the form does not have here. */
  .timer__value { font-size: clamp(1rem, 2.2vw, 1.2rem); }

  .form { gap: clamp(12px, 2.2vh, 22px); }
  textarea.field__input { min-height: 3.1em; }

  .wordmark { font-size: clamp(1.6rem, 6.5vw, 3.25rem); }
  .btn { padding: 0.95em 2.2em; }
}

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

[hidden] { display: none !important; }

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

::selection { background: var(--fg); color: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
