/* Palette: #0e0e14 #1a1a24 #2a2a35 #3a3a4a #4a4a5a #6a6a7a #b0b0be #c0b283 #c8c8d4 #e85d4a #e8d5a3 */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: #0e0e14;
    color: #c8c8d4;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.2vw, 1.05rem);
    letter-spacing: 0.01em;
    line-height: 1.75;
    overflow-x: hidden;
    /* Scanline texture */
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(200, 200, 212, 0.03) 2px,
        rgba(200, 200, 212, 0.03) 4px
    );
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    letter-spacing: 0.05em;
    line-height: 1.65;
}

.gold {
    color: #c0b283;
}

/* === CRT VIGNETTE === */
#crt-vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    box-shadow: inset 0 0 120px 40px rgba(14, 14, 20, 0.8);
}

/* === HERO === */
#hero {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

#hero-frame {
    position: relative;
    border: 1px solid #4a4a5a;
    padding: clamp(2rem, 5vw, 5rem);
    margin: 3vw;
    width: calc(100% - 6vw);
    height: calc(100% - 6vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#crt-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, #2a2a35 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: width 1.5s ease-out, height 1.5s ease-out, opacity 0.5s ease;
    pointer-events: none;
}

#crt-glow.active {
    width: 150%;
    height: 150%;
    opacity: 1;
}

#hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.04em;
    line-height: 1.1;
    color: #c8c8d4;
    text-align: center;
    min-height: 1.2em;
}

#hero-subtitle {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    letter-spacing: 0.05em;
    line-height: 1.65;
    color: #6a6a7a;
    margin-top: 1.5rem;
    text-align: center;
    min-height: 1.65em;
}

/* Cursor */
.cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background-color: #c0b283;
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 1.06s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.cursor.fade-out {
    animation: none;
    opacity: 0;
    transition: opacity 800ms ease;
}

/* === BENTO GRID === */
#bento {
    padding: 0 3vw;
    margin-bottom: 4rem;
}

.bento-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: auto;
    gap: 2px;
    background-color: #3a3a4a;
}

.bento-cell {
    background-color: #1a1a24;
    padding: clamp(1rem, 2vw, 2rem);
    position: relative;
    overflow: hidden;
    transition: border-color 300ms ease;
}

/* Cell grid placements */
.cell-feature {
    grid-column: 1 / 4;
    grid-row: 1 / 3;
    min-height: 280px;
    display: flex;
    align-items: flex-end;
}

.cell-feature .cell-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a24 0%, #2a2a35 50%, #1a1a24 100%);
    filter: grayscale(85%) contrast(1.1) brightness(0.7);
    opacity: 0.35;
}

.cell-feature .cell-content {
    position: relative;
    z-index: 1;
}

.cell-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.02em;
    line-height: 1.1;
    color: #c8c8d4;
    margin-bottom: 1rem;
}

.cell-text {
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #b0b0be;
}

/* Data cells */
.cell-data {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 140px;
}

.cell-data:nth-child(2) { grid-column: 4 / 5; grid-row: 1 / 2; }
.cell-data:nth-child(3) { grid-column: 5 / 6; grid-row: 1 / 2; }
.cell-compass { grid-column: 6 / 7; grid-row: 1 / 2; }

.data-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #6a6a7a;
    margin-bottom: 0.5rem;
}

.data-value {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.3vw, 1.15rem);
    color: #c8c8d4;
    margin-bottom: 0.4rem;
}

.data-value.alert {
    color: #e85d4a;
}

.gold:hover {
    color: #e8d5a3;
}

.data-note {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    color: #4a4a5a;
    letter-spacing: 0.05em;
}

/* Narrative cells */
.cell-narrative {
    display: flex;
    align-items: center;
}

.cell-narrative:nth-of-type(2) { grid-column: 4 / 7; grid-row: 2 / 3; }

.cell-narrative .typewriter-target {
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #c8c8d4;
}

/* Visual cell */
.cell-visual {
    grid-column: 1 / 3;
    grid-row: 3 / 5;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

#monopole-field {
    animation: fieldPulse 4s ease-in-out infinite;
}

@keyframes fieldPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Remaining data cells - row 3 */
.bento-cell:nth-child(8) { grid-column: 3 / 4; grid-row: 3 / 4; }
.bento-cell:nth-child(9) { grid-column: 4 / 5; grid-row: 3 / 4; }
.bento-cell:nth-child(10) { grid-column: 5 / 7; grid-row: 3 / 4; }

/* Bottom narrative */
.bento-cell:nth-child(11) { grid-column: 3 / 7; grid-row: 4 / 5; }

/* Compass */
#compass-svg {
    margin-bottom: 0.3rem;
}

#compass-needle {
    transform-origin: 30px 30px;
    animation: compassSpin 60s linear infinite;
}

@keyframes compassSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* === RESEARCH LOG === */
#research-log {
    padding: clamp(3rem, 8vw, 8rem) clamp(2rem, 15vw, 20rem);
}

.log-container {
    max-width: 700px;
    margin: 0 auto;
}

.log-entry {
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #b0b0be;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 600ms ease-out, transform 600ms ease-out;
}

.log-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === TERMINUS === */
#terminus {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminus-text {
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    color: #6a6a7a;
}

/* === GRID PULSE (scroll-triggered) === */
.bento-grid.pulse {
    background-color: #c0b283;
    transition: background-color 300ms ease;
}

.bento-grid.pulse-off {
    background-color: #3a3a4a;
    transition: background-color 300ms ease;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .cell-feature,
    .cell-narrative:nth-of-type(2),
    .cell-visual,
    .bento-cell:nth-child(8),
    .bento-cell:nth-child(9),
    .bento-cell:nth-child(10),
    .bento-cell:nth-child(11) {
        grid-column: 1 / -1;
        grid-row: auto;
    }
    .cell-data:nth-child(2) { grid-column: 1 / 2; grid-row: auto; }
    .cell-data:nth-child(3) { grid-column: 2 / 3; grid-row: auto; }
    .cell-compass { grid-column: 1 / -1; grid-row: auto; }
}

@media (max-width: 480px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    .cell-data:nth-child(2),
    .cell-data:nth-child(3),
    .cell-compass {
        grid-column: 1 / -1;
    }
}

/* Field line SVG animation */
.field-line {
    stroke: #c0b283;
    stroke-width: 0.5;
    fill: none;
    stroke-dasharray: 150;
    animation: flowOutward 3s linear infinite;
}

@keyframes flowOutward {
    from { stroke-dashoffset: 150; }
    to { stroke-dashoffset: 0; }
}
