/* ============================================
   Brindis · Onboarding & Welcome
   ============================================ */

/* ============================================
   Welcome — visual stage at 1080×1920, fit-to-viewport.
   Inspired by the brand mockup with table glow + speech bubbles.
   ============================================ */

/* Design tokens specific to the welcome screen */
:root {
  --welcome-cream: #FAF6F0;
  --welcome-terra: #B85C3D;
  --welcome-ink: #2C2418;
  --welcome-ink-soft: #6B5D4D;
  --welcome-table: #E8DCC6;
  --welcome-table-rim: #C4AC85;
  --welcome-chair: #D6C4A4;
}

.welcome-viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--welcome-cream);
  overflow: hidden;
  /* Respect iOS notch + home indicator so the welcome stage never falls under them */
  padding-top: max(env(safe-area-inset-top, 0px), var(--safe-top, 0px));
  padding-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px));
}

.welcome-stage {
  position: relative;
  width: 1080px;
  height: 1920px;
  background: var(--welcome-cream);
  overflow: hidden;
  transform-origin: center center;
  /* JS sets --welcome-scale + width based on the viewport. Until it runs, stay
     HIDDEN and pre-scaled small — otherwise the stage paints at its full
     1080×1920, scale 1 for a frame and the welcome flashes "maximized" before
     snapping to size (very visible on Android, where JS init is a touch slower,
     and when returning here via "New event"). The .ready class (added at the end
     of fit()) fades it in already correctly sized; parents clip overflow so the
     oversized box never shows a scrollbar meanwhile. [Carlo: Android flash] */
  transform: scale(var(--welcome-scale, 0.36));
  opacity: 0;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}
.welcome-stage.ready { opacity: 1; }

/* Radial gold wash */
.welcome-bgwash {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%,
    rgba(255, 215, 165, 0.18) 0%,
    rgba(255, 215, 165, 0.08) 35%,
    rgba(255, 215, 165, 0) 70%);
  pointer-events: none;
}

/* Paper texture (subtle multiplied noise) */
.welcome-paper {
  position: absolute;
  inset: 0;
  opacity: 0.10;
  pointer-events: none;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27200%27%20height%3D%27200%27%3E%3Cfilter%20id%3D%27n%27%3E%3CfeTurbulence%20type%3D%27fractalNoise%27%20baseFrequency%3D%270.85%27%20numOctaves%3D%272%27%20seed%3D%273%27%2F%3E%3CfeColorMatrix%20values%3D%270%200%200%200%200.4%20%200%200%200%200%200.3%20%200%200%200%200%200.2%20%200%200%200%200.5%200%27%2F%3E%3C%2Ffilter%3E%3Crect%20width%3D%27200%27%20height%3D%27200%27%20filter%3D%27url(%23n)%27%2F%3E%3C%2Fsvg%3E");
}

/* Wordmark stack — vertical brand lockup: official glasses glyph ABOVE the
   "Brindis" wordmark. Centered in the open band between the framing tables so it
   reads elegant with room to breathe (glyph, word and tables never crowd). */
.welcome-wordmark {
  position: absolute;
  left: 50%;
  top: 560px;
  transform: translateX(-50%);
  text-align: center;
  z-index: 3;
}
/* Official brand glyph (gold arc + designed champagne glasses + sparkle).
   Transparent PNG rendered from the brand SVG so it floats cleanly on the cream
   stage and stays crisp at every display size. */
.welcome-glyph {
  display: block;
  width: 250px;
  height: auto;
  margin: 0 auto 4px;
}
/* "Brindis" in the brand serif (Fraunces). Live text so it uses the page's
   loaded Fraunces — matching the official wordmark's typography exactly. */
.welcome-title {
  font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  font-size: 150px;
  line-height: 1.0;
  color: var(--welcome-ink);
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 144, "wght" 500;
  margin: 0;
}
.welcome-divider {
  display: block;
  margin: 24px auto 0;
  width: 64px;
  height: 1px;
  background: var(--welcome-terra);
  opacity: 0.7;
}

/* Tagline (Inter, soft ink) — sized up so the bilingual fragment stays readable
   after the 1080→viewport-width scale-down on phones (≈0.36×). */
.welcome-tagline {
  position: absolute;
  /* Centred fixed-width column so it stays a tidy line and never stretches edge
     to edge when the stage widens on iPad/desktop. */
  left: 50%;
  transform: translateX(-50%);
  width: 920px;
  max-width: calc(100% - 80px);
  top: 1040px;
  text-align: center;
  font-family: Inter, system-ui, sans-serif;
  font-size: 44px;
  line-height: 1.25;
  color: var(--welcome-ink-soft);
  font-weight: 400;
  letter-spacing: 0.005em;
  z-index: 3;
}

/* CTA — terracotta pill button */
.welcome-actions {
  position: absolute;
  /* Full stage width (left:0/right:0) so the CTA can size to ONE line. With
     left:50% the container was capped at half the stage (540px) and the long
     "Continuar donde me quedé" label wrapped to two lines. [Carlo 2026-06-11] */
  left: 0;
  right: 0;
  bottom: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  z-index: 3;
}
.welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  /* CTA needs to feel like a real button after the stage scale-down. Padding
     and font-size are in 1080-stage units; on a 393px phone these compress to
     roughly the visible footprint of a 16-18px Inter button — exactly what
     Apple HIG asks for. */
  padding: 36px 72px;
  background: var(--welcome-terra);
  color: #FBF6EB;
  border: none;
  border-radius: 999px;
  font-family: Inter, system-ui, sans-serif;
  font-size: 44px;
  font-weight: 500;
  letter-spacing: 0.01em;
  /* Never wrap — the label is a single phrase; the container is now full-width
     so it has room on one line. */
  white-space: nowrap;
  box-shadow: 0 6px 20px rgba(184, 92, 61, 0.25);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.welcome-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(184, 92, 61, 0.32);
}
.welcome-cta:active {
  transform: translateY(0) scale(0.97);
}
.welcome-continue,
.welcome-import {
  background: transparent;
  border: none;
  color: var(--welcome-ink-soft);
  font-family: Inter, system-ui, sans-serif;
  /* Was 20px (≈7px on screen after the stage scale-down — "súper chiquito",
     Carlo). Bumped to a readable, tappable secondary link. [2026-06-11] */
  font-size: 34px;
  font-weight: 500;
  text-decoration: underline;
  cursor: pointer;
  padding: 16px 28px;
}
.welcome-continue:hover,
.welcome-import:hover {
  color: var(--welcome-terra);
}

/* Tables — generated by JS, positioned absolutely on stage */
.welcome-tables {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.w-table {
  position: absolute;
  width: 0;
  height: 0;
}
.w-table-shadow {
  position: absolute;
  border-radius: 50%;
  background: rgba(64, 40, 20, 0.10);
  filter: blur(14px);
  opacity: 0.9;
}
.w-chair {
  position: absolute;
  border-radius: 50%;
  background: var(--welcome-chair);
  opacity: 0.85;
}
.w-table-top {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #F0E5D0 0%, var(--welcome-table) 55%, #DCCEAF 100%);
  border: 1.5px solid var(--welcome-table-rim);
  box-shadow: inset 0 -8px 18px rgba(120, 90, 50, 0.08);
}
.w-glow {
  position: absolute;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(232, 145, 80, 0.85) 0%,
    rgba(232, 145, 80, 0.35) 35%,
    rgba(232, 145, 80, 0) 70%);
  filter: blur(2px);
  pointer-events: none;
  animation: candle 3.4s ease-in-out infinite;
}
.w-avatar {
  position: absolute;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(60, 35, 15, 0.18);
}

@keyframes candle {
  0%, 100% { opacity: 0.12; transform: scale(0.88); }
  50%      { opacity: 0.40; transform: scale(1.22); }
}

/* Speech bubbles */
.welcome-bubbles {
  position: absolute;
  inset: 0;
  z-index: 2;
}
.w-bubble {
  position: absolute;
  pointer-events: none;
  animation: float 4.2s ease-in-out infinite;
}
.w-bubble-inner {
  position: relative;
  background: #FFFBF3;
  border: 1.5px solid var(--welcome-terra);
  border-radius: 28px;
  padding: 14px 24px 16px;
  font-family: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 32px;
  color: var(--welcome-ink);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(60, 35, 15, 0.10);
  font-weight: 400;
}
.w-bubble-tail {
  position: absolute;
  bottom: -12px;
  width: 22px;
  height: 18px;
  overflow: visible;
}
.w-bubble-tail.tail-bl { left: 26px; }
.w-bubble-tail.tail-br { right: 26px; }

@keyframes float {
  0%, 100% { transform: translateY(-3px); }
  50%      { transform: translateY(3px); }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Onboarding */
.onboarding {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: calc(max(env(safe-area-inset-top, 0px), var(--safe-top, 0px)) + var(--space-6)) var(--space-5) calc(max(env(safe-area-inset-bottom, 0px), var(--safe-bottom, 0px)) + var(--space-5));
  overflow-y: auto;
}

.onboarding-header {
  position: relative;
  text-align: center;
  margin-bottom: var(--space-6);
  padding-top: 48px;
  animation: fadeInUp 0.5s var(--ease) both;
}

.onboarding-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: var(--space-2);
  letter-spacing: -0.01em;
  padding: 0 var(--space-5);
}

/* First screen (language) has no back button, no need for padding */
[data-screen="language"] .onboarding-header {
  padding-top: var(--space-4);
}

.onboarding-subtitle {
  font-size: 15px;
  color: var(--muted);
  max-width: 300px;
  margin: 0 auto;
}

/* Choice grid (2 columns) */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: auto;
  margin-bottom: auto;
}

.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  aspect-ratio: 1;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--dur-fast) var(--ease);
  animation: fadeInUp 0.5s var(--ease) both;
}

.choice:nth-child(2) { animation-delay: 0.05s; }
.choice:nth-child(3) { animation-delay: 0.10s; }
.choice:nth-child(4) { animation-delay: 0.15s; }
.choice:nth-child(5) { animation-delay: 0.20s; }

.choice:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.choice:active {
  transform: scale(0.97);
}

.choice.selected {
  border-color: var(--gold);
  background: var(--gold-light);
}

.choice-icon {
  font-size: 44px;
  line-height: 1;
}

.choice-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
}

/* For event type 5 items: 2+2+1 layout */
[data-screen="event-type"] .choice-grid .choice:nth-child(5) {
  grid-column: span 2;
  aspect-ratio: 2.2 / 1;
}

/* Choice list (full width rows) */
.choice-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
  margin-bottom: auto;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-4);
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: var(--radius-lg);
  transition: all var(--dur-fast) var(--ease);
  text-align: left;
  width: 100%;
  animation: fadeInUp 0.5s var(--ease) both;
}

.choice-row:nth-child(2) { animation-delay: 0.05s; }
.choice-row:nth-child(3) { animation-delay: 0.10s; }
.choice-row:nth-child(4) { animation-delay: 0.15s; }

/* Hover effects only on real pointers — :hover sticks on iOS Safari after a
   tap, leaving rows looking pre-selected when a sheet animates open. */
@media (hover: hover) {
  .choice-row:hover {
    border-color: var(--gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

.choice-row:active {
  transform: scale(0.98);
  border-color: var(--gold);
}

.choice-icon-lg {
  font-size: 36px;
  line-height: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--cream);
  border-radius: var(--radius-md);
}

.choice-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.choice-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.choice-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.35;
}

/* Honor reduced-motion for the welcome's ambient animations (candle glow +
   floating bubbles): keep everything visible, just hold it still. [Carlo rule #6] */
@media (prefers-reduced-motion: reduce) {
  .welcome-stage .w-glow,
  .welcome-stage .w-bubble { animation: none !important; }
}

/* On tablets/desktop the app shell is now full-width (for the welcome + canvas),
   but the onboarding FORMS shouldn't stretch edge to edge — keep them a centred
   readable column. [Carlo: iPad-native welcome, but forms stay tidy] */
@media (min-width: 641px) {
  .onboarding {
    width: 100%;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}
