/* Cervus, one page. Tokens first; everything below uses them. */

@font-face {
  font-family: "Marcellus";
  src: url("/fonts/marcellus-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* Colour: warm near-black, bone, silver, one accent. */
  --ink: #0e0d0b;
  --surface: #171512;
  --rule: #2b2722;
  --edge: #8a8274;      /* input border, 3:1 or better on ink */
  --bone: #eee8dd;
  --stone: #a8a094;
  --rut: #d9672e;       /* accent: button, 12 o'clock tick and focus only */
  --rut-hi: #e87a40;
  --alert: #ff9b7a;
  --metal: linear-gradient(100deg, #fdfdfe 0%, #b3b9c2 26%, #f3f4f6 48%, #8c929c 72%, #e9ebef 100%);

  /* Space: 4px steps. */
  --s1: 0.25rem;
  --s2: 0.5rem;
  --s3: 0.75rem;
  --s4: 1rem;
  --s6: 1.5rem;
  --s8: 2rem;
  --s12: 3rem;
  --s16: 4rem;
  --s24: 6rem;

  /* Type. */
  --display: "Marcellus", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --step-0: 1.0625rem;
  --step-1: 1.1875rem;
  --step-sm: 0.875rem;
  --step-display: clamp(2.75rem, 0.6rem + 4.6vw, 6rem);

  --radius: 2px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html { -webkit-text-size-adjust: 100%; background: var(--ink); }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font: 400 var(--step-0) / 1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--rut-hi); }
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--rut-hi);
  outline-offset: 3px;
}

img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.skip {
  position: absolute;
  left: var(--s4);
  top: -4rem;
  padding: var(--s3) var(--s4);
  min-height: 2.75rem;
  background: var(--bone);
  color: var(--ink);
  z-index: 10;
}
.skip:focus { top: var(--s4); }

/* Page frame */

.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  max-width: 90rem;
  margin-inline: auto;
  padding: var(--s6) var(--s6) var(--s6);
}

@media (min-width: 880px) {
  .page { padding: var(--s12) var(--s16) var(--s8); }
}

.masthead { padding-bottom: var(--s6); }
.name { display: inline-block; line-height: 0; padding-block: var(--s3); margin-block: calc(var(--s3) * -1); }
.name img { width: 9.8rem; height: auto; }

/* Home: atmosphere, the dial, then the copy. */

.home { --dial: min(calc(100vw - 3rem), 40svh); }

.atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(120% 95% at 72% 52%, transparent 38%, rgba(0, 0, 0, 0.6) 100%);
}
.atmos::before {
  content: "";
  position: absolute;
  right: -28vmax;
  top: 50%;
  width: 96vmax;
  height: 96vmax;
  margin-top: -48vmax;
  background: radial-gradient(closest-side, rgba(217, 103, 46, 0.24), rgba(132, 74, 32, 0.11) 46%, transparent 72%);
  animation: drift 28s ease-in-out infinite alternate;
  will-change: transform;
}
.atmos::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/grain.svg") 0 0 / 256px 256px;
  opacity: 0.06;
}

.plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
  animation: plate-in 1800ms var(--ease) both;
}
/* Keeps the left, where the words are, dark enough to read. */
.shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(14, 13, 11, 0.86) 0%, rgba(14, 13, 11, 0.55) 40%, rgba(14, 13, 11, 0) 72%),
    linear-gradient(0deg, rgba(14, 13, 11, 0.7) 0%, rgba(14, 13, 11, 0) 30%);
}

.home .page {
  position: relative;
  z-index: 1;
  max-width: none;
  overflow: clip;
}
.home .masthead { padding-bottom: 0; position: relative; z-index: 2; }
.home .name img { width: clamp(10rem, 7rem + 7vw, 14rem); }

.home .stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: end;
  gap: var(--s8);
  padding-block: var(--s6) var(--s8);
}

.dial {
  position: relative;
  width: var(--dial);
  aspect-ratio: 1;
  margin-inline: auto;
  animation: dial-in 1600ms var(--ease) both;
}
.dial > img { position: absolute; inset: 0; width: 100%; height: 100%; }
.seconds { position: absolute; inset: 0; animation: tick 60s steps(60) infinite; }
.seconds img { width: 100%; height: 100%; }

.emblem {
  position: absolute;
  left: 31%;
  width: 38%;
  top: 50%;
  transform: translateY(-51%);
}
.emblem img {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 1.5rem 2.25rem rgba(0, 0, 0, 0.6));
}
/* A slow band of light crosses the metal, clipped to the emblem's own shape. */
.emblem::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.9) 50%, transparent 60%) 200% 0 / 300% 100% no-repeat;
  -webkit-mask: url("/assets/emblem-mask.svg") center / contain no-repeat;
  mask: url("/assets/emblem-mask.svg") center / contain no-repeat;
  animation: glint 11s var(--ease) 2.2s infinite;
}

.copy { position: relative; z-index: 1; }
.copy > * { max-width: 40rem; }
.copy > h1 { max-width: none; }

h1 {
  margin: 0;
  font: 400 var(--step-display) / 0.98 var(--display);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  text-wrap: balance;
}
.metal {
  background: var(--metal);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.lede {
  margin: var(--s6) 0 0;
  max-width: 40ch;
  color: var(--stone);
  font-size: var(--step-1);
  line-height: 1.55;
  text-wrap: pretty;
}

@media (min-width: 880px) {
  .home { --dial: min(88svh, 58vw); }
  .home .stage { padding-block: var(--s12) var(--s16); }
  .dial {
    position: absolute;
    right: calc(var(--dial) * -0.13);
    top: 46%;
    translate: 0 -50%;
    margin: 0;
  }
  .lede { max-width: 36ch; }
}

@media (min-width: 880px) and (max-height: 800px) {
  .home .stage { padding-block: var(--s6) var(--s12); }
}

/* Sign up */

.notify { margin-top: var(--s8); }

.notify > label,
.trap { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.row { display: flex; max-width: 32rem; }

input[type="email"] {
  flex: 1 1 auto;
  min-width: 0;
  height: 3.75rem;
  padding: 0 var(--s6);
  background: rgba(23, 21, 18, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--bone);
  border: 1px solid var(--edge);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  font: inherit;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease);
}
input[type="email"]::placeholder { color: var(--stone); opacity: 1; }
input[type="email"]:hover { border-color: var(--bone); }
input[type="email"]:focus { border-color: var(--bone); background: rgba(23, 21, 18, 0.9); }
input[type="email"][aria-invalid="true"] { border-color: var(--alert); }
input[type="email"]:disabled { opacity: 0.6; }

button {
  position: relative;
  flex: 0 0 auto;
  height: 3.75rem;
  min-width: 9rem;
  padding: 0 var(--s8);
  background: linear-gradient(180deg, #e67c3f 0%, #cd5e26 100%);
  color: var(--ink);
  border: 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0.75rem 2rem -0.75rem rgba(217, 103, 46, 0.6);
  font: 600 var(--step-0) / 1 var(--body);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter 180ms var(--ease), transform 120ms var(--ease);
}
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

/* Loading: the label holds its width, a ring turns on top. */
button[aria-busy="true"] { cursor: progress; opacity: 1; }
button[aria-busy="true"] .label { visibility: hidden; }
button[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--ink);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.note {
  margin: var(--s3) 0 0;
  max-width: 32rem;
  color: var(--stone);
  font-size: var(--step-sm);
  line-height: 1.5;
}

.status {
  min-height: 1.5rem;
  margin: var(--s3) 0 0;
  max-width: 32rem;
  font-size: var(--step-sm);
  line-height: 1.5;
}
.status[data-kind="error"] { color: var(--alert); }
.status[data-kind="ok"] { color: var(--bone); }
.status:not(:empty) { animation: settle 320ms var(--ease) both; }

/* Footer */

.foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2) var(--s8);
  padding-top: var(--s6);
  border-top: 1px solid var(--rule);
  color: var(--stone);
  font-size: var(--step-sm);
}
.foot p { margin: 0; }
.foot ul { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s6); margin: 0; padding: 0; list-style: none; }
.foot a { display: inline-flex; align-items: center; min-height: 2.75rem; }

/* Touch: links in running text get a 44px target too. */
@media (pointer: coarse) {
  .note a,
  .back a { display: inline-flex; align-items: center; min-height: 2.75rem; }
}

/* Privacy page */

.prose { max-width: 40rem; padding-block: var(--s12) var(--s16); }
.prose h1 { margin-bottom: var(--s8); }
.prose h2 { margin: var(--s12) 0 var(--s2); font: 600 var(--step-0) / 1.4 var(--body); }
.prose p { margin: 0 0 var(--s4); color: var(--stone); line-height: 1.7; }
.prose p a { color: var(--bone); }
.prose .back { margin-top: var(--s12); }

/* Motion: named animations, all off for reduced motion. */

@keyframes plate-in {
  from { opacity: 0; }
  to { opacity: 0.95; }
}
@keyframes dial-in {
  from { opacity: 0; scale: 0.96; }
  to { opacity: 1; scale: 1; }
}
@keyframes tick { to { transform: rotate(360deg); } }
@keyframes glint {
  0%, 62% { background-position: 200% 0; }
  100% { background-position: -100% 0; }
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-4vmax, 3vmax, 0) scale(1.08); }
}
@keyframes settle {
  from { opacity: 0; transform: translateY(0.25rem); }
  to { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .plate { display: none; }
  .atmos { background: linear-gradient(90deg, rgba(14, 13, 11, 0.86), rgba(14, 13, 11, 0.2)), url("/media/cervus-hero-poster.jpg") center / cover; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  button[aria-busy="true"]::after { animation-duration: 1500ms !important; animation-iteration-count: infinite !important; }
}

@media (forced-colors: active) {
  .metal { background: none; -webkit-text-fill-color: currentColor; color: CanvasText; }
}
