/* ==========================================================================
   Happy Thanksgiving, Devs — styles
   Mobile-first. Tweak the palette below and everything follows.
   ========================================================================== */

:root {
  /* Palette */
  --bg:            #14110f;
  --bg-elevated:   #1e1a17;
  --bg-terminal:   #0f0d0c;
  --border:        #3a322c;

  --text:          #f4ece4;
  --text-muted:    #bdaea0;

  --amber:         #ffc46b;
  --pumpkin:       #ff8a3d;
  --cranberry:     #e4572e;
  --leaf:          #8fbf5f;
  --terminal-green:#7ee787;

  /* Typography */
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
               sans-serif;

  /* Spacing / shape */
  --radius: 12px;
  --gap: 1.25rem;
  --maxw: 44rem;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: clamp(1rem, 4vw, 2.5rem);
  gap: var(--gap);
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -10%, #2a1d14 0%, transparent 70%),
    var(--bg);
  line-height: 1.6;
}

/* --- Accessibility helpers ------------------------------------------------ */

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -3rem;
  left: 1rem;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  background: var(--amber);
  color: #14110f;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 1rem; }

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

/* --- Canvas for confetti / leaves ---------------------------------------- */

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* --- Layout -------------------------------------------------------------- */

main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1;
}

/* --- Terminal ------------------------------------------------------------ */

.terminal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-terminal);
  overflow: hidden;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.45);
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 0.8rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.dot { width: 0.7rem; height: 0.7rem; border-radius: 50%; flex: none; }
.dot--red   { background: var(--cranberry); }
.dot--amber { background: var(--amber); }
.dot--green { background: var(--leaf); }

.terminal__title {
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.terminal__body {
  margin: 0;
  padding: 1rem 1rem 1.25rem;
  min-height: 9.5rem;
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 3.2vw, 0.95rem);
  line-height: 1.75;
  color: var(--terminal-green);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Spans injected by main.js */
.terminal__body .cmd  { color: var(--amber); }
.terminal__body .ok   { color: var(--leaf); }
.terminal__body .warn { color: var(--pumpkin); }
.terminal__body .dim  { color: var(--text-muted); }

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--terminal-green);
  animation: blink 1s step-end infinite;
}
.cursor[hidden] { display: none; }

@keyframes blink { 50% { opacity: 0; } }

/* --- Reveal / title ------------------------------------------------------ */

.reveal {
  text-align: center;
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.reveal[hidden] { display: none; }

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

.title {
  margin: 0 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  line-height: 1.15;
}

.title__en {
  font-size: clamp(1.9rem, 8.6vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-wrap: balance;
  background: linear-gradient(100deg, var(--amber), var(--pumpkin) 55%, var(--cranberry));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title__es {
  font-size: clamp(0.95rem, 4vw, 1.3rem);
  font-weight: 600;
  color: var(--amber);
}

.tagline {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: clamp(0.95rem, 3.6vw, 1.05rem);
}

.nowrap { white-space: nowrap; }

/* --- Panels -------------------------------------------------------------- */

.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: flex-start;
}

.panel__heading {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  text-transform: lowercase;
}

.prompt { color: var(--terminal-green); }

.gratitude {
  margin: 0;
  min-height: 3.2em;
  font-size: clamp(1.05rem, 4.4vw, 1.4rem);
  font-weight: 600;
  color: var(--text);
}

.panel--actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

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

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--bg-terminal);
  color: var(--amber);
}

/* --- Buttons ------------------------------------------------------------- */

.btn {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-terminal);
  color: var(--text);
  transition: transform 0.12s ease, background-color 0.12s ease,
              border-color 0.12s ease;
}
.btn:hover { border-color: var(--amber); background: #211b16; }
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: linear-gradient(100deg, var(--amber), var(--pumpkin));
  border-color: transparent;
  color: #1a1209;
}
.btn--primary:hover { filter: brightness(1.07); background: linear-gradient(100deg, var(--amber), var(--pumpkin)); }

/* --- Easter egg ---------------------------------------------------------- */

.egg {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 0.75rem;
  text-align: center;
  padding: 1.5rem;
  background: rgb(10 8 7 / 0.88);
  backdrop-filter: blur(3px);
}
.egg[hidden] { display: none; }

.egg__emoji {
  margin: 0;
  font-size: clamp(4.5rem, 26vw, 9rem);
  animation: dance 0.7s ease-in-out infinite alternate;
}

@keyframes dance {
  from { transform: rotate(-14deg) translateY(0) scale(1); }
  to   { transform: rotate(14deg) translateY(-14px) scale(1.07); }
}

.egg__text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 4vw, 1.15rem);
  color: var(--amber);
  max-width: 28rem;
}

/* --- Footer -------------------------------------------------------------- */

.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer p { margin: 0.2rem 0; }
.footer a { color: var(--amber); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.footer a:hover { color: var(--pumpkin); }
.footer__meta { font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.7; }

/* --- Wider screens ------------------------------------------------------- */

@media (min-width: 40rem) {
  .panel { padding: 1.5rem; }
  .terminal__title { font-size: 0.8rem; }
}

/* --- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cursor { animation: none; }
  .egg__emoji { animation: none; }
}
