/* Small Raffle — harvest-hall paper, terracotta, and bowl-of-slips */

:root {
  --paper: #f3e6d0;
  --paper-deep: #e8d4b5;
  --card: #fbf6ec;
  --ink: #2a1f16;
  --ink-soft: #5c4636;
  --muted: #7a624e;
  --line: #d4b896;
  --terracotta: #c14a20;
  --terracotta-deep: #9a3514;
  --terracotta-soft: #e8b6a0;
  --sage: #3e5c4a;
  --sage-soft: #d7e4d8;
  --gold: #c9a04a;
  --gold-soft: #f3e4b8;
  --error: #8b2e1f;
  --error-bg: #f8e4dc;
  --focus: #c14a20;
  --shadow: 0 18px 40px -24px rgba(42, 31, 22, 0.45);
  --radius: 18px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-ui: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --space: clamp(1rem, 2vw, 1.5rem);
}

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

/* Author display rules must not override the hidden attribute. */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1.05rem;
  line-height: 1.5;
  background:
    radial-gradient(ellipse 80% 45% at 50% -8%, rgba(193, 74, 32, 0.12), transparent 55%),
    radial-gradient(ellipse 40% 30% at 100% 100%, rgba(62, 92, 74, 0.1), transparent 50%),
    linear-gradient(180deg, #f7edd9 0%, var(--paper) 40%, #ead6b6 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(42, 31, 22, 0.08) 3px),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(42, 31, 22, 0.04) 4px);
  mix-blend-mode: multiply;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--card);
  border-radius: 8px;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

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

.site-header {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem var(--space) 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.logo {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  box-shadow: 0 8px 18px -12px rgba(42, 31, 22, 0.6);
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.tagline {
  margin: 0.2rem 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem var(--space) 2.5rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(20rem, 26rem) minmax(0, 1fr);
    align-items: start;
  }
}

.panel {
  position: relative;
  background: var(--card);
  border: 1px solid rgba(212, 184, 150, 0.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup {
  padding: 1.4rem 1.35rem 1.2rem;
}

.stage {
  min-height: 28rem;
  padding: 1.6rem 1.4rem 1.5rem;
  background:
    linear-gradient(180deg, rgba(62, 92, 74, 0.06), transparent 30%),
    var(--card);
}

.panel-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-lede {
  margin: 0 0 1.2rem;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.field {
  margin-bottom: 1rem;
}

.field-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 650;
  font-size: 0.95rem;
}

.optional {
  font-weight: 500;
  color: var(--muted);
}

.count {
  margin: 0;
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 650;
}

.hint {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.error {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.75rem;
  color: var(--error);
  background: var(--error-bg);
  border-radius: 10px;
  font-size: 0.92rem;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
  background: #fffdf8;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  appearance: none;
}

textarea {
  min-height: 8.5rem;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
textarea:focus,
button:focus-visible,
.toggle input:focus-visible {
  outline: 3px solid var(--terracotta-soft);
  outline-offset: 2px;
  border-color: var(--terracotta);
}

.row {
  margin: 0.15rem 0 1rem;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--terracotta);
}

.winners-field input {
  max-width: 8rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.05rem;
  border: 1.5px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  color: #fffdf8;
  background: #8a2f12;
  box-shadow: 0 10px 20px -12px rgba(138, 47, 18, 0.9);
}

.btn.primary:hover:not(:disabled) {
  background: #721f0c;
}

.btn.ghost {
  color: var(--ink);
  background: transparent;
  border-color: var(--line);
}

.btn.ghost:hover:not(:disabled) {
  background: rgba(193, 74, 32, 0.06);
  border-color: var(--terracotta-soft);
}

.text-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--terracotta-deep);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
}

.sample-line {
  margin: 0.9rem 0 0;
}

.stage-inner {
  display: flex;
  flex-direction: column;
  min-height: 24rem;
}

.stage-kicker {
  margin: 0 0 0.25rem;
  color: var(--sage);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stage-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stage-sub {
  margin: 0 0 1.4rem;
  max-width: 36rem;
  color: var(--ink-soft);
}

.stage.is-drawing .stage-title,
.stage.is-revealed .stage-title {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
}

.reel-wrap {
  display: grid;
  place-items: center;
  margin: auto 0;
  padding: 1.6rem 1rem 1.8rem;
  background:
    radial-gradient(ellipse 70% 80% at 50% 40%, #c16a3a 0%, #8b4a2b 70%, #6d3820 100%);
  border-radius: 50% 50% 46% 46%;
  box-shadow:
    inset 0 12px 24px rgba(42, 31, 22, 0.28),
    0 16px 28px -18px rgba(42, 31, 22, 0.5);
  color: #fff8ee;
  text-align: center;
}

.reel-label {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.8;
}

.reel {
  overflow: hidden;
  width: min(100%, 28rem);
  min-height: 3.4rem;
}

.reel-name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.winners {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticket {
  display: grid;
  grid-template-columns: auto 1fr;
  overflow: hidden;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 22px -18px rgba(42, 31, 22, 0.7);
}

.ticket-stub {
  display: grid;
  place-items: center;
  min-width: 5.2rem;
  padding: 0.9rem 0.75rem;
  color: #fff8ee;
  background: var(--sage);
  border-right: 2px dashed rgba(251, 246, 236, 0.55);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 700;
  text-align: center;
}

.ticket:nth-child(1) .ticket-stub { background: #9a3514; }
.ticket:nth-child(2) .ticket-stub { background: #b56a1a; }
.ticket:nth-child(3) .ticket-stub { background: #3e5c4a; }

.ticket-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.95rem 1.1rem;
}

.ticket-place {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ticket-name {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  word-break: break-word;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.copy-status {
  margin: 0;
  color: var(--sage);
  font-size: 0.9rem;
  font-weight: 650;
}

.site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 var(--space) 2.5rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.site-footer p {
  margin: 0 0 0.35rem;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.site-footer a {
  color: var(--terracotta-deep);
  font-weight: 650;
}

.dot {
  margin: 0 0.4rem;
}

.tip-jar {
  color: var(--muted);
}

.noscript {
  margin: 1rem var(--space);
  padding: 0.8rem 1rem;
  background: var(--error-bg);
  border-radius: 10px;
}

@media (max-width: 639px) {
  .setup { padding: 1.15rem 1rem 1.1rem; }
  .stage { min-height: 18rem; }
  .panel-lede { font-size: 0.92rem; }
  textarea { min-height: 6.5rem; }
  .actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    padding: 0.55rem 0 0.15rem;
    background: linear-gradient(180deg, rgba(251, 246, 236, 0), var(--card) 28%);
  }
  .btn.primary { flex: 1 1 100%; }
  .ticket { grid-template-columns: 4.4rem 1fr; }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }

  body::before,
  .skip-link,
  .site-header .tagline,
  .setup,
  .stage-sub,
  .reel-wrap,
  .result-actions,
  .site-footer,
  .noscript {
    display: none !important;
  }

  .layout {
    display: block;
    max-width: none;
    padding: 0;
  }

  .stage {
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .stage-title {
    font-size: 1.8rem;
  }

  .ticket {
    break-inside: avoid;
    box-shadow: none;
  }

  .ticket-name {
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reel-name,
  .ticket {
    animation: none !important;
    transition: none !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink: #1a100a;
    --line: #8a6b48;
    --card: #fffaf0;
  }

  .btn.primary {
    background: #8a2f12;
  }

  .btn.primary:hover:not(:disabled) {
    background: #721f0c;
  }
}

@keyframes ticket-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ticket.is-in {
  animation: ticket-in 320ms ease-out both;
}
