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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.05), transparent 40%),
    radial-gradient(circle at 80% 85%, rgba(0,0,0,0.25), transparent 45%),
    repeating-linear-gradient(97deg, rgba(35,18,4,0.18) 0px, rgba(35,18,4,0.18) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(93deg, rgba(255,225,170,0.06) 0px, rgba(255,225,170,0.06) 1px, transparent 1px, transparent 11px),
    repeating-linear-gradient(100deg, rgba(20,10,2,0.12) 0px, rgba(20,10,2,0.12) 2px, transparent 2px, transparent 23px),
    linear-gradient(135deg, #8f5c30 0%, #6b4322 30%, #7c4e28 55%, #55300f 100%);
    background-color: #6b4322;
}

/* ===== PROJECT GALLERY LIGHTBOX ===== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(6, 6, 6, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
}
.lightbox.visible { display: flex; }

.lightbox-image {
    max-width: 88vw;
    max-height: 84vh;
    object-fit: contain; /* full image, never cropped */
    border-radius: 4px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.8;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s ease;
}
.lightbox-arrow:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ccc;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
}

/* ===== INTRO MODAL ===== */
.intro-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(10, 10, 10, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.intro-modal.hidden { display: none; }

.intro-modal-box {
    background: #f5f4f0;
    border-radius: 10px;
    padding: 2rem;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.intro-modal-note {
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #b23b2e;
    margin-bottom: 0.9rem;
}
.intro-modal-text {
    font-size: 1rem;
    color: #33312c;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.intro-modal-text strong { color: #b23b2e; }

#intro-modal-ok {
background: #b23b2e;
color: #fff;
border: none;
padding: 0.7rem 2.2rem;
border-radius: 6px;
font-family: 'Space Grotesk', sans-serif;
font-weight: 700;
font-size: 0.95rem;
cursor: pointer;
transition: background 0.2s ease;
}
#intro-modal-ok:hover { background: #8f2e23; }

/* ===== RADIO UNIT ===== */
.radio-unit {
    position: fixed;
    inset: clamp(14px, 3vw, 34px);
    background: linear-gradient(180deg, #2b2b2d 0%, #1a1a1b 100%);
    border-radius: 10px;
    box-shadow:
    inset 0 0 0 2px rgba(255,255,255,0.04),
    inset 0 2px 6px rgba(0,0,0,0.6),
    0 10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ===== SCREEN ===== */
.screen {
    position: relative;
    flex: 1;
    background: #f5f4f0;
    margin: 14px 14px 0;
    border-radius: 4px;
    overflow: hidden;
}

/* Drawn as a dedicated top layer instead of relying on box-shadow paint order —
 *  a card that lifts on hover (or any content near the edge) would otherwise
 *  render on top of a box-shadow border, since box-shadow belongs to the
 *  parent's own paint step and children always paint above it. */
.screen::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    box-shadow: inset 0 0 0 6px #101010, inset 0 0 10px rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 50;
}

.station-panels { position: relative; width: 100%; height: 100%; overflow: hidden; }

.station {
    position: absolute;
    inset: 0;
    padding: clamp(1.5rem, 6vh, 7rem) clamp(1.2rem, 4vw, 5rem) clamp(1.2rem, 4vh, 5rem);
    color: #262626;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.station.active { opacity: 1; pointer-events: auto; transform: translateY(0); }

.station::-webkit-scrollbar { width: 6px; }
.station::-webkit-scrollbar-track { background: transparent; }
.station::-webkit-scrollbar-thumb { background: #d8d5cc; border-radius: 3px; }
.station { scrollbar-width: thin; scrollbar-color: #d8d5cc transparent; }

.station p { color: #55534d; }
.station p a { color: #b23b2e; text-decoration: underline; text-decoration-color: rgba(178,59,46,0.4); }
.station p a:hover { text-decoration-color: #b23b2e; }

.station h1 {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, min(7vw, 10vh), 6.5rem);
    letter-spacing: 0.01em;
    line-height: 0.95;
    margin-bottom: 1rem;
    color: #17130f;
}

.station-eyebrow {
    font-family: 'Space Mono', monospace;
    font-size: clamp(0.9rem, 0.9vw, 1.3rem);
    color: #8a6a4f;
    margin-bottom: 0.7rem;
}

.station-tag {
    display: block;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #b23b2e;
    margin-bottom: 1.3rem;
    font-weight: 700;
}

.station-body { font-size: clamp(1.05rem, 0.7vw + 0.7rem, 1.7rem); max-width: 620px; }

.placeholder-box { background: #eae8e2; border: 1px dashed #c8c5bc; border-radius: 8px; display: flex; align-items: center; justify-content: center; min-height: 200px; }
.placeholder-label { color: #999; font-size: 0.8rem; font-family: 'Space Mono', monospace; }

/* ===== IMAGES =====
 *  Shared rule: every real <img> you drop in gets sized responsively (percentage-based,
 *  not fixed pixels) so it can never overflow its column on a narrow screen. Shape/crop
 *  is controlled by the modifier class (.home-photo, .about-photo), sizing itself is
 *  controlled here so it stays consistent everywhere. Project/hobby images use the
 *  .image-slot wrapper instead (see below) so a missing file still shows a clean box. */
.home-layout img,
.about-layout img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.about-layout { display: grid; grid-template-columns: 260px 1fr; gap: 2.5rem; align-items: center; }
.about-photo { max-width: min(420px, 32vw); max-height: 50vh; aspect-ratio: 3 / 4; border-radius: 4px; }

.home-layout { display: grid; grid-template-columns: 200px 1fr; gap: 2.5rem; align-items: center; }
.home-photo { max-width: min(280px, 22vw); max-height: 40vh; aspect-ratio: 1 / 1; border-radius: 50%; }

.timeline-item { border-left: 2px solid #b23b2e; padding-left: 1.6rem; margin-bottom: 2.2rem; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: -1px; top: 0; width: 9px; height: 9px; border-radius: 50%; background: #b23b2e; transform: translate(-50%, -50%); }
.timeline-date { font-family: 'Space Mono', monospace; font-size: clamp(0.8rem, 0.5vw + 0.6rem, 1.05rem); color: #93877a; }
.timeline-item h3 { margin: 0.3rem 0; font-size: clamp(1.1rem, 0.7vw + 0.7rem, 1.6rem); color: #17130f; font-weight: 700; }

/* ===== SKILLS (with icon slots) =====
 *  Fully fluid: auto-fit decides how many columns fit based on real width,
 *  auto-rows splits whatever's left vertically into equal shares. No fixed
 *  counts anywhere — this adapts to any window shape. A max-width keeps
 *  columns from stretching absurdly wide on huge monitors (which is what
 *  forces sensible wrapping into more rows instead of staying single-row). */
.skills-grid {
    flex: 1;
    min-height: 0; /* without this, flex items refuse to shrink below their content's natural size, which is what was pushing content past the screen's edge */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.8rem);
    margin-top: clamp(1rem, 3vh, 2rem);
    width: 100%; /* no overall width cap — always fills available space, more columns appear as it grows */
}
.skill {
    height: 100%;
    overflow: hidden;
    background: #eae8e2;
    border: 1px solid #d8d5cc;
    text-align: center;
    border-radius: 8px;
    transition: border-color 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1rem;
}
.skill:hover { border-color: #b23b2e; transform: translateY(-3px); }
.skill-icon {
    width: clamp(40px, 4vw, 68px);
    height: clamp(40px, 4vw, 68px);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.5rem;
    color: #aaa;
    font-family: 'Space Mono', monospace;
    overflow: hidden;
}
.skill-icon img { width: 100%; height: 100%; object-fit: contain; }
.skill-name { font-size: clamp(0.9rem, 0.4vw + 0.65rem, 1.2rem); color: #33312c; font-weight: 500; }

/* Reserved, styled box for every image slot — if the file hasn't been added yet
 *  (or fails to load), you get a clean placeholder-shaped box instead of raw
 *  broken-image text with no boundary. */
.image-slot {
    position: relative;
    flex: 0 0 auto;
    max-height: 38%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #dedbd2;
    border: 1px dashed #c8c5bc;
    border-radius: 6px;
    margin-bottom: 0.7rem;
}
.image-slot img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Only project image slots are galleries (they have data-project) — hobby
 *  image slots stay plain, non-clickable. */
.image-slot[data-project] {
    cursor: pointer;
}
.gallery-hint {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(20, 18, 14, 0.72);
    color: #fff;
    font-family: 'Space Mono', monospace;
    font-size: 0.65rem;
    padding: 3px 7px;
    border-radius: 4px;
    opacity: 0.85;
    transition: opacity 0.2s ease, transform 0.2s ease;
    pointer-events: none;
}
.image-slot[data-project]:hover .gallery-hint {
    opacity: 1;
    transform: translateY(-2px);
}

.projects-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.8rem);
    margin-top: clamp(1rem, 3vh, 2rem);
    width: 100%;
}
.project-card {
    height: 100%;
    overflow-y: auto;
    background: #eae8e2;
    border: 1px solid #d8d5cc;
    border-radius: 8px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.project-card:hover { border-color: #b23b2e; transform: translateY(-3px); }
.project-card h3 { font-size: clamp(1.05rem, 0.4vw + 0.7rem, 1.35rem); margin-bottom: 0.3rem; color: #17130f; font-weight: 700; }
.project-card p { font-size: clamp(0.9rem, 0.25vw + 0.65rem, 1.05rem); }

.hobbies-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: minmax(0, 1fr);
    gap: clamp(1rem, 2vw, 1.8rem);
    margin-top: clamp(1rem, 3vh, 2rem);
    width: 100%;
}
.hobby {
    height: 100%;
    overflow-y: auto;
    background: #eae8e2;
    border: 1px solid #d8d5cc;
    border-radius: 8px;
    padding: 1.1rem;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.hobby:hover { border-color: #b23b2e; transform: translateY(-3px); }
.hobby h3 { font-size: clamp(1.05rem, 0.4vw + 0.7rem, 1.35rem); margin-bottom: 0.3rem; color: #17130f; font-weight: 700; }
.hobby p { font-size: clamp(0.9rem, 0.25vw + 0.65rem, 1.05rem); }
.hobby-links { display: flex; gap: 1.2rem; margin-top: 0.6rem; }
.hobby-links a {
    font-size: 0.85rem;
    color: #b23b2e;
    border-bottom: 1px solid #b23b2e;
    padding-bottom: 1px;
    text-decoration: none;
}
.hobby-links a:hover { color: #17130f; border-color: #17130f; }

/* ===== CONTACT ===== */
.contact-links { list-style: none; display: flex; gap: 2rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.contact-links a {
    color: #17130f; font-size: 1.1rem; font-weight: 500;
    border-bottom: 1px solid #b23b2e; padding-bottom: 2px; text-decoration: none;
}
.contact-links a:hover { color: #b23b2e; }
.contact-note {
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: #93877a;
    max-width: 480px;
}

.numbers-station { display: flex; align-items: center; justify-content: center; background: #0c0c0c; }
.numbers-word { font-family: 'Space Mono', monospace; font-size: 2rem; letter-spacing: 0.15em; color: #b23b2e; text-transform: uppercase; }

/* ===== NO SIGNAL ===== */
.no-signal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; background: #f5f4f0; opacity: 0; pointer-events: none; transition: opacity 0.25s ease; }
.no-signal.visible { opacity: 1; pointer-events: auto; }
.no-signal p { font-family: 'Space Mono', monospace; font-size: 0.85rem; letter-spacing: 0.15em; color: #999; }
.eq-bars { display: flex; gap: 5px; align-items: flex-end; height: 40px; }
.eq-bars span { width: 6px; background: #b23b2e; border-radius: 2px; animation: eq 0.9s ease-in-out infinite; }
.eq-bars span:nth-child(1) { animation-delay: 0s; }
.eq-bars span:nth-child(2) { animation-delay: 0.15s; }
.eq-bars span:nth-child(3) { animation-delay: 0.3s; }
.eq-bars span:nth-child(4) { animation-delay: 0.45s; }
.eq-bars span:nth-child(5) { animation-delay: 0.6s; }
@keyframes eq { 0%, 100% { height: 8px; } 50% { height: 36px; } }

/* ===== TUNER PANEL ===== */
.tuner-panel { padding: 14px; display: flex; flex-direction: column; gap: 16px; }

.scale-window {
    position: relative;
    height: 70px;
    background: #0c0c0d;
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.7);
    overflow: hidden;
}

.scale-labels { position: absolute; top: 8px; left: 0; right: 0; height: 34px; }
.scale-label-item {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
    white-space: nowrap;
}
.label-tag {
    font-family: 'Space Mono', monospace;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #8a8a8a;
}
.label-freq {
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    color: #e2ded4;
}

.scale-ticks { position: absolute; left: 0; right: 0; bottom: 8px; height: 22px; }
.tick-major { position: absolute; bottom: 0; width: 2px; height: 100%; background: #b23b2e; border-radius: 1px; transform: translateX(-50%); }
.tick-minor { position: absolute; bottom: 0; width: 1px; height: 45%; background: #4a4a4a; transform: translateX(-50%); }

.scale-glass { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0) 40%); pointer-events: none; }

.needle {
    position: absolute;
    top: 2px; bottom: 2px;
    width: 2px;
    background: #e6392c;
    box-shadow: 0 0 6px rgba(230,57,44,0.8);
    pointer-events: none;
    left: 0;
    transition: left 0.03s linear, opacity 0.15s ease;
}
.needle.hidden { opacity: 0; }

.control-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

/* ===== ROTARY KNOBS ===== */
.knob-group { display: flex; flex-direction: column; align-items: center; gap: 6px; }

.knob {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4a4a4c, #1c1c1d 70%);
    box-shadow:
    0 3px 0 rgba(0,0,0,0.5),
    inset 0 1px 2px rgba(255,255,255,0.15),
    inset 0 -2px 4px rgba(0,0,0,0.6);
    position: relative;
    cursor: ns-resize;
    touch-action: none;
    user-select: none;
}
.knob.knob-horizontal { cursor: ew-resize; }

.knob-indicator {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 3px;
    height: 16px;
    background: #e6392c;
    border-radius: 2px;
    transform-origin: 50% 22px;
    transform: translateX(-50%) rotate(-130deg);
    box-shadow: 0 0 4px rgba(230,57,44,0.6);
}

.knob-label { font-family: 'Space Mono', monospace; font-size: 0.65rem; letter-spacing: 0.1em; color: #777; }

/* ===== FREQUENCY READOUT ===== */
.readout-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.readout-section { font-family: 'Space Mono', monospace; font-size: 0.6rem; letter-spacing: 0.15em; color: #777; }

.readout {
    display: flex;
    align-items: baseline;
    gap: 4px;
    background: #0c0c0d;
    padding: 8px 14px;
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.7);
}
.readout input {
    background: transparent;
    border: none;
    outline: none;
    color: #e6392c;
    font-family: 'Big Shoulders Display', sans-serif;
    font-weight: 600;
    font-size: 1.4rem;
    width: 5ch;
    text-align: right;
}
.readout small { font-family: 'Space Mono', monospace; font-size: 0.6rem; color: #883029; }

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    .station { padding: 3.5rem 1.3rem 2rem; }

    /* Both two-column layouts stack to one column and photos shrink to fit */
    .about-layout,
    .home-layout {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }
    .about-photo,
    .home-photo {
        max-width: 140px;
        margin: 0 auto;
    }
    .home-text { text-align: center; }

    .knob { width: 46px; height: 46px; }

    /* Section-name subheadings get too tight to fit above narrowly-spaced numbers
     *    on small screens — hide them here and let the LCD readout (which already
     *    shows the section name) carry that job instead. */
    .label-tag { display: none; }
    .scale-labels { top: 20px; }

    /* On a small screen there usually isn't room to fit everything without scrolling
     *    somewhere — the page itself should be what scrolls, never an individual card.
     *    Undo the fill-exact-space grid behavior (which is what desktop uses to avoid
     *    ANY scrolling) and let content size naturally instead. */
    .skills-grid,
    .projects-grid,
    .hobbies-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: auto;
    }
    .skill,
    .project-card,
    .hobby {
        height: auto;
        overflow: visible;
    }
}

@media (max-width: 420px) {
    .station h1 { font-size: clamp(2rem, 9vw, 2.8rem); }
    .readout input { font-size: 1.2rem; width: 4.2ch; }
}
