:root {
  --bg: #F1F1F4;
  --ink: #17171C;
  --muted: #5C5C68;
  --line: #D9D9E0;
  --field: #FFFFFF;
  --red: #E20A17;
  --red-deep: #A80812;
  /* the paper sheets stay light in every theme */
  --paper: #FFFFFF;
  --paper-ink: #17171C;
  --paper-muted: #6A6A76;
  --rule: #D8DCE8;
  --serif: "Bodoni Moda", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111116; --ink: #F4F4F7; --muted: #A6A6B2; --line: #2E2E37; --field: #1A1A21;
  }
}
:root[data-theme="dark"] {
  --bg: #111116; --ink: #F4F4F7; --muted: #A6A6B2; --line: #2E2E37; --field: #1A1A21;
}

* { box-sizing: border-box; margin: 0; }

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--red);
  z-index: 2;
}

.page {
  min-height: 100dvh;
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) clamp(20px, 5vw, 56px) 24px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 32px;
}

/* The logo has dark lettering, so it always sits on a white nameplate */
.brand {
  display: inline-block;
  background: #fff;
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: 0 0 0 1px var(--line);
}
.brand img { display: block; height: auto; width: min(210px, 52vw); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: center;
}

h1 {
  font: 500 clamp(2.7rem, 6.4vw, 5.2rem) / 1.02 var(--serif);
  letter-spacing: -0.01em;
  max-width: 12ch;
  -webkit-text-stroke-width: 0.5px;
    stroke-width: 0.5px;
    -webkit-text-stroke-color: var(--paper-ink);
    stroke: var(--paper-ink);
}
.lead {
  margin-top: 24px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.05rem;
}

/* Notify form */
.notify {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin-top: 32px;
  padding: 6px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.notify:focus-within { outline: 3px solid var(--red); outline-offset: 3px; }
.notify input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
}
.notify input:focus { outline: none; }
.notify button {
  padding: 14px 22px;
  border: 0;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font: 700 0.95rem var(--sans);
  cursor: pointer;
  transition: background 0.2s;
}
.notify button:hover { background: var(--red-deep); }
.notify button:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.msg { min-height: 1.6em; margin-top: 12px; font-size: 0.92rem; color: var(--muted); }
.msg[data-state="ok"] { color: var(--ink); font-weight: 600; }
.msg[data-state="error"] { color: var(--red); font-weight: 600; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Paper stack */
.stage {
  position: relative;
  isolation: isolate;
  width: min(400px, calc(100% - 28px));
  margin-inline: auto;
}
.sheet {
  border-radius: 6px;
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05);
  transform: translate(calc(var(--mx, 0) * var(--d) * 2px), calc(var(--my, 0) * var(--d) * 2px)) rotate(var(--r));
  transition: transform 0.25s ease-out;
  animation: settle 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}
.sheet--cover, .sheet--mid { position: absolute; inset: 0; }
.sheet--cover { background: var(--red); z-index: -3; animation-delay: 0.05s; }
.sheet--mid,
.sheet--top {
  background-color: var(--paper);
  background-image: linear-gradient(transparent 27px, var(--rule) 27px);
  background-size: 100% 28px;
  background-position: 0 4px;
}
.sheet--mid { z-index: -2; animation-delay: 0.2s; }
.sheet--top {
  position: relative;
  padding: 32px 24px 28px 64px;
  animation-delay: 0.35s;
}
.sheet--top::before { /* margin line */
  content: "";
  position: absolute;
  inset: 0 auto 0 48px;
  width: 2px;
  background: rgba(226, 10, 23, 0.5);
}
@keyframes settle {
  from { opacity: 0; transform: translateY(48px) rotate(0deg); }
}

.sheet-title { font: italic 500 1.25rem / 56px var(--serif); color: var(--paper-ink); }
.row { display: flex; align-items: baseline; gap: 12px; height: 56px; }
.num {
  min-width: 2.2ch;
  font: 500 2.7rem / 56px var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--paper-ink);
  -webkit-text-stroke-width: 0.5px;
    stroke-width: 0.5px;
    -webkit-text-stroke-color: var(--paper-ink);
    stroke: var(--paper-ink);
}
.unit { font: 600 0.85rem / 56px var(--sans); color: var(--paper-muted); }
.sheet-date { font: 600 0.82rem / 28px var(--sans); color: var(--paper-muted); }

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  color: var(--muted);
  font-size: 0.85rem;
}
footer nav { display: flex; gap: 20px; }
footer a { color: inherit; text-underline-offset: 3px; }
footer a:hover { color: var(--red); }
a:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 4px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  h1 { max-width: none; }
}
@media (max-width: 480px) {
  .notify { flex-direction: column; }
  .notify input { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; transition: none; }
}
