/* ==========================================================================
   THE PARTNER OS - MASTER STYLES (v4.0 - Final Precision Polish)
   ========================================================================== */

:root {
    --navy-deep: #131A26;
    --navy-mid: #1C2636;
    --navy-hi: #2A384D;
    --copper: #A67C52;
    --copper-dark: #7D5A3C;
    --text: #F2F2F2;
    --muted: rgba(242, 242, 242, 0.70);
    --glass: rgba(22, 28, 38, 0.95);
    --border-soft: rgba(166, 124, 82, 0.2);
    --font-serif: ui-serif, "Iowan Old Style", serif;
    --font-sans: -apple-system, system-ui, sans-serif;
    --font-mono: "SF Mono", monospace;
    --radius: 20px;
}

html, body {
    background-color: #131A26 !important;
    color: #F2F2F2 !important;
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: var(--font-sans); -webkit-font-smoothing: antialiased;
}

* { box-sizing: inherit; }

/* 3️⃣ ACCESSIBILITY: FOCUS STATES */
:focus-visible {
  outline: 2px solid rgba(166, 124, 82, 0.75);
  outline-offset: 4px;
  border-radius: 10px;
}

body::after {
    content: ""; position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3F%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.03; z-index: 2; pointer-events: none;
}
.bg-wash { position: fixed; inset: 0; z-index: 0; background: radial-gradient(circle at 15% 25%, rgba(166, 124, 82, 0.05) 0%, transparent 45%); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 5; }
section { padding: 100px 0; clear: both; }

.divider-line { height: 1px; width: 100%; background: rgba(166, 124, 82, 0.18); margin: 0; opacity: 0.9; }

/* 2️⃣ UTILITY CLASSES */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* 1️⃣ HEADER CSS SCOPING */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(19, 26, 38, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
  z-index: 100;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  padding: 24px 0;
}

.header-divider { color: var(--copper); opacity: 0.3; margin: 0 8px; font-weight: 300; }
.nav-links { display: flex; gap: 32px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; }
.nav-links a { text-decoration: none; color: var(--muted); transition: color 0.3s; }
.nav-links a.active, .nav-links a:hover { color: var(--copper) !important; }

/* HERO GRID */
.hero { display: grid; grid-template-columns: 2fr 1fr; gap: 60px; align-items: center; }

/* GRID SYSTEMS */
.swipe-container, .books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 24px;
    margin-top: 40px;
    align-items: stretch;
    padding-bottom: 40px;
}

@media (min-width: 769px) { .swipe-indicators { display: none !important; } }

h1 { font-family: var(--font-serif); font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.05; font-weight: 400; }
h2 { font-family: var(--font-serif); font-size: 2.5rem; font-weight: 400; margin-bottom: 20px; }
h3, .title-sm, .card-title { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 400; color: #FFF; margin-bottom: 10px; }
sup { font-size: 0.6em; vertical-align: super; line-height: 0; }

.text-muted { color: var(--muted); } .text-sm { font-size: 0.95rem; } .text-xs { font-size: 0.85rem; }
.text-copper { color: var(--copper); font-weight: 600; } .font-serif { font-family: var(--font-serif); } .italic { font-style: italic; }
.mono { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; color: var(--copper); letter-spacing: 0.12em; }
.mono-small { font-family: var(--font-mono); font-size: 0.65rem; text-transform: uppercase; color: var(--muted); }

/* CARDS */
.glass-card, .book-card, .portrait-card {
    background: var(--glass); border: 1px solid var(--border-soft); border-radius: var(--radius);
    box-shadow: 0 40px 90px rgba(0,0,0,0.55); overflow: hidden; display: flex; flex-direction: column;
    position: relative; transition: border-color 0.35s ease, transform 0.35s ease; text-align: left;
}
.glass-card, .book-card { padding: 48px !important; }
.portrait-card { padding: 12px !important; }
.glass-card::before, .book-card::before, .portrait-card::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
    background: linear-gradient(180deg, rgba(255,255,255,0.07) 0%, rgba(255,255,255,0.02) 18%, transparent 45%);
}
@media (hover: hover) { .glass-card:hover, .book-card:hover { border-color: rgba(166, 124, 82, 0.55); transform: translateY(-1px); } }
.portrait-img { width: 100%; aspect-ratio: 4/5; border-radius: 12px; background-size: cover; background-position: center; }
.tier0-artifact { background: var(--glass) !important; border-color: rgba(166,124,82,0.4) !important; }

/* ANIMATED VIZ */
.watermelon-viz-container { flex: 1; display: flex; justify-content: center; align-items: center; min-height: 400px; }
.watermelon-viz { width: 100%; max-width: 320px; position: relative; }
.scanner { transform-origin: center; animation: scan 4s linear infinite; }
.pulse { animation: pulseGlow 3s ease-in-out infinite; }
.orbit { transform-origin: center; animation: rotateOrbit 20s linear infinite; }
.fracture { animation: coreTremor 2s ease-in-out infinite; }
@keyframes scan { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulseGlow { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.6; } }
@keyframes rotateOrbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes coreTremor { 0%, 100% { opacity: 0.4; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.02); } }
.viz-label { position: absolute; width: 100%; text-align: center; pointer-events: none; }
.viz-label.outer { bottom: -20px; color: #22C55E; opacity: 0.6; }
.viz-label.inner { top: 50%; left: 50%; transform: translate(-50%, -50%); color: #EF4444; opacity: 0.8; }

/* 1️⃣ BUTTON HOVER LOGIC (Separate & Safe) */
.btn { display: inline-block; padding: 16px 32px; text-decoration: none; font-weight: 700; text-transform: uppercase; font-size: 0.8rem; border-radius: 999px; transition: all 0.3s ease; border: 1.5px solid transparent; text-align: center; white-space: nowrap; }

.btn.primary { background: rgba(28, 38, 54, 0.8); border-color: rgba(166, 124, 82, 0.6); color: #FFF; box-shadow: 0 12px 30px rgba(166, 124, 82, 0.15); }
.btn.secondary { background: transparent; border-color: rgba(166, 124, 82, 0.4); color: var(--muted); }

@media (hover: hover) {
  .btn.primary:hover {
    border-color: var(--copper);
    color: #FFF;
    transform: translateY(-2px);
    background: rgba(42, 56, 77, 0.9);
  }
  .btn.secondary:hover {
    border-color: var(--copper);
    color: #FFF;
    transform: translateY(-2px);
    background: rgba(42, 56, 77, 0.45);
  }
}

.cta-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.cta-item { display: block; flex: 0 1 auto; }
.full-width { width: 100%; }

/* FORMULA MATHEMATICAL ALIGNMENT */
.formula-capsule { max-width: 860px; margin: 80px auto; padding: 60px 20px; text-align: center; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); font-family: var(--font-mono); font-size: clamp(1rem, 4vw, 2.2rem); color: #FFF; }

.formula-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
}

.formula-eq, .operator {
  color: var(--copper);
  font-weight: bold;
}

.fraction {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  padding: 0 10px;
}

.numerator, .denominator {
  padding: 5px 15px;
}

.fraction-line {
  width: 100%;
  border-bottom: 1.5px solid rgba(242, 242, 242, 0.8); 
  margin: 2px 0;
}

#reading-progress { position: fixed; top: 0; left: 0; width: 100%; height: 2px; background: transparent; z-index: 1000; }
#reading-progress-fill { height: 100%; background: var(--copper); width: 0%; will-change: width; }

footer { padding: 100px 0 60px 0; border-top: 1px solid var(--border-soft); text-align: center; width: 100%; clear: both; }
.footer-line { font-family: var(--font-serif); font-size: 1rem; color: var(--muted); opacity: 0.5; margin-bottom: 40px; }
.legal-links { display: flex; justify-content: center; align-items: center; gap: 32px; font-size: 0.65rem; text-transform: uppercase; font-family: var(--font-mono); letter-spacing: 0.05em; flex-wrap: wrap; }
.legal-links a { color: rgba(255,255,255,0.3) !important; text-decoration: none; transition: color 0.3s ease; }
.legal-links a:hover { color: var(--copper) !important; }

@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none !important; transform: none !important; opacity: 1 !important; }
  .scanner, .pulse, .orbit, .fracture { animation: none !important; }
}

@media (max-width: 768px) {
    .header-inner { padding: 18px 0; } 
    .header-role, .header-divider { display: none; }
    .nav-links {
      display: flex; gap: 18px; overflow-x: auto; white-space: nowrap;
      -webkit-overflow-scrolling: touch; scrollbar-width: none;
      padding-bottom: 4px;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    
    .hero { grid-template-columns: 1fr; gap: 40px; }
    .swipe-container, .books-grid { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; margin: 30px -24px 0 -24px; padding: 0 24px 40px 24px; scrollbar-width: none; gap: 16px; scroll-padding: 0 24px; }
    .swipe-container::-webkit-scrollbar, .books-grid::-webkit-scrollbar { display: none; }
    .glass-card, .book-card { min-width: 85vw; scroll-snap-align: center; padding: 32px !important; }
    .swipe-indicators { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
    .dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.1); display: inline-block; margin: 0 4px; }
    .dot.active { background: var(--copper); width: 16px; border-radius: 4px; }
    h2 { font-size: 1.8rem; }
    .watermelon-viz-container { min-height: 300px; }

    /* MOBILE FORMULA FIX */
    .formula-row { font-size: 0.9rem; }
    .numerator { white-space: nowrap; }

    /* MOBILE AI CARD BORDER REMOVAL */
    .tier0-artifact { border-color: var(--border-soft) !important; }
}

.reveal { opacity: 0; transform: translateY(20px); transition: 0.8s ease-out; }
.reveal.active { opacity: 1; transform: translateY(0); }