/* reasoner.dev - Victorian reasoning parlor submerged beneath the Atlantic */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --deep-bg: #0a1628;
    --section-bg: #0d1f2d;
    --ornament: #8b7345;
    --accent-teal: #0d7377;
    --accent-amber: #c4872f;
    --text-primary: #d4c9a8;
    --text-secondary: #7a8b8f;
    --highlight: #2dd4a8;
    --contour: #3a4a52;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-bg);
    color: var(--text-primary);
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Stipple Texture Overlay
   ============================================ */
.stipple-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='4' height='4'%3E%3Ccircle cx='1' cy='1' r='0.5' fill='%23d4c9a8'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ============================================
   Depth Indicator
   ============================================ */
.depth-indicator {
    position: fixed;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 50;
    pointer-events: none;
}

.depth-line {
    position: absolute;
    left: 50%;
    top: 5%;
    bottom: 5%;
    width: 1px;
    background: linear-gradient(to bottom, var(--contour) 0%, var(--ornament) 50%, var(--contour) 100%);
    opacity: 0.4;
}

.depth-marker {
    position: absolute;
    left: -5px;
    top: 10%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: top 0.1s linear;
}

.depth-value {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 0.7rem;
    color: var(--ornament);
    letter-spacing: 0.05em;
}

.depth-unit {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.55rem;
    font-style: italic;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
}

.depth-tick {
    position: absolute;
    left: 8px;
    width: 14px;
    height: 1px;
    background-color: var(--contour);
    opacity: 0.3;
}

.depth-tick-label {
    position: absolute;
    left: 25px;
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 0.5rem;
    font-style: italic;
    color: var(--text-secondary);
    opacity: 0.4;
    transform: translateY(-50%);
    white-space: nowrap;
}

/* ============================================
   Bioluminescent Particles
   ============================================ */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background-color: var(--highlight);
    pointer-events: none;
}

@keyframes particleRise {
    from {
        transform: translateY(100vh) translateX(0px);
        opacity: 0;
    }
    10% {
        opacity: var(--particle-opacity, 0.3);
    }
    90% {
        opacity: var(--particle-opacity, 0.3);
    }
    to {
        transform: translateY(-20vh) translateX(var(--wobble-x, 30px));
        opacity: 0;
    }
}

@keyframes particleWobble {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(var(--wobble-amount, 15px)); }
    75% { transform: translateX(calc(var(--wobble-amount, 15px) * -1)); }
}

/* ============================================
   Victorian Cityscape
   ============================================ */
.cityscape {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 5;
    pointer-events: none;
    opacity: 0.15;
    transition: opacity 2s ease;
}

.cityscape-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Section Base Styles
   ============================================ */
.section {
    position: relative;
    display: grid;
    grid-template-columns: [margin-left] 8vw [content-start] 1fr [content-end] 8vw [margin-right];
    min-height: 100vh;
    padding: clamp(3rem, 8vw, 8rem) 0;
}

.section > * {
    grid-column: content-start / content-end;
}

/* ============================================
   Section: Surface
   ============================================ */
.section-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-bg);
}

.surface-content {
    text-align: center;
    padding: 2rem;
}

.site-title {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.title-letter {
    display: inline-block;
    text-shadow: 1px 1px 0 var(--accent-teal), 0 0 20px rgba(13, 115, 119, 0.2);
    transition: transform 0.6s ease;
}

.title-dot {
    display: inline-block;
    color: var(--ornament);
    text-shadow: 1px 1px 0 var(--accent-amber);
}

.site-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.ornamental-rule {
    max-width: 400px;
    margin: 0 auto;
}

.ornament-svg {
    width: 100%;
    height: auto;
}

/* ============================================
   Contour Dividers
   ============================================ */
.contour-divider {
    position: relative;
    width: 100%;
    height: 60px;
    overflow: hidden;
}

.contour-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Section: Shallow
   ============================================ */
.section-shallow {
    background: linear-gradient(to bottom, var(--deep-bg), var(--section-bg));
}

/* ============================================
   Ornate Frames
   ============================================ */
.ornate-frame {
    position: relative;
    border: 1px solid var(--ornament);
    border-image: none;
    padding: clamp(2rem, 5vw, 5rem);
    margin: clamp(2rem, 4vw, 4rem) auto;
    max-width: 42em;
    background-color: rgba(10, 22, 40, 0.4);
    box-shadow: inset 0 0 60px rgba(10, 22, 40, 0.5);
}

.ornate-frame::before,
.ornate-frame::after {
    content: '';
    position: absolute;
    border-color: var(--ornament);
    border-style: solid;
    width: 30px;
    height: 30px;
}

.ornate-frame::before {
    top: 4px;
    left: 4px;
    border-width: 1px 0 0 1px;
}

.ornate-frame::after {
    bottom: 4px;
    right: 4px;
    border-width: 0 1px 1px 0;
}

/* Frame corners with SVG flourishes */
.frame-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    opacity: 0;
    transition: opacity 0.5s ease 0.5s;
}

.frame-corner::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--ornament);
    opacity: 0.6;
}

.frame-corner::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-radius: 50%;
    border: 1px solid var(--ornament);
    opacity: 0.3;
}

.frame-corner-tl { top: -8px; left: -8px; }
.frame-corner-tr { top: -8px; right: -8px; }
.frame-corner-bl { bottom: -8px; left: -8px; }
.frame-corner-br { bottom: -8px; right: -8px; }

.ornate-frame.is-visible .frame-corner {
    opacity: 1;
}

/* Frame drift variants */
.frame-drift-left {
    transform: translateX(-3%);
}

.frame-drift-right {
    transform: translateX(3%);
}

/* ============================================
   Zoom Focus Pattern
   ============================================ */
.zoom-focus {
    opacity: 0.3;
    transform: scale(0.92);
    filter: blur(2px);
    transition: opacity 0.8s ease, transform 0.8s ease, filter 0.8s ease;
}

.zoom-focus.is-focused {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* Preserve intentional drift transforms when focused */
.frame-drift-left.zoom-focus.is-focused {
    transform: scale(1) translateX(-3%);
}

.frame-drift-right.zoom-focus.is-focused {
    transform: scale(1) translateX(3%);
}

.text-drift-left.zoom-focus.is-focused {
    transform: scale(1) translateX(-5%);
}

.text-drift-right.zoom-focus.is-focused {
    transform: scale(1) translateX(5%);
}

/* ============================================
   Typography Styles
   ============================================ */
.section-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 1px 1px 0 var(--accent-teal);
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: 'Lora', Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.75;
    color: var(--text-primary);
    max-width: 38em;
    margin-bottom: 1.2rem;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* ============================================
   Marginalia
   ============================================ */
.marginalia {
    position: absolute;
    width: 7vw;
    min-width: 100px;
    max-width: 160px;
    font-family: 'EB Garamond', Georgia, serif;
    font-style: italic;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    opacity: 0.7;
    z-index: 5;
}

.marginalia-right {
    right: 1vw;
}

.marginalia-left {
    left: 1vw;
}

/* ============================================
   Section: Middle (Nautilus)
   ============================================ */
.section-middle {
    background-color: var(--section-bg);
    position: relative;
    padding-top: 8rem;
    padding-bottom: 8rem;
}

.engraving-nautilus {
    position: absolute;
    right: 5%;
    top: 10%;
    width: 55%;
    max-width: 600px;
    z-index: 1;
    opacity: 0.7;
}

.engraving-svg {
    width: 100%;
    height: auto;
    mix-blend-mode: screen;
}

.middle-text-block {
    position: relative;
    z-index: 2;
    max-width: 38em;
    padding: clamp(1.5rem, 3vw, 3rem);
    margin: clamp(2rem, 5vw, 5rem) 0;
}

.text-drift-left {
    transform: translateX(-5%);
}

.text-drift-right {
    transform: translateX(5%);
    margin-left: auto;
}

/* ============================================
   Section: Deep (Instruments)
   ============================================ */
.section-deep {
    background: linear-gradient(to bottom, var(--section-bg), var(--deep-bg));
    padding-top: 6rem;
    padding-bottom: 6rem;
}

.instrument-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(2rem, 4vw, 4rem);
    align-items: center;
    margin: clamp(3rem, 6vw, 6rem) auto;
    max-width: 900px;
    grid-column: content-start / content-end;
}

.instrument-group-alt {
    direction: rtl;
}

.instrument-group-alt > * {
    direction: ltr;
}

.engraving-instrument {
    max-width: 280px;
    justify-self: center;
}

.instrument-svg {
    mix-blend-mode: screen;
    opacity: 0.85;
}

.frame-instrument {
    margin: 0;
}

/* ============================================
   Section: Floor (Anglerfish)
   ============================================ */
.section-floor {
    background-color: var(--deep-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8rem 2rem;
    text-align: center;
}

.engraving-anglerfish {
    max-width: 500px;
    width: 80%;
    margin: 0 auto 3rem;
}

.anglerfish-svg {
    mix-blend-mode: screen;
}

/* Anglerfish lure glow animation */
.lure-glow {
    animation: lureGlow 3s ease-in-out infinite;
}

.lure-glow-inner {
    animation: lureGlowInner 3s ease-in-out infinite;
}

@keyframes lureGlow {
    0%, 100% { opacity: 0.6; filter: drop-shadow(0 0 4px var(--highlight)); }
    50% { opacity: 1; filter: drop-shadow(0 0 12px var(--highlight)); }
}

@keyframes lureGlowInner {
    0%, 100% { fill-opacity: 0.1; }
    50% { fill-opacity: 0.35; }
}

.floor-text {
    margin-bottom: 3rem;
}

.floor-heading {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 1px 1px 0 var(--accent-teal), 0 0 30px rgba(45, 212, 168, 0.15);
}

.ornamental-rule-final {
    max-width: 400px;
    margin: 0 auto;
    opacity: 0.6;
}

/* ============================================
   Media Queries
   ============================================ */
@media (max-width: 768px) {
    .section {
        grid-template-columns: [margin-left] 4vw [content-start] 1fr [content-end] 4vw [margin-right];
    }

    .marginalia {
        position: relative;
        width: 90%;
        max-width: 90%;
        left: auto !important;
        right: auto !important;
        margin: 1rem auto;
        padding: 0.8rem;
        border-left: 1px solid var(--ornament);
        opacity: 0.6;
    }

    .instrument-group {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .engraving-nautilus {
        position: relative;
        right: auto;
        top: auto;
        width: 80%;
        margin: 0 auto 2rem;
        opacity: 0.5;
    }

    .depth-indicator {
        display: none;
    }

    .frame-drift-left,
    .frame-drift-right,
    .frame-drift-left.zoom-focus.is-focused,
    .frame-drift-right.zoom-focus.is-focused {
        transform: none !important;
    }

    .text-drift-left,
    .text-drift-right,
    .text-drift-left.zoom-focus.is-focused,
    .text-drift-right.zoom-focus.is-focused {
        transform: none !important;
    }
}

@media (max-width: 480px) {
    .site-title {
        letter-spacing: 0.06em;
    }

    .ornate-frame {
        padding: 1.5rem;
    }
}
