/* Gift Stampede — holiday party, not a wireframe */

:root {
  --pine: #0c2418;
  --pine-deep: #07150e;
  --pine-mid: #163d28;
  --evergreen: #1f4d35;
  --moss: #2f6d4d;
  --gold: #c9a84c;
  --gold-bright: #e8c872;
  --gold-deep: #8a7028;
  --cream: #f4ecd8;
  --cream-dim: #d4cbb3;
  --crimson: #9e2a2b;
  --crimson-bright: #c4453a;
  --ink: #140e08;
  --card: #f6efe0;
  --card-ink: #1c140c;
  --muted: #8aa392;
  --ring: #e8c872;
  --danger: #c4453a;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --max: 40rem;
}

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

html, body { margin: 0; min-height: 100%; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  color: var(--cream);
  background: var(--pine-deep);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img, svg { display: block; max-width: 100%; }

button, input, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; }

a { color: var(--gold-bright); }

a:hover { color: var(--cream); }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 80;
  padding: 0.5rem 0.85rem;
  background: var(--gold);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border-radius: 8px;
}

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

/* Atmosphere */
.atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(201, 168, 76, 0.16), transparent 55%),
    radial-gradient(700px 480px at 0% 100%, rgba(158, 42, 43, 0.12), transparent 50%),
    linear-gradient(180deg, #0a1f15 0%, var(--pine) 45%, #0a1c14 100%);
}

.atmosphere__glow {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 20% 30%, rgba(47, 109, 77, 0.25), transparent 35%),
    radial-gradient(circle at 70% 70%, rgba(201, 168, 76, 0.08), transparent 40%);
}

.atmosphere__grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.atmosphere__snow span {
  position: absolute;
  top: -8px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(244, 236, 216, 0.55);
  animation: flake linear infinite;
}

@keyframes flake {
  to { transform: translateY(110vh) translateX(20px); opacity: 0.15; }
}

.site-header, main, .site-footer { position: relative; z-index: 1; }

.site-header {
  padding: 1.1rem 1.25rem 0;
  max-width: 52rem;
  margin: 0 auto;
  width: 100%;
}

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

.brand__mark { color: var(--gold-bright); flex: none; }

.brand__name {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.brand__tag {
  margin: 0.05rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

main {
  flex: 1;
  width: 100%;
  max-width: 52rem;
  margin: 0 auto;
  padding: 0.75rem 1.15rem 3rem;
}

.view[hidden] { display: none !important; }

.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.eyebrow--gold { color: var(--gold-bright); }

h1 {
  font-family: var(--font-serif);
  font-weight: 650;
  font-size: clamp(1.85rem, 6vw, 2.7rem);
  line-height: 1.15;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

h2 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
  color: var(--card-ink);
}

h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  margin: 1.4rem 0 0.6rem;
}

.lede {
  margin: 0;
  color: var(--cream-dim);
  font-size: 1.05rem;
  max-width: 36rem;
}

.lede--tight { font-size: 0.98rem; }

.hero { padding: 1.4rem 0 1.5rem; }

.panel,
.tracker-card,
.order {
  position: relative;
  color-scheme: light;
}
.panel::before,
.tracker-card::before,
.order::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #c9a84c, transparent);
  pointer-events: none;
}
.panel {
  background: var(--card);
  color: var(--card-ink);
  border-radius: var(--radius);
  padding: 1.25rem 1.2rem 1.4rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(201, 168, 76, 0.28);
}

.panel__head { margin-bottom: 1rem; }

.panel__hint {
  margin: 0.2rem 0 0;
  color: #5c5142;
  font-size: 0.92rem;
}

.add-row {
  display: flex;
  gap: 0.5rem;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  border: 1.5px solid #c9bea6;
  background: #fffdf6;
  color: var(--card-ink);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
}

input[type="text"]:focus-visible,
input[type="number"]:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 1px;
  border-color: var(--gold-deep);
}

textarea { resize: vertical; min-height: 7rem; }

.field-label {
  display: block;
  margin: 1.1rem 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6a5d48;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  margin: 0.85rem 0 0;
  min-height: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #ebe2cc;
  border: 1px solid #d3c6a6;
  color: var(--card-ink);
  border-radius: 999px;
  padding: 0.28rem 0.35rem 0.28rem 0.75rem;
  font-weight: 600;
  font-size: 0.92rem;
}

.chip__x {
  border: 0;
  background: transparent;
  color: #6a5d48;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  line-height: 1;
}

.chip__x:hover { background: #d9cfb5; color: var(--crimson); }

.empty-hint {
  margin: 0.7rem 0 0;
  color: #7a6d58;
  font-size: 0.9rem;
}

.empty-hint[hidden],
#chip-empty[hidden] { display: none; }

.count-line {
  margin: 0.7rem 0 1.1rem;
  font-size: 0.9rem;
  color: #5c5142;
}

.count-line__status { margin-left: 0.4rem; color: var(--moss); font-weight: 600; }

.check {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.85rem 0.9rem;
  background: #ebe4d0;
  border-radius: 14px;
  border: 1px solid #d5cbb0;
  position: relative;
  cursor: pointer;
}

.check--compact {
  padding: 0.55rem 0.7rem;
  align-items: center;
  background: transparent;
  border: 0;
}

.check input {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.check__box,
.check__text {
  position: relative;
  z-index: 0;
  pointer-events: none;
}

.check__box {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  border-radius: 5px;
  border: 2px solid var(--gold-deep);
  background: #fffdf6;
  position: relative;
}

.check--compact .check__box { margin-top: 0; }

.check input:checked + .check__box {
  background: var(--evergreen);
  border-color: var(--evergreen);
}

.check input:checked + .check__box::after {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.05rem;
  width: 0.32rem;
  height: 0.6rem;
  border: solid var(--gold-bright);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.check input:focus-visible + .check__box {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

.check__text { display: flex; flex-direction: column; gap: 0.15rem; }

.check__text strong { font-size: 0.98rem; }

.check__text em {
  font-style: normal;
  color: #5c5142;
  font-size: 0.88rem;
}

.cta-row { margin-top: 1.15rem; }

.form-hint {
  margin: 0.55rem 0 0;
  color: #6a5d48;
  font-size: 0.88rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
  padding: 0.72rem 1.2rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(180deg, #d4b45c 0%, var(--gold) 48%, #b8943a 100%);
  color: var(--ink);
  box-shadow: 0 2px 0 var(--gold-deep), 0 8px 20px rgba(138, 112, 40, 0.28);
}

.btn--primary:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--gold-bright) 0%, #d4b45c 100%);
}

.btn--primary:disabled {
  filter: grayscale(0.35);
  opacity: 0.45;
  box-shadow: none;
}

.btn--ghost {
  background: transparent;
  border-color: currentColor;
}

.panel .btn--ghost,
.tracker-card .btn--ghost {
  color: var(--evergreen);
  border-color: #b7c4b4;
  background: #eef3ea;
}

.panel .btn--ghost:hover,
.tracker-card .btn--ghost:hover { background: #e0eade; }

.btn--danger { color: var(--crimson) !important; border-color: #e0b4b0 !important; }

.view--setup .btn--primary,
.action-row .btn--primary {
  width: 100%;
  min-height: 3.1rem;
  font-size: 1.05rem;
}

@media (min-width: 560px) {
  .view--setup .btn--primary,
  .action-row .btn--primary { width: auto; min-width: 14rem; }
  .action-row { justify-content: flex-start; }
}

/* Stampede — full-bleed, not a racetrack */
.view--stampede {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background:
    radial-gradient(1200px 500px at 50% 120%, rgba(90, 60, 20, 0.45), transparent 50%),
    linear-gradient(180deg, #07140e 0%, #123224 55%, #2a2214 100%);
  max-width: none;
  padding: 0;
}

body.is-stampeding .site-header,
body.is-stampeding .site-footer,
body.is-stampeding .atmosphere { visibility: hidden; }

body.is-stampeding main {
  max-width: none;
  padding: 0;
}

.stampede-sky {
  position: absolute;
  inset: 0;
}

.stampede-copy {
  position: relative;
  z-index: 3;
  padding: 0 1.25rem 18vh;
  text-align: center;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.view--stampede h1 {
  font-size: clamp(2.2rem, 9vw, 4rem);
  color: var(--gold-bright);
}

.stampede-sub {
  margin: 0 auto;
  max-width: 24rem;
  color: var(--cream-dim);
}

.ground-dust {
  position: absolute;
  left: -10%;
  right: -10%;
  bottom: 0;
  height: 28vh;
  z-index: 2;
  background:
    radial-gradient(ellipse at 30% 80%, rgba(210, 180, 110, 0.28), transparent 50%),
    radial-gradient(ellipse at 70% 90%, rgba(160, 120, 60, 0.35), transparent 55%),
    linear-gradient(180deg, transparent, rgba(40, 28, 12, 0.55));
  filter: blur(6px);
  animation: dust-breathe 1.4s ease-in-out infinite alternate;
}

@keyframes dust-breathe {
  from { opacity: 0.7; transform: scaleX(1); }
  to { opacity: 1; transform: scaleX(1.04); }
}

.elephant {
  position: absolute;
  left: 0;
  top: 0;
  will-change: transform;
  pointer-events: none;
}

.elephant svg { width: 100%; height: auto; overflow: visible; }

.elephant .leg { transform-box: fill-box; transform-origin: top center; }

.elephant .leg-fl { animation: gallop-a 0.32s linear infinite; }
.elephant .leg-fr { animation: gallop-b 0.32s linear infinite; }
.elephant .leg-bl { animation: gallop-b 0.32s linear infinite; }
.elephant .leg-br { animation: gallop-a 0.32s linear infinite; }

.elephant .trunk { transform-box: fill-box; transform-origin: 20% 20%; animation: trunk-swing 0.5s ease-in-out infinite alternate; }

@keyframes gallop-a {
  0% { transform: rotate(18deg) translateY(0); }
  50% { transform: rotate(-16deg) translateY(-5px); }
  100% { transform: rotate(18deg) translateY(0); }
}

@keyframes gallop-b {
  0% { transform: rotate(-16deg) translateY(-4px); }
  50% { transform: rotate(14deg) translateY(0); }
  100% { transform: rotate(-16deg) translateY(-4px); }
}

@keyframes trunk-swing {
  from { transform: rotate(-8deg); }
  to { transform: rotate(10deg); }
}

.dust-puff {
  position: absolute;
  border-radius: 50%;
  background: rgba(210, 186, 130, 0.35);
  filter: blur(4px);
  pointer-events: none;
  animation: puff 0.9s ease-out forwards;
}

@keyframes puff {
  from { transform: scale(0.4); opacity: 0.7; }
  to { transform: scale(2.2); opacity: 0; }
}

.view--stampede.is-settling .elephant { opacity: 0; transition: opacity 0.5s ease; }
.view--stampede.is-settling .ground-dust { animation: none; opacity: 0.35; }

/* Results */
.results-hero { padding: 1.3rem 0 1.1rem; }

.order {
  list-style: none;
  margin: 0 0 1.4rem;
  padding: 0.4rem 0.2rem 0.5rem;
  background: var(--card);
  color: var(--card-ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(201, 168, 76, 0.28);
  overflow: hidden;
}

.order__item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid #e5dcc6;
  animation: rise 0.45s ease both;
}

.order__item:last-child { border-bottom: 0; }

.order__num {
  flex: none;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--cream);
  background:
    radial-gradient(circle at 35% 30%, #d45a4c, var(--crimson) 55%, #6d1b1c);
  box-shadow: 0 0 0 3px #e8d9a8, 0 2px 0 #8a7028;
}

.order__name {
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font-serif);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

.action-row .btn--ghost {
  color: var(--cream);
  border-color: rgba(244, 236, 216, 0.35);
  background: rgba(12, 36, 24, 0.25);
}

.action-row .btn--ghost:hover { background: rgba(244, 236, 216, 0.08); }

/* Tracker */
.tracker-wrap { margin-top: 0.5rem; }

.tracker-card {
  background: var(--card);
  color: var(--card-ink);
  border-radius: var(--radius);
  padding: 1.25rem 1.15rem 1.4rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(201, 168, 76, 0.28);
}

.rules {
  margin: 0.9rem 0 1rem;
  background: #ebe4d0;
  border-radius: 12px;
  padding: 0.15rem 0.85rem;
}

.rules summary {
  cursor: pointer;
  font-weight: 700;
  padding: 0.65rem 0;
}

.rules ul {
  margin: 0 0 0.85rem;
  padding-left: 1.15rem;
  color: #4a4032;
  font-size: 0.92rem;
}

.rules li + li { margin-top: 0.35rem; }

.tracker-settings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.mini-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6a5d48;
}

.mini-field input { width: 5.5rem; padding: 0.45rem 0.55rem; }

.turn-banner {
  background: var(--pine-mid);
  color: var(--cream);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  font-size: 1.02rem;
  border: 1px solid rgba(201, 168, 76, 0.35);
}

.turn-banner strong { color: var(--gold-bright); }

.open-box {
  margin: 0.9rem 0;
}

.open-box label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6a5d48;
  margin-bottom: 0.35rem;
}

.tracker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.85rem 0 0.4rem;
}

.gifts-heading { color: var(--card-ink); }

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

.gift {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.8rem;
  align-items: center;
  background: #fffdf6;
  border: 1px solid #d8cfb6;
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
}

.gift.is-locked {
  background: #efe8d6;
  border-style: dashed;
}

.gift__name {
  margin: 0;
  font-weight: 700;
  font-family: var(--font-serif);
  font-size: 1.08rem;
}

.gift__meta {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: #5c5142;
}

.gift__lock {
  display: inline-block;
  margin-left: 0.3rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--crimson);
  font-weight: 800;
}

.gift .btn { padding: 0.45rem 0.85rem; font-size: 0.88rem; }

.site-footer {
  padding: 1.5rem 1.25rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-name {
  margin: 0 0 0.35rem;
  font-family: var(--font-serif);
  color: var(--gold);
  font-size: 1rem;
}

.footer-meta, .footer-fine { margin: 0.2rem 0; }

.footer-fine { opacity: 0.8; font-size: 0.8rem; }

.dot { margin: 0 0.45rem; }

body.is-stampeding .site-footer { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .atmosphere__snow { display: none; }
  .ground-dust { animation: none; }
}

.tipjar {
  display: inline-block;
  vertical-align: middle;
}
.tipjar iframe,
.tipjar img {
  vertical-align: middle;
}

.steal-log {
  margin: 0;
  padding: 0 0 0 1.2rem;
  color: var(--card-ink);
  font-size: 0.9rem;
}

.steal-log li { margin: 0.25rem 0; }
