/* ============================================================
   TIME LEDGER THEORY — Main Stylesheet
   Colors: Cobalt blue, purple accents, white, dark
   Mobile-first. Scroll-driven. Clean. Wonder-inducing.
   ============================================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cobalt: #1B4F9B;
    --cobalt-light: #2E6FCF;
    --cobalt-dark: #0D2F66;
    --purple: #6B3FA0;
    --purple-light: #9B59B6;
    --white: #FFFFFF;
    --off-white: #F5F6FA;
    --black: #0A0A0A;
    --gray-dark: #222222;
    --gray-mid: #888888;
    --gray-light: #CCCCCC;
    --font-main: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --header-height: 50px;
    --transition: 0.4s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--black);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--cobalt-light);
    text-decoration: none;
}

a:hover {
    color: var(--purple-light);
    text-decoration: underline;
}

/* --- Header --- */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: var(--header-height);
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 12px;
}

.header-title-text {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--cobalt-light);
}

/* --- Menu Toggle --- */
.menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1001;
}

.menu-bar {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--cobalt-light);
    transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.open .menu-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.open .menu-bar:nth-child(2) { opacity: 0; }
.menu-toggle.open .menu-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* --- Mobile Menu --- */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: rgba(10, 10, 10, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    overflow-y: auto;
}

.mobile-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.menu-list {
    list-style: none;
    text-align: center;
    padding: 60px 0 40px;
}

.menu-list li { margin: 4px 0; }

.menu-link {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    padding: 8px 16px;
    display: inline-block;
    min-height: 44px;
    line-height: 28px;
}

.menu-link:hover { color: var(--cobalt-light); text-decoration: none; }

.menu-divider {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--cobalt);
    text-transform: uppercase;
    margin-top: 16px;
    margin-bottom: 4px;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    right: 0;
    top: var(--header-height);
    bottom: 0;
    width: 3px;
    z-index: 900;
    background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
    width: 100%;
    background: linear-gradient(180deg, var(--cobalt), var(--purple));
    height: 0%;
    transition: height 0.1s;
}

/* --- Lattice Background Canvas --- */
#lattice-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Scroll Sections --- */
.scroll-section {
    position: relative;
    z-index: 1;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px 60px 20px;
}

/* First section gets more top padding for header */
.scroll-section:first-child {
    padding-top: calc(var(--header-height) + 40px);
    min-height: 80vh;
}

.section-content {
    max-width: 700px;
    width: 100%;
}

/* Section themes */
.section-dark {
    background: transparent;
    color: var(--white);
}

.section-light {
    background: var(--white);
    color: var(--gray-dark);
}

.section-transition {
    background: linear-gradient(180deg, var(--black) 0%, var(--cobalt-dark) 50%, var(--white) 100%);
    color: var(--white);
}

/* --- Section Text --- */
.section-text {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.section-text.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Text backdrop for dark sections — lattice shows through but
   text remains readable. Semi-transparent dark glass effect. */
.section-dark .section-text {
    background: rgba(10, 10, 10, 0.75);
    padding: 24px 20px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.section-text.centered {
    text-align: center;
}

.text-lead {
    font-size: 22px;
    font-weight: 300;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--white);
}

.section-light .text-lead {
    color: var(--gray-dark);
}

.text-body {
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 12px;
    color: rgba(255, 255, 255, 0.75);
}

.section-light .text-body {
    color: var(--gray-dark);
}

.text-accent {
    font-size: 18px;
    font-weight: 600;
    color: var(--cobalt-light);
    margin-top: 16px;
    margin-bottom: 12px;
}

.section-light .text-accent {
    color: var(--cobalt);
}

/* --- Section Visual --- */
.section-visual {
    width: 100%;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.equation {
    font-size: 48px;
    font-weight: 200;
    letter-spacing: 8px;
    color: var(--cobalt-light);
    text-align: center;
    opacity: 0;
    transition: opacity 1s ease;
}

.section-text.visible .equation,
.visible .equation {
    opacity: 1;
}

/* --- Pulse Animation (first section dot) --- */
#vis-pulse {
    position: relative;
}

#vis-pulse::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--cobalt-light);
    border-radius: 50%;
    animation: pulse-beat 1.5s ease-in-out infinite;
    box-shadow: 0 0 30px var(--cobalt), 0 0 60px var(--cobalt-dark);
}

@keyframes pulse-beat {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.8); opacity: 1; }
}

/* --- Paper Cards (dark sections) --- */
.paper-card {
    border: 1px solid rgba(46, 111, 207, 0.3);
    border-left: 4px solid var(--cobalt-light);
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 4px;
    background: rgba(10, 10, 10, 0.7);
}

.paper-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--cobalt-light);
    margin-bottom: 4px;
}

.paper-card .paper-meta {
    font-size: 12px;
    color: var(--gray-mid);
    margin-bottom: 8px;
}

.paper-card p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.5;
    margin-bottom: 8px;
}

.paper-card a {
    font-size: 13px;
    font-weight: 600;
    color: var(--cobalt-light);
}

.paper-card a:hover {
    color: var(--purple-light);
}

/* --- Section Headings (light sections) --- */
.section-heading {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--cobalt);
    text-transform: uppercase;
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--cobalt);
}

/* --- Book Cards --- */
.book-card {
    border: 1px solid #E0E0E0;
    border-left: 4px solid var(--cobalt);
    padding: 20px;
    margin-bottom: 16px;
    border-radius: 4px;
    background: var(--off-white);
}

.book-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-dark);
    margin-bottom: 4px;
}

.book-series {
    font-size: 12px;
    color: var(--gray-mid);
    margin-bottom: 8px;
}

.book-hook {
    font-size: 15px;
    color: var(--gray-dark);
    font-style: italic;
    margin-bottom: 8px;
}

.book-release {
    font-size: 13px;
    font-weight: 700;
    color: var(--cobalt);
    letter-spacing: 1px;
}

/* --- Implication Cards --- */
.implication-card {
    padding: 16px 0;
    border-bottom: 1px solid #E8E8E8;
}

.implication-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--cobalt);
    margin-bottom: 4px;
}

.implication-card p {
    font-size: 15px;
    color: var(--gray-dark);
    font-style: italic;
}

/* --- FAQ --- */
.faq-item {
    border-bottom: 1px solid #E8E8E8;
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    padding: 16px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-dark);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    font-family: var(--font-main);
}

.faq-question::after {
    content: '+';
    font-size: 20px;
    color: var(--cobalt);
    flex-shrink: 0;
    margin-left: 12px;
    transition: transform 0.3s;
}

.faq-question[aria-expanded="true"]::after {
    content: '-';
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.4s ease;
    padding: 0;
}

.faq-answer.open {
    max-height: 300px;
    padding: 0 0 16px 0;
}

.faq-answer p {
    font-size: 14px;
    color: var(--gray-mid);
    line-height: 1.6;
}

.faq-answer a {
    color: var(--cobalt);
}

/* --- Contact Form --- */
.contact-form {
    max-width: 500px;
    margin: 24px 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-family: var(--font-main);
    border: 1px solid #DDD;
    border-radius: 4px;
    background: var(--white);
    color: var(--gray-dark);
    min-height: 48px;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--cobalt);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

.btn { display: inline-block; padding: 12px 24px; font-size: 14px; font-weight: 600; border: none; border-radius: 4px; cursor: pointer; min-height: 48px; }
.btn-primary { background: var(--cobalt); color: var(--white); }
.btn-primary:hover { background: var(--cobalt-dark); text-decoration: none; }

/* --- Footer Section --- */
.footer-section {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #E0E0E0;
    font-size: 13px;
    color: var(--gray-mid);
}

.footer-links {
    margin: 8px 0;
    display: flex;
    gap: 16px;
}

.footer-links a { color: var(--gray-mid); font-size: 12px; }
.footer-links a:hover { color: var(--cobalt); }

.copyright { font-size: 12px; color: var(--gray-light); margin-top: 8px; }

/* --- Desktop --- */
@media (min-width: 768px) {
    .header-title-text { font-size: 14px; letter-spacing: 3px; }
    .text-lead { font-size: 28px; }
    .text-body { font-size: 17px; }
    .text-accent { font-size: 20px; }
    .equation { font-size: 64px; }
    .section-content { max-width: 800px; }
    .scroll-section { padding: 80px 40px; }
}

@media (min-width: 1024px) {
    .text-lead { font-size: 32px; }
    .equation { font-size: 72px; }
}
