/* ─────────────────────────────────────────────────────────────
   PatriotChat main.css (global) — theme aware + iOS-safe
   ───────────────────────────────────────────────────────────── */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }

/* --- THEME BRIDGE: guarantee Bootstrap vars for both themes --- */
:root[data-bs-theme="light"], [data-bs-theme="light"]{
  --bs-body-bg: #ffffff;
  --bs-body-color: #111827;
  --bs-card-bg: #ffffff;
  --bs-card-border-color: #e5e7eb;
  --bs-dropdown-bg: #ffffff;
  --bs-dropdown-border-color: #e5e7eb;
}

:root[data-bs-theme="dark"], [data-bs-theme="dark"]{
  --bs-body-bg: #0e1624;              /* page surface */
  --bs-body-color: #e5e7eb;
  --bs-card-bg: #111827;
  --bs-card-border-color: #1f2937;
  --bs-dropdown-bg: #0f172a;
  --bs-dropdown-border-color: #1f2937;
}

/* iOS sometimes paints body before vars propagate — force it here too */
[data-bs-theme="light"] body{
  background: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
}
[data-bs-theme="dark"] body{
  background: var(--bs-body-bg) !important;
  color: var(--bs-body-color) !important;
}

/* Base typography & colors (theme-aware) */
html, body{
  margin:0;
  padding:0;
  font-family: Inter, Roboto, sans-serif;
  background: var(--bs-body-bg, #0e1624);
  color: var(--bs-body-color, #e5e7eb);
}

/* Layout helpers */
body.full-height{
  display:flex;
  flex-direction:column;
  min-height:100vh;
}

/* Fixed navbar offset + iOS safe area */
:root{ --nav-height: 56px; }
body{
  padding-top: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
  overflow-x: hidden;
}

/* Main container */
main{
  flex:1;
  width:100%;
  max-width:960px;
  margin:0 auto;
  padding:0.5rem 1rem; /* navbar already provides top offset */
}
main.hero-page{ padding-top: 0; margin-top: 0; }

/* Links & buttons */
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }
main .btn, .btn-primary{ display:block; margin:1rem auto; text-align:center; }
.btn-primary{ margin:2rem auto; }

/* Content pages (generic) */
.content-page{ padding:3rem 1rem; }
.content-shell{ max-width:1100px; margin:0 auto; }
.content-narrow{ max-width:760px; margin:0 auto; }
.content-page h1{ font-size:2.25rem; margin-bottom:1rem; }
.content-page .lead{ font-size:1.2rem; opacity:.85; }
.content-page p{ line-height:1.6; }

/* Utilities */
.hidden{ display:none!important; }
.text-nowrap{ white-space:nowrap; }

/* Alerts */
.alert{ padding:.75rem 1rem; border-radius:6px; margin-top:1rem; }
.alert-info{    background:#2c3e50; color:#fff;}
.alert-danger{  background:#c0392b; color:#fff;}
.alert-success{ background:#27ae60; color:#fff;}

/* Password strength meter */
.meter{ background:#e5e5e5; border-radius:4px; height:6px; margin-top:6px; }
.meter #fill{ height:100%; width:0; border-radius:4px; transition:width .3s; }

/* Checkbox layout helpers */
.form-group.checkbox > label{
  display:inline-flex; align-items:center; gap:.4rem; margin-bottom:0;
}
.form-group.checkbox input[type="checkbox"]{ flex:0 0 auto; }

/* Registration card */
.register-card,
.step-card,
.card--registration{
  width:100%; max-width:420px; margin:0 auto;
  padding:1.5rem 1.25rem; box-sizing:border-box;
}
@media (max-width:360px){
  .register-card{ padding:1.25rem 1rem; }
  .form-group input, .form-group select{ font-size:1rem; }
}

/* Dashboard grid */
.dashboard .grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap:1.5rem; margin-top:2rem;
}
.dashboard .card{
  background: var(--bs-card-bg, #ffffff);
  border: 1px solid var(--bs-card-border-color, #e5e7eb);
  padding:1.5rem; border-radius:10px;
  box-shadow:0 0 8px rgba(0,0,0,.05);
}

/* CTA helpers */
.page-container{
  padding-top:64px; padding-bottom:1rem;
  max-width:1200px; margin:0 auto;
}
.cta-button-wrapper{ text-align:center; margin-top:1rem; }
.cta .btn-primary{
  display:inline-block; padding:.75rem 1.5rem;
  font-weight:bold; font-size:1.1rem;
}

/* Generic card */
.card{
  border-radius:10px; padding:1.5rem; margin-bottom:1.5rem;
  background: var(--bs-card-bg, #1e1e1e);
  border: 1px solid var(--bs-card-border-color, #333);
}

/* Images / SVG never overflow */
img, svg{ max-width:100%; height:auto; }

/* ===========================================================
   HOME / INDEX POLISH (applies to <main class="hero-page">)
   =========================================================== */
.hero-page .container{
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Hero section */
.hero{
  padding-block: clamp(28px, 6vw, 72px);
}
.hero h1{
  font-size: clamp(28px, 4.2vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  margin: 0 0 12px 0;
}
.hero p{
  margin: 0 0 18px 0;
  color: var(--text-muted, #6b7280);
}
.hero .sticky-cta{
  display:inline-block;
  padding:10px 16px;
  border-radius:12px;
  font-weight:600;
  text-decoration:none;
}
.hero .cta-tagline{
  margin-top:10px;
  color: var(--text-muted, #6b7280);
}

/* Feature grid */
.features{
  padding-block: clamp(24px, 5vw, 56px);
}
.features h2{
  margin: 0 0 14px 0;
  font-size: clamp(22px, 2.4vw, 28px);
}
.features .grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:16px;
}
@media (max-width: 992px){
  .features .grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px){
  .features .grid{ grid-template-columns: 1fr; }
}
.features .feature{
  background: var(--bs-card-bg, #ffffff);
  border: 1px solid var(--bs-card-border-color, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
}

/* Story detail rich media should not overflow */
.story-body img,
.story-body video,
.story-body iframe {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 1rem auto;
}

.story-body figure {
  max-width: 100%;
  margin: 0 auto 1.5rem auto;
}

.story-actions{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin: 1rem 0;
}
.story-actions .btn,
.story-actions .vp-btn{
  border-radius: 999px;
  padding: 8px 12px;
}
.comments{
  margin-top: 1rem;
}
.comments textarea{
  width: 100%;
  min-height: 100px;
  padding: 10px;
  border-radius: 8px;
}

/* Salutes modal */
.salute-overlay{
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.salute-modal{
  background: var(--card-bg, #0f172a);
  color: var(--text, #e5e7eb);
  border: 1px solid var(--card-border, rgba(255,255,255,0.12));
  border-radius: 14px;
  padding: 18px;
  width: min(420px, 92vw);
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.salute-modal h3{ margin: 0 0 8px 0; font-size: 1.1rem; }
.salute-modal .balance{ font-size: 0.95rem; margin-bottom: 10px; color: var(--text-muted, #94a3b8); }
.salute-choices{
  display:flex; flex-wrap:wrap; gap:8px; margin:10px 0;
}
.salute-choices button{
  border-radius: 999px;
  padding: 8px 12px;
}
.salute-actions{
  display:flex; gap:10px; justify-content:flex-end; margin-top:10px;
}

/* CTA band */
.cta{
  text-align:center;
  padding: clamp(24px, 5vw, 56px) 16px;
  border-block: 1px solid var(--bs-card-border-color, #1f2937);
}
.cta h2{ margin: 0 0 8px 0; }
.cta .cta-tagline{ margin: 0 0 12px 0; color: var(--text-muted, #6b7280); }
.cta .btn{ padding:10px 18px; border-radius:12px; font-weight:600; }

/* AI teaser */
.ai-teaser{
  padding-block: clamp(20px, 4vw, 48px);
}
.ai-teaser .container{
  max-width: 1100px; margin: 0 auto; padding-inline: 16px;
}
