/* GenevAI swipe-feed — mobile-first TikTok aesthetic.
   Phase 1: silent feed. No build step; plain CSS. */

:root {
  --bg: #0b0d12;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --accent: #1d8fb0;
  --phone-w: 430px;
  --nav-h: 58px;        /* floating nav height — spec cap is 60px */
  --card-radius: 0px;   /* phone-frame corner radius — 0 = SQUARE corners (per preference). Bump to round. */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Mobile: full-bleed. Desktop: a full-height phone-width column, centred.
   Full height (not a floating 920px device) so the fixed nav anchors to the
   column's bottom edge exactly — see .nav. */
.app {
  min-height: 100dvh;
  background:
    radial-gradient(120% 80% at 50% -10%, #16202e 0%, var(--bg) 60%);
}

.phone {
  position: relative;
  width: 100%;
  max-width: var(--phone-w);
  height: 100dvh;          /* dynamic viewport height — tracks the address bar */
  margin: 0 auto;
  overflow: hidden;
  /* Hard clip mask: every card's foreground image AND blurred backdrop are descendants,
     so overflow:hidden contains them within the card edges on EVERY path (cover + framed)
     — a cover-crop or scaled backdrop never paints past the card. Corners are SQUARE
     (--card-radius: 0) per design preference; set the var > 0 to round the frame (feed +
     detail panel, both inside .phone). The fixed nav escapes this clip (position:fixed). */
  border-radius: var(--card-radius);
  background: #000;
}

@media (min-width: 480px) {
  .phone {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 80px rgba(0, 0, 0, 0.55);
  }
}

/* ---- Feed: vertical scroll-snap ---- */
.feed {
  position: absolute;
  inset: 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;            /* Firefox */
}
.feed::-webkit-scrollbar { display: none; }  /* WebKit */

.card {
  position: relative;
  height: 100dvh;                   /* full dynamic viewport — root snap fix */
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;         /* one flick = one card (TikTok feel) */
  overflow: hidden;
  /* Designed loading state: a brand gradient shows while the image streams in,
     so a slow photo reads as intentional, never as a broken black card. */
  background: linear-gradient(150deg, #0b2a4a 0%, #12517f 55%, #1d8fb0 100%);
}

/* Orientation-aware image scaling.
   - portrait / near-square  -> cover, full-bleed (immersive TikTok look)
   - landscape               -> contain over a blurred cover backdrop of the
                                 same image: nothing cropped, no black bars.
   Mode is decided per image at load time from natural width/height (feed.js). */
.card__backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.55);
  transform: scale(1.2);            /* hide the soft blurred edges */
  opacity: 0;
  transition: opacity 320ms ease;
}
.card.is-framed .card__backdrop { opacity: 1; }

.card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;                /* default: portrait/square */
  display: block;
  opacity: 0;
  transition: opacity 320ms ease;
}
/* Framed (square + landscape): contain the photo within an explicitly-sized box.
   feed.js sets inline top + height (+ bottom:auto) so the photo sits in a centered
   image+plate group; object-fit:contain keeps the whole photo, no crop, no bars. */
.card.is-framed .card__img {
  object-fit: contain;
  object-position: center;
  height: auto;
}
.card__img.is-loaded { opacity: 1; }
.card__img--fallback { object-fit: cover; opacity: 1; }

/* Frosted plate behind the text group — applied to EVERY card so legibility is
   guaranteed independent of the image (no per-image conditional). Sized to its
   content and inset from the edges, so most of the photo stays visible. */
.card__content {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(var(--nav-h) + 12px);
  padding: 13px;
  border-radius: 14px;
  background: rgba(18, 18, 26, 0.6);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}
/* Fallback for browsers without backdrop-filter: raise the fill opacity so white
   text keeps contrast over a bright image without the blur. ~0.6 (blurred) /
   ~0.78 (unblurred) is the legibility floor — never go more transparent. */
@supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .card__content { background: rgba(18, 18, 26, 0.78); }
}

.card__date {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(29, 143, 176, 0.92);
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 27px;
  line-height: 1.15;
  font-weight: 800;
  color: #fff;                       /* white on the frosted plate */
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.card__desc {
  margin: 0 0 12px;
  font-size: 15.5px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);   /* white on the frosted plate */
  max-width: 36ch;
}

.card__venue {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.82);  /* white on the frosted plate */
}

/* ---- Floating bottom nav (visual only) ----
   position: fixed + out of flow, so the card stays a clean 100dvh and the
   snap math is untouched. Centred to the phone-width column and capped at the
   column width; the card image runs full-bleed behind it to the bottom edge. */
.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--phone-w);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 5;
}
.nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.55);
  font: inherit;
  cursor: default;
}
.nav__item.is-active { color: var(--ink); }
.nav__icon { font-size: 20px; line-height: 1; }
.nav__label { font-size: 11px; letter-spacing: 0.02em; }

/* Call toggle in the nav: green "Connect" (idle) <-> red "Hang up" (live). */
.nav__call {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav__call-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2ea043;                 /* green = connect */
  box-shadow: 0 4px 16px rgba(46, 160, 67, 0.45);
  transition: background 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}
.nav__call.is-live .nav__call-badge {
  background: #e5484d;                 /* red = hang up */
  box-shadow: 0 4px 16px rgba(229, 72, 77, 0.45);
}
.nav__call:active .nav__call-badge { transform: scale(0.93); }
.nav__call-icon { width: 20px; height: 20px; color: #fff; }
.nav__call .ico-end { display: none; }
.nav__call.is-live .ico-call { display: none; }
.nav__call.is-live .ico-end { display: inline-block; }
.nav__call-label { font-size: 11px; letter-spacing: 0.02em; color: rgba(255, 255, 255, 0.85); }
.nav__call[disabled] { opacity: 0.6; cursor: default; }

/* ---- Explicit error state ---- */
.error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 10;
  text-align: center;
  padding: 24px;
}
.error[hidden] { display: none; }
.error__mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%;
  background: #b3261e;
  display: grid; place-items: center;
  font-size: 30px; font-weight: 800;
}
.error__title { margin: 0 0 8px; font-size: 20px; }
.error__body { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.error__retry {
  background: var(--accent); color: #fff; border: 0;
  padding: 11px 22px; border-radius: 999px; font: inherit; font-weight: 600;
  cursor: pointer;
}

/* ---- Landing / Start gate (audio unlock + session start) ---- */
.start {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(29, 143, 176, 0.35) 0%, rgba(11, 13, 18, 0.92) 55%),
    linear-gradient(160deg, #0b2a4a 0%, #0b0d12 70%);
  transition: opacity 360ms ease;
}
.start[hidden] { display: none; }
.start.is-hiding { opacity: 0; pointer-events: none; }
.start__inner { max-width: 320px; }
.start__logo {
  font-size: 40px; font-weight: 800; letter-spacing: 1px; margin-bottom: 6px;
}
.start__tag { margin: 0 0 28px; color: var(--muted); font-size: 16px; }
.start__btn {
  background: var(--accent); color: #fff; border: 0;
  padding: 16px 40px; border-radius: 999px;
  font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  box-shadow: 0 10px 30px rgba(29, 143, 176, 0.45);
}
.start__btn:disabled { opacity: 0.6; cursor: default; }
.start__hint { margin: 18px 0 0; color: var(--muted); font-size: 13px; }
.start__silent {
  margin-top: 16px; background: none; border: 0; color: rgba(255, 255, 255, 0.55);
  font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer;
}

/* ---- Voice status chip ---- */
.vstatus {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0));
  left: 14px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.vstatus[hidden] { display: none; }
.vstatus__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
}
.vstatus[data-state="connecting"] .vstatus__dot { background: #e0a82e; animation: pulse 1s ease-in-out infinite; }
.vstatus[data-state="listening"] .vstatus__dot { background: #2ec27e; }
.vstatus[data-state="speaking"] .vstatus__dot { background: var(--accent); animation: pulse 0.8s ease-in-out infinite; }
.vstatus[data-state="error"] .vstatus__dot { background: #b3261e; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.5); } }

/* ---- Mic toggle (opt-in voice commands; narration works mic-muted) ---- */
/* Bottom-right voice controls: red hang-up + mic toggle, side by side. */
.vcontrols {
  position: absolute;
  right: 14px;
  bottom: calc(var(--nav-h) + 18px);
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mic {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.6);
  color: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mic[hidden] { display: none; }
.mic__icon { width: 17px; height: 17px; }
.mic.is-on {
  background: rgba(29, 143, 176, 0.92);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 22px rgba(29, 143, 176, 0.5);
}


/* ---- Card "Details" affordance (tap, or swipe right) ---- */
.card__more {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---- Swipe-right detail: horizontal carousel (info+map slide, then photos) ---- */
.detail {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  overflow: hidden;                 /* track handles horizontal; info slide scrolls vertically */
  transform: translateX(100%);
  transition: transform 340ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.detail[hidden] { display: none; }
.detail.is-open { transform: translateX(0); }

.detail__track {
  display: flex;
  height: 100%;
  width: 100%;
  transition: transform 300ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.detail__slide { flex: 0 0 100%; width: 100%; height: 100%; }
.detail__slide--info { overflow-y: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.detail__slide--info::-webkit-scrollbar { display: none; }
.detail__slide--photo { background: #11151c; }
.detail__slide--photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.detail__media { position: relative; height: 40%; min-height: 230px; }
.detail__img { width: 100%; height: 100%; object-fit: cover; display: block; background: #11151c; }
.detail__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 2%, rgba(11, 13, 18, 0) 42%);
}
.detail__close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0));
  left: 12px;
  background: rgba(10, 12, 18, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  border: 0; border-radius: 999px;
  padding: 8px 15px; font: inherit; font-weight: 600; cursor: pointer;
}
.detail__body { position: relative; margin-top: -30px; padding: 0 22px calc(var(--nav-h) + 28px); }
.detail__date {
  display: inline-block; font-size: 13px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase; color: #fff; background: rgba(29, 143, 176, 0.92);
  padding: 5px 10px; border-radius: 999px;
}
.detail__title { margin: 12px 0 8px; font-size: 26px; line-height: 1.15; font-weight: 800; }
.detail__venue { font-size: 14.5px; color: var(--muted); margin-bottom: 10px; }
.detail__profile {
  display: inline-block; font-size: 12px; text-transform: capitalize; color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.25); padding: 3px 10px; border-radius: 999px; margin-bottom: 14px;
}
.detail__profile[hidden] { display: none; }
.detail__desc { font-size: 15.5px; line-height: 1.5; color: rgba(255, 255, 255, 0.85); margin: 0 0 22px; }
.detail__maplabel {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px;
}
.detail__mapwrap {
  border-radius: 14px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.08); background: #11151c;
}
.detail__map { width: 100%; height: 200px; border: 0; display: block; }
.detail__maplink {
  display: inline-block; margin-top: 12px; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none;
}

/* Instagram-style slide dots */
.detail__dots {
  position: absolute;
  bottom: 16px;
  left: 0; right: 0;
  display: flex; justify-content: center; gap: 7px;
  pointer-events: none;
  z-index: 2;
}
.detail__dots:empty { display: none; }
.detail__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  transition: background 200ms ease, transform 200ms ease;
}
.detail__dot.is-active { background: #fff; transform: scale(1.3); }

@media (prefers-reduced-motion: reduce) {
  .feed { scroll-behavior: auto; }
  .card__img { transition: none; }
  .start { transition: none; }
  .detail, .detail__track { transition: none; }
  .vstatus__dot { animation: none !important; }
}
