/* ============================================================
   SilSera Phase 0A — Global Design System
   ============================================================ */

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
    --void: #0c0b0f;
    --void-soft: #161318;
    --ink: #1a1410;
    --parchment: #f0ebe1;
    --parchment-dim: #c8c1b5;
    --gold: #C7A46A;
    --gold-light: #E0C090;
    --gold-dim: #8a6e44;
    --burgundy: #7C1D2B;
    --burg-dark: #521220;
    --white-mist: rgba(240, 235, 225, 0.08);

    --font-script: 'Pinyon Script', cursive;
    --font-head: 'Josefin Slab', serif;
    --font-body: 'Caudex', serif;

    --header-h: 80px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
}

/* ── RESET ───────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--parchment);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

/* Eliminate 300ms tap delay on mobile */
a, button, .side-cta, .q-option, .subtitle-choice-btn, .prompt-btn, .sky-chapter-chip {
    touch-action: manipulation;
}

/* ── HEADER ──────────────────────────────────────────────── */
.site-header {
    position: fixed;
    inset: 0 0 auto;
    height: var(--header-h);
    z-index: 900;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 32px;
    transition: background 0.5s ease, box-shadow 0.5s ease, height 0.4s var(--ease-out);
}

.site-header.scrolled {
    background: rgba(12, 11, 15, 0.82);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 1px 0 rgba(199, 164, 106, 0.12);
    height: 62px;
}

/* Sky glyph */
.sky-glyph {
    font-size: 1.1rem;
    color: var(--gold-dim);
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
}

.sky-glyph:hover {
    color: var(--gold);
}

.sky-glyph-icon {
    font-size: 1.3rem;
    transition: transform 0.4s var(--ease-out);
}

.sky-glyph:hover .sky-glyph-icon {
    transform: scale(1.2) rotate(20deg);
}

.sky-glyph-label {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.7;
}

/* SVG Logo Container */
.header-wordmark {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 300px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-wordmark img {
    height: 300%;
    /* Scaled down from the giant 520px */
    width: auto;
    transition: height 0.4s var(--ease-out);
    display: block;
}

.site-header.scrolled .header-wordmark img {
    height: 110px;
}

.header-wordmark .wordmark-tag {
    font-family: var(--font-body);
    font-size: 0.6rem;
    letter-spacing: 0.22em;
    color: var(--gold-dim);
    text-transform: lowercase;
    display: block;
    margin-top: -2px;
}

/* Hamburger */
.header-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
}

.hamburger-btn {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px;
    cursor: pointer;
    transition: opacity 0.3s;
}

/* Hamburger → ✕ animation via .active class (no vanish) */

.ham-line {
    width: 22px;
    height: 1px;
    background: var(--gold-dim);
    transition: background 0.3s, transform 0.3s, opacity 0.3s;
    transform-origin: center;
}

.hamburger-btn:hover .ham-line {
    background: var(--gold);
}

.hamburger-btn.active .ham-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.hamburger-btn.active .ham-line:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active .ham-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* ── NAV OVERLAY ─────────────────────────────────────────── */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(8, 7, 10, 0.98);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.sky-modal {
    z-index: 1100;
}

.nav-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.nav-close {
    position: absolute;
    top: 28px;
    right: 32px;
    font-size: 2rem;
    color: var(--gold-dim);
    transition: color 0.3s, transform 0.4s;
    z-index: 1000;
    /* Ensure it's above everything in the overlay */
    pointer-events: auto;
    /* Force clickability */
    padding: 10px;
    /* Larger hit area */
}

.nav-close:hover {
    color: var(--gold);
    transform: rotate(90deg);
}

.nav-links {
    list-style: none;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-links li a {
    font-family: var(--font-head);
    font-size: clamp(1.4rem, 4vw, 2.5rem);
    font-weight: 300;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--parchment-dim);
    display: block;
    padding: 10px 20px;
    transition: color 0.3s, letter-spacing 0.4s;
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--gold);
    letter-spacing: 0.28em;
}

.nav-social {
    position: absolute;
    bottom: 36px;
    display: flex;
    gap: 24px;
}

.nav-social a {
    font-family: var(--font-head);
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    color: var(--gold-dim);
    text-transform: uppercase;
    transition: color 0.3s;
}

.nav-social a:hover {
    color: var(--gold);
}

/* ── SECTION SHARED ──────────────────────────────────────── */
.section-eyebrow {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-head);
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    font-weight: 300;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--parchment);
    line-height: 1.1;
}

.section-body {
    font-family: var(--font-body);
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--parchment-dim);
    max-width: 56ch;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn-primary {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.75rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--void);
    background: var(--gold);
    padding: 14px 36px;
    border: 1px solid var(--gold);
    transition: background 0.35s, color 0.35s, box-shadow 0.35s, letter-spacing 0.4s;
}

.btn-primary:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    box-shadow: 0 0 30px rgba(199, 164, 106, 0.25);
    letter-spacing: 0.32em;
}

.btn-ghost {
    display: inline-block;
    font-family: var(--font-head);
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold-dim);
    border: 1px solid rgba(199, 164, 106, 0.3);
    padding: 12px 30px;
    transition: color 0.35s, border-color 0.35s, box-shadow 0.35s;
}

.btn-ghost:hover {
    color: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(199, 164, 106, 0.12);
}

.btn-text {
    font-family: var(--font-body);
    font-style: italic;
    color: var(--gold-dim);
    font-size: 0.95rem;
    position: relative;
    padding-bottom: 2px;
    transition: color 0.3s;
}

.btn-text::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--gold);
    transition: width 0.4s var(--ease-out);
}

.btn-text:hover {
    color: var(--gold);
}

.btn-text:hover::after {
    width: 100%;
}

/* ── FOOTER ──────────────────────────────────────────────── */
.site-footer {
    padding: 40px 48px;
    border-top: 1px solid rgba(199, 164, 106, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-wordmark {
    font-family: var(--font-script);
    font-size: 1.6rem;
    color: var(--gold-dim);
}

.footer-links {
    display: flex;
    gap: 24px;
    list-style: none;
    flex-wrap: wrap;
}

.footer-links a {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--parchment-dim);
    opacity: 0.6;
    transition: opacity 0.3s, color 0.3s;
}

.footer-links a:hover {
    opacity: 1;
    color: var(--gold);
}

.footer-copy {
    font-family: var(--font-head);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--parchment-dim);
    opacity: 0.4;
    width: 100%;
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid rgba(199, 164, 106, 0.06);
}

/* ── ACCOUNT OVERLAY ─────────────────────────────────────── */
.account-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(8, 7, 10, 0.88);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.35s ease;
}

.account-modal {
    position: relative;
    background: var(--void-soft);
    border: 1px solid rgba(199, 164, 106, 0.2);
    padding: 56px 48px 48px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
}

.account-close {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 1.4rem;
    color: var(--gold-dim);
    transition: color 0.3s, transform 0.3s;
}

.account-close:hover {
    color: var(--gold);
    transform: rotate(90deg);
}

.account-eyebrow {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 12px;
}

.account-heading {
    font-family: var(--font-script);
    font-size: 2.2rem;
    color: var(--gold);
    font-weight: 400;
    margin-bottom: 12px;
}

.account-micro {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-style: italic;
    color: var(--parchment-dim);
    opacity: 0.7;
    margin-bottom: 36px;
    line-height: 1.6;
}

.account-google-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.account-skip-btn {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--parchment-dim);
    opacity: 0.4;
    transition: opacity 0.3s;
    padding: 8px;
}

.account-skip-btn:hover {
    opacity: 0.7;
}

/* ── NEWSLETTER ──────────────────────────────────────────── */
.newsletter-section {
    padding: 100px 48px;
    text-align: center;
    border-top: 1px solid rgba(199, 164, 106, 0.08);
}

.newsletter-form {
    display: flex;
    gap: 0;
    max-width: 420px;
    margin: 32px auto 16px;
    border-bottom: 1px solid rgba(199, 164, 106, 0.35);
}

.newsletter-input {
    flex: 1;
    background: none;
    border: none;
    padding: 12px 16px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--parchment);
    outline: none;
}

.newsletter-input::placeholder {
    color: var(--parchment-dim);
    opacity: 0.4;
}

.newsletter-btn {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 12px 20px;
    transition: color 0.3s;
}

.newsletter-btn:hover {
    color: var(--gold-light);
}

.newsletter-micro {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-style: italic;
    color: var(--parchment-dim);
    opacity: 0.45;
}

/* ── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes floatDrift {

    0%,
    100% {
        transform: translateY(0) translateX(0);
    }

    33% {
        transform: translateY(-14px) translateX(6px);
    }

    66% {
        transform: translateY(8px) translateX(-8px);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 0 rgba(199, 164, 106, 0);
    }

    50% {
        box-shadow: 0 0 30px rgba(199, 164, 106, 0.3);
    }
}

@keyframes bloom {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(199, 164, 106, 0);
    }

    40% {
        transform: scale(1.08);
        box-shadow: 0 0 24px rgba(199, 164, 106, 0.3);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(199, 164, 106, 0);
    }
}

.animate-bloom {
    animation: bloom 0.7s var(--ease-out) forwards;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── TASTE PORTRAIT CARD ─────────────────────────────────── */
.portrait-card {
    border: 1px solid rgba(199, 164, 106, 0.2);
    padding: 28px;
    background: rgba(22, 19, 24, 0.8);
    backdrop-filter: blur(6px);
    max-width: 320px;
}

.portrait-palette {
    display: flex;
    height: 60px;
    margin-bottom: 20px;
    overflow: hidden;
}

.portrait-swatch {
    flex: 1;
    transition: flex 0.6s var(--ease-out);
}

.portrait-swatch.dominant {
    flex: 2;
}

.portrait-zone {
    font-family: var(--font-head);
    font-size: 0.6rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold-dim);
    margin-bottom: 6px;
}

.portrait-descriptor {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    color: var(--parchment);
    line-height: 1.5;
    margin-bottom: 20px;
}

.portrait-share-btn {
    font-family: var(--font-head);
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold-dim);
    border: 1px solid rgba(199, 164, 106, 0.25);
    padding: 8px 18px;
    transition: color 0.3s, border-color 0.3s;
    display: inline-block;
}

.portrait-share-btn:hover {
    color: var(--gold);
    border-color: var(--gold);
}

/* ── UTILITY ─────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center {
    text-align: center;
}

.divider-gold {
    width: 48px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
    margin: 28px auto;
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--void);
}

::-webkit-scrollbar-thumb {
    background: var(--gold-dim);
    border-radius: 2px;
}

/* ── VISUAL UPGRADES ────────────────────────────────────── */
/* Glowing conic-gradient borders on hover */
@property --angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

.chapter-card {
    position: relative;
}

.chapter-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    background: conic-gradient(from var(--angle, 0deg),
        transparent 0deg, var(--gold-dim) 60deg, transparent 120deg);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s;
}

.chapter-card:hover::after {
    opacity: 1;
    animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
    to { --angle: 360deg; }
}

/* Star burst animation on pulse placement */
.star-burst {
    position: fixed;
    pointer-events: none;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--burst-color, #C7A46A);
    z-index: 9000;
    animation: starBurstAnim 0.8s var(--ease-out) forwards;
}

@keyframes starBurstAnim {
    0% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 var(--burst-color, #C7A46A); }
    50% { transform: scale(3); opacity: 0.8; box-shadow: 0 0 20px 8px rgba(199,164,106,0.4); }
    100% { transform: scale(0); opacity: 0; box-shadow: 0 0 40px 20px transparent; }
}

/* Scroll-triggered text reveals */
.will-reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.will-reveal.revealed {
    opacity: 1;
    transform: none;
}

/* ── READABILITY FLOOR ──────────────────────────────────── */
.section-eyebrow,
.chapter-numeral,
.chapter-breadcrumb,
.nav-social a,
.footer-links a {
    font-size: max(0.72rem, 11.5px);
}

/* Upgraded gold-dim for text-only contexts (4.8:1 contrast vs #0c0b0f) */
.section-eyebrow,
.chapter-numeral,
.hero-micro,
.scroll-hint-label,
.threshold-eyebrow,
.collection-vol,
.q-number {
    color: #b89a6a;
}

/* ── MOBILE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
    :root {
        --header-h: 64px;
    }

    .site-header {
        padding: 0 20px;
    }

    .sky-glyph-label {
        display: none;
    }

    .site-footer {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 32px 24px;
    }

    .newsletter-section {
        padding: 72px 24px;
    }

    .newsletter-form {
        flex-direction: column;
        border-bottom: none;
    }

    .newsletter-input {
        border-bottom: 1px solid rgba(199, 164, 106, 0.35);
        text-align: center;
    }

    .newsletter-btn {
        padding: 12px;
    }

    .nav-close {
        top: 20px;
        right: 20px;
    }
}