/* ===== SHARED DARK THEME ===== */
:root {
    --bg: #0f0d0b;
    --bg-raised: #171412;
    --bg-card: #1c1915;
    --bg-card-hover: #242018;
    --text: #cfc6b8;
    --text-bright: #ede6db;
    --text-muted: #7a7168;
    --text-dim: #3e3830;
    --accent: #c45a3c;
    --accent-soft: #d4785f;
    --line: #272320;
    --line-strong: #3a342e;
}

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

html { color-scheme: dark; }

body {
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.06;
    background-image:
        repeating-linear-gradient(0deg, rgba(200,180,160,0.07) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(200,180,160,0.05) 0 1px, transparent 1px 4px);
}

a { color: inherit; }

img { display: block; max-width: 100%; }

/* ===== HOMEPAGE ===== */

.homepage {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: clamp(32px, 5vw, 64px) clamp(20px, 4vw, 48px);
}

.hero {
    max-width: 960px;
    width: 100%;
    margin: 0 auto clamp(32px, 5vw, 56px);
    animation: fadeIn 0.8s ease both;
}

.hero__name {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(2.6rem, 7vw, 4.8rem);
    font-weight: 700;
    line-height: 0.92;
    letter-spacing: -0.03em;
    color: var(--text-bright);
}

.hero__location {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 12px;
}

/* ===== DOORWAYS GRID ===== */

.doorways {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    grid-template-rows: 300px 240px;
    gap: clamp(10px, 1.5vw, 18px);
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    animation: fadeSlide 0.7s ease 0.15s both;
}

.door {
    position: relative;
    display: flex;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--bg-card);
    text-decoration: none;
    transition: border-color 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.door:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.door:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Theater — large, top-left */
.door--theater {
    grid-column: 1;
    grid-row: 1;
}

.door--theater .door__media {
    position: absolute;
    inset: 0;
}

.door--theater .door__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.55;
    transition: opacity 0.5s ease, transform 0.5s ease;
    filter: grayscale(0.3);
}

.door--theater:hover .door__media img {
    opacity: 0.75;
    transform: scale(1.03);
    filter: grayscale(0);
}

.door--theater .door__content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(16px, 3vw, 28px);
    width: 100%;
    background: linear-gradient(to top, rgba(15,13,11,0.85) 0%, transparent 60%);
}

.door--theater .door__quote {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 0.92rem;
    font-style: italic;
    line-height: 1.5;
    color: var(--text);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease 0.1s, transform 0.4s ease 0.1s;
    margin-bottom: 14px;
    max-width: 48ch;
}

.door--theater:hover .door__quote {
    opacity: 1;
    transform: translateY(0);
}

/* Writing — top-right, text-based */
.door--writing {
    grid-column: 2;
    grid-row: 1;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(20px, 3vw, 32px);
}

.door__excerpt {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.15rem, 1.6vw, 1.4rem);
    line-height: 1.45;
    color: var(--text-muted);
    transition: color 0.4s ease;
}

.door--writing:hover .door__excerpt {
    color: var(--text);
}

/* Music — bottom-left, waveform */
.door--music {
    grid-column: 1;
    grid-row: 2;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
}

.waveform {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 3px;
    height: 64px;
}

.waveform span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: var(--text-dim);
    transform-origin: bottom;
    animation: wave 2s ease-in-out infinite;
    transition: background 0.4s ease;
}

.door--music:hover .waveform span {
    background: var(--accent);
    animation-duration: 1s;
}

.waveform span:nth-child(1)  { height: 16px; animation-delay: 0.00s; }
.waveform span:nth-child(2)  { height: 28px; animation-delay: 0.08s; }
.waveform span:nth-child(3)  { height: 40px; animation-delay: 0.16s; }
.waveform span:nth-child(4)  { height: 22px; animation-delay: 0.24s; }
.waveform span:nth-child(5)  { height: 50px; animation-delay: 0.32s; }
.waveform span:nth-child(6)  { height: 34px; animation-delay: 0.40s; }
.waveform span:nth-child(7)  { height: 56px; animation-delay: 0.48s; }
.waveform span:nth-child(8)  { height: 30px; animation-delay: 0.56s; }
.waveform span:nth-child(9)  { height: 44px; animation-delay: 0.64s; }
.waveform span:nth-child(10) { height: 20px; animation-delay: 0.72s; }
.waveform span:nth-child(11) { height: 52px; animation-delay: 0.80s; }
.waveform span:nth-child(12) { height: 36px; animation-delay: 0.88s; }
.waveform span:nth-child(13) { height: 26px; animation-delay: 0.96s; }
.waveform span:nth-child(14) { height: 48px; animation-delay: 1.04s; }
.waveform span:nth-child(15) { height: 18px; animation-delay: 1.12s; }
.waveform span:nth-child(16) { height: 38px; animation-delay: 1.20s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.25); }
    50% { transform: scaleY(1); }
}

/* Experiments — bottom-right, glitch */
.door--experiments {
    grid-column: 2;
    grid-row: 2;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    background:
        radial-gradient(ellipse at 30% 70%, rgba(196,90,60,0.08), transparent 60%),
        var(--bg-card);
}

.door__glitch {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    font-weight: 500;
    color: var(--text-muted);
    position: relative;
    transition: color 0.3s ease;
}

.door--experiments:hover .door__glitch {
    color: var(--text-bright);
}

.door__glitch::before,
.door__glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.door--experiments:hover .door__glitch::before {
    opacity: 1;
    animation: glitch-top 0.4s steps(2) infinite;
    color: var(--accent);
    clip-path: inset(0 0 55% 0);
}

.door--experiments:hover .door__glitch::after {
    opacity: 1;
    animation: glitch-bottom 0.4s steps(3) infinite;
    color: var(--accent-soft);
    clip-path: inset(50% 0 0 0);
}

@keyframes glitch-top {
    0% { transform: translate(0); }
    25% { transform: translate(-2px, -1px); }
    50% { transform: translate(2px, 1px); }
    75% { transform: translate(-1px, 2px); }
    100% { transform: translate(0); }
}

@keyframes glitch-bottom {
    0% { transform: translate(0); }
    33% { transform: translate(2px, -1px); }
    66% { transform: translate(-2px, 1px); }
    100% { transform: translate(0); }
}

/* Visual — fifth doorway, below grid */
.door--visual {
    max-width: 960px;
    width: 100%;
    margin: clamp(10px, 1.5vw, 18px) auto 0;
    height: 140px;
    justify-content: center;
    align-items: center;
    background:
        repeating-linear-gradient(45deg, transparent, transparent 8px, rgba(200,180,160,0.02) 8px, rgba(200,180,160,0.02) 9px),
        var(--bg-card);
    animation: fadeSlide 0.7s ease 0.3s both;
}

/* Doorway labels */
.door__label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-dim);
    transition: color 0.35s ease;
}

.door:hover .door__label {
    color: var(--accent);
}

/* ===== HOMEPAGE FOOTER ===== */

.homepage-footer {
    max-width: 960px;
    width: 100%;
    margin: auto auto 0;
    padding-top: clamp(48px, 8vw, 96px);
    animation: fadeIn 0.7s ease 0.4s both;
}

.about {
    border-top: 1px solid var(--line);
    padding-top: 28px;
}

.about__text {
    font-size: clamp(0.92rem, 1.1vw, 1rem);
    color: var(--text-muted);
    max-width: 60ch;
    line-height: 1.75;
}

.about__links {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.about__links a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text-muted);
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.about__links a:hover {
    background: var(--accent);
    color: var(--text-bright);
    border-color: var(--accent);
}

.counter {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 28px;
    padding-bottom: 20px;
}

.counter-display {
    font-weight: 500;
    color: var(--text-muted);
}

/* ===== ROOM NAVIGATION ===== */

.room-nav {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2.5vw, 24px);
    padding: 18px clamp(20px, 4vw, 48px);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--line);
}

.room-nav__home {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    text-decoration: none;
    margin-right: clamp(8px, 2vw, 20px);
    transition: color 0.2s ease;
}

.room-nav__home:hover { color: var(--text-bright); }

.room-nav__link {
    color: var(--text-dim);
    text-decoration: none;
    text-transform: uppercase;
    padding: 6px 0;
    transition: color 0.2s ease;
}

.room-nav__link:hover { color: var(--text-muted); }
.room-nav__link--active { color: var(--accent); }

/* ===== ROOM PAGE ===== */

.room {
    max-width: 960px;
    margin: 0 auto;
    padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 48px) 48px;
    animation: fadeSlide 0.5s ease both;
}

.room__header {
    margin-bottom: clamp(28px, 5vw, 48px);
}

.room__title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(2.2rem, 6vw, 3.6rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.02em;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.room__subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 55ch;
}

/* ===== ROOM ENTRIES ===== */

.year-group { margin-bottom: 32px; }

.year-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.entry {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    background: var(--bg-card);
    margin-bottom: 12px;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.entry:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.entry--featured {
    grid-template-columns: 200px 1fr;
}

.entry__image {
    width: 100%;
    height: 130px;
    overflow: hidden;
    border: 1px solid var(--line);
}

.entry__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.entry__title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.15rem, 1.3vw, 1.35rem);
    font-weight: 500;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 6px;
}

.entry__title a {
    color: var(--text-bright);
    text-decoration: none;
    transition: color 0.2s ease;
}

.entry__title a:hover { color: var(--accent); }
.entry__title span { color: var(--text-bright); }

.entry__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.entry__tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.66rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 8px;
    background: rgba(255,255,255,0.02);
}

.entry__description {
    font-size: clamp(0.9rem, 0.2vw + 0.88rem, 0.98rem);
    line-height: 1.65;
    color: var(--text-muted);
    max-width: 65ch;
}

.entry__quote {
    font-family: 'Newsreader', Georgia, serif;
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-muted);
    border-left: 2px solid var(--accent);
    padding-left: 14px;
    margin-top: 8px;
}

/* Writing room — larger cards */
.writing-card {
    padding: clamp(24px, 4vw, 36px);
    border: 1px solid var(--line);
    background: var(--bg-card);
    margin-bottom: 16px;
    transition: border-color 0.25s ease, transform 0.25s ease;
}

.writing-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.3);
}

.writing-card__title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.4rem, 2vw, 1.8rem);
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 12px;
}

.writing-card__title a {
    color: var(--text-bright);
    text-decoration: none;
    transition: color 0.2s ease;
}

.writing-card__title a:hover { color: var(--accent); }

.writing-card__excerpt {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-muted);
    max-width: 60ch;
}

.writing-card__year {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-top: 14px;
}

/* Music room */
.music-feature {
    padding: clamp(24px, 4vw, 36px);
    border: 1px solid var(--line);
    background: var(--bg-card);
    margin-bottom: 20px;
}

.music-feature__title {
    font-family: 'Newsreader', Georgia, serif;
    font-size: clamp(1.3rem, 1.8vw, 1.6rem);
    font-weight: 500;
    color: var(--text-bright);
    margin-bottom: 10px;
}

.music-feature__description {
    font-size: 0.95rem;
    color: var(--text-muted);
    max-width: 60ch;
    margin-bottom: 16px;
}

.music-feature__link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.74rem;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: 8px 16px;
    display: inline-flex;
    transition: background 0.2s ease, color 0.2s ease;
}

.music-feature__link:hover {
    background: var(--accent);
    color: var(--text-bright);
}

/* Placeholder room */
.room-placeholder {
    text-align: center;
    padding: clamp(48px, 10vw, 120px) 20px;
}

.room-placeholder__text {
    font-family: 'Newsreader', Georgia, serif;
    font-size: 1.2rem;
    font-style: italic;
    color: var(--text-dim);
}

/* Room footer */
.room-footer {
    border-top: 1px solid var(--line);
    margin-top: 48px;
    padding: 20px clamp(20px, 4vw, 48px);
}

.room-footer .counter {
    margin-top: 0;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeSlide {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@media (max-width: 740px) {
    .doorways {
        grid-template-columns: 1fr;
        grid-template-rows: 260px 220px 200px 180px;
    }

    .door--theater { grid-column: 1; grid-row: 1; }
    .door--writing { grid-column: 1; grid-row: 2; }
    .door--music   { grid-column: 1; grid-row: 3; }
    .door--experiments { grid-column: 1; grid-row: 4; }

    .door--visual { height: 120px; }

    .room-nav {
        flex-wrap: wrap;
        gap: 8px 16px;
        padding: 14px 16px;
    }

    .entry--featured {
        grid-template-columns: 1fr;
    }

    .entry__image { height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .door:hover { transform: none; }
    .entry:hover { transform: none; }
}
