/* ===== Q-SERA DESIGN TOKENS =====
   Palette:
   --ink:      #0B0B0C   near-black canvas
   --ink-2:    #17161A   raised panel
   --cream:    #F7F1E1   warm paper
   --gold:     #C6A15B   champagne gold, primary accent
   --gold-2:   #E8CD8F   pale gold, highlights
   --oxblood:  #6B1E2E   deep accent for urgency/CTA warmth
   --sage:     #8A9A80   scalp/wellness accent, used sparingly
   Type: Cormorant Garamond (display), Manrope (body/UI)
*/

:root {
  --ink: #0B0B0C;
  --ink-2: #17161A;
  --ink-3: #201F24;
  --cream: #F7F1E1;
  --gold: #C6A15B;
  --gold-2: #E8CD8F;
  --oxblood: #6B1E2E;
  --sage: #8A9A80;
  --line: rgba(198,161,91,0.25);
  --font-display: 'Cormorant Garamond', serif;
  --font-body: 'Manrope', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--ink); }
body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
main { display: block; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

a { color: inherit; text-decoration: none; }

.grain-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== HEADER ===== */
.qs-header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 6vw;
  background: linear-gradient(180deg, rgba(11,11,12,0.96), rgba(11,11,12,0.86));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.qs-wordmark { font-family: var(--font-display); font-size: 28px; letter-spacing: 0.08em; display: flex; }
.qs-wordmark.small { font-size: 22px; margin-bottom: 8px; }
.qs-wordmark-q { color: var(--gold-2); font-style: italic; font-size: 1.3em; line-height: 0.8; }
.qs-wordmark-rest { color: var(--cream); font-weight: 600; }
.qs-nav { display: flex; align-items: center; gap: 32px; font-size: 14px; letter-spacing: 0.04em; }
.qs-nav a { opacity: 0.8; transition: opacity 0.25s; padding-bottom: 4px; border-bottom: 1px solid transparent; }
.qs-nav a:hover { opacity: 1; border-color: var(--gold); }
.qs-nav-cta {
  background: var(--gold); color: var(--ink) !important; padding: 10px 20px; border-radius: 999px;
  font-weight: 600; opacity: 1 !important; border: none !important;
  transition: transform 0.25s, box-shadow 0.25s;
}
.qs-nav-cta:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(198,161,91,0.35); }
.qs-menu-btn { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; }
.qs-menu-btn span { width: 24px; height: 1.5px; background: var(--cream); }

@media (max-width: 860px) {
  .qs-nav { position: fixed; top: 76px; right: -100%; flex-direction: column; background: var(--ink-2);
    width: 70vw; height: calc(100vh - 76px); padding: 40px 30px; transition: right 0.4s ease; align-items: flex-start; }
  .qs-nav.open { right: 0; }
  .qs-menu-btn { display: flex; }
}

/* ===== SIGNATURE ELEMENT: the drawn thread ===== */
.thread-divider { width: 100%; height: 40px; margin: 0 auto; overflow: visible; }
.thread-divider path {
  fill: none; stroke: var(--gold); stroke-width: 1.4; stroke-linecap: round;
  stroke-dasharray: 600; stroke-dashoffset: 600;
  animation: draw-thread 2.4s ease forwards;
}
@keyframes draw-thread { to { stroke-dashoffset: 0; } }

/* ===== HERO ===== */
.hero {
  min-height: 92vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 6vw 60px; position: relative;
}
.hero-eyebrow {
  font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold);
  opacity: 0; animation: fade-up 0.9s ease forwards 0.1s;
}
.hero-title {
  font-family: var(--font-display); font-size: clamp(52px, 9vw, 128px); font-weight: 400; line-height: 0.95;
  margin: 18px 0; letter-spacing: -0.01em;
  opacity: 0; animation: fade-up 1s ease forwards 0.3s;
}
.hero-title em { font-style: italic; color: var(--gold-2); }
.hero-sub {
  max-width: 560px; font-size: 18px; color: rgba(247,241,225,0.72); margin: 0 auto 36px;
  opacity: 0; animation: fade-up 1s ease forwards 0.55s;
}
.hero-actions { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  opacity: 0; animation: fade-up 1s ease forwards 0.8s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }

.hero-strand-canvas { position: absolute; inset: 0; z-index: -1; opacity: 0.5; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 15px 30px; border-radius: 999px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px; letter-spacing: 0.03em;
  cursor: pointer; border: 1px solid transparent; transition: transform 0.25s, box-shadow 0.25s, background 0.25s;
}
.btn-primary { background: var(--gold); color: var(--ink); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(198,161,91,0.35); }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold-2); }

/* ===== SECTIONS ===== */
.section { padding: 110px 6vw; max-width: 1180px; margin: 0 auto; }
.section-eyebrow { font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); margin-bottom: 14px; }
.section-title { font-family: var(--font-display); font-size: clamp(34px, 4vw, 56px); margin: 0 0 26px; font-weight: 400; }
.section-title em { font-style: italic; color: var(--gold-2); }
.section-lede { max-width: 620px; color: rgba(247,241,225,0.72); font-size: 17px; margin-bottom: 50px; }

.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ===== CARD GRID ===== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.card {
  background: linear-gradient(160deg, var(--ink-2), var(--ink-3));
  border: 1px solid var(--line); border-radius: 18px; padding: 32px 26px;
  transition: transform 0.3s, border-color 0.3s;
}
.card:hover { transform: translateY(-6px); border-color: var(--gold); }
.card-num { font-family: var(--font-display); font-size: 15px; color: var(--gold); margin-bottom: 14px; }
.card h3 { font-family: var(--font-display); font-size: 24px; font-weight: 500; margin: 0 0 10px; }
.card p { font-size: 14.5px; color: rgba(247,241,225,0.68); margin: 0; }

/* ===== QUIZ ===== */
.quiz-shell { max-width: 640px; margin: 0 auto; padding: 100px 6vw 80px; min-height: 80vh; }
.quiz-progress { display: flex; gap: 6px; margin-bottom: 44px; }
.quiz-progress-seg { flex: 1; height: 3px; background: var(--line); border-radius: 3px; overflow: hidden; }
.quiz-progress-seg span { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.5s ease; }
.quiz-step { display: none; animation: fade-up 0.5s ease; }
.quiz-step.active { display: block; }
.quiz-q { font-family: var(--font-display); font-size: 32px; margin-bottom: 30px; }
.quiz-options { display: grid; gap: 12px; }
.quiz-option {
  padding: 18px 22px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer;
  transition: border-color 0.25s, background 0.25s, transform 0.15s; font-size: 15.5px;
}
.quiz-option:hover { border-color: var(--gold); transform: translateX(4px); }
.quiz-option.selected { border-color: var(--gold); background: rgba(198,161,91,0.12); color: var(--gold-2); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 40px; }
@keyframes shakeStep {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}

/* ===== RESULTS / DIAL ===== */
.result-dial-wrap { display: flex; flex-direction: column; align-items: center; padding: 60px 6vw; text-align: center; }
.result-dial { width: 220px; height: 220px; position: relative; transition: filter 1s ease; }
.result-dial svg { transform: rotate(-90deg); }
.result-dial-bg { fill: none; stroke: var(--line); stroke-width: 10; }
.result-dial-fg { fill: none; stroke: var(--gold); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 597; stroke-dashoffset: 597; transition: stroke-dashoffset 0.1s linear, stroke 0.6s ease; }
.result-dial-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.result-dial-label .num { font-family: var(--font-display); font-size: 52px; color: var(--gold-2); }
.result-dial-label .txt { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.6; }
#tierBadge { animation: fade-up 0.6s ease 0.4s both; }

/* ===== MECHANISM ANIMATION ===== */
.mech-stage { position: relative; max-width: 900px; margin: 0 auto; padding: 60px 6vw 30px; }
.mech-svg-wrap { background: var(--ink-2); border: 1px solid var(--line); border-radius: 24px; padding: 20px; }
.mech-controls { display: flex; justify-content: center; gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.mech-controls button {
  background: transparent; border: 1px solid var(--line); color: var(--cream); padding: 10px 18px;
  border-radius: 999px; font-size: 13px; cursor: pointer; transition: all 0.25s;
}
.mech-controls button.active, .mech-controls button:hover { border-color: var(--gold); color: var(--gold-2); }
.mech-caption { text-align: center; max-width: 520px; margin: 26px auto 0; color: rgba(247,241,225,0.75); font-size: 15px; min-height: 48px; }

.follicle { fill: var(--ink); stroke: var(--gold); stroke-width: 1.2; }
.strand { stroke: var(--cream); stroke-width: 2; fill: none; }
.particle { fill: var(--gold-2); opacity: 0; }
.ecm-web { stroke: var(--sage); stroke-width: 1; fill: none; opacity: 0; }

/* ===== ROUTINE / STREAK ===== */
.routine-shell { max-width: 760px; margin: 0 auto; padding: 100px 6vw; }
.streak-hero { text-align: center; padding: 40px 0 50px; }
.streak-num { font-family: var(--font-display); font-size: 96px; color: var(--gold-2); line-height: 1; }
.streak-label { font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.6; margin-top: 8px; }
.streak-check {
  margin: 30px auto; width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 34px; color: var(--gold);
  transition: transform 0.2s, background 0.2s;
}
.streak-check:hover { transform: scale(1.06); }
.streak-check.done { background: var(--gold); color: var(--ink); }
.timeline { position: relative; margin: 60px 0; padding-left: 30px; border-left: 1px solid var(--line); }
.timeline-item { position: relative; padding: 0 0 44px 24px; }
.timeline-item::before { content: ''; position: absolute; left: -35px; top: 4px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--ink); border: 2px solid var(--gold); }
.timeline-item.reached::before { background: var(--gold); }
.timeline-item h4 { font-family: var(--font-display); font-size: 20px; margin: 0 0 6px; }
.timeline-item p { margin: 0; font-size: 14px; color: rgba(247,241,225,0.65); }

/* ===== CHAT ===== */
.chat-shell { max-width: 720px; margin: 0 auto; padding: 60px 6vw 20px; height: calc(100vh - 76px); display: flex; flex-direction: column; }
.chat-log { flex: 1; overflow-y: auto; padding: 20px 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-bubble { max-width: 78%; padding: 14px 18px; border-radius: 18px; font-size: 15px; line-height: 1.55; animation: fade-up 0.4s ease; }
.chat-bubble.user { align-self: flex-end; background: var(--gold); color: var(--ink); border-bottom-right-radius: 4px; }
.chat-bubble.assistant { align-self: flex-start; background: var(--ink-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-bubble.system { align-self: center; font-size: 13px; opacity: 0.6; font-style: italic; }
.chat-input-row { display: flex; gap: 12px; padding: 16px 0 30px; border-top: 1px solid var(--line); }
.chat-input-row input {
  flex: 1; background: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 14px 22px;
  color: var(--cream); font-family: var(--font-body); font-size: 15px;
}
.chat-input-row input:focus { outline: none; border-color: var(--gold); }
.chat-input-row button {
  background: var(--gold); color: var(--ink); border: none; border-radius: 999px; width: 52px; height: 52px;
  cursor: pointer; font-size: 18px; flex-shrink: 0;
}
.typing-dots span { display: inline-block; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; margin: 0 2px; animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ===== ADMIN ===== */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 60px 6vw; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 18px; margin-bottom: 50px; }
.admin-stat { background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.admin-stat .num { font-family: var(--font-display); font-size: 40px; color: var(--gold-2); }
.admin-stat .lbl { font-size: 12px; opacity: 0.6; letter-spacing: 0.1em; text-transform: uppercase; }
table.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); }
table.admin-table th { color: var(--gold); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.admin-form { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 40px; }
.admin-form input { background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--cream); font-family: var(--font-body); }
.pill-link { font-size: 12px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; margin-right: 6px; display: inline-block; }
.pill-link:hover { border-color: var(--gold); color: var(--gold-2); }
.login-shell { max-width: 360px; margin: 120px auto; padding: 0 6vw; text-align: center; }
.login-shell input { width: 100%; background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; color: var(--cream); margin: 20px 0; font-family: var(--font-body); }
.flash { color: var(--gold-2); font-size: 13px; }

/* ===== FOOTER ===== */
.qs-footer { border-top: 1px solid var(--line); padding: 60px 6vw 40px; text-align: center; }
.qs-footer-inner { max-width: 520px; margin: 0 auto; }
.qs-footer p { font-size: 13px; color: rgba(247,241,225,0.55); margin: 6px 0; }
.qs-fine-print { font-size: 11.5px; opacity: 0.45; margin-top: 18px; }

@media (max-width: 600px) {
  .section { padding: 70px 6vw; }
  .chat-bubble { max-width: 88%; }
}
