/* ============================================================
   Feliz Día de Acción de Gracias — styles
   Palette lives in :root, so tweaking colors is a one-line job.
   ============================================================ */

:root {
  /* --- autumn palette --- */
  --naranja:      #D9641E;   /* warm orange */
  --naranja-honda:#B8501A;   /* darker orange — keeps button text readable */
  --naranja-claro:#F0A64B;
  --rojo:         #96241F;   /* deep red */
  --oro:          #E0A127;   /* gold */
  --crema:        #FFF6E7;   /* cream */
  --crema-honda:  #FBE8C8;
  --marron:       #46291A;   /* body text */
  --marron-suave: #6B4630;

  /* --- surfaces --- */
  --fondo: radial-gradient(130% 90% at 50% 0%, #FFF9EE 0%, #FDE9C8 42%, #F7CE97 100%);
  --tarjeta: rgba(255, 252, 245, 0.92);
  --borde: rgba(150, 36, 31, 0.16);
  --sombra: 0 10px 30px rgba(109, 55, 20, 0.14);

  /* --- type --- */
  --serif: "Georgia", "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radio: 20px;
  --tap: 52px;             /* minimum tap target */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 0 0 2rem;
  background: var(--fondo);
  background-attachment: fixed;
  color: var(--marron);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- layout ---------- */

.wrap {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 1.15rem;
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  justify-content: flex-end;
  padding: 0.9rem 1.15rem 0;
  position: relative;
  z-index: 5;
}

/* ---------- language toggle ---------- */

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.55rem 1.05rem;
  border: 2px solid var(--borde);
  border-radius: 999px;
  background: rgba(255, 252, 245, 0.9);
  color: var(--rojo);
  font: 600 0.95rem/1 var(--sans);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(109, 55, 20, 0.1);
  transition: transform 0.15s ease, background 0.2s ease;
}
.lang-btn:hover { background: #fff; }
.lang-btn:active { transform: scale(0.96); }

/* ---------- 1. welcome ---------- */

.hero {
  text-align: center;
  padding: 1.6rem 0 2.2rem;
}

.kicker {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--marron-suave);
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.1rem, 10.5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.08;
  color: var(--rojo);
  text-wrap: balance;
}

/* Each word of the greeting fades up in turn (see playWelcome) */
.title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em);
  animation: wordIn 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes wordIn {
  to { opacity: 1; transform: translateY(0); }
}

.sub {
  margin: 1rem auto 0;
  max-width: 24rem;
  font-size: 1.1rem;
  color: var(--marron-suave);
}

.hint {
  margin: 1.5rem 0 0;
  font-size: 0.95rem;
  color: var(--marron);
  animation: breathe 3.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.8; transform: translateY(0); }
  50%      { opacity: 1;   transform: translateY(-3px); }
}

/* Fade-in used by the welcome sequence */
.fade-in {
  opacity: 0;
  animation: fadeUp 0.9s ease forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* the hint fades in first, then keeps breathing */
.hint.fade-in {
  animation:
    fadeUp 0.9s ease var(--d, 0ms) forwards,
    breathe 3.4s ease-in-out calc(var(--d, 0ms) + 0.9s) infinite;
}

/* ---------- cards ---------- */

.card {
  margin: 0 0 1.4rem;
  padding: 1.5rem 1.25rem 1.6rem;
  background: var(--tarjeta);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  box-shadow: var(--sombra);
  text-align: center;
}

.card-title {
  margin: 0 0 0.3rem;
  font-family: var(--serif);
  font-size: 1.45rem;
  color: var(--rojo);
}

.card-intro {
  margin: 0 0 1.1rem;
  font-size: 0.98rem;
  color: var(--marron-suave);
}

/* ---------- 2. gratitude jar ---------- */

.jar {
  display: block;
  margin: 0.4rem auto 1.1rem;
  padding: 0.6rem 0.6rem 1rem;
  border: 0;
  border-radius: var(--radio);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.jar:active .jar-art { transform: scale(0.94) rotate(-2deg); }

.jar-art {
  display: block;
  width: 128px;
  margin: 0 auto;
  transition: transform 0.2s ease;
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-6px) rotate(1deg); }
}
.jar-art svg { display: block; width: 100%; height: auto; }

.jar-lid   { fill: var(--rojo); }
.jar-body  { fill: rgba(224, 161, 39, 0.34); stroke: var(--naranja); stroke-width: 3.5; }
.jar-notes rect { fill: var(--crema); stroke: var(--naranja-claro); stroke-width: 2; }
.jar-shine { fill: #fff; opacity: 0.5; }

/* the jar wiggles when it hands you a note */
.jar.shake .jar-art { animation: shake 0.5s ease; }
@keyframes shake {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-6deg); }
  75%      { transform: rotate(6deg); }
}

.jar-cta {
  display: inline-block;
  margin-top: 0.9rem;
  min-height: var(--tap);
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--naranja-honda) 0%, var(--rojo) 100%);
  color: #FFF8EC;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 5px 14px rgba(150, 36, 31, 0.3);
}

.gratitude {
  margin: 0 auto;
  min-height: 4.6rem;
  max-width: 26rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--marron);
  text-wrap: pretty;
}
.gratitude.pop { animation: pop 0.5s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pop {
  0%   { opacity: 0; transform: translateY(10px) scale(0.97); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- 3. your table ---------- */

.dishes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.dish {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  min-height: 86px;
  padding: 0.7rem 0.3rem;
  border: 2px solid transparent;
  border-radius: 16px;
  background: var(--crema-honda);
  color: var(--marron);
  font: 600 0.8rem/1.2 var(--sans);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.dish:hover { background: #FFF1D8; transform: translateY(-3px); }
.dish:active { transform: scale(0.95); }
.dish[aria-pressed="true"] {
  border-color: var(--naranja);
  background: #FFF1D8;
  box-shadow: 0 4px 12px rgba(217, 100, 30, 0.22);
}

.dish-emoji {
  font-size: 1.95rem;
  line-height: 1;
}

.dish-note {
  margin: 0;
  min-height: 3.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  background: rgba(224, 161, 39, 0.16);
  font-size: 1.02rem;
  color: var(--marron);
  text-wrap: pretty;
}
.dish-note.pop { animation: pop 0.45s cubic-bezier(0.22, 1, 0.36, 1); }

/* ---------- closing + footer ---------- */

.closing {
  padding: 0.6rem 0.5rem 0;
  text-align: center;
}
.closing-line {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--rojo);
  text-wrap: pretty;
}

.footer {
  position: relative;
  z-index: 2;
  margin-top: 2.2rem;
  text-align: center;
}
.footer p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--marron-suave);
}

/* ---------- decorative layers ---------- */

.leaves,
.burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.leaves { z-index: 1; }
.burst-layer { z-index: 9; }

.leaf {
  position: absolute;
  top: -8vh;
  font-size: var(--size, 1.5rem);
  opacity: 0;
  will-change: transform, opacity;
  animation: fall var(--dur, 12s) linear var(--delay, 0s) infinite;
}
@keyframes fall {
  0%   { opacity: 0;    transform: translate3d(0, 0, 0) rotate(0deg); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { opacity: 0;    transform: translate3d(var(--drift, 40px), 112vh, 0) rotate(var(--spin, 420deg)); }
}

.spark {
  position: absolute;
  font-size: 1.5rem;
  will-change: transform, opacity;
  animation: spark 1s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes spark {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.5) rotate(0deg); }
  70%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.15) rotate(var(--rot, 90deg));
  }
}

/* ---------- focus visibility (keyboard) ---------- */

:focus-visible {
  outline: 3px solid var(--rojo);
  outline-offset: 3px;
  border-radius: 10px;
}

/* ---------- wider screens ---------- */

@media (min-width: 40rem) {
  body { font-size: 1.125rem; }
  .wrap { max-width: 38rem; }
  .card { padding: 2rem 2rem 2.1rem; }
  .dishes { grid-template-columns: repeat(6, 1fr); }
  .dish { min-height: 94px; }
}

/* ---------- motion-sensitive visitors ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  .title .word,
  .fade-in { opacity: 1; transform: none; }
  .leaves { display: none; }
  .hint { opacity: 1; }

  /* taps still celebrate, without anything flying across the screen */
  .spark { animation: sparkStill 0.85s ease forwards !important; }
  @keyframes sparkStill {
    from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    to   { opacity: 0; transform: translate(-50%, -62%) scale(1.1); }
  }
}
