/* ==========================================================================
   Wine Discovery App — Design Tokens
   Tone: restrained, confident, warm — the bar at 9pm. Not tech-startup dark mode.
   ========================================================================== */

:root {
  --color-bg: #161210;          /* near-black, warm undertone */
  --color-surface: #211C19;     /* lifted warm dark, for cards */
  --color-accent: #C9A15C;      /* warm amber/gold, candlelight-adjacent */
  --color-text-primary: #F5EFE6;/* warm off-white */
  --color-text-muted: #8A8078;  /* warm gray */
  --color-border: #332D28;      /* subtle warm dark */

  --font-display: 'Playfair Display', serif; /* wine names, headlines */
  --font-ui: 'Inter', sans-serif;             /* labels, body, buttons */

  --phone-width: 390px;
}

/* ==========================================================================
   Base / Reset
   ========================================================================== */

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--color-text-primary);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Phone frame
   Neutral surrounding background so the 390px column reads as a phone screen
   even on wide desktop viewports.
   ========================================================================== */

.page-backdrop {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #0B0A09;
  padding: 32px 0;
}

.phone {
  width: 100%;
  max-width: var(--phone-width);
  min-height: 844px;
  background: var(--color-bg);
  position: relative;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   Screens
   ========================================================================== */

.screen {
  display: none;
  flex-direction: column;
  min-height: 844px;
  padding: 24px;
}

.screen.active {
  display: flex;
}

.screen-section + .screen-section {
  margin-top: 40px;
}

.screen-section__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

/* ==========================================================================
   Chip
   Used for mood, anchor, and context selectors. Tap to toggle selected state.
   ========================================================================== */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--color-accent);
}

.chip.selected {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #1A140C;
  font-weight: 600;
}

/* Static, non-interactive bubbles (e.g. tasting notes) — same shape as a chip,
   but no hover/selected affordance since there's nothing to tap. */
.chip--static {
  cursor: default;
  font-size: 13px;
  padding: 8px 14px;
  color: var(--color-text-muted);
}

.chip--static:hover {
  border-color: var(--color-border);
}

/* ==========================================================================
   Button
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 10px;
  padding: 16px 20px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #1A140C;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

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

.btn:disabled:hover {
  opacity: 0.4;
}

/* ==========================================================================
   Match card
   Screen 4: name, sensory one-liner, price w/ per-glass equivalent,
   "why this matches" line, natural-wine expectation note.
   ========================================================================== */

.match-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px;
}

.match-card + .match-card {
  margin-top: 16px;
}

.match-card__name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.match-card__region {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.match-card__description {
  font-family: var(--font-ui);
  font-size: 14px;
  font-style: italic;
  color: var(--color-text-primary);
  margin-top: 10px;
  line-height: 1.5;
}

.match-card__price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.match-card__price {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-accent);
}

.match-card__price-note {
  font-size: 12px;
  color: var(--color-text-muted);
}

.match-card__why {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 10px;
}

.match-card__why strong {
  color: var(--color-text-primary);
  font-weight: 600;
}

.match-card__natural-note {
  font-size: 13px;
  font-style: italic;
  color: var(--color-accent);
  border-left: 2px solid var(--color-accent);
  padding-left: 10px;
  margin-top: 10px;
}

/* ==========================================================================
   Wine detail blocks
   Screen 5: producer story, region, farming practice (tap-to-explain terms),
   staff pick note, pairing suggestion.
   ========================================================================== */

.detail-block__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.detail-block__body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-primary);
}

.term-tag {
  color: var(--color-accent);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  padding: 0;
}

.staff-pick {
  background: var(--color-surface);
  border: 1px solid var(--color-accent);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-text-primary);
}

.staff-pick strong {
  color: var(--color-accent);
}

/* ==========================================================================
   Screen 1 — Landing / entry
   ========================================================================== */

#screen-landing {
  justify-content: space-between;
  padding-top: 56px;
  padding-bottom: 40px;
}

#screen-refine {
  padding-top: 56px;
  padding-bottom: 40px;
}

#screen-refine .btn-primary {
  margin-top: auto;
}

/* ==========================================================================
   Screen 4 — Matches
   ========================================================================== */

#screen-matches {
  padding-top: 56px;
  padding-bottom: 40px;
}

.matches-heading {
  margin-top: 32px;
  margin-bottom: 24px;
}

.matches-heading__eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.matches-heading__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  color: var(--color-text-primary);
}

.matches-heading__subtitle {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.is-hidden {
  display: none;
}

.match-card--tappable {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.match-card--tappable:hover {
  border-color: var(--color-accent);
}

/* ==========================================================================
   Screen 5 — Wine detail
   ========================================================================== */

#screen-detail {
  padding-top: 56px;
  padding-bottom: 40px;
}

/* Uniform vertical rhythm between every direct section (heading, tasting
   notes, map, body blocks, button) — previously only same-type blocks got a
   margin, so gaps were inconsistent wherever the map or heading sat between
   two .detail-block elements. */
#screen-detail > * + * {
  margin-top: 28px;
}

#screen-detail > .btn-primary {
  margin-top: 36px;
}

.detail-heading {
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}

.detail-heading__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  line-height: 1.25;
  color: var(--color-text-primary);
}

.detail-heading__region {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.detail-map__frame-wrap {
  position: relative;
  height: 160px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

/* Crops OpenStreetMap's "View Larger Map" link, which renders as a line below
   the map inside the iframe — taller iframe than wrapper, clipped by overflow.
   Map stays fully interactive (pan/zoom) within the visible area. */
.detail-map__frame {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 195px;
  border: 0;
  /* Soft dark-mode tint (invert + hue-rotate cancels the inversion's hue shift,
     preserving legibility) rather than a semantic land/sea recolor. */
  filter: invert(90%) hue-rotate(180deg) brightness(0.95) contrast(0.92);
}

.detail-map__caption {
  font-family: var(--font-ui);
  font-size: 12px;
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* ==========================================================================
   Screen 7 — Browse the list
   ========================================================================== */

#screen-browse {
  padding-top: 56px;
  padding-bottom: 40px;
}

.browse-group + .browse-group {
  margin-top: 28px;
}

.browse-group__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.browse-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
}

.browse-row:last-child {
  border-bottom: none;
}

.browse-row:hover .browse-row__name {
  color: var(--color-accent);
}

.browse-row__text {
  min-width: 0;
}

.browse-row__name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  transition: color 0.15s ease;
}

.browse-row__meta {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.browse-row__price {
  flex-shrink: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-accent);
}

/* ==========================================================================
   Screen 6 — Handoff
   ========================================================================== */

#screen-handoff {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-top: 40px;
  padding-bottom: 40px;
}

.handoff__eyebrow {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 20px;
}

.handoff-card {
  width: 100%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 32px 24px;
}

/* Abstract wine-bottle silhouette (neck + shoulder + body) via clip-path.
   Not a literal illustration — just enough shape to read as "bottle." */
.bottle-icon {
  width: 16px;
  height: 34px;
  margin: 0 auto 16px;
  clip-path: polygon(
    40% 0%, 60% 0%, 60% 18%,
    82% 30%, 100% 46%, 100% 100%,
    0% 100%, 0% 46%, 18% 30%, 40% 18%
  );
}

.bottle-icon--white { background: #E8D9A8; }
.bottle-icon--red { background: #7B2D3B; }
.bottle-icon--orange { background: #C9773D; }
.bottle-icon--sparkling { background: #D9C98A; }
.bottle-icon--rose { background: #D98A93; }

.handoff-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  line-height: 1.25;
  color: var(--color-text-primary);
}

.handoff-card__region {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 8px;
}

.handoff-card__varietal {
  font-family: var(--font-ui);
  font-size: 14px;
  font-style: italic;
  color: var(--color-text-primary);
  margin-top: 12px;
}

.handoff-card__divider {
  border-top: 1px dashed var(--color-border);
  margin: 24px 0;
}

.handoff-card__price-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
}

.handoff-card__price {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 600;
  color: var(--color-accent);
}

.handoff-card__price-note {
  font-size: 13px;
  color: var(--color-text-muted);
}

.handoff__note {
  font-family: var(--font-ui);
  font-size: 13px;
  font-style: italic;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-top: 24px;
  max-width: 300px;
}

#screen-handoff .btn-secondary {
  margin-top: 32px;
  width: auto;
  padding-left: 28px;
  padding-right: 28px;
}

/* ==========================================================================
   Term explainer modal — tap-to-explain, brief principle "teach quietly,
   on demand." Absolutely positioned over the phone frame, independent of
   which screen is active.
   ========================================================================== */

.term-modal {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: flex-end;
}

.term-modal.active {
  display: flex;
}

.term-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 10, 9, 0.7);
}

.term-modal__sheet {
  position: relative;
  width: 100%;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-radius: 20px 20px 0 0;
  padding: 24px;
}

.term-modal__term {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--color-accent);
  text-transform: capitalize;
  margin-bottom: 12px;
}

.term-modal__body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}

.landing__mark {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
}

.landing__hero {
  margin-top: 64px;
}

.landing__headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 38px;
  line-height: 1.18;
  color: var(--color-text-primary);
}

.landing__subtext {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-text-muted);
  margin-top: 20px;
  max-width: 320px;
}

.landing__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   Shared step-screen chrome (Screens 2 & 3)
   ========================================================================== */

.back-link {
  align-self: flex-start;
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.back-link:hover {
  color: var(--color-text-primary);
}

.step-heading {
  margin-top: 32px;
  margin-bottom: 32px;
}

.step-progress {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.step-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.chip-row--stacked {
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
}

.chip-row--stacked .chip {
  width: 100%;
  text-align: left;
  padding: 16px 18px;
}
