/* Shared portal chrome — sticky top bar + social auth affordances
   Used by boarding + Mission so navigation stays stationary site-wide. */

:root {
  --portal-topbar-h: 56px;
  --portal-max: 1600px;
}

.portal-topbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--portal-topbar-h);
  border-bottom: 1px solid var(--line, #1c1c1f);
  background: rgba(10, 10, 14, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.portal-topbar-inner {
  max-width: var(--portal-max);
  margin: 0 auto;
  height: 100%;
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Mission: brand+nav | centered telemetry | actions */
.portal-topbar-inner.portal-topbar-mission {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
}
.portal-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  justify-self: start;
}
.portal-topbar-left .portal-nav {
  flex: 0 1 auto;
  margin-left: 0.15rem;
}
.portal-topbar-center {
  justify-self: center;
  min-width: 0;
  max-width: 100%;
}
.portal-topbar-mission .portal-actions {
  margin-left: 0;
  justify-self: end;
}
.portal-telemetry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.28rem;
  flex-wrap: nowrap;
  /* Wide enough for mark + F&G + BTC.D + Mode without clipping */
  max-width: min(640px, 52vw);
  min-width: min(420px, 40vw);
  overflow-x: auto;
  scrollbar-width: none;
}
.portal-telemetry::-webkit-scrollbar { display: none; }
.portal-telemetry .seg {
  flex: 1 1 0;
  flex-shrink: 1;
  min-width: 4.6rem;
}
/* —— Mobile / tablet only (desktop grid above unchanged) —— */
@media (max-width: 900px) {
  .portal-topbar-inner.portal-topbar-mission {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.45rem;
    padding: 0.4rem 0.55rem 0.35rem;
    align-items: center;
  }
  .portal-topbar-center {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 0 0 0.15rem;
  }
  body.has-portal-topbar .portal-topbar:has(.portal-topbar-mission) {
    height: auto;
    min-height: var(--portal-topbar-h);
  }
  /* Rails: full-page scroll on mobile rather than sticky under tall topbar */
  body.has-portal-topbar:has(.portal-topbar-mission) .rail {
    top: 0;
    max-height: none;
    position: relative;
  }
  .portal-telemetry {
    max-width: 100% !important;
    min-width: 0 !important;
    width: 100% !important;
    justify-content: stretch;
    gap: 0.2rem;
    overflow-x: visible;
  }
  .portal-telemetry .seg {
    flex: 1 1 0;
    min-width: 0 !important;
    max-width: none;
  }
  .portal-actions {
    gap: 0.25rem;
  }
  .portal-actions .btn.sm {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
  }
  .portal-burger {
    width: 2.25rem;
    height: 2.25rem;
  }
}

.portal-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text, #e4e4e7);
  flex-shrink: 0;
  text-decoration: none;
}
.portal-brand:hover { color: var(--text, #e4e4e7); }

/* Default mark; brand.css + logo-mark-*.png for official art (height-driven) */
.portal-mark {
  height: 1.75rem; /* 28px — fits 56px topbar with padding */
  width: auto;
  aspect-ratio: 1.32 / 1;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: visible;
  background: transparent;
  border: none;
  flex-shrink: 0;
  line-height: 0;
}
.portal-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.portal-name {
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.portal-name em {
  font-style: normal;
  color: var(--green, #00ff9f);
  font-weight: 800;
}

.portal-nav {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.portal-nav::-webkit-scrollbar { display: none; }

.portal-link {
  color: var(--muted, #71717a);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.58rem;
  border-radius: 8px;
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}
.portal-link:hover {
  color: var(--text, #e4e4e7);
  background: rgba(255, 255, 255, 0.04);
}
.portal-link.is-on {
  color: var(--text, #e4e4e7);
  background: rgba(0, 255, 159, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 255, 159, 0.15);
}

.portal-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

.portal-icon-btn {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--line, #1c1c1f);
  background: transparent;
  color: var(--muted, #71717a);
  cursor: pointer;
}
.portal-icon-btn:hover {
  color: var(--text, #e4e4e7);
  border-color: rgba(147, 197, 253, 0.3);
}

.portal-burger {
  display: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  border: 1px solid var(--line, #1c1c1f);
  background: var(--bg-panel, #0c0c10);
  color: var(--text, #e4e4e7);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.portal-mobile-nav {
  border-bottom: 1px solid var(--line, #1c1c1f);
  background: var(--bg-elev, #0a0a0c);
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.portal-mobile-nav[hidden] { display: none !important; }
.portal-mobile-nav a,
.portal-mobile-nav button {
  color: var(--text, #e4e4e7);
  padding: 0.55rem 0.4rem;
  font-weight: 600;
  font-size: 0.88rem;
  border-radius: 8px;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.portal-mobile-nav a:hover,
.portal-mobile-nav button:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Social login grid (UI-first; providers wired later) */
.social-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.55rem;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--line, #1c1c1f);
  background: #08080a;
  color: var(--text, #e4e4e7);
  font-weight: 600;
  font-size: 0.75rem;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  font-family: inherit;
}
.social-btn:hover {
  border-color: rgba(147, 197, 253, 0.35);
  background: rgba(59, 130, 246, 0.08);
}
.social-btn:disabled,
.social-btn.is-soon {
  opacity: 0.92;
}
.social-btn .s-ico {
  width: 1.05rem;
  height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: 4px;
  flex-shrink: 0;
}
.social-btn[data-provider="google"] .s-ico { background: #fff; color: #ea4335; font-size: 0.7rem; }
.social-btn[data-provider="apple"] .s-ico { background: #111; color: #fff; border: 1px solid #333; }
.social-btn[data-provider="telegram"] .s-ico { background: #229ed9; color: #fff; font-size: 0.65rem; }
.social-btn[data-provider="x"] .s-ico { background: #000; color: #fff; border: 1px solid #333; }
.social-soon {
  margin: 0.45rem 0 0;
  font-size: 0.65rem;
  color: var(--dim, #52525b);
  text-align: center;
}

body.has-portal-topbar {
  /* Mission shell sits under sticky bar */
}

body.has-portal-topbar .shell {
  min-height: calc(100vh - var(--portal-topbar-h));
}

body.has-portal-topbar .rail {
  max-height: calc(100vh - var(--portal-topbar-h));
  top: var(--portal-topbar-h);
}

@media (max-width: 980px) {
  .portal-nav { display: none; }
  .portal-burger { display: inline-flex; }
}
@media (max-width: 640px) {
  /* Keep official mark; hide text wordmark to save space */
  .portal-name { display: none; }
  /* Slightly larger mark when wordmark is hidden (logo-only topbar) */
  .portal-mark.brand-mark,
  .portal-mark {
    height: 2rem; /* 32px */
    width: auto;
    aspect-ratio: 1.32 / 1;
  }
  .portal-actions .btn-hide-sm { display: none; }
  /* Log out / long labels live in burger menu — free top-row space */
  .portal-actions #btn-portal-logout {
    display: none;
  }
  .portal-actions #btn-portal-user {
    max-width: 5.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .portal-topbar-inner.portal-topbar-mission {
    padding-left: 0.45rem;
    padding-right: 0.45rem;
  }
  .portal-mobile-nav {
    padding: 0.45rem 0.65rem 0.65rem;
  }
  .portal-mobile-nav button {
    min-height: 2.6rem;
    padding: 0.65rem 0.5rem;
    font-size: 0.92rem;
  }
}

/* �� Shared site footer + legal pages �� */
.portal-footer {
  border-top: 1px solid var(--line, #1c1c1f);
  padding: 2rem 0 0;
  background: #070709;
  margin-top: auto;
}
.portal-footer .section-inner,
.portal-footer .footer-grid {
  max-width: var(--portal-max, 1600px);
  margin: 0 auto;
  padding-left: 1.1rem;
  padding-right: 1.1rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
}
.footer-brand { margin-bottom: 0.5rem; }
.footer-tag {
  margin: 0.4rem 0 0;
  color: var(--dim, #52525b);
  font-size: 0.82rem;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.footer-h {
  margin: 0 0 0.45rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim, #52525b);
}
.footer-cols a,
.footer-muted {
  display: block;
  color: var(--muted, #71717a);
  font-size: 0.82rem;
  margin-bottom: 0.3rem;
  text-decoration: none;
}
.footer-cols a:hover { color: var(--text, #e4e4e7); }
.footer-base {
  border-top: 1px solid var(--line-soft, #141418);
  max-width: var(--portal-max, 1600px);
  margin: 0 auto;
  padding: 0.85rem 1.1rem 1.15rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--dim, #52525b);
  font-size: 0.72rem;
}
.footer-base a {
  color: var(--muted, #71717a);
  text-decoration: none;
  margin-left: 0.75rem;
}
.footer-base a:hover { color: var(--text, #e4e4e7); }
.footer-base-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

/* Compact footer for Mission SPA */
.site-footer-slim {
  border-top: 1px solid var(--line, #1c1c1f);
  background: rgba(7, 7, 9, 0.95);
  padding: 0.55rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.72rem;
  color: var(--dim, #52525b);
  z-index: 50;
}
.site-footer-slim a {
  color: var(--muted, #71717a);
  text-decoration: none;
  margin-left: 0.85rem;
}
.site-footer-slim a:hover { color: var(--text, #e4e4e7); }
.site-footer-slim .foot-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

/* Legal document pages */
body.legal-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #050506);
  color: var(--text, #e4e4e7);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}
.legal-main {
  flex: 1 1 auto;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.75rem 1.15rem 3rem;
  width: 100%;
  box-sizing: border-box;
}
.legal-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim, #52525b);
}
.legal-main h1 {
  margin: 0 0 0.5rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.legal-meta {
  margin: 0 0 1.5rem;
  font-size: 0.82rem;
  color: var(--muted, #71717a);
}
.legal-callout {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(252, 211, 77, 0.28);
  background: rgba(66, 48, 6, 0.25);
  color: #fde68a;
  font-size: 0.84rem;
  line-height: 1.5;
}
.legal-main h2 {
  margin: 1.75rem 0 0.55rem;
  font-size: 1.05rem;
  font-weight: 700;
}
.legal-main h3 {
  margin: 1.1rem 0 0.4rem;
  font-size: 0.92rem;
  font-weight: 650;
  color: #d4d4d8;
}
.legal-main p,
.legal-main li {
  color: #d4d4d8;
  font-size: 0.92rem;
}
.legal-main p { margin: 0 0 0.75rem; }
.legal-main ul,
.legal-main ol {
  margin: 0 0 0.9rem;
  padding-left: 1.25rem;
}
.legal-main li { margin-bottom: 0.35rem; }
.legal-main a { color: #93c5fd; }
.legal-toc {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line, #1c1c1f);
  background: #0a0a0e;
}
.legal-toc p {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim, #52525b);
}
.legal-toc a {
  display: block;
  font-size: 0.84rem;
  color: var(--muted, #71717a);
  text-decoration: none;
  margin-bottom: 0.25rem;
}
.legal-toc a:hover { color: var(--text, #e4e4e7); }
.legal-nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line, #1c1c1f);
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr 1fr; }
}
