/* ============================================================
   STABEN COSMOS — Main Stylesheet
   Aesthetic: Celestial / Tarot / Illuminated manuscript
   Color Palette:
     Void: #080B14 (near-black, deep space)
     Deep Navy: #0D1526
     Midnight: #121E38
     Dusty Gold: #C9A84C
     Pale Gold: #E8D5A3
     Bone White: #F2EDE3
     Indigo: #2A4066
     Sage Violet: #8B6FD4
     Forest: #3A5E3A
     Sage: #7DAA7D
     Parchment: #F5F0E8
============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --void: #080B14;
  --deep-navy: #0D1526;
  --midnight: #121E38;
  --gold: #C9A84C;
  --pale-gold: #E8D5A3;
  --bone: #F2EDE3;
  --parchment: #F5F0E8;
  --indigo: #2A4066;
  --violet: #8B6FD4;
  --forest: #3A5E3A;
  --sage: #7DAA7D;
  --text-primary: #F2EDE3;
  --text-secondary: #B8AD96;
  --text-muted: #6B7280;

  --font-display: 'Cinzel', serif;
  --font-body: 'Crimson Pro', serif;

  --transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
  max-width: 100%;
}

.tarot-card,
.mini-card,
.family-story-card,
.tab-btn,
.nav-hamburger,
.nav-overlay a,
.site-nav a {
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--void);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: clip;
  max-width: 100%;
  width: 100%;
}

main {
  max-width: 100%;
  overflow-x: clip;
}

/* ---- Starfield Canvas ---- */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* ---- Navigation ---- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.25rem 2rem;
  background: linear-gradient(to bottom, rgba(8,11,20,0.95) 0%, transparent 100%);
  backdrop-filter: blur(4px);
}

.nav-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--pale-gold);
}

.nav-glyph {
  color: var(--gold);
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  position: relative;
  z-index: 1;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  overflow: hidden;
}

.hero-constellation {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 700px;
}

.hero-eyebrow {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 1s 0.3s forwards;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 400;
  line-height: 1.05;
  color: var(--bone);
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: fadeUp 1s 0.5s forwards;
}

.hero-subtitle {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-style: italic;
  color: var(--pale-gold);
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 1s 0.7s forwards;
}

.hero-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 1s 0.9s forwards;
}

.divider-line {
  flex: 1;
  max-width: 100px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold));
}

.hero-divider .divider-line:last-child {
  background: linear-gradient(to left, transparent, var(--gold));
}

.divider-glyph {
  color: var(--gold);
  font-size: 1.1rem;
}

.hero-dedication {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--text-secondary);
  opacity: 0;
  animation: fadeUp 1s 1.1s forwards;
}

.scroll-hint {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0;
  animation: fadeUp 1s 1.5s forwards;
}

.scroll-arrow {
  animation: bounce 2s infinite;
}

/* ---- Intro Section ---- */
.intro-section {
  padding: 6rem 0;
  position: relative;
  z-index: 1;
}

.intro-text {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.intro-lead {
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-style: italic;
  color: var(--pale-gold);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.intro-text p {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
}

/* ---- Child Section ---- */
.child-section {
  padding: 5rem 0 6rem;
  position: relative;
  z-index: 1;
}

#jackson-section {
  background: radial-gradient(ellipse at 50% 0%, rgba(42, 64, 102, 0.15) 0%, transparent 70%);
}

#wyatt-section {
  background: radial-gradient(ellipse at 50% 0%, rgba(58, 94, 58, 0.12) 0%, transparent 70%);
}


.child-eyebrow {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.75rem;
}

.child-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 400;
  color: var(--bone);
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  line-height: 1.1;
}

.big-three {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.big-three-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.big-three-label {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.big-three-glyph {
  font-size: 1.3rem;
  color: var(--gold);
  line-height: 1;
}

.big-three-sign {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--pale-gold);
}

.big-three-divider {
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-bottom: -0.3rem;
}

.child-birth-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-style: italic;
}

.child-chinese {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.child-archetype {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
}

/* ---- Cards Intro ---- */
.cards-intro {
  text-align: center;
  margin-bottom: 2.5rem;
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.95rem;
}

/* ---- Card Grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ---- Tarot Card ---- */
.tarot-card {
  aspect-ratio: 2/3;
  cursor: pointer;
  perspective: 1200px;
  position: relative;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.tarot-card.flipped .card-inner {
  transform: rotateY(180deg);
}

/* Card faces */
.card-front,
.card-back {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(201, 168, 76, 0.2);
}

/* ---- Card Front ---- */
.card-front {
  background: linear-gradient(165deg, var(--midnight) 0%, var(--deep-navy) 60%, var(--void) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.75rem 1.25rem;
  position: relative;
}

.card-front::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 8px;
  pointer-events: none;
}

.card-front::after {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(201, 168, 76, 0.07);
  border-radius: 6px;
  pointer-events: none;
}

/* Jackson card fronts */
#jackson-section .card-front {
  background: linear-gradient(165deg, #0E1528 0%, #131C36 60%, #080B1A 100%);
}

/* Wyatt card fronts */
#wyatt-section .card-front {
  background: linear-gradient(165deg, #0C1A0C 0%, #122012 60%, #080F08 100%);
}

.card-front-top {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.7;
  text-align: center;
}

.card-front-symbol {
  font-size: 4rem;
  color: var(--gold);
  opacity: 0.85;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(201, 168, 76, 0.3));
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-front-mandala {
  width: 120px;
  height: 120px;
  position: relative;
}

.card-front-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--pale-gold);
  text-align: center;
  margin-top: 1rem;
}

.card-front-tradition {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.4rem;
}

.card-tap-hint {
  position: absolute;
  bottom: 1.2rem;
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s;
}

@media (hover: hover) and (pointer: fine) {
  .tarot-card:hover .card-tap-hint {
    opacity: 1;
  }
}

/* ---- Card Back ---- */
.card-back {
  transform: rotateY(180deg);
  background: var(--parchment);
  color: #2a2018;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
}

.card-back::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(42, 32, 24, 0.2);
  border-radius: 8px;
  pointer-events: none;
}

.card-back-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(42, 32, 24, 0.15);
}

.card-back-symbol {
  font-size: 1.3rem;
  color: #8B6830;
  flex-shrink: 0;
}

.card-back-header-text {
  flex: 1;
}

.card-back-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #2a2018;
  line-height: 1.2;
}

.card-back-tradition {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.7rem;
  color: #7a6040;
  margin-top: 0.15rem;
}

.card-back-content {
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.95rem;
  line-height: 1.65;
  color: #2a2018;
  overflow-y: auto;
}

.card-back-content::-webkit-scrollbar {
  width: 3px;
}
.card-back-content::-webkit-scrollbar-track {
  background: transparent;
}
.card-back-content::-webkit-scrollbar-thumb {
  background: rgba(42, 32, 24, 0.2);
}

.card-back-footer {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(42, 32, 24, 0.15);
}

.card-back-close {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #7a6040;
}

/* ---- Section Divider ---- */
.section-divider {
  padding: 3rem 0;
  position: relative;
  z-index: 1;
}

.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.divider-line-long {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(201, 168, 76, 0.3), transparent);
}

.divider-symbol {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.orbit-ring {
  position: absolute;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 50%;
  animation: slowSpin 20s linear infinite;
}

.orbit-dot {
  width: 6px;
  height: 6px;
  background: var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.5);
}

/* ---- Closing Section ---- */
.closing-section {
  padding: 6rem 0 5rem;
  position: relative;
  z-index: 1;
}

.closing-content {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.closing-glyph-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 3rem;
}

.closing-glyph {
  font-size: 1.8rem;
  color: var(--gold);
  opacity: 0.7;
}

.closing-glyph-divider {
  color: var(--text-muted);
}

.closing-quote {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(1.15rem, 2.5vw, 1.4rem);
  color: var(--pale-gold);
  line-height: 1.75;
  border: none;
  padding: 0;
  margin-bottom: 2rem;
}

.closing-tradition {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Footer ---- */
.site-footer {
  padding: 3rem 2rem;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
  position: relative;
  z-index: 1;
}

.footer-inner {
  text-align: center;
}

.footer-glyph-row {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 1.1rem;
  color: var(--gold);
  opacity: 0.4;
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.7;
}

/* ---- Constellation SVG drawings ---- */
.constellation-svg {
  width: 100%;
  height: 100%;
}

/* ---- Animations ---- */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

@keyframes slowSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Card Hover Effect (desktop only — avoid sticky-hover on touch) ---- */
@media (hover: hover) and (pointer: fine) {
  .tarot-card:not(.flipped):hover .card-inner {
    transform: rotateY(8deg) translateY(-4px);
    box-shadow: -8px 16px 40px rgba(0, 0, 0, 0.5);
  }
}

/* ---- Responsive (legacy block superseded by mobile-optimizations section at bottom) ---- */

/* ---- Gold Shimmer on Card Borders ---- */
@keyframes goldShimmer {
  0% { opacity: 0.15; }
  50% { opacity: 0.35; }
  100% { opacity: 0.15; }
}

@media (hover: hover) and (pointer: fine) {
  .tarot-card:hover .card-front {
    border-color: rgba(201, 168, 76, 0.45);
  }
}

.card-front {
  transition: border-color 0.3s ease;
}

/* ============================================================
   ADDITIONS FROM DESIGN ASSETS — 2026-04-19
   Merged from design_assets/css/style.css
   ============================================================ */

/* ---- Full nav-links structure (for rebuilt nav) ---- */
.site-nav .brand {
  font-family: var(--font-display);
  font-size: 0.9rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.9);
}

.site-nav .nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.site-nav .nav-links a {
  font-family: var(--font-display);
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(232, 213, 163, 0.65);
  text-decoration: none;
  transition: color 0.25s ease;
}

.site-nav .nav-links a:hover { color: rgba(201, 168, 76, 1); }

/* ---- Mobile nav hamburger ---- */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: rgba(232, 213, 163, 0.8);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4.5px, 4.5px); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4.5px, -4.5px); }

/* ---- Mobile nav overlay ---- */
.nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 11, 20, 0.97);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.nav-overlay.open { opacity: 1; pointer-events: auto; }

.nav-overlay a {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  color: rgba(232, 213, 163, 0.85);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}

.nav-overlay a:hover { color: rgba(201, 168, 76, 1); }

.nav-overlay-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1.5rem;
  color: rgba(232, 213, 163, 0.5);
  cursor: pointer;
  background: none;
  border: none;
  line-height: 1;
}

@media (max-width: 768px) {
  .nav-hamburger { display: flex; }
  .site-nav .nav-links { display: none; }
}

/* ---- Chapter layout (Sam/Todd/Jackson/Wyatt section body) ---- */
.chapter {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 0;
  text-align: center;
  border-top: 1px solid rgba(201, 168, 76, 0.1);
}

.chapter-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.55);
  margin: 0.25rem 0 1.5rem;
}

/* ---- Person-specific section background tints ---- */
#sam    { background: radial-gradient(ellipse at 50% 0%, rgba(30, 77, 94, 0.18) 0%, transparent 70%); }
#todd   { background: radial-gradient(ellipse at 50% 0%, rgba(92, 58, 26, 0.18) 0%, transparent 70%); }
#jackson { background: radial-gradient(ellipse at 50% 0%, rgba(30, 45, 94, 0.18) 0%, transparent 70%); }
#wyatt  { background: radial-gradient(ellipse at 50% 0%, rgba(26, 61, 26, 0.15) 0%, transparent 70%); }

/* Card front person-specific tints */
#sam    .card-front { background: linear-gradient(165deg, #0B1E28 0%, #0F2533 60%, #080C14 100%); }
#todd   .card-front { background: linear-gradient(165deg, #1E1006 0%, #261508 60%, #0D0804 100%); }

/* ---- Quick stats strip ---- */
.quick-stats {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
  margin: 1.5rem 0;
}

.quick-stats::-webkit-scrollbar { display: none; }

.stat-pill {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(201, 168, 76, 0.18);
  border-radius: 20px;
  padding: 0.35rem 1rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: rgba(232, 213, 163, 0.7);
  white-space: nowrap;
}

/* ---- Family star map ---- */
.family-star-map {
  display: flex;
  justify-content: center;
  margin: 3rem auto;
  max-width: 720px;
  width: 100%;
}

.family-star-map svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

@media (max-width: 640px) {
  .family-star-map { display: none; }
}

/* ---- Family map star nodes (hover) ---- */
.family-star-node { cursor: default; }
.family-star-node:hover .family-star-ring { opacity: 0.55; }
.family-star-node:hover .family-star-name { fill: rgba(255, 240, 200, 1); }

/* ---- Family connection line draw-in ---- */
.family-line {
  stroke-dasharray: 500;
  stroke-dashoffset: 500;
  transition: stroke-dashoffset 2.2s ease;
}

.family-star-map.in-view .family-line { stroke-dashoffset: 0; }

/* ---- Tradition tab bar ---- */
.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(201, 168, 76, 0.15);
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(184, 173, 150, 0.55);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab-btn:hover { color: rgba(232, 213, 163, 0.8); }
.tab-btn.active {
  color: rgba(232, 213, 163, 0.95);
  border-bottom-color: currentColor; /* overridden per-person in JS */
}

/* Person-specific active tab accent colors set via inline style in JS */

/* ---- Tradition tab content panel ---- */
.tab-content {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  position: absolute;
  top: 0; left: 0; right: 0;
}

.tab-content.active {
  opacity: 1;
  pointer-events: auto;
  position: relative;
}

.tab-panels {
  position: relative;
}

.tab-story {
  background: rgba(245, 240, 232, 0.04);
  border: 1px solid rgba(201, 168, 76, 0.10);
  border-radius: 12px;
  padding: 2.5rem;
  margin-bottom: 2rem;
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.8;
  color: rgba(232, 213, 163, 0.82);
  position: relative;
}

.tab-story p { margin-bottom: 1.2rem; }
.tab-story p:last-child { margin-bottom: 0; }

.tab-tradition-label {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.45);
}

/* ---- Tradition mini cards (landscape) ---- */
.mini-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.mini-card {
  aspect-ratio: 3/2;
  cursor: pointer;
  perspective: 900px;
}

.mini-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-card.flipped .mini-card-inner { transform: rotateY(180deg); }

.mini-card-front,
.mini-card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 10px;
  border: 1px solid rgba(201, 168, 76, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.mini-card-front {
  background: linear-gradient(165deg, var(--midnight) 0%, var(--deep-navy) 100%);
}

.mini-card-back {
  transform: rotateY(180deg);
  background: var(--parchment);
  color: #2a2018;
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
}

.mini-card-glyph {
  font-size: 2.5rem;
  color: rgba(201, 168, 76, 0.85);
  margin-bottom: 0.75rem;
}

.mini-card-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: var(--pale-gold);
  text-align: center;
}

.mini-card-tradition {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-style: italic;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.25rem;
}

/* ---- Family story cards ---- */
.family-story-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .family-story-grid { grid-template-columns: 1fr; }
}

.family-story-card {
  cursor: pointer;
  perspective: 1200px;
  min-height: 260px;
}

.family-story-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 260px;
  transform-style: preserve-3d;
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.family-story-card.flipped .family-story-card-inner { transform: rotateY(180deg); }

.family-story-front,
.family-story-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 1px solid rgba(201, 168, 76, 0.18);
  padding: 2.5rem;
}

.family-story-front {
  background: var(--deep-navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}

.family-story-glyph {
  font-size: 3.5rem;
  color: rgba(201, 168, 76, 0.8);
  line-height: 1;
}

.family-story-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: var(--pale-gold);
}

.family-story-participants {
  display: flex;
  gap: 0.5rem;
}

.participant-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.85);
}

.family-story-back {
  transform: rotateY(180deg);
  background: var(--parchment);
  color: #2a2018;
  overflow-y: auto;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
}

.family-story-back p { margin-bottom: 1rem; }
.family-story-back p:last-child { margin-bottom: 0; }

/* ---- Person summary cards (Constellation section) ---- */
.person-card-row {
  display: flex;
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none;
  justify-content: center;
  flex-wrap: wrap;
}

.person-card-row::-webkit-scrollbar { display: none; }

.person-card {
  flex-shrink: 0;
  width: 210px;
  background: var(--deep-navy);
  border: 1px solid rgba(201, 168, 76, 0.14);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.3s ease, transform 0.2s ease;
}

.person-card:hover {
  border-color: rgba(201, 168, 76, 0.35);
  transform: translateY(-3px);
}

.person-card-accent-bar {
  height: 3px;
  width: 100%;
}

.person-card-body {
  padding: 1.25rem;
}

.person-card .eyebrow {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.55);
  margin-bottom: 0.4rem;
}

.person-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--bone);
  margin-bottom: 0.3rem;
}

.person-card .archetype {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.65);
  margin-bottom: 0.85rem;
}

.big-three-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.big-three-pills span {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: rgba(232, 213, 163, 0.7);
}

.person-card .read-link {
  font-family: var(--font-display);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(201, 168, 76, 0.7);
  text-decoration: none;
  display: inline-block;
  margin-top: 0.5rem;
}

/* ---- Additional keyframes from Design ---- */

@keyframes ringPulse {
  0%, 100% { opacity: 0.25; transform: scale(1); }
  50%       { opacity: 0.45; transform: scale(1.1); }
}

@keyframes starPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.65; transform: scale(0.9); }
}

/* ---- Tab scroll arrows ---- */
.tabs-wrapper { position: relative; }

.tab-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(to right, rgba(13, 21, 38, 0) 0%, rgba(13, 21, 38, 0.95) 100%);
  color: rgba(201, 168, 76, 0.7);
  font-size: 1rem;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tab-arrow.right { right: 0; }
.tab-arrow.left  { left: 0; transform: translateY(-50%) scaleX(-1); }
.tab-arrow.visible { opacity: 1; pointer-events: auto; }

/* ---- Scroll reveal ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   MOBILE OPTIMIZATIONS — 2026-04-19
   Consolidates all small-screen overrides in one block.
   ============================================================ */

/* iOS safe-area handling for the fixed top nav */
.site-nav {
  padding-top: calc(1.25rem + env(safe-area-inset-top, 0px));
  padding-left: calc(2rem + env(safe-area-inset-left, 0px));
  padding-right: calc(2rem + env(safe-area-inset-right, 0px));
}

/* iOS flip-card rendering fixes — older Safari needs the prefixed preserve-3d */
.card-inner,
.mini-card-inner,
.family-story-card-inner {
  -webkit-transform-style: preserve-3d;
}

.card-back-content,
.mini-card-back {
  -webkit-overflow-scrolling: touch;
}

/* Lock body scroll when mobile nav overlay is open (paired with JS) */
body.nav-open {
  overflow: hidden;
  touch-action: none;
}

/* ---- Phone layout (<= 640px) ---- */
@media (max-width: 640px) {
  body { font-size: 17px; }

  .container { padding: 0 1.25rem; }

  /* Safety net: if scroll-reveal JS ever sets opacity: 0 on a section header,
     keep it visible anyway. */
  .chapter,
  .section-header {
    opacity: 1 !important;
    transform: none !important;
  }

  .chapter { padding: 2.5rem 0; }

  /* Anchor jumps land below the fixed nav instead of under it */
  .child-section,
  .family-section {
    scroll-margin-top: 72px;
  }

  /* Nav: brand left, hamburger right */
  .site-nav {
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: calc(0.9rem + env(safe-area-inset-top, 0px));
    padding-bottom: 0.9rem;
    padding-left: calc(1.25rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1.25rem + env(safe-area-inset-right, 0px));
  }
  .site-nav .brand {
    font-size: 0.72rem;
    letter-spacing: 0.25em;
  }

  /* Hero — dvh avoids the iOS URL-bar vh bug */
  .hero {
    padding: 5rem 1.25rem 3rem;
    min-height: 100dvh;
  }
  .hero-title { font-size: clamp(2.75rem, 11vw, 4rem); }
  .hero-subtitle { font-size: 1.05rem; margin-bottom: 1.75rem; }
  .hero-dedication { font-size: 1rem; }
  .hero-divider { margin-bottom: 1.5rem; }
  .divider-line { max-width: 60px; }
  .scroll-hint { bottom: 1.5rem; }

  /* Section vertical rhythm */
  .intro-section { padding: 3.5rem 0; }
  .intro-lead { font-size: 1.2rem; margin-bottom: 1.5rem; }
  .intro-text p { font-size: 1rem; }

  .child-section { padding: 2.5rem 0 3rem; }
  .chapter { padding: 2rem 0; }
  .child-name { margin-bottom: 1rem; }
  .child-birth-info,
  .child-chinese { font-size: 0.85rem; }

  /* Big-three sign row — keep on one row when possible */
  .big-three {
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .big-three-glyph { font-size: 1.15rem; }
  .big-three-sign { font-size: 0.85rem; }
  .big-three-divider { font-size: 1rem; }

  /* Section dividers — shrink */
  .section-divider { padding: 1.75rem 0; }
  .divider-ornament { gap: 1rem; padding: 0 1rem; }

  /* Closing section */
  .closing-section { padding: 4rem 0 3rem; }
  .closing-glyph-row { gap: 0.75rem; margin-bottom: 2rem; }
  .closing-glyph { font-size: 1.4rem; }
  .closing-quote { font-size: 1.1rem; line-height: 1.65; }

  /* Footer */
  .site-footer { padding: 2.5rem 1.25rem; }
  .footer-glyph-row { gap: 0.6rem; font-size: 1rem; }

  /* Tarot cards — single column, readable size */
  .card-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
    max-width: 360px;
    margin: 0 auto;
  }
  .tarot-card { aspect-ratio: 3/4; }
  .card-front { padding: 1.25rem 1rem; }
  .card-front-symbol { font-size: 3rem; }
  .card-front-title { font-size: 0.95rem; }
  .card-back { padding: 1.25rem 1rem; }
  .card-back-content { font-size: 0.95rem; line-height: 1.6; }

  /* Tab bar — bigger touch targets, hide desktop scroll arrows (use swipe) */
  .tab-bar { margin-bottom: 1.5rem; }
  .tab-btn {
    padding: 0.95rem 1rem;
    font-size: 0.72rem;
    min-height: 44px;
  }
  .tab-arrow { display: none; }

  /* Tab story panel */
  .tab-story {
    padding: 1.5rem 1.25rem 1.75rem;
    font-size: 1rem;
    line-height: 1.7;
  }
  .tab-tradition-label {
    position: static;
    display: block;
    margin-bottom: 0.75rem;
    text-align: left;
  }

  /* Mini cards — full width, natural height */
  .mini-card-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .mini-card { aspect-ratio: auto; min-height: 180px; }
  .mini-card-front,
  .mini-card-back { padding: 1.25rem 1rem; }

  /* Family story cards */
  .family-story-front,
  .family-story-back { padding: 1.5rem 1.25rem; }
  .family-story-glyph { font-size: 2.5rem; }
  .family-story-title { font-size: 1rem; }
  .family-story-card,
  .family-story-card-inner { min-height: 220px; }
  .family-story-back { font-size: 0.95rem; line-height: 1.65; }

  /* Quick stats strip — keep scrollable, tighten pill size */
  .stat-pill {
    padding: 0.3rem 0.85rem;
    font-size: 0.65rem;
  }

  /* Nav overlay links — bigger tap targets */
  .nav-overlay { gap: 1.75rem; }
  .nav-overlay a {
    font-size: 1.25rem;
    padding: 0.5rem 1rem;
  }
}

/* ---- Narrow phones (<= 380px) ---- */
@media (max-width: 380px) {
  .container { padding: 0 1rem; }
  .hero-title { font-size: clamp(2.25rem, 12vw, 3rem); }
  .big-three { gap: 0.35rem; }
  .big-three-divider { display: none; }
  .tab-btn { padding: 0.9rem 0.75rem; font-size: 0.68rem; }
}
