/* Ambassador portal — shared styles. Reuses the getfirstchair.app design
   tokens; adds portal chrome (gate wall, category rail, story cards, video
   frames). Loaded by /ambassador/ and every /ambassador/stories/* page. */

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

:root {
  --bg:            #F7F7F5;
  --surface:       #FFFFFF;
  --surface-dim:   #EFEFEC;
  --ink:           #1B1D1F;
  --ink-soft:      #55585C;
  --ink-faint:     #8A8D91;
  --line:          #E4E3E0;
  --accent:        #FF7A1A;
  --accent-ink:    #331200;
  --danger:        #E0392C;
  --ok:            #2E9A5C;
  --navy:          #14161A;
  --radius-lg:     28px;
  --radius-md:     18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { display: block; max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ── NAV ── */
nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  background: rgba(247,247,245,0.86);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1120px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 17px; text-decoration: none; color: var(--ink);
}
.nav-logo img { width: 30px; height: 30px; border-radius: 8px; }
.nav-logo .badge {
  font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-ink); background: rgba(255,122,26,0.16);
  padding: 3px 8px; border-radius: 100px;
}
.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-user { font-size: 13px; color: var(--ink-faint); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 600; font-size: 15px;
  padding: 12px 22px; border-radius: 100px;
  text-decoration: none; border: none; cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn-sm { padding: 8px 15px; font-size: 13.5px; }

/* ── Sign-in wall ── */
.gate {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
}
.gate-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  max-width: 460px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 48px -28px rgba(20,22,26,0.25);
}
.gate-card .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}
.gate-card .eyebrow::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.gate-card h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 12px; }
.gate-card p { font-size: 15.5px; color: var(--ink-soft); margin-bottom: 26px; }
.gate-card .fine { font-size: 12.5px; color: var(--ink-faint); margin: 18px 0 0; }
.gate-error {
  background: rgba(224,57,44,0.08); color: var(--danger);
  border-radius: var(--radius-md); padding: 12px 16px;
  font-size: 13.5px; font-weight: 600; margin-bottom: 20px;
}

/* Apple sign-in button (Apple HIG-ish, black pill) */
.apple-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  background: #000; color: #fff;
  font-family: var(--font); font-weight: 600; font-size: 16px;
  padding: 14px 22px; border-radius: 100px; border: none; cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.apple-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.apple-btn svg { width: 17px; height: 17px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Portal shell ── */
.portal { padding: 40px 24px 100px; max-width: 1120px; margin: 0 auto; }
.portal-head { margin-bottom: 34px; }
.portal-head .eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px;
}
.portal-head h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.portal-head p { color: var(--ink-soft); font-size: 16px; max-width: 60ch; }

/* Ambassador revenue dashboard */
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 22px;
  margin-bottom: 44px;
}
.dashboard-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.panel-head .eyebrow,
.section-divider .eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.panel-head h2,
.section-divider h2 {
  font-size: 18px;
  line-height: 1.25;
}
.code-form {
  display: grid;
  grid-template-columns: 1fr 0.75fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.code-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.code-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: 600 15px var(--font);
  padding: 10px 12px;
  letter-spacing: 0;
  text-transform: none;
}
.code-form input:focus {
  outline: 2px solid rgba(255,122,26,0.28);
  border-color: rgba(255,122,26,0.7);
}
.code-form button { min-height: 46px; white-space: nowrap; }
.code-form button:disabled { opacity: 0.55; cursor: wait; transform: none; }
.code-output {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 14px;
  margin-bottom: 14px;
}
.share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.code-output a {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration-color: rgba(255,122,26,0.45);
}
.code-token {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border: 1px solid rgba(255,122,26,0.28);
  border-radius: 10px;
  background: rgba(255,122,26,0.12);
  color: var(--accent-ink);
  font: 800 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  padding: 10px 12px;
  overflow-wrap: anywhere;
}
.code-output .redeem-link {
  color: var(--accent-ink);
  font-size: 13px;
}
.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.metric-row > div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--bg);
}
.metric-row span,
.commission-row span {
  display: block;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
}
.metric-row strong {
  display: block;
  font-size: 24px;
  line-height: 1.15;
  margin-top: 4px;
}
.commission-table {
  display: grid;
  gap: 8px;
}
.commission-row {
  display: grid;
  grid-template-columns: 1.1fr 0.8fr 1fr 1fr;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.commission-row strong {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}
.section-divider {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  padding-top: 30px;
  margin-bottom: 18px;
}
.dashboard-panel .fine {
  color: var(--ink-faint);
  font-size: 12.5px;
  line-height: 1.45;
}
.testflight-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin: -18px 0 44px;
}
.testflight-panel .eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.testflight-panel h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 5px;
}
.testflight-panel p {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.45;
}
.testflight-panel .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Category rail */
.categories { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 36px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.category-pill {
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 9px 16px; border-radius: 100px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  cursor: pointer;
}
.category-pill[aria-selected="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.category-pill[disabled] { opacity: 0.5; cursor: default; }
.category-pill .count { color: var(--ink-faint); font-weight: 600; margin-left: 4px; }
.category-pill[aria-selected="true"] .count { color: rgba(255,255,255,0.6); }

.category-intro { font-size: 15px; color: var(--ink-soft); margin-bottom: 26px; max-width: 62ch; }

/* Story card grid */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.story-card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-md); overflow: hidden;
  text-decoration: none; color: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.story-card:hover { transform: translateY(-2px); box-shadow: 0 18px 36px -22px rgba(20,22,26,0.28); }
.story-card .thumb {
  aspect-ratio: 16 / 10; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.5); position: relative;
}
.story-card .thumb img, .story-card .thumb video { width: 100%; height: 100%; object-fit: cover; }
.story-card .thumb .play {
  position: absolute; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.92); display: flex; align-items: center; justify-content: center;
}
.story-card .thumb .play svg { width: 18px; height: 18px; margin-left: 2px; color: var(--navy); }
.story-card .body { padding: 18px 20px 22px; }
.story-card .status-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.story-card h3 { font-size: 17px; font-weight: 700; line-height: 1.3; margin-bottom: 6px; }
.story-card p { font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

.chip {
  font-size: 11px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 100px;
}
.chip-ready { background: rgba(46,154,92,0.14); color: #1c6b3e; }
.chip-soon { background: var(--surface-dim); color: var(--ink-faint); }
.chip-test { background: rgba(255,122,26,0.14); color: var(--accent-ink); }

.empty-cat {
  border: 1px dashed var(--line); border-radius: var(--radius-md);
  padding: 40px 24px; text-align: center; color: var(--ink-faint); font-size: 14.5px;
}

/* ── Story detail page ── */
.story-hero { padding: 40px 24px 8px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; margin-bottom: 26px;
}
.back-link:hover { color: var(--ink); }
.story-body { max-width: 780px; margin: 0 auto; padding: 0 24px 100px; }
.story-body .eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 14px;
}
.story-body h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-bottom: 16px; }
.story-body .lead { font-size: 18px; color: var(--ink-soft); margin-bottom: 34px; }
.story-body h2 { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em; margin: 44px 0 14px; }
.story-body p { font-size: 16.5px; color: var(--ink-soft); line-height: 1.65; }
.story-body p + p { margin-top: 12px; }

.meta-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 34px; }

/* Video frames */
.video-block { margin: 24px 0 8px; }
.video-frame {
  border-radius: var(--radius-md); overflow: hidden;
  border: 1px solid var(--line); background: var(--navy);
}
.video-frame.portrait { max-width: 340px; margin: 0 auto; }
.video-frame video { width: 100%; display: block; background: var(--navy); }
.video-caption { font-size: 13px; color: var(--ink-faint); text-align: center; margin-top: 10px; }
.video-missing {
  aspect-ratio: 9 / 16; max-width: 340px; margin: 0 auto;
  border: 1px dashed var(--line); border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 24px; color: var(--ink-faint);
}
.video-missing.landscape { aspect-ratio: 16 / 9; max-width: 100%; }
.video-missing .k { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-soft); word-break: break-all; }

/* Transcript */
.transcript {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md); padding: 24px 26px;
}
.transcript .beat { margin-bottom: 16px; }
.transcript .beat:last-child { margin-bottom: 0; }
.transcript .beat .role {
  font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 4px;
}
.transcript .beat p { font-size: 16px; color: var(--ink); line-height: 1.6; }
.transcript .beat.payoff p { font-weight: 600; }

/* Journey steps */
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 18px; }
.steps li { counter-increment: step; display: flex; gap: 16px; }
.steps li::before {
  content: counter(step);
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.steps h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 3px; }
.steps p { font-size: 14.5px; }

.note {
  background: var(--surface-dim); border-radius: var(--radius-md);
  padding: 20px 22px; border-left: 3px solid var(--accent);
  font-size: 14.5px; color: var(--ink); margin-top: 20px;
}
.note strong {
  display: block; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 8px;
}

/* ── Footer ── */
footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner {
  max-width: 1120px; margin: 0 auto; padding: 30px 24px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
}
.footer-logo { font-weight: 700; font-size: 15px; }
.footer-links { display: flex; gap: 22px; list-style: none; flex-wrap: wrap; }
.footer-links a { font-size: 14px; color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--ink); }
.footer-copy { font-size: 13px; color: var(--ink-faint); width: 100%; margin-top: 14px; }

.hidden { display: none !important; }

@media (max-width: 720px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .code-form { grid-template-columns: 1fr; align-items: stretch; }
  .code-form button { width: 100%; }
  .testflight-panel {
    align-items: stretch;
    flex-direction: column;
    margin-top: -20px;
  }
  .testflight-panel .btn { width: 100%; }
  .commission-row {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ── Mobile nav: keep it on one line ── */
@media (max-width: 560px) {
  nav { padding: 11px 14px; gap: 10px; }
  .nav-logo { font-size: 15px; white-space: nowrap; gap: 8px; }
  .nav-logo img { width: 26px; height: 26px; }
  .nav-logo .badge { display: none; }        /* decorative; drop it when tight */
  .nav-right { gap: 8px; min-width: 0; }
  .nav-user {
    max-width: 34vw; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .btn-sm { padding: 7px 12px; font-size: 13px; }
}
@media (max-width: 380px) {
  .nav-user { display: none; }               /* name goes; Sign out stays */
  .portal { padding-left: 16px; padding-right: 16px; }
  .dashboard-panel { padding: 18px; }
  .metric-row { grid-template-columns: 1fr; }
  .commission-row { grid-template-columns: 1fr; }
}
