/* =============================================================
   Doctor G Science — Site Theme (v1)
   Place at: /css/theme.css
   Purpose: Centralize shared styles (colors, layout, header/footer,
            buttons, cards, timeline, hero, and utilities)
   ============================================================= */

/* ---------- CSS Variables (brand & theme) ---------- */
:root {
  --bg: #0b1220;          /* deep space */
  --card: #111a2e;
  --text: #eff3ff;
  --muted: #a8b3cf;
  --accent: #6fa8ff;
  --accent-2: #b78bff;
  --ring: rgba(111,168,255,0.45);
  --step: #ffd54a;        /* soft yellow for steps */
  --border: #223055;
  --shadow: rgba(0,0,0,.35);
}

/* ---------- Base / Reset-ish ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 700px at 70% -10%, #18223c 0%, var(--bg) 60%) fixed var(--bg);
  color: var(--text);
  line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(111,168,255,.35);
}

.brand h1 {
  font-size: clamp(22px, 3vw, 30px);
  margin: 0;
  letter-spacing: .3px;
}

nav {
  display: flex;
  gap: 14px;
  align-items: center;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid #2a3552;
  background: #121a2e;
  color: var(--text);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  transition: border-color .2s, transform .15s, box-shadow .2s;
  cursor: pointer;
}
.btn:hover {
  border-color: #3a4970;
}
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}
.btn:active {
  transform: translateY(1px);
}

/* ---------- Hero ---------- */
.hero {
  margin-top: 18px;
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(17,26,46,.65), rgba(17,26,46,.35));
  border: 1px solid var(--border);
  box-shadow: 0 6px 30px var(--shadow), inset 0 0 40px rgba(111,168,255,.06);
  position: relative;
  overflow: hidden;
}
.hero h1, .hero h2 {
  font-size: clamp(22px, 3.2vw, 34px);
  margin: 4px 0 8px;
}
.hero p { color: var(--muted); margin: 0; }

/* Decorative starfield (optional element) */
.stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #e6f0ff 40%, transparent 41%),
    radial-gradient(1px 1px at 80% 20%, #cfe0ff 40%, transparent 41%),
    radial-gradient(1.5px 1.5px at 60% 70%, #e1e8ff 40%, transparent 41%),
    radial-gradient(1px 1px at 30% 80%, #9fbaff 40%, transparent 41%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* ---------- Cards / Sections ---------- */
.card {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}
.card h2 { margin: .2rem 0 .6rem; font-size: 20px; }
.muted { color: var(--muted); font-size: 14px; }
.stack { display: grid; gap: 12px; }

/* ---------- Video chooser (active state) ---------- */
.chooser { display:flex; flex-wrap:wrap; gap:8px; }
.chooser .btn.is-active,
.chooser .btn[aria-current="true"] {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg);
  border-color: transparent;
  box-shadow: 0 0 0 3px var(--ring), 0 8px 16px rgba(111,168,255,0.35);
}
.chooser .btn:is(:focus-visible, :hover) {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Video Player ---------- */
.player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0b1220;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
iframe { width: 100%; height: 100%; border: 0; }

/* ---------- Timeline (Homepage) ---------- */
.timeline-wrap {
  margin-top: 24px;
  background: #0f172a url("/images/Timeline_graphic.png") center/cover no-repeat;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}
/* Lighter overlay so the image shows through more */
.timeline-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,.08));
  pointer-events: none;
}
.timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: #0f172a;
  border-bottom: 1px solid var(--border);
}
.timeline-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: .3px;
}

.hscroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-color: #3b4a72 transparent;
}
.rail {
  position: relative;
  display: flex;
  gap: 34px;
  padding: 26px 26px 30px;
  min-height: 130px;
}
.rail::before {
  content: "";
  position: absolute;
  left: 26px;
  right: 26px;
  top: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .6;
  border-radius: 2px;
}
.dot { position: relative; z-index: 1; flex: 0 0 auto; width: max-content; text-align: center; }
.dot button { position: relative; border: none; background: transparent; cursor: pointer; padding: 0; }
.dot .orb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(111,168,255,.4);
  transform: translateY(50%);
  border: 2px solid #0f172a;
}
.dot .label {
  margin-top: 16px;
  padding: 10px 12px;
  background: #0f1a31;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 13px;
  color: #d8e3ff;
  min-width: 180px;
  white-space: nowrap;
}
.dot .label .title { font-weight: 700; display: block; }
.dot .label .subtitle { color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
.dot:focus-within .label, .dot:hover .label {
  outline: 1px solid var(--ring);
  box-shadow: 0 0 0 6px rgba(111,168,255,.1);
}

.step { font-weight: 800; letter-spacing: .3px; }
.step .n { color: var(--step); }

/* ---------- Landing Page Grid (topic pages) ---------- */
.content {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  margin-top: 22px;
}
@media (max-width: 900px) {
  .content { grid-template-columns: 1fr; }
}

/* ---------- FAQ ---------- */
.faq details {
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
}
.faq summary { cursor: pointer; font-weight: 700; }

/* ---------- Footer ---------- */
footer {
  margin: 32px 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}
.contact a { font-weight: 700; }

/* ---------- Forms (generic styles you control) ---------- */
.form input[type="text"],
.form input[type="email"],
.form input[type="tel"],
.form select,
.form textarea {
  width: 100%;
  padding: 12px 16px;
  background: #0b1220;
  border: 1px solid #2a3552;
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
.form input::placeholder,
.form textarea::placeholder { color: var(--muted); }
.form input:focus,
.form select:focus,
.form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Brevo embed (optional, safe overrides) ---------- */
#sib-container input,
#sib-container .input,
#sib-container select,
#sib-container textarea {
  color: #0f172a !important;
  background-color: #ffffff !important;
  border-color: #C0CCD9 !important;
}
#sib-container .entry__label { color: #3c4858 !important; }
#sib-container .entry__specification { color: #8390A4 !important; }
#sib-container input:focus,
#sib-container select:focus,
#sib-container textarea:focus {
  outline: none !important;
  box-shadow: 0 0 0 3px rgba(111,168,255,0.35) !important;
  border-color: #6fa8ff !important;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.center { text-align: center; }
.max-w-680 { max-width: 680px; }
.rounded { border-radius: 12px; }
.border { border: 1px solid var(--border); }
.shadow { box-shadow: 0 6px 30px var(--shadow); }

/* ---------- Timeline label transparency + smaller buttons (OVERRIDES) ---------- */
/* High-specificity + !important to win over earlier rules */
.timeline-wrap .rail .dot .label {
  padding: 8px 10px;                  /* smaller */
  font-size: 12.5px;                  /* smaller text */
  min-width: 160px;                   /* narrower */
  background: rgba(15, 26, 49, 0.55) !important;
  border-color: rgba(34, 48, 85, 0.60) !important;
  color: #d8e3ff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  backdrop-filter: saturate(120%) blur(6px);
  -webkit-backdrop-filter: saturate(120%) blur(6px);
}
.timeline-wrap .rail .dot:focus-within .label,
.timeline-wrap .rail .dot:hover .label {
  background: rgba(15, 26, 49, 0.80) !important;
  border-color: rgba(58, 73, 112, 0.85) !important;
  box-shadow: 0 0 0 6px rgba(111,168,255,0.10), 0 8px 24px rgba(0,0,0,0.35);
}
/* Slightly tone down the orb glow over the image */
.timeline-wrap .rail .dot .orb { opacity: 0.9; }
/* Mobile: raise opacity for readability */
@media (max-width: 640px) {
  .timeline-wrap .rail .dot .label {
    background: rgba(15, 26, 49, 0.70) !important;
  }
}

/* --- Horizontal scroll affordances for the timeline --- */
.timeline-wrap .hscroll { 
  position: relative;
  scroll-snap-type: x proximity;        /* gentle snap */
  -webkit-overflow-scrolling: touch; 
}

/* Faded edges hint there’s more content off-screen */
.timeline-wrap .hscroll::before,
.timeline-wrap .hscroll::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 2;
}
.timeline-wrap .hscroll::before {
  left: 0;
  background: linear-gradient(to right, rgba(11,18,32,0.85), rgba(11,18,32,0));
}
.timeline-wrap .hscroll::after {
  right: 0;
  background: linear-gradient(to left, rgba(11,18,32,0.85), rgba(11,18,32,0));
}

/* Chevron buttons */
.timeline-wrap .scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  border: 1px solid rgba(58,73,112,0.8);
  background: rgba(15,26,49,0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: 999px;
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
}
.timeline-wrap .scroll-btn:hover { border-color: var(--accent); }
.timeline-wrap .scroll-btn.left  { left: 8px; }
.timeline-wrap .scroll-btn.right { right: 8px; }

/* Snap items (each milestone) */
.timeline-wrap .rail .dot { scroll-snap-align: start; }

@media (max-width: 640px) {
  .timeline-wrap .rail {
    gap: 18px;              /* was 34px */
    padding: 18px;          /* was 26px */
    min-height: 120px;      /* slightly shorter */
  }
  .timeline-wrap .rail::before {
    left: 18px; right: 18px; top: 52px;  /* re-align the line */
  }
  .timeline-wrap .rail .dot .label {
    min-width: 140px;       /* was 160px in your override */
    padding: 8px 10px;
    font-size: 12.5px;
  }
}

.timeline-header .swipe-hint {
  color: var(--muted);
  font-size: 12px;
  display: none;
}
@media (max-width: 640px) {
  .timeline-header .swipe-hint { display: block; }
}

/* --- Watch state UI on topic cards --- */
.topic-card { position: relative; display: grid; grid-template-rows: auto 1fr auto; }
.topic-card .actions { margin-top: auto; display: flex; gap: 8px; align-items: center; }

.topic-card .badge-watched {
  position: absolute; top: 8px; left: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--bg); font-weight: 700; font-size: 12px;
  padding: 4px 8px; border-radius: 999px; box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.topic-card .progress-line {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(255,255,255,.15);
}
.topic-card .progress-line > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0%;
}

