/* Signature Tune styles.
   A royal French invitation and a gilded music box. Versailles palette:
   ivory and white surfaces, navy ink, gold and gilt ornament, burgundy accents,
   with soft rose, powder-blue and sage washes. Serif display face (self-hosted
   Cormorant Garamond, OFL) for headings, names, the tagline and the reveal;
   local system sans-serif for controls. 16px minimum body text.
   No web fonts loaded over the network: all font files are local. */

/* Self-hosted Cormorant Garamond (SIL OFL, see fonts/OFL.txt). */
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-500.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-600.woff2") format("woff2");
}
@font-face {
  font-family: "Cormorant Garamond";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-500.woff2") format("woff2");
}

:root {
  --ivory: #FBF6EC;
  --white: #FFFFFF;
  --navy: #1A2238;
  --muted-navy: #4A5270;
  --gold: #8A6D1D;
  --gilt: #C9A227;
  --deep-gilt: #B08D33;
  --burgundy: #6E1423;
  --rose: #E8C8C8;
  --powder: #C9D8E4;
  --sage: #BFC9A8;

  --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;

  --gilt-grad: linear-gradient(180deg, #C9A227 0%, #B08D33 48%, #8A6D1D 100%);

  --max-width: 1140px;
  --radius: 10px;
  --paper-shadow: 0 2px 10px rgba(26, 34, 56, 0.12), 0 16px 44px rgba(26, 34, 56, 0.10);
  --gold-rule: 1px solid rgba(138, 109, 29, 0.55);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  color: var(--navy);
  font-family: var(--sans);
  font-size: 1.1875rem; /* 19px, above the 16px minimum */
  line-height: 1.6;
  padding: 0;
  /* Ivory base with a candlelit hall-of-mirrors wash: soft gilt and pastel
     radial glows over ivory. All colours are approved rgba tints. */
  background-color: var(--ivory);
  background-image:
    radial-gradient(1200px 520px at 50% -140px, rgba(201, 162, 39, 0.16), rgba(201, 162, 39, 0) 70%),
    radial-gradient(760px 520px at 12% 8%, rgba(201, 216, 228, 0.28), rgba(201, 216, 228, 0) 70%),
    radial-gradient(760px 520px at 88% 6%, rgba(232, 200, 200, 0.26), rgba(232, 200, 200, 0) 70%),
    radial-gradient(900px 620px at 50% 108%, rgba(191, 201, 168, 0.22), rgba(191, 201, 168, 0) 72%);
  background-attachment: fixed;
}

/* Candlelit shimmer: a very slow, subtle brightness drift over the washes. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background: radial-gradient(1000px 460px at 50% -120px, rgba(201, 162, 39, 0.14), rgba(201, 162, 39, 0) 68%);
  opacity: 0.6;
  animation: candle 9s ease-in-out infinite alternate;
}
@keyframes candle {
  from { opacity: 0.35; transform: translateY(0); }
  to   { opacity: 0.8;  transform: translateY(-8px); }
}

/* Keyboard access */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--white);
  color: var(--navy);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--gold);
  z-index: 10;
}
.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Visually hidden, but kept available to assistive technology. Used for the
   reveal live region that announces the full message once per playback, so the
   visual letter-by-letter reveal element carries no aria-live. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Keyboard focus ring: a navy outline with a gilt offset ring, kept visually
   distinct from the Burgundy error border so focus and "this field has an
   error" never look the same. Navy on ivory/white clears 3:1; the gilt ring
   sits in the offset gap. The error border stays Burgundy (see the
   aria-invalid rules below), so a focused invalid field shows both: the
   Burgundy border and the navy/gilt focus ring. */
:focus-visible {
  outline: 3px solid var(--navy);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--gold);
}

/* Message shown when JavaScript is off. */
.noscript-note {
  max-width: 60ch;
  margin: 1.5rem auto;
  padding: 1rem 1.25rem;
  background: var(--white);
  border: 1px solid rgba(138, 109, 29, 0.45);
  border-radius: var(--radius);
  color: var(--navy);
}

/* Header: a crowned invitation masthead framed in gold. */
.site-header {
  text-align: center;
  padding: 2.6rem 1rem 1.6rem;
  position: relative;
}
.site-header::after {
  /* A centred gold rule with a lozenge, like an engraved divider. */
  content: "";
  display: block;
  width: min(420px, 72%);
  height: 2px;
  margin: 1rem auto 0;
  background: var(--gilt-grad);
  border-radius: 2px;
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 3.4rem;
  line-height: 1.05;
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--navy);
}
.tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.5rem;
  margin: 0.25rem 0 0;
  color: var(--burgundy);
}

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}
main:focus {
  outline: none;
}

/* A gilded invitation panel wrapping the composer and the hero. */
.screen-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0.25rem 0 0.5rem;
  color: var(--navy);
}
.intro {
  margin: 0 0 1.5rem;
  max-width: 48ch;
  font-size: 1.2rem;
  color: var(--muted-navy);
}
.section-label {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
  margin: 1.5rem 0 0.6rem;
  color: var(--navy);
}
.section-label::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 0.3rem;
  background: var(--gilt-grad);
  border-radius: 2px;
}

/* Hero on the Make screen: a gilt-framed invitation with the music box. */
.make-hero {
  position: relative;
  margin: 0 0 2rem;
  padding: 1.75rem 1.75rem 1.5rem;
  background:
    radial-gradient(520px 260px at 82% 24%, rgba(201, 162, 39, 0.14), rgba(201, 162, 39, 0) 70%),
    var(--white);
  border-radius: var(--radius);
  box-shadow: var(--paper-shadow);
  border: 1px solid rgba(138, 109, 29, 0.35);
  overflow: hidden;
}
/* Double gold rococo frame on the hero, drawn with layered borders. */
.make-hero::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
  border-radius: 8px;
  pointer-events: none;
}
.make-hero::after {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(138, 109, 29, 0.5);
  border-radius: 6px;
  pointer-events: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  align-items: center;
}
@media (min-width: 760px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 2rem;
  }
}
.hero-text .screen-heading { margin-top: 0; }
.hero-art {
  display: flex;
  justify-content: center;
  align-items: center;
}
.music-box-svg {
  width: 100%;
  max-width: 340px;
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 14px rgba(26, 34, 56, 0.18));
}

/* Narrow screens (phones): the hero music box must not push the name input
   below the first screen (R15.17). Shrink the music box strongly, move the art
   below the hero text, and tighten the hero spacing so the maker form, and the
   name input at its top, stay within the first screen at 375x667, 390x844, and
   360x800. The desktop Versailles look is unchanged. */
@media (max-width: 600px) {
  .hero-grid {
    gap: 0.5rem;
  }
  .hero-text { order: 0; }
  .hero-art {
    order: 1;
    max-height: 120px;
  }
  .music-box-svg {
    max-width: 140px;
  }
  .make-hero {
    margin-bottom: 1.25rem;
    padding-top: 1.4rem;
    padding-bottom: 1.1rem;
  }
  .hero-text .intro { margin-bottom: 0; }
}

/* The maker is a single column by default. The "Your card" preview lives inside
   the form, placed after the name, message, sender and full-greeting fields but
   before the Print and Copy actions, so on narrow screens the form stays first
   (the name input is near the top) while the preview still comes before the
   Print action (R15.11, R15.17). */
.make-grid {
  display: block;
}

/* Two-column layout on wide screens: composer on the left, live card preview on
   the right. The form becomes a grid; the fields flow down the left column and
   the preview is pulled into a sticky right column. The desktop Versailles look
   is unchanged. */
@media (min-width: 900px) {
  #make-form {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    column-gap: 3rem;
    align-items: start;
  }
  /* Every form row sits in the left column by default. */
  #make-form > * {
    grid-column: 1;
  }
  /* The preview occupies the right column and anchors to the top, sticky so it
     stays in view while the composer scrolls. A large row span pins it from the
     first row without needing an explicit row template for the variable number
     of form fields. */
  #make-form > .make-right {
    grid-column: 2;
    grid-row: 1 / span 100;
    position: sticky;
    top: 1.5rem;
    align-self: start;
  }
  #make-form > .make-right .section-label {
    margin-top: 0;
  }
}

/* Form */
.field {
  margin: 0 0 1.25rem;
}
label {
  display: block;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--navy);
}
input[type="text"],
textarea {
  width: 100%;
  font-family: var(--sans);
  color: var(--navy);
  background: var(--white);
  border: 1px solid rgba(138, 109, 29, 0.6);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  font-size: 1.125rem;
}
/* The name field (and the cipher-demo input) use the serif display face. This
   selector is `input.name-input` so its specificity (0,1,1) at least matches the
   generic `input[type="text"]` rule above; a bare `.name-input` (0,1,0) loses
   to that rule and the field would fall back to the sans family. */
input.name-input {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  padding: 0.5rem 0.75rem;
}
textarea {
  resize: vertical;
  line-height: 1.5;
}
input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.25);
}
/* A field flagged aria-invalid gets a visible Burgundy highlight: a thicker
   Burgundy border (and a soft ring) so the "highlighted field" the preview
   refers to is clearly marked. This pairs with the Burgundy error text, so the
   status is never shown by colour alone. Burgundy on White clears WCAG AA. */
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--burgundy);
  border-width: 2px;
  box-shadow: 0 0 0 2px rgba(110, 20, 35, 0.25);
}
input[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(110, 20, 35, 0.35);
}
.count {
  margin: 0.3rem 0 0;
  font-size: 1rem;
  color: var(--muted-navy);
}
.warning,
.form-error {
  color: var(--burgundy);
  font-weight: 700;
  margin: 0.4rem 0 0;
}

/* Buttons */
.btn {
  font-family: var(--sans);
  font-size: 1.125rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--gold);
  min-height: 48px;
  min-width: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--navy);
  color: var(--ivory);
  border-color: var(--navy);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.55);
}
.btn-primary:hover {
  background: var(--burgundy);
  border-color: var(--burgundy);
  color: var(--ivory);
}
.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border-color: var(--gold);
}
.btn-secondary:hover {
  background: rgba(201, 162, 39, 0.12);
}
.btn-big {
  font-size: 1.45rem;
  padding: 1rem 2.25rem;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.playback-controls,
.actions,
.reveal-controls,
.play-start {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin: 0.75rem 0;
}

.copy-status {
  color: var(--navy);
  font-weight: 700;
}
.audio-note {
  color: var(--burgundy);
  font-weight: 700;
  margin: 0.5rem 0;
}

/* Tune strip: a gilded stave on white. */
.tune-strip-host {
  border: 1px solid rgba(138, 109, 29, 0.45);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  overflow-x: auto;
  background: var(--white);
  min-height: 80px;
}
.tune-strip-host svg {
  max-width: 100%;
  height: auto;
}
.play-tune-host {
  min-height: 100px;
}

/* Card preview: a white invitation card with a gold edge and a soft shadow. */
.card-host {
  border: 1px solid rgba(138, 109, 29, 0.5);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--white);
  box-shadow: var(--paper-shadow);
  overflow-x: auto;
}
.card-host svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

/* How it works */
.how-it-works {
  margin: 2rem 0;
  border: 1px solid rgba(138, 109, 29, 0.45);
  border-radius: var(--radius);
  padding: 0.5rem 1.25rem;
  background: var(--white);
}
.how-it-works summary {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  padding: 0.6rem 0;
  color: var(--navy);
  cursor: pointer;
}
.how-body h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 1rem 0 0.25rem;
  color: var(--navy);
}
.how-body p {
  margin: 0 0 0.75rem;
  max-width: 56ch;
  color: var(--navy);
}

/* Interactive cipher demo inside How it works. */
.cipher-demo {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(138, 109, 29, 0.4);
  border-radius: var(--radius);
  background: rgba(201, 216, 228, 0.18);
}
.cipher-rows {
  margin: 0.75rem 0;
}
.cipher-row {
  display: flex;
  gap: 1.25rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(138, 109, 29, 0.25);
}
.cipher-letter {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  color: var(--burgundy);
  min-width: 1.5ch;
}
.cipher-note {
  color: var(--navy);
  min-width: 10ch;
}
.cipher-dur {
  color: var(--muted-navy);
}
.cipher-row.is-current {
  background: rgba(110, 20, 35, 0.08);
  border-bottom-color: var(--burgundy);
}
.cipher-row.is-current .cipher-note,
.cipher-row.is-current .cipher-dur {
  color: var(--burgundy);
  font-weight: 600;
}
.cipher-recovered {
  font-weight: 600;
  color: var(--navy);
  margin: 0.5rem 0;
}

/* Full-greeting playback block on the Make screen. */
.full-greeting {
  margin: 1.5rem 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(138, 109, 29, 0.35);
}
.full-greeting-hint {
  color: var(--muted-navy);
  margin: 0 0 0.75rem;
  max-width: 56ch;
}

/* Clipboard fallback: the real link on screen, read-only and selectable. */
.copy-fallback {
  margin-top: 0.75rem;
}
.copy-link-field {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
}

/* Play screen: one invitation card framed in gold, opened by hand. */
.play-card {
  position: relative;
  max-width: 720px;
  margin: 1rem auto;
  background:
    radial-gradient(420px 220px at 50% -40px, rgba(201, 162, 39, 0.12), rgba(201, 162, 39, 0) 70%),
    var(--white);
  border-radius: var(--radius);
  box-shadow: var(--paper-shadow);
  padding: 2.5rem 2.25rem 2.5rem;
  text-align: center;
}
.play-card::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
  border-radius: 8px;
  pointer-events: none;
}
.play-card::after {
  content: "";
  position: absolute;
  inset: 15px;
  border: 1px solid rgba(138, 109, 29, 0.5);
  border-radius: 6px;
  pointer-events: none;
}
.play-for {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--burgundy);
  margin: 0;
}
.play-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 3.6rem;
  line-height: 1.08;
  margin: 0.2rem 0 1.25rem;
  color: var(--navy);
  word-break: break-word;
}
.play-card .tune-strip-host {
  margin: 0 auto 1.25rem;
}
.play-start {
  justify-content: center;
}
.reveal-area {
  margin: 1.5rem 0 0.5rem;
  border-top: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
  padding-top: 1.5rem;
}
.reveal-text {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.1rem;
  line-height: 1.4;
  min-height: 2.6em;
  margin: 0.5rem 0 1rem;
  color: var(--navy);
  word-break: break-word;
}
.reveal-controls {
  justify-content: center;
}
.sing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  font-size: 1rem;
  color: var(--muted-navy);
}
.sing-toggle input {
  width: 1.15rem;
  height: 1.15rem;
}
.play-sender {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.6rem;
  margin: 1.25rem 0 0;
  color: var(--navy);
}
.make-your-own {
  margin-top: 2rem;
}
.text-link {
  color: var(--burgundy);
  font-weight: 700;
}

/* Damaged card screen: calm and centred, same palette. */
.damaged-card {
  max-width: 560px;
  margin: 2rem auto;
  text-align: center;
  background: var(--white);
  border: 1px solid rgba(138, 109, 29, 0.45);
  border-radius: var(--radius);
  box-shadow: var(--paper-shadow);
  padding: 2rem 1.75rem 2.25rem;
}
.torn-illustration {
  margin: 0 auto 1rem;
  max-width: 260px;
}
.torn-illustration svg {
  max-width: 100%;
  height: auto;
}

/* Five parts, one song */
.five-parts {
  margin: 3rem 0 0;
  padding-top: 1.75rem;
  border-top: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
}
.five-parts-intro {
  margin: 0 0 1.25rem;
  max-width: 60ch;
  color: var(--navy);
}
.five-parts-host {
  margin: 0 0 1.5rem;
  overflow-x: auto;
}
.five-parts-host svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 2.25rem 1rem;
  margin-top: 2rem;
  border-top: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
  color: var(--muted-navy);
  font-family: var(--serif);
  font-size: 1.15rem;
}

/* Print-only card holder: hidden on screen, shown only in print. */
.print-card {
  display: none;
}

/* Small screens: keep usable at 320px, large readable type. */
@media (max-width: 480px) {
  .wordmark { font-size: 2.5rem; }
  .tagline { font-size: 1.25rem; }
  .screen-heading { font-size: 2rem; }
  .play-name { font-size: 2.4rem; }
  .play-card { padding: 1.75rem 1.1rem; }
  .reveal-text { font-size: 1.7rem; }
  input.name-input { font-size: 1.6rem; }
  main { padding: 1rem 1rem 2.5rem; }
  /* Keep the hero text at least 16px inside the gold frame (the frame sits at
     inset 8px, so content needs at least 24px of padding from the edge). */
  .make-hero { padding: 1.9rem 1.6rem 1.6rem; }
  .btn { width: 100%; }
  .playback-controls .btn,
  .actions .btn,
  .play-start .btn,
  .reveal-controls .btn { width: 100%; }
  .copy-status { width: 100%; }
  .make-your-own .btn { width: auto; }
}

/* Subtle music-box motion. The drum is drawn side-on, so its outline must stay
   fixed: a 2D rotation would tumble it end over end. Instead, the pin rows sweep
   sideways inside a clip shaped like the drum, which reads as the drum turning,
   and the comb teeth pluck in sequence. */
.music-box-cylinder {
  transform-box: fill-box;
  transform-origin: center;
}
.music-box-pins {
  transform-box: fill-box;
  animation: pin-sweep 6s linear infinite;
}
@keyframes pin-sweep {
  /* The pins alternate a vertical stagger every two columns, so the pattern
     period is two column spacings (2 x 15px = 30px). Sweeping a whole period
     keeps the drum full and makes the end frame identical to the first (R19.1). */
  from { transform: translateX(0); }
  to   { transform: translateX(-30px); }
}
.comb-tooth {
  transform-box: fill-box;
  transform-origin: left center;
  animation: tooth-pluck 2.2s ease-in-out infinite;
}
.comb-tooth:nth-child(2) { animation-delay: 0.0s; }
.comb-tooth:nth-child(3) { animation-delay: 0.18s; }
.comb-tooth:nth-child(4) { animation-delay: 0.36s; }
.comb-tooth:nth-child(5) { animation-delay: 0.54s; }
.comb-tooth:nth-child(6) { animation-delay: 0.72s; }
.comb-tooth:nth-child(7) { animation-delay: 0.90s; }
.comb-tooth:nth-child(8) { animation-delay: 1.08s; }
.comb-tooth:nth-child(9) { animation-delay: 1.26s; }
.comb-tooth:nth-child(10) { animation-delay: 1.44s; }
@keyframes tooth-pluck {
  0%, 82%, 100% { transform: translateY(0); }
  88% { transform: translateY(2.2px) scaleX(0.96); }
  94% { transform: translateY(-1px); }
}

/* Respect reduced motion: nothing animates, but keep everything visible. */
@media (prefers-reduced-motion: reduce) {
  *,
  body::before,
  .music-box-cylinder,
  .music-box-pins,
  .comb-tooth {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  body::before { opacity: 0.5; transform: none; }
}

/* Print: when a card is present (body.has-print-card, set by print-sync.js when
   #print-card holds the current card), show only the finished card and hide
   everything else. Without a card the page prints its own content, so the
   judges page and a card-less maker still print readably. The card SVG uses
   explicit fills, so it prints without background graphics enabled. */
@media print {
  body.has-print-card > *:not(.print-card) {
    display: none !important;
  }
  body.has-print-card::before { display: none !important; }
  body.has-print-card .print-card {
    display: block !important;
    margin: 0;
    padding: 0;
  }
  .print-card svg {
    width: 150mm;
    height: 100mm;
    display: block;
  }
  @page {
    size: landscape;
    margin: 12mm;
  }
}

/* ---------- Judges page ---------- */
.judges {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
}
.judges-lede {
  margin: 0 0 2rem;
}
.judges-section {
  margin: 0 0 2.5rem;
  padding-top: 1.75rem;
  border-top: 2px solid transparent;
  border-image: var(--gilt-grad) 1;
}
.judges-section > p {
  max-width: 68ch;
  color: var(--navy);
}
.section-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  color: var(--navy);
  margin: 0 0 0.75rem;
}
.judges-parts {
  margin: 1.25rem 0 0;
  padding-left: 1.4rem;
  max-width: 72ch;
}
.judges-parts li {
  margin: 0 0 0.75rem;
  color: var(--navy);
}

/* Sample cards */
.samples-host {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0;
}
.sample-card {
  margin: 0;
  padding: 1.25rem;
  background: var(--white);
  border: var(--gold-rule);
  border-radius: var(--radius);
  box-shadow: var(--paper-shadow);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sample-preview svg {
  width: 100%;
  height: auto;
  display: block;
}
.sample-caption {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.sample-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--navy);
  margin: 0;
}
.sample-note {
  margin: 0;
  color: var(--muted-navy);
}
.sample-audio {
  margin-top: 0.3rem;
}
.sample-audio-label {
  margin: 0 0 0.35rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--muted-navy);
}
.sample-audio audio {
  width: 100%;
}
.sample-honest,
.props-honest,
.kiro-honest,
.sample-card .sample-note {
  color: var(--muted-navy);
}
.sample-honest {
  max-width: 68ch;
}

/* Properties table */
.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
}
.props-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--navy);
}
.props-table caption {
  text-align: left;
  color: var(--muted-navy);
  margin-bottom: 0.6rem;
}
.props-table th,
.props-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: var(--gold-rule);
  vertical-align: top;
}
.props-table th[scope="col"] {
  font-weight: 600;
  color: var(--navy);
}
.props-table th[scope="row"] {
  font-weight: 600;
}

.kiro-list {
  margin: 1rem 0;
  padding-left: 1.4rem;
  max-width: 72ch;
}
.kiro-list li {
  margin: 0 0 0.75rem;
  color: var(--navy);
}
.links-list {
  margin: 0.5rem 0;
  padding-left: 1.4rem;
}
.links-list li {
  margin: 0 0 0.5rem;
}
.judges a {
  color: var(--burgundy);
}
/* Button links inside the judges content must keep the button colours. These
   selectors are more specific than `.judges a`, so the ivory-on-navy text wins
   the cascade and the button never falls back to the burgundy link colour. */
.judges a.btn-primary {
  color: var(--ivory);
}
.judges a.btn-primary:hover {
  color: var(--ivory);
}
.judges a.btn-secondary {
  color: var(--navy);
}
.judges a:focus-visible {
  outline: 3px solid var(--burgundy);
  outline-offset: 2px;
}
.props-table code,
.kiro-list code,
.kiro-honest code,
.sample-honest code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* Purpose paragraphs under the introduction */
.purpose {
  max-width: 60ch;
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--navy);
}

/* Primary demo block */
.primary-demo {
  margin: 1rem 0 0;
  font-size: 1.1rem;
  line-height: 1.9;
}
.primary-demo .demo-link {
  font-family: var(--serif);
  font-weight: 600;
}

/* A smaller heading inside a section */
.subsection-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  margin: 1.5rem 0 0.4rem;
  color: var(--navy);
}

/* Screenshots */
.shot {
  margin: 0 0 1.5rem;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 520px;
  border: var(--gold-rule);
  border-radius: 4px;
  background: var(--white);
}
.shot figcaption {
  margin-top: 0.4rem;
  color: var(--muted-navy);
  font-size: 0.95rem;
}
