:root {
  --bg: #F8F7F4;
  --ink: #1C1C1A;
  --ink-soft: #6B6A64;
  --accent: #1A4BFF;
  --accent-dark: #0F35CC;
  --accent-deep: #10307F;
  --tag: #00875A;
  --ui: 'Space Grotesk', sans-serif;
  --display: 'Fraunces', serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-deep); }

@keyframes wordIn {
  0%   { opacity: 0; transform: translateY(14px) rotate(-0.6deg); filter: blur(4px); }
  100% { opacity: 1; transform: translateY(0) rotate(0deg); filter: blur(0); }
}

/* ---------- shell ---------- */

.page {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 32px;
}

.header {
  width: 100%;
  max-width: 900px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: auto;
}

.brand {
  margin: 0;
  font-weight: 700;
  font-size: clamp(20px, 3vw, 26px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tagline {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
}

.badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 5px 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------- word ---------- */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  max-width: 880px;
  width: 100%;
  padding: 60px 0;
}

.wordline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.28em;
  margin: 0 0 28px;
  animation: wordIn 0.5s var(--ease);
}

.singular {
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(24px, 4vw, 44px);
  letter-spacing: -0.01em;
  color: var(--ink-soft);
}

.plural {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(56px, 12vw, 132px);
  line-height: 0.95;
  /* Handoff says -0.02em; all-caps Fraunces 900 collides at that tracking. */
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.notice-line {
  margin: 24px 0 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}

/* `display: flex` beats the [hidden] UA rule, so opt out explicitly. */
.wordline[hidden], .share[hidden], .notice-line[hidden] { display: none; }

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

.action { margin-bottom: 40px; }

.primary {
  font-family: inherit;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.01em;
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 20px 44px;
  cursor: pointer;
  text-transform: uppercase;
  transition: transform 0.15s ease, background 0.15s ease;
}

.primary:hover { background: var(--accent-dark); transform: translateY(-2px); }
.primary:active { transform: translateY(0) scale(0.98); }
.primary[disabled] { opacity: 0.55; cursor: progress; transform: none; }

.share {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 40px;
}

.share a {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
}

.share a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- admin ---------- */

.admin {
  width: 100%;
  max-width: 620px;
  margin-bottom: auto;
}

.admin-title {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(36px, 7vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 48px 0 8px;
}

.admin-sub {
  margin: 0 0 40px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
}

.field { display: block; margin-bottom: 24px; }

.label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

.input {
  width: 100%;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1.5px solid var(--ink);
  padding: 6px 0;
  transition: border-color 0.15s ease;
}

.input::placeholder { color: #C4C2BA; }
.input:focus { outline: none; border-bottom-color: var(--accent); }

.input--mono { font-family: var(--ui); font-size: 17px; letter-spacing: 0.04em; }
.input--big { font-weight: 900; font-size: 32px; letter-spacing: -0.02em; }

.hint { margin: 8px 0 0; font-size: 13px; color: var(--ink-soft); }

.notice {
  font-size: 14px;
  font-weight: 600;
  padding: 12px 16px;
  margin-bottom: 28px;
}

.notice--ok { background: var(--tag); color: var(--bg); }
.notice--bad { background: #B3261E; color: var(--bg); }
.notice[hidden] { display: none; }

.admin-bar {
  width: 100%;
  max-width: 620px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  border-top: 1.5px solid var(--ink);
  margin-top: 56px;
  padding-top: 16px;
}

.linkbtn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: none;
  border: none;
  border-bottom: 1.5px solid transparent;
  padding: 0;
  cursor: pointer;
}

.linkbtn:hover { color: var(--accent); border-bottom-color: var(--accent); }

.wordlist { list-style: none; margin: 0; padding: 0; }

.wordlist li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #E2E0D8;
}

.wordlist .pair { font-family: var(--display); font-size: 18px; }
.wordlist .pair b { font-weight: 900; }
.wordlist .meta { font-size: 13px; color: var(--ink-soft); white-space: nowrap; }

/* ---------- print: "dela old school" ---------- */

/* The tear-off tabs exist only on paper. */
.tearoffs { display: none; }

@media print {
  @page { size: A4 portrait; margin: 14mm; }

  html, body { background: #fff; }

  /* Heading, subheading, word pair, tear-offs. Nothing else. */
  .badge, .action, .share, .notice-line { display: none !important; }

  .page {
    min-height: 0;
    height: calc(297mm - 28mm);
    padding: 0;
    display: flex;
    flex-direction: column;
  }

  .header {
    max-width: none;
    margin: 0;
    padding-bottom: 6mm;
    border-bottom: 1.5pt solid var(--ink);
    flex-wrap: nowrap;
  }

  .brand { font-size: 20pt; }
  .tagline { font-size: 10pt; margin-top: 2mm; }

  .stage {
    flex: 1;
    max-width: none;
    padding: 0;
    justify-content: center;
  }

  .wordline {
    margin: 0;
    animation: none;
    /* Long words must not run off the sheet. */
    max-width: 100%;
  }

  .singular { font-size: 16pt; }
  .plural { font-size: 60pt; line-height: 0.92; }

  .tearoffs {
    display: flex;
    align-items: stretch;
    /* .page centres its children, so the row needs to be told to span. */
    width: 100%;
    align-self: stretch;
    /* Tall enough for the whole URL set sideways at 8pt. */
    height: 44mm;
    border-top: 1pt dashed var(--ink);
    margin-top: 8mm;
  }

  .tearoff {
    flex: 1 1 0;
    min-width: 0;
    border-left: 1pt dashed var(--ink);
    /* Sideways down the tab. No rotate() here: transforming the box would
       carry the dashed divider over to the wrong edge. */
    writing-mode: vertical-rl;
    /* Grid centring is writing-mode agnostic; text-align alone would leave the
       line box parked at block-start, i.e. hugging the tab's right edge. */
    display: grid;
    place-items: center;
    white-space: nowrap;
    padding: 2mm 0;
    font-family: var(--ui);
    font-size: 8pt;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ink);
  }

  .tearoff:first-child { border-left: none; }
}
