/* ========================================================
   maljosim.com - Desert Observatory Telemetry
   Terracotta-warm | Avant-garde | Zen-contemplative
   ======================================================== */

:root {
    --color-kiln-black: #1A0F0A;
    --color-fired-earth: #2C1810;
    --color-sunbaked-clay: #4A2E1F;
    --color-dark-clay: #3A2A1E;
    --color-desert-copper: #D4845A;
    --color-neon-ember: #FF6B3D;
    --color-sand-gold: #E8C88A;
    --color-pale-dune: #D4C4B0;
    --color-dust: #8A7B6A;
    --color-ember-glow: rgba(255, 107, 61, 0.15);

    --font-main: 'Commissioner', sans-serif;
    --sidebar-width: 280px;
    --ease-reveal: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

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

body {
    font-family: var(--font-main);
    background: var(--color-kiln-black);
    color: var(--color-pale-dune);
    line-height: 1.75;
    overflow-x: hidden;
}

.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
}

/* =====================
   SIDEBAR
   ===================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #2C1810 0%, #1A0F0A 100%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2.5rem 0 2rem;
    border-right: 1px solid rgba(212, 132, 90, 0.08);
}

.sidebar__logo {
    margin-bottom: 2rem;
}

.logo-glyph {
    width: 50px;
    height: 50px;
    filter: drop-shadow(0 0 6px rgba(212, 132, 90, 0.5));
}

.logo-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    animation: pathDraw 2.4s var(--ease-reveal) forwards 0.6s;
}

@keyframes pathDraw {
    to { stroke-dashoffset: 0; }
}

.sidebar__divider {
    width: 40px;
    height: 1px;
    background: rgba(212, 132, 90, 0.3);
    margin-bottom: 2rem;
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 80px;
    flex: 1;
    justify-content: center;
    align-items: center;
}

.sidebar__glyph {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--color-dust);
    text-decoration: none;
    transition: color 0.4s var(--ease-reveal);
}

.sidebar__glyph svg {
    width: 28px;
    height: 28px;
}

.sidebar__glyph:hover {
    color: var(--color-desert-copper);
}

.sidebar__glyph.active {
    color: var(--color-desert-copper);
}

.sidebar__glyph.active svg {
    filter: drop-shadow(0 0 6px rgba(212, 132, 90, 0.5));
}

/* Sidebar nav path-draw on hover */
.nav-draw-path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s var(--ease-reveal);
}

.sidebar__glyph.active .nav-draw-path,
.sidebar__glyph:hover .nav-draw-path {
    stroke-dashoffset: 0;
}

/* Status indicator dot */
.glyph-indicator {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-neon-ember);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.sidebar__glyph.active .glyph-indicator {
    opacity: 1;
    animation: indicatorPulse 3s ease-in-out infinite;
}

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

/* Coordinate readout in sidebar footer */
.sidebar__coordinates {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.coord-lat, .coord-lon {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-desert-copper);
    opacity: 0.5;
}

/* =====================
   MOBILE MENU
   ===================== */
.mobile-menu-trigger {
    display: none;
    position: fixed;
    top: 14px;
    right: 1.5rem;
    z-index: 200;
    background: none;
    border: none;
    cursor: pointer;
    width: 28px;
    height: 20px;
    flex-direction: column;
    justify-content: space-between;
}

.trigger-line {
    display: block;
    width: 100%;
    height: 1px;
    background: var(--color-desert-copper);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: var(--color-fired-earth);
    z-index: 150;
    opacity: 0;
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease-reveal), opacity 0.4s ease;
}

.mobile-nav-overlay.is-open {
    opacity: 1;
    transform: translateX(0);
}

.mobile-nav-panel {
    display: flex;
    flex-direction: column;
    padding: 5rem 2rem;
    gap: 2.5rem;
}

.mobile-nav-item {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-dust);
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-nav-item:hover {
    color: var(--color-desert-copper);
}

/* =====================
   MAIN CONTENT
   ===================== */
.content {
    margin-left: var(--sidebar-width);
}

/* =====================
   PLATES (General)
   ===================== */
.plate {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 4rem 6rem;
    overflow: hidden;
    scroll-snap-align: start;
    background: radial-gradient(ellipse at 60% 40%, #2C1810 0%, #1A0F0A 70%);
}

.plate__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plate__content {
    position: relative;
    z-index: 2;
    max-width: 480px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s var(--ease-reveal), transform 1s var(--ease-reveal);
}

.plate__content.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.plate__content--right {
    margin-left: auto;
    margin-right: 10%;
}

.plate__content--center {
    text-align: center;
    margin: 0 auto;
    max-width: 400px;
}

.plate__content--hero {
    margin-left: 15%;
}

/* =====================
   CORNER BRACKETS (HUD)
   ===================== */
.corner-bracket {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.8s var(--ease-reveal);
}

.plate.is-snapped .corner-bracket {
    opacity: 1;
}

.corner-bracket::before,
.corner-bracket::after {
    content: '';
    position: absolute;
    background: var(--color-desert-copper);
}

.corner-bracket--tl { top: 3rem; left: 3rem; }
.corner-bracket--tl::before { top: 0; left: 0; width: 20px; height: 1px; }
.corner-bracket--tl::after { top: 0; left: 0; width: 1px; height: 20px; }

.corner-bracket--tr { top: 3rem; right: 3rem; }
.corner-bracket--tr::before { top: 0; right: 0; width: 20px; height: 1px; }
.corner-bracket--tr::after { top: 0; right: 0; width: 1px; height: 20px; }

.corner-bracket--bl { bottom: 3rem; left: 3rem; }
.corner-bracket--bl::before { bottom: 0; left: 0; width: 20px; height: 1px; }
.corner-bracket--bl::after { bottom: 0; left: 0; width: 1px; height: 20px; }

.corner-bracket--br { bottom: 3rem; right: 3rem; }
.corner-bracket--br::before { bottom: 0; right: 0; width: 20px; height: 1px; }
.corner-bracket--br::after { bottom: 0; right: 0; width: 1px; height: 20px; }

/* =====================
   MEASUREMENT TICKS
   ===================== */
.measure-ticks {
    position: absolute;
    z-index: 1;
    pointer-events: none;
}

.measure-ticks--top {
    top: 2rem;
    left: 3rem;
    right: 3rem;
    height: 6px;
    display: flex;
    gap: 40px;
}

.measure-ticks--right {
    top: 3rem;
    right: 2rem;
    bottom: 3rem;
    width: 6px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.measure-tick {
    width: 1px;
    height: 6px;
    background: var(--color-desert-copper);
    opacity: 0.15;
}

.measure-tick--v {
    width: 6px;
    height: 1px;
    background: var(--color-desert-copper);
    opacity: 0.15;
}

/* =====================
   SCAN LINE (Hero)
   ===================== */
.scan-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--color-desert-copper);
    opacity: 0.2;
    z-index: 2;
    animation: scanSweep 20s linear infinite;
    pointer-events: none;
}

@keyframes scanSweep {
    0% { top: 0; }
    100% { top: 100%; }
}

/* =====================
   TYPOGRAPHY
   ===================== */
.plate__marker {
    display: block;
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-desert-copper);
    opacity: 0.5;
    margin-bottom: 2.5rem;
}

.plate__title {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-pale-dune);
    line-height: 1.15;
    margin-bottom: 2rem;
}

.plate__title--hero {
    font-size: clamp(3.5rem, 9vw, 7rem);
    letter-spacing: 0.08em;
    opacity: 0;
    transition: opacity 1.2s var(--ease-reveal);
}

.plate__title--hero.is-revealed {
    opacity: 1;
}

.plate__text {
    font-family: var(--font-main);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    color: var(--color-pale-dune);
    margin-bottom: 1.5rem;
}

/* =====================
   HERO COORDINATE READOUT
   ===================== */
.hero-coord-readout {
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.8s var(--ease-reveal);
}

.hero-coord-readout.is-visible {
    opacity: 1;
}

.hero-coord-text {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-desert-copper);
    opacity: 0.5;
}

/* =====================
   TOPOGRAPHIC SVG (Hero)
   ===================== */
.topo-contour-svg {
    width: 70%;
    max-width: 800px;
    opacity: 0.7;
}

.topo-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: topoTrace 3.2s var(--ease-reveal) forwards 0.6s;
}

@keyframes topoTrace {
    to { stroke-dashoffset: 0; }
}

/* =====================
   ORBITAL ARC SVG (Plate 2)
   ===================== */
.orbital-arc-svg {
    width: 80%;
    max-width: 700px;
}

.orbital-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    filter: drop-shadow(0 0 6px rgba(212, 132, 90, 0.3));
}

.plate--signal.is-snapped .orbital-path {
    animation: orbitalDraw 2.8s var(--ease-reveal) forwards;
}

@keyframes orbitalDraw {
    to { stroke-dashoffset: 0; }
}

/* =====================
   SIGNAL TEXT (Plate 2)
   ===================== */
.signal-line {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s var(--ease-reveal), transform 0.8s var(--ease-reveal);
}

.plate--signal.is-snapped .signal-line[data-line="0"] {
    opacity: 0.75;
    transform: translateY(0);
    transition-delay: 0.2s;
}

.plate--signal.is-snapped .signal-line[data-line="1"] {
    opacity: 0.75;
    transform: translateY(0);
    transition-delay: 0.4s;
}

.plate--signal.is-snapped .signal-line[data-line="2"] {
    opacity: 0.75;
    transform: translateY(0);
    transition-delay: 0.6s;
}

/* =====================
   GLYPH GRID (Plate 3)
   ===================== */
.glyph-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
}

.glyph-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s var(--ease-reveal), transform 0.6s var(--ease-reveal);
}

.glyph-cell.is-drawn {
    opacity: 1;
    transform: translateY(0);
}

.glyph-cell-svg {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 6px rgba(212, 132, 90, 0.5));
}

.cell-draw-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
}

.glyph-cell.is-drawn .cell-draw-path {
    animation: cellDraw 1.8s var(--ease-reveal) forwards;
}

@keyframes cellDraw {
    to { stroke-dashoffset: 0; }
}

.glyph-cell-label {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-desert-copper);
    opacity: 0.5;
}

/* =====================
   PLATE 4: RESONANCE
   ===================== */
.plate__bg-numeral {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--color-pale-dune);
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
    letter-spacing: 0.05em;
}

.pulse-line-svg {
    width: 100%;
    height: 100px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.pulse-draw-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    filter: drop-shadow(0 0 4px rgba(212, 132, 90, 0.4));
}

.plate--resonance.is-snapped .pulse-draw-path {
    animation: pulseDraw 3s var(--ease-reveal) forwards;
}

@keyframes pulseDraw {
    to { stroke-dashoffset: 0; }
}

/* Archive List */
.archive-list {
    border: 1px solid rgba(212, 132, 90, 0.12);
    margin-top: 1rem;
}

.archive-entry {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(212, 132, 90, 0.08);
    gap: 2rem;
    transition: background 0.3s ease;
}

.archive-entry:last-child {
    border-bottom: none;
}

.archive-entry:hover {
    background: rgba(74, 46, 31, 0.3);
}

.archive-entry__time {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: var(--color-pale-dune);
    min-width: 110px;
}

.archive-entry__freq {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--color-desert-copper);
    filter: drop-shadow(0 0 4px rgba(212, 132, 90, 0.3));
    flex: 1;
}

.archive-entry__status {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-dust);
}

.archive-entry__status--decoded {
    color: var(--color-sand-gold);
}

.archive-entry__status--processing {
    color: var(--color-desert-copper);
    animation: statusBlink 2s ease-in-out infinite;
}

.archive-entry__status--anomalous {
    color: var(--color-neon-ember);
    filter: drop-shadow(0 0 4px rgba(255, 107, 61, 0.4));
}

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

/* =====================
   PLATE 5: HORIZON
   ===================== */
.plate--horizon {
    justify-content: center;
    background: radial-gradient(ellipse at 50% 50%, #2C1810 0%, #1A0F0A 60%);
}

.horizon-line-svg {
    width: 100%;
    height: 4px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.horizon-draw-path {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
}

.plate--horizon.is-snapped .horizon-draw-path {
    animation: horizonDraw 2.4s var(--ease-reveal) forwards;
}

@keyframes horizonDraw {
    to { stroke-dashoffset: 0; }
}

.terminus-glyph {
    margin-bottom: 2.5rem;
}

.terminus-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 8px rgba(212, 132, 90, 0.3));
}

.terminus-draw-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
}

.plate--horizon.is-snapped .terminus-draw-path {
    animation: terminusDraw 2s var(--ease-reveal) forwards;
}

@keyframes terminusDraw {
    to { stroke-dashoffset: 0; }
}

.ember-dot {
    animation: emberPulse 3s ease-in-out infinite;
}

@keyframes emberPulse {
    0%, 100% { opacity: 0.3; r: 3; }
    50% { opacity: 0.8; r: 5; }
}

.terminus-text {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--color-dust);
    margin-bottom: 1.5rem;
    font-style: italic;
}

.terminus-domain {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: 0.72rem;
    letter-spacing: 0.35em;
    color: var(--color-dust);
    opacity: 0.4;
}

/* =====================
   RESPONSIVE: <= 768px
   ===================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    html {
        scroll-snap-type: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 48px;
        flex-direction: row;
        padding: 0 1.5rem;
        border-right: none;
        border-bottom: 1px solid rgba(212, 132, 90, 0.1);
        background: var(--color-fired-earth);
    }

    .sidebar__logo {
        margin-bottom: 0;
    }

    .logo-glyph {
        width: 30px;
        height: 30px;
    }

    .sidebar__divider {
        display: none;
    }

    .sidebar__nav {
        display: none;
    }

    .sidebar__coordinates {
        display: none;
    }

    .mobile-menu-trigger {
        display: flex;
    }

    .mobile-nav-overlay {
        display: block;
    }

    .content {
        margin-left: 0;
        padding-top: 48px;
    }

    .plate {
        min-height: 100vh;
        height: auto;
        padding: 4rem 1.5rem;
        scroll-snap-align: none;
    }

    .plate__content--right {
        margin-left: 0;
        margin-right: 0;
    }

    .plate__content--hero {
        margin-left: 0;
    }

    .glyph-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .archive-entry {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }

    .archive-entry__freq {
        flex: none;
    }

    .corner-bracket {
        display: none;
    }

    .measure-ticks {
        display: none;
    }
}

@media (max-width: 480px) {
    .plate {
        padding: 3rem 1rem;
    }

    .plate__title--hero {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .plate__title {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
    }

    .glyph-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .glyph-cell-svg {
        width: 60px;
        height: 60px;
    }
}
