/* ===================== Tokens ===================== */
:root {
  --navy-950: #0f1b2d;
  --navy-800: #16283f;
  --navy-700: #1f3552;
  --sand-50:  #faf7f2;
  --sand-100: #f2ede3;
  --coral-500:#ff7a4a;
  --coral-600:#f2603a;
  --ink-900:  #17212e;
  --ink-500:  #5c6a7a;
  --line:     #e4ddd0;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-card: 0 1px 2px rgba(15,27,45,.04), 0 12px 28px -14px rgba(15,27,45,.18);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--sand-50);
  color: var(--ink-900);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

/* ===================== Top bar ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 247, 242, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}
.brand__mark { color: var(--coral-500); font-size: 1.2rem; }

.topbar__nav { display: flex; gap: 24px; }
.topbar__nav a {
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink-500);
  transition: color .15s ease;
}
.topbar__nav a:hover,
.topbar__nav a[aria-current="page"] { color: var(--ink-900); }

.help-wrap { position: relative; }
.help-btn {
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink-900);
  background: var(--sand-100);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.help-btn:hover { background: var(--line); }

.help-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 40;
  width: 260px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  text-align: left;
}
.help-popover p {
  font-size: .88rem;
  color: var(--ink-500);
  margin-bottom: 10px;
}
.help-popover a {
  display: inline-block;
  font-size: .92rem;
  font-weight: 600;
  color: var(--coral-600);
  text-decoration: none;
  word-break: break-word;
}
.help-popover a:hover { text-decoration: underline; }
.help-popover__email {
  font-size: .92rem;
  font-weight: 600;
  color: var(--coral-600);
  word-break: break-word;
}

/* ===================== Hero ===================== */
.hero {
  position: relative;
  z-index: 10;
  padding: 96px 24px 120px;
  background:
    radial-gradient(120% 60% at 12% -10%, rgba(255,122,74,.14), transparent 55%),
    var(--navy-950);
  color: var(--sand-50);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 20% 20%, black, transparent 70%);
  pointer-events: none;
}
.hero__inner {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.hero__eyebrow {
  font-size: .85rem;
  font-weight: 500;
  color: var(--coral-500);
  margin-bottom: 14px;
  letter-spacing: .02em;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -.01em;
}
.hero__sub {
  margin: 20px auto 0;
  max-width: 480px;
  color: #b9c2cf;
  font-size: 1.02rem;
}

/* ---- search bar ---- */
.searchbar {
  position: relative;
  margin: 40px auto 0;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sand-50);
  border-radius: 999px;
  padding: 6px 8px 6px 20px;
  box-shadow: 0 20px 45px -18px rgba(0,0,0,.55);
}
.searchbar__icon { width: 20px; height: 20px; color: var(--ink-500); flex-shrink: 0; }
.searchbar input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1rem;
  font-family: var(--font-body);
  padding: 12px 0;
  color: var(--ink-900);
}
.searchbar input::placeholder { color: #9aa4b1; }

.searchbar__results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  text-align: left;
  max-height: 320px;
  overflow-y: auto;
}
.searchbar__results button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: .94rem;
  color: var(--ink-900);
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--sand-100);
}
.searchbar__results button:last-child { border-bottom: none; }
.searchbar__results button:hover { background: var(--sand-100); }
.searchbar__results .room-code { font-weight: 600; }
.searchbar__results .room-building { color: var(--ink-500); font-size: .82rem; }
.searchbar__empty {
  padding: 16px 18px;
  color: var(--ink-500);
  font-size: .9rem;
}

/* ===================== Buildings grid ===================== */
.buildings {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 24px 40px;
}
.buildings__header { max-width: 520px; margin-bottom: 36px; }
.buildings__header h2 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
}
.buildings__header p {
  margin-top: 8px;
  color: var(--ink-500);
  font-size: .98rem;
}

.building-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.building-card {
  position: relative;
  border: 0;
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--navy-800);
  aspect-ratio: 4 / 5;
  isolation: isolate;
}
.building-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.62) saturate(1.05);
  transition: transform .5s cubic-bezier(.2,.7,.2,1), filter .3s ease;
}
.building-card:hover img { transform: scale(1.06); filter: brightness(.5) saturate(1.1); }

.building-card__count {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(15,27,45,.55);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  z-index: 2;
}
.building-card__body {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 20px;
  z-index: 2;
}
.building-card__body h3 {
  color: #fff;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 10px;
}
.building-card__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--coral-500);
}
.building-card__skeleton {
  background: linear-gradient(100deg, var(--navy-800) 40%, var(--navy-700) 50%, var(--navy-800) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ===================== Room panel ===================== */
.panel-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15,27,45,.45);
  backdrop-filter: blur(2px);
  z-index: 40;
}

.room-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(440px, 100%);
  background: #fff;
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .32s cubic-bezier(.2,.7,.2,1);
  box-shadow: -20px 0 50px -20px rgba(0,0,0,.35);
}
.room-panel.is-open { transform: translateX(0); }

.room-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 24px 18px;
  border-bottom: 1px solid var(--line);
}
.room-panel__eyebrow {
  font-size: .78rem;
  font-weight: 600;
  color: var(--coral-600);
  text-transform: none;
  margin-bottom: 4px;
}
.room-panel__head h3 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}
.room-panel__close {
  border: 0;
  background: var(--sand-100);
  width: 34px; height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: .95rem;
  color: var(--ink-500);
  flex-shrink: 0;
}
.room-panel__close:hover { background: var(--line); color: var(--ink-900); }

.room-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}
.room-list li {
  border-bottom: 1px solid var(--sand-100);
  transition: background .5s ease;
}
.room-list li.is-selected {
  background: #fff2ea;
  box-shadow: inset 3px 0 0 var(--coral-500);
}
.room-list li.is-selected .room-name { color: var(--coral-600); }
.room-list button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
}
.room-list button:hover { background: var(--sand-100); }
.room-list .room-name { font-weight: 600; font-size: .96rem; }
.room-list .room-play {
  font-size: .78rem;
  font-weight: 600;
  color: var(--coral-600);
  white-space: nowrap;
}
.room-list__empty, .room-list__loading, .room-list__error {
  padding: 32px 24px;
  color: var(--ink-500);
  font-size: .92rem;
}

.room-video {
  border-top: 1px solid var(--line);
  padding: 20px 24px 26px;
  background: var(--sand-50);
}
.room-video__frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}
.room-video__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ===================== Footer ===================== */
.site-footer {
  padding: 40px 24px 60px;
  text-align: center;
  color: var(--ink-500);
  font-size: .85rem;
}

/* ===================== Responsive ===================== */
@media (max-width: 620px) {
  .hero { padding: 72px 20px 96px; }
  /* Keep primary nav reachable on mobile: brand + help on row 1, nav pills on row 2 */
  .topbar__inner { flex-wrap: wrap; row-gap: 10px; padding: 12px 16px; }
  .brand { order: 1; }
  .help-wrap { order: 2; }
  .topbar__nav {
    order: 3;
    width: 100%;
    gap: 6px;
    padding: 4px;
    background: var(--sand-100);
    border-radius: 999px;
  }
  .topbar__nav a {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: .88rem;
  }
  .topbar__nav a[aria-current="page"] {
    background: #fff;
    box-shadow: 0 1px 3px rgba(15,27,45,.12);
  }
  .help-popover { width: 220px; }
  .buildings { padding: 56px 20px 24px; }
  .room-panel { width: 100%; }
}

/* ===================== Motion & accessibility ===================== */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
:focus-visible {
  outline: 2px solid var(--coral-500);
  outline-offset: 2px;
}