/* ============================================
   monopoleai.com — Victorian AI Honeycomb
   ============================================ */

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #0A0A0F;
    color: #E8DCC8;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    line-height: 1.65;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ---- Scroll Container ---- */
#scroll-container {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

/* ---- Chapters ---- */
.chapter {
    position: relative;
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ---- Sigil Watermark ---- */
.sigil-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.03;
    pointer-events: none;
    z-index: 0;
}

/* ---- Compass Rose Navigation ---- */
#compass-btn {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    background: rgba(10, 10, 15, 0.8);
    border: 1px solid #C9A84C;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                box-shadow 0.3s ease;
    backdrop-filter: blur(4px);
}

#compass-btn:hover {
    transform: rotate(15deg);
    box-shadow: 0 0 16px rgba(201, 168, 76, 0.25);
}

/* ---- Nav Overlay ---- */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    backdrop-filter: blur(8px);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.nav-content {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.nav-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    color: #C9A84C;
    letter-spacing: 0.04em;
    font-feature-settings: 'smcp', 'onum', 'liga';
    margin-bottom: 1.5rem;
}

.nav-separator {
    width: 80px;
    height: 1px;
    background: #8B7D5C;
    margin: 0 auto 2rem;
}

.nav-link {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 1rem 0;
    text-decoration: none;
    color: #E8DCC8;
    border-bottom: 1px dashed rgba(139, 125, 92, 0.3);
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: #B87333;
}

.nav-link:hover .nav-chapter-num {
    color: #F4D47C;
}

/* Error/alert color available for warnings: #6B1D2A */
.error-state { color: #6B1D2A; }

.nav-chapter-num {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    color: #C9A84C;
    font-size: 1.1em;
    min-width: 2rem;
}

.nav-chapter-name {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.2em;
    white-space: nowrap;
}

.nav-dots {
    flex: 1;
    border-bottom: 1px dotted #8B7D5C;
    margin-bottom: 0.3em;
    min-width: 30px;
}

.nav-chapter-desc {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.9em;
    color: #A8935E;
    white-space: nowrap;
}

/* ============================================
   CHAPTER I — The Hypothesis
   ============================================ */

#monopole-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

#ch1-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
    margin-top: 60px;
}

.display-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: #C9A84C;
    letter-spacing: 0.04em;
    line-height: 1.1;
    font-feature-settings: 'smcp', 'onum', 'liga';
    opacity: 0;
    transition: opacity 0.8s ease;
}

.display-title.visible {
    opacity: 1;
}

.subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: #E8DCC8;
    letter-spacing: 0.02em;
    margin-top: 0.75rem;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.subtitle.visible {
    opacity: 1;
}

#scroll-chevron {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0;
    animation: fadeInChevron 0.5s ease 2.5s forwards;
}

#scroll-chevron svg {
    animation: pulseChevron 2s ease-in-out infinite;
}

@keyframes fadeInChevron {
    to { opacity: 0.7; }
}

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

/* ============================================
   HONEYCOMB GRID
   ============================================ */

.honeycomb-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 8px;
    max-width: 900px;
    padding: 1rem;
    position: relative;
    z-index: 1;
}

.honeycomb-dense {
    max-width: 1100px;
}

.hex-cell {
    width: clamp(140px, 18vw, 220px);
    height: clamp(120px, 16vw, 190px);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: #1A1A24;
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
                transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(201,168,76,0.06) 0%, transparent 70%);
    pointer-events: none;
}

.hex-cell:hover {
    transform: scale(1.05);
    filter: brightness(1.15);
    z-index: 5;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    border: 1px solid rgba(201, 168, 76, 0.25);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hex-cell.visible::after {
    opacity: 1;
}

.hex-inner {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20%;
    text-align: center;
}

.hex-engraving {
    width: 70%;
    height: auto;
    max-height: 60%;
}

.hex-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    letter-spacing: 0.06em;
    color: #8B7D5C;
    margin-top: 6px;
    text-transform: uppercase;
}

.hex-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    line-height: 1.5;
    color: #E8DCC8;
}

.hex-text-glow {
    color: #F4D47C;
    text-shadow: 0 0 8px rgba(244, 212, 124, 0.15);
}

/* ---- Hex glow effect for Chapter III ---- */
.hex-glow.visible {
    background: linear-gradient(135deg, #1A1A24, #1e1e2a);
}

.hex-glow.glowing::before {
    background: radial-gradient(ellipse at center, rgba(201,168,76,0.12) 0%, transparent 70%);
}

/* ---- Circuit overlay ---- */
.circuit-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   CHAPTER II — The Workshop
   ============================================ */

.chapter-header {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-bottom: 2rem;
}

.chapter-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.1em;
    color: #8B7D5C;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.4rem;
}

.chapter-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #C9A84C;
    letter-spacing: 0.04em;
    line-height: 1.1;
    font-feature-settings: 'smcp', 'onum', 'liga';
}

.drop-cap {
    font-size: 1.3em;
    text-shadow: 0 0 8px rgba(201, 168, 76, 0.4);
    padding: 0 2px;
    border: 1px dashed rgba(201, 168, 76, 0.3);
    margin-right: 2px;
}

/* ============================================
   CHAPTER III — The Singularity
   ============================================ */

.hex-center-sigil {
    background: radial-gradient(ellipse at center, rgba(244, 212, 124, 0.08) 0%, #1A1A24 70%);
}

.sigil-spinning {
    animation: spinSigil 120s linear infinite;
}

@keyframes spinSigil {
    to { transform: rotate(360deg); }
}

#radial-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(201, 168, 76, 0.08), transparent 70%);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
}

#radial-pulse.pulse {
    animation: radialPulse 1.5s ease-out forwards;
}

@keyframes radialPulse {
    0% { width: 0; height: 0; opacity: 1; }
    100% { width: 200vmax; height: 200vmax; opacity: 0; }
}

.final-statement {
    position: absolute;
    bottom: 8vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #C9A84C;
    letter-spacing: 0.04em;
    font-feature-settings: 'smcp', 'onum', 'liga';
    opacity: 0;
    transition: opacity 1s ease;
    white-space: nowrap;
    z-index: 2;
}

.final-statement.visible {
    opacity: 1;
}

/* ============================================
   FIELD LINE ANIMATIONS (Chapter I)
   ============================================ */

#central-dot.visible {
    opacity: 1;
    transition: opacity 0.4s ease;
}

#field-lines.visible {
    opacity: 1;
    transition: opacity 0.3s ease;
}

#field-lines.visible .field-line {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1.2s ease-out;
}

#hex-nodes.visible {
    opacity: 1;
    transition: opacity 0.5s ease 1s;
}

#hex-nodes.visible .hex-node {
    fill: rgba(201, 168, 76, 0.08);
    transition: fill 0.5s ease;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .hex-cell {
        width: clamp(100px, 30vw, 150px);
        height: clamp(86px, 26vw, 130px);
    }

    .honeycomb-grid {
        gap: 4px;
    }

    #monopole-center svg {
        width: 300px;
        height: 300px;
    }

    .nav-chapter-desc {
        display: none;
    }

    .nav-dots {
        display: none;
    }
}

/* ============================================
   EVEN ROW OFFSET for honeycomb
   ============================================ */

.hex-cell:nth-child(even) {
    margin-top: -20px;
}

@media (min-width: 601px) {
    .hex-cell:nth-child(even) {
        margin-top: -25px;
    }
}

/* Filigree border animation */
@keyframes drawBorder {
    from { stroke-dashoffset: 100; }
    to { stroke-dashoffset: 0; }
}

/* Circuit trace pulse */
@keyframes tracePulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.35; }
}

.circuit-overlay line {
    animation: tracePulse 3s ease-in-out infinite;
}

.circuit-overlay line:nth-child(2) {
    animation-delay: 1s;
}

.circuit-overlay line:nth-child(3) {
    animation-delay: 2s;
}
