/* =====================================================
   VARIATION A-1 — PRODUCT FIRST
   Plus Jakarta Sans. Blue-tinted dark. Indigo accent.
   Centered hero with CSS app mockup.
   Inspired by: Linear, Zed.
===================================================== */

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

:root {
  --bg:        hsl(228, 22%, 5.5%);
  --surface:   hsl(229, 18%, 9%);
  --surface-2: hsl(229, 15%, 12%);
  --border:    hsl(229, 14%, 15%);
  --border-2:  hsl(229, 14%, 19%);
  --text-1:    hsl(228, 25%, 92%);
  --text-2:    hsl(228, 10%, 58%);
  --text-3:    hsl(228, 10%, 35%);
  --accent:    hsl(237, 84%, 70%);
  --accent-bg: hsla(237, 84%, 70%, 0.1);
  --green:     hsl(152, 58%, 55%);
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Plus Jakarta Sans', sans-serif;
}

html {
  scroll-behavior: smooth;
  background: hsl(228, 22%, 5.5%); /* Match --bg for Safari safe-area fill */
}

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ---- ATMOSPHERIC GLOW — soft indigo light source bleeding from top ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(
      ellipse 100% 60% at 50% -8%,
      hsla(237, 84%, 68%, 0.09) 0%,
      transparent 65%
    );
}

/* ---- GRAIN TEXTURE — subtle noise overlay for premium depth ---- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23g)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ---- NAV ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  padding: 16px 40px;
  padding-top: calc(16px + constant(safe-area-inset-top)); /* iOS 11.0-11.1 */
  padding-top: calc(16px + env(safe-area-inset-top));      /* iOS 11.2+ */
  pointer-events: none;   /* click-through transparent zones */
}

.nav-inner {
  pointer-events: all;
  width: 100%;
  max-width: 1080px;
  padding: 0 8px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* visual state */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  /* transition everything */
  transition:
    max-width    0.45s cubic-bezier(0.4, 0, 0.2, 1),
    padding      0.45s cubic-bezier(0.4, 0, 0.2, 1),
    background   0.3s  ease,
    border-color 0.3s  ease,
    border-radius 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow   0.3s  ease;
}

/* ---- floating pill — triggered by JS adding .scrolled ---- */
.nav.scrolled .nav-inner {
  max-width: 820px;
  padding: 0 22px;
  background: hsla(228, 22%, 7%, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: hsla(229, 14%, 24%, 0.85);
  border-radius: 14px;
  box-shadow:
    0 4px 32px hsla(228, 22%, 2%, 0.55),
    0 1px 0    hsla(229, 14%, 40%, 0.1) inset;
}

.nav-logo {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--text-1);
  font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
}
.nav-logo img { border-radius: 5px; opacity: 0.9; }
.nav-links { display: flex; align-items: center; gap: 20px; }
.nav-link {
  color: var(--text-2); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--text-1); }
.nav-link-gh {
  display: inline-flex; align-items: center; gap: 6px;
}

/* ---- BUTTONS ---- */
.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex; align-items: center;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary.btn-lg {
  padding: 12px 28px;
  font-size: 15px;
  border-radius: 10px;
}
.btn-ghost-lg {
  color: var(--text-2);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: color 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-ghost-lg:hover { color: var(--text-1); }
.btn-ghost-sm {
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.btn-ghost-sm:hover { opacity: 0.75; }

/* ---- HERO ---- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 40px 0;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.hero-inner {
  text-align: center;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.hero-title {
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--text-1);
}
.hero-sub {
  font-size: 17px;
  color: var(--text-2);
  line-height: 1.7;
  max-width: 500px;
  font-weight: 400;
}
.hero-cta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---- HANDWRITTEN LABEL ---- */
.mockup-stage {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin-top: 40px;
}
.mockup-handlabel {
  position: absolute;
  top: -17px;
  left: -68px;
  font-family: 'Caveat', cursive;
  font-size: 34px;
  font-weight: 600;
  color: var(--accent);
  transform: rotate(-38deg);
  transform-origin: center center;
  display: inline-block;
  opacity: 0.82;
  line-height: 1;
  z-index: 5;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ---- APP MOCKUP ---- */
.mockup-wrap {
  width: 100%;
  max-width: 960px;
  margin-top: 0;
  /* fade bottom edge into background */
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  border-top: 1px solid var(--border-2);
  border-left: 1px solid var(--border-2);
  border-right: 1px solid var(--border-2);
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--border),
    0 32px 80px hsla(230,50%,10%,0.6),
    inset 0 1px 0 hsla(228,50%,70%,0.08);
}
.mockup {
  display: grid;
  grid-template-columns: 252px 1fr 160px;
  height: 420px;
  background: var(--surface);
  font-family: var(--sans);
  font-size: 13px;
}

/* Left panel: wraps server col + sidebar, user row spans both */
.m-left-panel {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  overflow: hidden;
  background: var(--surface);
}
.m-left-top {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* server / nav column */
.m-servers {
  width: 50px;
  min-width: 50px;
  background: hsl(230, 18%, 8%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 8px;
  gap: 0;
  border-right: 1px solid var(--border);
}
.m-nav-top {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-bottom: 4px;
}
.m-nav-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-top: auto;
  padding-top: 4px;
}
.m-nav-ic {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3); cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.m-nav-ic:hover { color: var(--text-2); background: var(--surface-2); }
.m-nav-plus { border: 1.5px dashed var(--border-2); color: var(--text-3); }
.m-srv-divider {
  width: 20px; height: 1px;
  background: var(--border);
  margin: 6px 0;
}
.m-srv-avs {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.m-srv-av {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: rgba(255,255,255,0.9);
  cursor: pointer;
  transition: border-radius 0.2s;
  letter-spacing: -0.02em;
}
.m-srv-av.active {
  background: var(--accent);
  border-radius: 10px;
}

/* channel sidebar — inside m-left-top, no outer border */
.m-sidebar {
  background: var(--surface);
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.m-server-name {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 13px;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
/* Lobby + Message Search nav items */
.m-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 16px;
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.m-nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.m-nav-item svg { color: var(--text-3); flex-shrink: 0; }
/* ROOMS section header */
.m-rooms-header {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 16px 2px;
  font-size: 10px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); cursor: pointer;
  flex-shrink: 0;
}
.m-rooms-header:hover { color: var(--text-2); }
.m-section-label {
  padding: 6px 16px 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  flex-shrink: 0;
}
/* Voice Connected bar (spans full left panel, call mode only) */
.m-vc-bar {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: hsl(230, 18%, 9%);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.m-vc-bar.visible { display: flex; }
.m-vc-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 700; color: var(--green);
  letter-spacing: 0.03em;
}
.m-vc-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}
.m-vc-ctrls { display: flex; align-items: center; gap: 6px; }
.m-vc-btn {
  width: 28px; height: 28px; border-radius: 50%;
  background: hsl(230,15%,18%); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background 0.12s;
}
.m-vc-btn:hover { background: hsl(230,15%,24%); }
.m-vc-muted { color: #ef5350; }
.m-vc-cam-off { color: var(--text-3); }
.m-vc-screen {
  flex: 1; border-radius: 6px;
  background: hsl(152, 50%, 22%); color: var(--green);
  width: auto; padding: 0 8px; height: 24px; font-size: 9px;
}
.m-channel {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 14px 5px 16px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 12.5px;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.m-channel:hover { background: var(--surface-2); color: var(--text-2); }
.m-channel.active { background: var(--accent-bg); color: var(--text-1); }
.m-hash { color: var(--text-3); font-size: 15px; line-height: 1; font-weight: 600; flex-shrink: 0; }
.m-channel.active .m-hash { color: var(--accent); }
.m-unread {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  line-height: 1.4;
}

/* Voice channel try-it hint */
.m-channel-voice { position: relative; }
.m-try-hint {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  opacity: 0.7;
  letter-spacing: 0.04em;
  animation: hint-pulse 2.5s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}
.m-channel-voice.active .m-try-hint { display: none; }

/* Voice participants (below lounge channel, shown in call mode) */
.m-voice-participants {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 6px 4px 26px;
}
.m-voice-participants.visible { display: flex; }
.m-voice-member {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 6px;
  font-size: 11px; color: var(--text-3);
  border-radius: 4px;
}
.m-voice-member.speaking { color: var(--text-2); }
.m-voice-avatar {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 700; color: rgba(255,255,255,0.9);
}
.m-speaking-icon { color: var(--green); margin-left: auto; }
.m-muted-icon    { color: var(--text-3); margin-left: auto; opacity: 0.6; }
.m-voice-live {
  margin-left: auto;
  font-size: 8px; font-weight: 800;
  letter-spacing: 0.04em;
  background: #c62828; color: #fff;
  padding: 1px 4px; border-radius: 2px;
  line-height: 1.4;
}
/* User row — full-width footer of m-left-panel */
.m-user-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: hsl(230, 18%, 9%);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
/* Rounded-square avatar matching the real app */
.m-user-sq {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: #26a69a;   /* teal, like the real app */
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
  position: relative;
}
.m-user-online-dot {
  position: absolute; bottom: -1px; right: -1px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #4caf50;
  border: 1.5px solid hsl(230, 18%, 9%);
}
.m-user-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.m-username { font-size: 12px; font-weight: 700; color: var(--text-1); }
.m-user-active {
  font-size: 9px; color: var(--text-3); line-height: 1;
}
.m-user-icons {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-3); flex-shrink: 0;
}

/* view container — chat and call share the same column */
.m-view {
  display: flex; flex-direction: column;
  flex: 1; overflow: hidden;
}

/* chat area */
.m-chat {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
.m-chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
  height: 46px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px; color: var(--text-1);
  flex-shrink: 0;
}
.m-chat-badge {
  margin-left: auto;
  display: flex; align-items: center; gap: 4px;
  font-size: 10px;
  color: var(--green);
  font-weight: 600;
  letter-spacing: 0.03em;
  background: hsla(152, 58%, 55%, 0.1);
  padding: 3px 8px;
  border-radius: 999px;
}
.m-messages {
  flex: 1;
  overflow: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.m-msg { display: flex; gap: 10px; align-items: flex-start; }
.m-msg-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  flex-shrink: 0; margin-top: 1px;
}
.m-msg-body { display: flex; flex-direction: column; gap: 3px; }
.m-msg-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  display: flex; align-items: baseline; gap: 6px;
}
.m-msg-time { font-size: 10px; font-weight: 400; color: var(--text-3); }
.m-msg-text { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.m-input {
  display: flex; align-items: center; gap: 10px;
  margin: 0 16px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
}
.m-input-placeholder { color: var(--text-3); font-size: 13px; flex: 1; }
.m-input-actions { display: flex; gap: 10px; color: var(--text-3); }

/* members sidebar */
.m-members {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 12px 0;
  overflow: hidden;
}
.m-members .m-section-label { padding: 4px 12px 8px; }
.m-member {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px;
  font-size: 12px; color: var(--text-2);
  cursor: pointer;
  transition: background 0.1s;
}
.m-member:hover { background: var(--surface-2); }
.m-member-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
}

/* ---- TYPING INDICATOR — faithful to RoomViewTyping.css.ts ---- */
@keyframes TypingDotAnime {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  45%       { opacity: 1;   transform: translateY(-3px); }
}
/* Matches FadeSlideAnime from RoomViewTyping.css.ts exactly */
@keyframes FadeSlideAnime {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes badgePop {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes msgReveal {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Strip between messages and input — matches RoomViewTyping layout */
.m-typing-strip {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 3px 16px 4px;
  background: var(--bg);
  flex-shrink: 0;
  animation: FadeSlideAnime 120ms ease-out;
}
.m-typing-strip.visible { display: flex; }

.m-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 2px;          /* toRem(2) for size '400' */
}
.m-typing-dot {
  width: 5px; height: 5px;    /* toRem(5) for size '400' */
  border-radius: 50%;
  background: var(--text-2);  /* var(--text-secondary) in real app */
  opacity: 0.5;               /* base opacity from TypingIndicator.css.ts */
  display: inline-block;
  animation: TypingDotAnime 1.2s ease-in-out infinite;
}
.m-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.m-typing-dot:nth-child(3) { animation-delay: 0.4s; }

.m-typing-label {
  font-size: 11px;
  color: var(--text-2);
  line-height: 1;
}
.m-typing-label b { color: var(--text-1); font-weight: 700; }

.m-msg-reveal {
  animation: msgReveal 0.3s ease forwards;
}
.m-unread.pop {
  animation: badgePop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* ---- CALL VIEW ---- */
#view-call {
  background: hsl(230, 20%, 6%);
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.m-call-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  height: 44px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-1);
  flex-shrink: 0;
}
.m-call-close {
  background: transparent; border: none;
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 4px;
  transition: background 0.1s, color 0.1s;
  padding: 0;
}
.m-call-close:hover { background: var(--surface-2); color: var(--text-2); }
.m-call-connected {
  margin-left: auto;
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 600;
  color: var(--green);
  background: hsla(152, 58%, 55%, 0.1);
  padding: 3px 8px; border-radius: 999px;
}
.m-call-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}

/* tiles layout: screenshare on top, cams row below */
.m-call-tiles {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 6px;
  padding: 8px;
  overflow: hidden;
}
.m-tile {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}

/* screenshare tile */
.m-tile-screen {
  flex: 1;
  background: hsl(230, 16%, 9%);
  border: 1.5px solid hsl(237, 60%, 45%);
  display: flex; flex-direction: column;
  justify-content: flex-end;
}
.m-tile-screen-content {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px;
  color: var(--text-3);
}
.m-tile-screen-name {
  font-size: 11px; font-weight: 600; color: var(--text-2);
  margin-top: 4px;
}
.m-tile-screen-res {
  font-size: 9px; font-family: var(--mono);
  background: hsla(228,15%,20%,0.8);
  color: var(--text-3);
  padding: 2px 6px; border-radius: 3px;
}
.m-tile-watch-btn {
  display: flex; align-items: center; gap: 5px;
  background: hsl(237, 84%, 60%);
  color: #fff; border: none; cursor: pointer;
  padding: 5px 12px; border-radius: 4px;
  font-size: 10px; font-weight: 700;
  font-family: var(--sans);
  margin-top: 4px;
  transition: opacity 0.15s;
}
.m-tile-watch-btn:hover { opacity: 0.85; }
.m-tile-label {
  display: flex; align-items: center; gap: 4px;
  font-size: 9px; color: var(--text-3);
  padding: 4px 8px;
  background: hsla(230,20%,5%,0.7);
}

/* camera tiles row */
.m-call-cams {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.m-tile-cam {
  background: var(--cam-bg, hsl(230,18%,10%));
  border-radius: 6px;
  aspect-ratio: 16/10;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
  border: 1px solid var(--border);
}
.m-tile-who {
  position: absolute; top: 5px; left: 7px;
  font-size: 9px; font-weight: 600; color: rgba(255,255,255,0.7);
}
.m-tile-live {
  position: absolute; top: 5px; right: 7px;
  font-size: 8px; font-weight: 700;
  background: #c62828; color: #fff;
  padding: 1px 5px; border-radius: 3px;
  letter-spacing: 0.03em;
}
.m-tile-avatar {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: #fff;
}
.m-tile-speaker, .m-tile-muted {
  position: absolute; bottom: 5px; left: 6px;
  display: flex; align-items: center; gap: 3px;
  font-size: 9px; color: rgba(255,255,255,0.5);
}
.m-tile-speaker.speaking { color: var(--green); }
.m-tile-muted { color: rgba(255,255,255,0.3); }

/* call controls */
.m-call-controls {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 8px 16px 10px;
  flex-shrink: 0;
}
.m-ctrl {
  width: 32px; height: 32px; border-radius: 50%;
  background: hsl(230, 15%, 16%);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s;
}
.m-ctrl:hover { background: hsl(230, 15%, 22%); color: var(--text-1); }
.m-ctrl.off { background: hsl(230, 15%, 16%); color: var(--text-3); }
.m-ctrl.active-ctrl {
  background: hsl(152, 58%, 30%);
  color: var(--green);
}
.m-ctrl.active-ctrl:hover { background: hsl(152, 58%, 25%); }
.m-ctrl.hangup {
  background: hsl(0, 70%, 40%);
  color: #fff;
  width: 36px; height: 36px;
}
.m-ctrl.hangup:hover { background: hsl(0, 70%, 35%); }

/* ---- SECTIONS ---- */
.section { padding: 96px 0; border-bottom: 1px solid var(--border); }

.section-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 52px;
}

/* ---- FEATURES ---- */
.feat-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 48px;
}
.feat-col { display: flex; flex-direction: column; gap: 12px; }
.feat-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
}
.feat-col h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
}
.feat-col p {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
}

/* ---- QUICKSTART ---- */
.quickstart { background: var(--bg); }
.qs-inner {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 80px;
  align-items: start;
}
.qs-left { display: flex; flex-direction: column; gap: 16px; }
.qs-left .section-title { margin-bottom: 0; }
.qs-desc { font-size: 14px; color: var(--text-2); line-height: 1.75; }
.qs-checklist {
  list-style: none;
  display: flex; flex-direction: column; gap: 8px;
}
.qs-checklist li {
  font-size: 13px; color: var(--text-2);
  padding-left: 18px; position: relative;
}
.qs-checklist li::before {
  content: '✓';
  color: var(--green);
  position: absolute; left: 0;
  font-size: 12px;
}
.qs-checklist li code {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  background: var(--accent-bg);
  padding: 1px 5px;
  border-radius: 3px;
}

.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tab {
  background: transparent; border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-3);
  padding: 10px 16px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
/* All panels stacked in the same grid cell — container keeps height of tallest panel,
   so switching tabs never changes the layout height */
.tab-panels {
  display: grid;
}
.tab-panel {
  grid-row: 1;
  grid-column: 1;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.tab-panel.active {
  visibility: visible;
  opacity: 1;
  pointer-events: all;
}

.code-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.code-lang { font-size: 10px; color: var(--text-3); letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--mono); }
.copy-btn {
  background: transparent; border: 1px solid var(--border-2);
  color: var(--text-3); padding: 3px 8px;
  border-radius: 4px; cursor: pointer;
  display: flex; align-items: center;
  transition: color 0.12s, border-color 0.12s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.code-block pre { padding: 16px; overflow-x: auto; }
.code-block code {
  font-family: var(--mono); font-size: 12.5px;
  line-height: 2; color: var(--text-1); display: block;
}
.cp { color: var(--accent); user-select: none; }
.cc { color: var(--text-3); }
.code-note {
  font-size: 12.5px; color: var(--text-3); line-height: 1.6; margin-top: 4px;
}
.code-note code {
  font-family: var(--mono); font-size: 11.5px;
  color: var(--accent); background: var(--accent-bg); padding: 1px 5px; border-radius: 3px;
}

/* ---- FOOTER ---- */
.footer { padding: 40px 0; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; }
.footer-left {
  display: flex; flex-direction: column; gap: 6px;
}
.footer-left p { font-size: 12px; color: var(--text-3); }
.footer-left a { color: var(--text-3); text-decoration: none; font-size: 12px; }
.footer-left a:hover { color: var(--accent); }
.footer-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.footer-link {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-3); text-decoration: none; font-size: 13px;
  transition: color 0.12s;
}
.footer-link:hover { color: var(--text-1); }

/* ================================================================
   ANIMATIONS
   ================================================================ */

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

/* ── Hero: staggered entrance on page load ── */
.hero-badge,
.hero-title,
.hero-sub,
.hero-cta,
.hero .mockup-stage {
  animation: fadeUp 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-badge         { animation-delay: 0.05s; }
.hero-title         { animation-delay: 0.17s; }
.hero-sub           { animation-delay: 0.30s; }
.hero-cta           { animation-delay: 0.42s; }
.hero .mockup-stage { animation-delay: 0.56s; }

/* ── Scroll reveal — driven by IntersectionObserver ── */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity   0.65s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in-view {
  opacity: 1;
  transform: none;
}

/* ── Feature column: hover lift ── */
.feat-col {
  transition: transform 0.22s ease;
  cursor: default;
}
.feat-col:hover { transform: translateY(-3px); }
.feat-col .feat-icon {
  transition: border-color 0.22s ease, background 0.22s ease;
}
.feat-col:hover .feat-icon {
  border-color: hsla(237, 84%, 70%, 0.35);
  background: hsla(237, 84%, 70%, 0.06);
}

/* ── Respect prefers-reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  .hero-badge, .hero-title, .hero-sub,
  .hero-cta, .hero .mockup-stage {
    animation: none;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- RESPONSIVE ---- */

/* ── Tablet (≤ 900px) ── */
@media (max-width: 900px) {
  .mockup { grid-template-columns: 252px 1fr; }
  .m-members { display: none; }
  .feat-cols { grid-template-columns: repeat(2, 1fr); gap: 32px 36px; }
  .qs-inner { grid-template-columns: 1fr; gap: 48px; }
}

/* ── Mobile (≤ 640px) ── */
@media (max-width: 640px) {

  /* Prevent any element from blowing out horizontal scroll */
  body { overflow-x: hidden; }

  /* Nav: disable floating pill, solid fixed bar + notch coverage */
  .nav {
    padding: 0;
    padding-top: constant(safe-area-inset-top); /* iOS 11.0-11.1 */
    padding-top: env(safe-area-inset-top);      /* iOS 11.2+ */
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }
  .nav.scrolled .nav-inner {
    max-width: 100%;
    padding: 0 20px;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .nav-inner { padding: 0 20px; height: 52px; }
  .nav-links .nav-link { display: none; }
  .nav-links { gap: 12px; }

  /* Hero: hide mockup, tight bottom padding */
  .hero {
    padding: 72px 24px 48px;
    padding-top: calc(72px + constant(safe-area-inset-top)); /* iOS 11.0-11.1 */
    padding-top: calc(72px + env(safe-area-inset-top));      /* iOS 11.2+ */
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  .hero-inner { gap: 14px; max-width: 100%; }
  .hero-title { font-size: clamp(28px, 8.5vw, 40px); }
  .hero-sub { font-size: 14px; max-width: 100%; }
  .hero-cta {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    width: 100%;
  }
  .hero-cta .btn-primary,
  .hero-cta .btn-ghost-lg { width: 100%; justify-content: center; text-align: center; }
  .hero-cta .btn-primary { padding: 14px 20px; }
  .hero-cta .btn-ghost-lg { padding: 12px 0; min-height: 44px; display: flex; }
  .hero .mockup-stage { display: none !important; }

  /* Container + sections */
  .container { padding: 0 20px; }
  .section { padding: 48px 0; }
  .section-eyebrow { margin-bottom: 8px; }
  .section-title { font-size: clamp(22px, 6.5vw, 30px); margin-bottom: 28px; }

  /* Features */
  .feat-cols { grid-template-columns: 1fr; gap: 24px; }
  .feat-col { gap: 8px; }

  /* Quickstart */
  .qs-inner { grid-template-columns: 1fr; gap: 32px; }
  .qs-left { gap: 12px; }
  .qs-checklist { gap: 8px; }
  .tabs { gap: 4px; flex-wrap: wrap; }
  .tab { font-size: 13px; padding: 6px 14px; }

  /* Tab panels: prevent overflow from stacked grid */
  .tab-panels { min-width: 0; overflow: hidden; }
  .tab-panel  { min-width: 0; }

  /* Code blocks */
  .code-block { overflow: hidden; }
  .code-block pre {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .code-block pre code { white-space: pre; }

  /* Footer: stack */
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
  .footer-right {
    align-items: flex-start;
    flex-direction: row;
    gap: 20px;
    flex-wrap: wrap;
  }
}
