/* =====================================================================
   SOVEREIGN 5-SYSTEM — "Quiet Luxury / Obsidian & Gold" design system
   ===================================================================== */
:root {
  --obsidian: #0A0A0C;
  --charcoal: #121318;
  --charcoal-2: #181A21;
  --line: rgba(212, 175, 55, 0.18);
  --line-soft: rgba(245, 245, 247, 0.08);
  --gold: #D4AF37;
  --champagne: #F3E5AB;
  --olive: #556B2F;
  --ivory: #F5F5F7;
  --muted: #A1A1AA;
  --gold-grad: linear-gradient(135deg, #F3E5AB 0%, #D4AF37 45%, #A8862A 100%);
}

* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
body {
  background: var(--obsidian);
  color: var(--ivory);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body::before { /* subtle vignette + gold haze */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212, 175, 55, 0.12), transparent 60%),
    radial-gradient(ellipse 60% 40% at 50% 110%, rgba(85, 107, 47, 0.10), transparent 60%);
}
main, header, footer { position: relative; z-index: 1; }

.font-display { font-family: 'Cinzel', serif; letter-spacing: 0.04em; }
.font-serif { font-family: 'Cormorant Garamond', serif; }
.text-gold-grad {
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold);
}
.eyebrow {
  font-family: 'Inter', sans-serif; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.28em; text-transform: uppercase; color: var(--gold);
}
.hairline { height: 1px; background: linear-gradient(90deg, transparent, var(--gold), transparent); opacity: .5; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, rgba(24, 26, 33, 0.9), rgba(18, 19, 24, 0.95));
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(243, 229, 171, 0.06) inset, 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}
.card-soft { background: var(--charcoal); border: 1px solid var(--line-soft); border-radius: 14px; }

/* ---------- Inputs ---------- */
.field-label { display: block; font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--champagne); opacity: .8; margin-bottom: .45rem; font-weight: 600; }
.field {
  width: 100%; background: #0E0F13; color: var(--ivory);
  border: 1px solid rgba(245, 245, 247, 0.12); border-radius: 12px;
  padding: 0.95rem 1rem; font-size: 16px; /* 16px prevents iOS zoom */
  transition: border-color .2s, box-shadow .2s;
  color-scheme: dark;
}
.field:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }
.field.error { border-color: #b4534b; }
.field-error { color: #e0857c; font-size: .78rem; margin-top: .35rem; min-height: 1em; }

/* ---------- Buttons ---------- */
.btn-gold {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  width: 100%; padding: 1.05rem 1.25rem; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--gold-grad); color: #141108;
  font-weight: 800; letter-spacing: .08em; font-size: .9rem; text-transform: uppercase;
  box-shadow: 0 10px 30px -10px rgba(212, 175, 55, .55), 0 1px 0 rgba(255,255,255,.5) inset;
  transition: transform .15s, box-shadow .2s, filter .2s;
}
.btn-gold:hover { filter: brightness(1.06); box-shadow: 0 14px 40px -10px rgba(212, 175, 55, .7); }
.btn-gold:active { transform: translateY(1px) scale(.995); }
.btn-gold::after { /* shimmer */
  content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-20deg); animation: shimmer 3.6s infinite;
}
@keyframes shimmer { 0%, 60% { left: -60%; } 100% { left: 130%; } }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.1rem; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--line); color: var(--champagne); background: rgba(212, 175, 55, 0.04);
  font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  transition: background .2s, border-color .2s;
}
.btn-ghost:hover { background: rgba(212, 175, 55, 0.1); border-color: var(--gold); }
.btn-demo {
  width: 100%; padding: .85rem; border-radius: 12px; cursor: pointer;
  border: 1px dashed rgba(85, 107, 47, .9); background: rgba(85, 107, 47, .12); color: #b9cf8f;
  font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
}
.btn-demo:hover { background: rgba(85, 107, 47, .22); }

/* ---------- Badges ---------- */
.badge-olive { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(85, 107, 47, .22); border: 1px solid rgba(85, 107, 47, .7); color: #c7d9a3; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }
.badge-gold { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border-radius: 999px; background: rgba(212, 175, 55, .1); border: 1px solid rgba(212, 175, 55, .45); color: var(--champagne); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 600; }

/* ---------- Language Switcher ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(18, 19, 24, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.lang-switch button {
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: rgba(245, 245, 247, 0.6);
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.2s ease;
}
.lang-switch button:hover:not(.active) {
  color: var(--ivory);
}
.lang-switch button.active {
  background: var(--gold-grad);
  color: #141108;
  box-shadow: 0 1px 4px rgba(212, 175, 55, 0.4);
}

/* ---------- Number medallion ---------- */
.medallion {
  position: relative; display: grid; place-items: center; border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, #2a2516, #0d0d10 70%);
  border: 1px solid rgba(212, 175, 55, .6);
  box-shadow: 0 0 0 6px rgba(212, 175, 55, .06), 0 0 60px -10px rgba(212, 175, 55, .45), inset 0 0 30px rgba(212,175,55,.12);
}
.medallion::before { content: ''; position: absolute; inset: 8px; border-radius: 999px; border: 1px dashed rgba(212, 175, 55, .3); }
.medallion-lg { width: 148px; height: 148px; }
.medallion-md { width: 92px; height: 92px; }
.medallion-sm { width: 56px; height: 56px; }
.glow-pulse { animation: glow 3.2s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(212, 175, 55, .1), 0 0 90px -5px rgba(212, 175, 55, .65), inset 0 0 30px rgba(212,175,55,.2); } }

/* ---------- Locked / frosted glass ---------- */
.locked { position: relative; overflow: hidden; }
.locked .locked-content { filter: blur(6px); user-select: none; pointer-events: none; opacity: .75; }
.locked .lock-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; text-align: center; padding: 1rem;
  background: rgba(10, 10, 12, 0.35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.lock-icon { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; border: 1px solid rgba(212,175,55,.6); background: rgba(212,175,55,.08); color: var(--gold); }

/* ---------- VSL ---------- */
.vsl-frame {
  position: relative; width: 100%; max-width: 340px; aspect-ratio: 9 / 16; margin: 0 auto;
  border-radius: 22px; overflow: hidden; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 30%, #2a2414, #0b0b0d 70%);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.9), 0 0 60px -20px rgba(212,175,55,.3);
}
.vsl-frame iframe, .vsl-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.play-btn { width: 76px; height: 76px; border-radius: 999px; display: grid; place-items: center; background: var(--gold-grad); color: #141108; box-shadow: 0 0 0 10px rgba(212,175,55,.15), 0 0 50px rgba(212,175,55,.5); }

/* ---------- Order bump ---------- */
.bump {
  border: 2px dashed var(--gold); border-radius: 14px; background: rgba(212,175,55,.07);
  padding: 1rem; cursor: pointer; transition: background .2s;
}
.bump:hover { background: rgba(212,175,55,.12); }
.bump.checked { background: rgba(212,175,55,.16); border-style: solid; }
.bump input { width: 22px; height: 22px; accent-color: var(--gold); flex-shrink: 0; margin-top: 2px; }
.arrow-bounce { display: inline-block; animation: nudge 1.2s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }

/* ---------- Sticky mobile CTA ---------- */
.sticky-cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(10,10,12,0), rgba(10,10,12,.92) 30%);
  transform: translateY(110%); transition: transform .35s ease;
}
.sticky-cta.show { transform: translateY(0); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; top: 1rem; transform: translate(-50%, -150%); z-index: 60; max-width: 92vw; transition: transform .35s ease; }
.toast.show { transform: translate(-50%, 0); }

/* ---------- Loading ritual ---------- */
.ritual { position: fixed; inset: 0; z-index: 70; display: none; align-items: center; justify-content: center; background: rgba(10,10,12,.96); }
.ritual.show { display: flex; }
.ritual-ring { width: 110px; height: 110px; border-radius: 999px; border: 1px solid rgba(212,175,55,.2); border-top-color: var(--gold); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bars & Frequency Tally ---------- */
.bar-row {
  margin-bottom: 0.95rem;
  width: 100%;
  box-sizing: border-box;
  padding-right: 4px;
}
.bar-label {
  display: flex !important;
  justify-content: space-between !important;
  align-items: baseline !important;
  width: 100% !important;
  box-sizing: border-box !important;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  gap: 0.5rem;
}
.bar-label > span:first-child {
  color: var(--ivory);
  font-weight: 500;
  display: block;
  white-space: normal;
  word-break: break-word;
  padding-right: 0.25rem;
  min-width: 0;
  flex: 1 1 auto;
}
.bar-label > span:first-child > * {
  white-space: normal;
  word-break: break-word;
}
.bar-label .bar-val, .bar-label > span:last-child {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}
.bar-track { height: 8px; border-radius: 99px; background: rgba(245,245,247,.06); overflow: hidden; width: 100%; box-sizing: border-box; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--gold-grad); }

/* ---------- Lo Shu grid ---------- */
.loshu { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; max-width: 300px; }
.loshu-cell {
  aspect-ratio: 1; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid rgba(245,245,247,.08); background: #0E0F13; position: relative;
}
.loshu-cell.on { border-color: rgba(212,175,55,.55); background: radial-gradient(circle at 50% 30%, rgba(212,175,55,.16), #0E0F13 70%); }
.loshu-cell .pos { position: absolute; top: 6px; left: 8px; font-size: .62rem; color: var(--muted); opacity: .7; }
.loshu-cell .digits { font-family: 'Cinzel', serif; font-size: 1.35rem; color: var(--champagne); letter-spacing: .05em; }
.loshu-cell .el { position: absolute; bottom: 5px; font-size: .55rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }

/* ---------- Letter chips ---------- */
.chip { display: inline-flex; flex-direction: column; align-items: center; min-width: 26px; padding: 4px 3px; border-radius: 6px; background: #0E0F13; border: 1px solid rgba(245,245,247,.07); }
.chip b { font-family: 'Cinzel', serif; font-size: .8rem; color: var(--ivory); }
.chip span { font-size: .62rem; color: var(--gold); }
.chip.vowel { border-color: rgba(212,175,55,.45); }

/* ---------- Tables ---------- */
.lux-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.lux-table th { text-align: left; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; padding: .6rem .5rem; border-bottom: 1px solid var(--line); }
.lux-table td { padding: .65rem .5rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.lux-table tr.current td { background: rgba(212,175,55,.1); }
.lux-table tr.current td:first-child { box-shadow: inset 3px 0 0 var(--gold); }

.mode-press { color: #e7cf74; background: rgba(212,175,55,.12); border: 1px solid rgba(212,175,55,.5); }
.mode-preserve { color: #9fb7d9; background: rgba(80,110,160,.14); border: 1px solid rgba(110,140,190,.5); }
.mode-calibrate { color: #e9b8c8; background: rgba(170,90,120,.12); border: 1px solid rgba(190,110,140,.45); }
.mode-build { color: #b9cf8f; background: rgba(85,107,47,.18); border: 1px solid rgba(85,107,47,.7); }
.mode-pill { display: inline-block; padding: .2rem .55rem; border-radius: 99px; font-size: .62rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }

/* ---------- Fade in ---------- */
.reveal { animation: reveal .7s cubic-bezier(.2,.7,.2,1) both; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* =====================================================================
   DOSSIER PAGES (screen + print)
   ===================================================================== */
.dossier { max-width: 860px; margin: 0 auto; }
.page {
  position: relative; background: linear-gradient(180deg, #111216, #0B0B0E);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 48px 48px 24px; margin: 0 auto 28px;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 1050px;
  box-sizing: border-box;
}
.page::before { /* inner gold frame */
  content: ''; position: absolute; inset: 14px; border: 1px solid rgba(212,175,55,.22); border-radius: 3px; pointer-events: none;
}
.page-head { display: flex; justify-content: space-between; align-items: center; font-size: .6rem; letter-spacing: .25em; text-transform: uppercase; color: rgba(212,175,55,.75); margin-bottom: 20px; flex-shrink: 0; }
.page-body { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.page-foot { position: static; width: 100%; margin-top: auto; padding-top: 18px; display: flex; justify-content: space-between; font-size: .58rem; letter-spacing: .22em; text-transform: uppercase; color: rgba(245,245,247,.35); flex-shrink: 0; }
.page h2.sec-title { font-family: 'Cinzel', serif; font-size: 1.9rem; line-height: 1.15; margin: .35rem 0 .6rem; }
.page p.lead { font-family: 'Cormorant Garamond', serif; font-size: 1.22rem; line-height: 1.55; color: #e7e3d6; }
.page p, .page li { line-height: 1.65; }
.avoid-break { break-inside: avoid; page-break-inside: avoid; }
.cover { min-height: 1050px; display: flex; flex-direction: column; justify-content: space-between; text-align: center;
  background: radial-gradient(ellipse 70% 50% at 50% 35%, rgba(212,175,55,.14), transparent 70%), linear-gradient(180deg, #0f0f12, #08080a); }
.seal { width: 120px; height: 120px; margin: 0 auto; }

@media (max-width: 640px) {
  html, body, #view-dossier {
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }
  .dossier {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding: 0;
    margin: 0 auto;
  }
  .page {
    width: calc(100% - 24px) !important;
    max-width: calc(100% - 24px) !important;
    margin: 0 auto 24px !important;
    box-sizing: border-box !important;
    padding: 22px 14px 18px !important;
    border-radius: 4px;
    overflow-x: hidden !important;
    min-height: auto !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
  }
  .page::before { inset: 6px; }
  .page-foot { position: static !important; width: 100% !important; margin-top: auto !important; padding-top: 14px !important; left: auto !important; right: auto !important; bottom: auto !important; }
  .page h2.sec-title { font-size: 1.35rem; }
  .cover {
    min-height: 580px;
    padding: 22px 14px 32px !important;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
  .cover .seal { width: 72px; height: 72px; }
  .cover .hairline { margin: 10px auto; }

  /* Medallions scaling on mobile */
  .page .medallion-lg { width: 96px !important; height: 96px !important; }
  .page .medallion-lg span { font-size: 2.2rem !important; }
  .page .medallion-md { width: 68px !important; height: 68px !important; }
  .page .medallion-md span { font-size: 1.5rem !important; }
  .page .flex.justify-center.gap-6,
  .page .flex.justify-center.gap-5,
  .page .flex.justify-center.items-end { gap: 10px !important; }

  /* Grid strictly 1 column on mobile to prevent overflow */
  .page .grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .page .grid > * {
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Secondary harmonics flex wrap on mobile */
  .page .flex.items-center.gap-4 {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }

  /* Bars & Tally on mobile */
  .bar-row {
    width: 100% !important;
    box-sizing: border-box !important;
    padding-right: 4px !important;
  }

  /* Lo Shu grid centered on mobile */
  .loshu {
    margin: 0 auto !important;
    max-width: 270px !important;
  }

  /* Tables on mobile */
  table.lux-table {
    width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
  }
  table.lux-table th, table.lux-table td {
    padding: 0.45rem 0.2rem !important;
    word-break: break-word !important;
  }

  /* 4-column Rosicrucian Cycles table */
  table.lux-table.table-cycles th:nth-child(1), table.lux-table.table-cycles td:nth-child(1),
  article.page[data-page="13"] table.lux-table th:nth-child(1), article.page[data-page="13"] table.lux-table td:nth-child(1) {
    width: 10% !important;
  }
  table.lux-table.table-cycles th:nth-child(2), table.lux-table.table-cycles td:nth-child(2),
  article.page[data-page="13"] table.lux-table th:nth-child(2), article.page[data-page="13"] table.lux-table td:nth-child(2) {
    width: 34% !important;
  }
  table.lux-table.table-cycles th:nth-child(3), table.lux-table.table-cycles td:nth-child(3),
  article.page[data-page="13"] table.lux-table th:nth-child(3), article.page[data-page="13"] table.lux-table td:nth-child(3) {
    width: 26% !important;
  }
  table.lux-table.table-cycles th:nth-child(4), table.lux-table.table-cycles td:nth-child(4),
  article.page[data-page="13"] table.lux-table th:nth-child(4), article.page[data-page="13"] table.lux-table td:nth-child(4) {
    width: 30% !important;
    text-align: right !important;
  }

  .mode-pill {
    font-size: 0.48rem !important;
    padding: 2px 4px !important;
    letter-spacing: 0.04em !important;
    white-space: normal !important;
    word-break: break-word !important;
    display: inline-block !important;
    text-align: center !important;
    line-height: 1.15 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* =====================================================================
   PRINT — book-quality multi-page PDF, zero UI clutter
   ===================================================================== */
@page { size: Letter; margin: 0; }
@media print {
  html, body { background: #0A0A0C !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body::before { display: none; }
  .no-print, header, footer, #view-hero, #view-teaser, .sticky-cta, .toast, .ritual { display: none !important; }
  #view-dossier { display: block !important; padding: 0 !important; margin: 0 !important; }
  .dossier { max-width: none; }
  .page {
    width: 8.5in !important; height: 11in !important; min-height: 11in !important; max-height: 11in !important; box-sizing: border-box !important; overflow: hidden !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    padding: 0.44in 0.52in 0.36in !important; break-after: page !important; page-break-after: always !important; break-inside: avoid !important; page-break-inside: avoid !important;
    display: flex !important; flex-direction: column !important; justify-content: space-between !important;
  }
  .page:last-child { break-after: auto !important; page-break-after: auto !important; }
  .page::before { inset: 10px !important; }
  .page-head { margin-bottom: 12px !important; font-size: .56rem !important; flex-shrink: 0 !important; }
  .page-body { flex: 1 1 auto !important; display: flex !important; flex-direction: column !important; min-height: 0 !important; }
  .page-foot { position: static !important; width: 100% !important; margin-top: auto !important; padding-top: 14px !important; font-size: .54rem !important; flex-shrink: 0 !important; left: auto !important; right: auto !important; bottom: auto !important; }
  .page h2.sec-title { font-size: 1.5rem; margin: .2rem 0 .35rem; }
  .page p.lead { font-size: 1.05rem; line-height: 1.45; }
  .page p, .page li { line-height: 1.45; font-size: .8rem; }
  .card-soft { padding: .65rem .75rem !important; }
  .lux-table td, .lux-table th { padding: .4rem .35rem !important; }
  .hairline { margin: .5rem 0 !important; }
  .medallion-lg { width: 115px; height: 115px; }
  .medallion-lg span { font-size: 3.2rem; }
  .seal { width: 95px; height: 95px; }
  .cover { justify-content: space-evenly; }
  .reveal { animation: none !important; }
  .btn-gold::after { display: none; }
  a { color: inherit; text-decoration: none; }
}
