/* ============================================================
   aiice.quest — Peak Aiice Field Station
   anti-design dashboard / earth-tones / eclectic-hybrid
   zero gradients. zero photography. solid hex fills only.
   ============================================================ */

:root {
    --peak-shadow:        #1f1c17; /* deep granite in shade at 03:40, body copy           */
    --basalt:             #2d2a24; /* weathered basalt on the approach ridge, panel titles*/
    --hand-ink:           #3a2e22; /* the brown ink Alice writes her letters in            */
    --parchment-pale:     #e8decb; /* dog-eared logbook paper, primary background          */
    --parchment-shadow:   #d4c6a9; /* paper where a thumb has held it open                 */
    --moss-damp:          #5c6b3a; /* underside of green moss after rain                   */
    --lichen-xanthoria:   #b9653a; /* Xanthoria elegans lichen (it grows above 3000m)      */
    --lichen-rhizocarpon: #8a9044; /* Rhizocarpon geographicum lichen, secondary accent    */
    --meltwater:          #6d7a74; /* glacial meltwater in a Nalgene, telemetry rails      */
    --alpenglow:          #a8331c; /* alpenglow at 18:02, AI marginalia + alert            */
    --birch-bark:         #cfc2a7; /* inner birch-bark strip, card highlights              */
    --summit-sky:         #8a9ba0; /* winter sky above 3800m, the only cool accent         */
    --ink-red:            #7a2218; /* old red pencil corrections                           */

    --font-signet:    'Rubik Mono One', 'Special Elite', monospace;
    --font-log:       'Special Elite', 'Courier New', monospace;
    --font-alice:     'Caveat', 'Comic Sans MS', cursive;
    --font-margin:    'Oswald', 'Arial Narrow', sans-serif;
    --font-label:     'UnifrakturMaguntia', 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--parchment-pale);
    color: var(--peak-shadow);
    font-family: var(--font-log);
    font-size: 15px;
    line-height: 1.68;
    letter-spacing: 0.01em;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

/* paper-tooth noise overlay (the only background texture) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.12  0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0.5 0'/></filter><rect width='220' height='220' filter='url(%23n)' opacity='0.5'/></svg>");
    opacity: 0.05;
    z-index: 9999;
}

/* ============================================================
   Dashboard grid: 12 columns, fixed at 1440 reference width
   ============================================================ */
.dashboard {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 38px 96px repeat(10, 1fr) 50px;
    gap: 6px;
    padding: 6px;
    width: 100vw;
    height: 100vh;
    background: var(--parchment-pale);
}

/* ============================================================
   Panel base
   ============================================================ */
.panel {
    position: relative;
    background: var(--parchment-shadow);
    border: 1px solid var(--basalt);
    padding: 18px 14px 12px;
    overflow: hidden;
    opacity: 0;
    animation: paneRise 0.4s ease-out forwards;
}

@keyframes paneRise {
    from { opacity: 0; transform: translate(var(--tx, 0), calc(var(--ty, 0) + 6px)); }
    to   { opacity: 1; transform: translate(var(--tx, 0), var(--ty, 0)); }
}

.panel__title {
    position: absolute;
    top: 2px;
    left: 8px;
    margin: 0;
    font-family: var(--font-label);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--basalt);
    opacity: 0.62;
    text-transform: none;
    white-space: nowrap;
    pointer-events: none;
}

.panel__body {
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* ============================================================
   Panel placement — calibrated misalignment
   each transform offset is documented per panel
   ============================================================ */

/* Panel 16: FOOTER.IN-HEADER (anti-design: footer at top) */
.panel--footer-header {
    grid-column: 1 / span 12;
    grid-row: 1 / span 1;
    --tx: 0px; --ty: 0px;
    transform: translate(var(--tx), var(--ty));
    background: var(--basalt);
    color: var(--parchment-pale);
    padding: 6px 12px 4px;
    border: none;
    animation-delay: 0.05s;
}
.panel--footer-header .panel__title { color: var(--parchment-pale); opacity: 0.6; top: 1px; }
.panel--footer-header .panel__body {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    font-family: var(--font-log);
    font-size: 10px;
    color: var(--parchment-pale);
    margin-top: 12px;
}
.panel--footer-header .kv em { color: var(--lichen-xanthoria); font-style: normal; }

/* Panel 9: CABIN.HEADER */
.panel--cabin-header {
    grid-column: 1 / span 5;
    grid-row: 2 / span 1;
    --tx: -3px; --ty: 2px; /* leans away from the corner where the wood warped */
    transform: translate(var(--tx), var(--ty));
    animation-delay: 0.15s;
}
.cabin-row {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    line-height: 1.4;
    border-bottom: 1px dotted var(--meltwater);
    padding: 1px 0;
}
.cabin-row span { font-family: var(--font-label); color: var(--basalt); opacity: 0.7; font-size: 9px; }
.cabin-row strong { font-family: var(--font-log); font-weight: 400; color: var(--peak-shadow); }
.temp-stuck { color: var(--alpenglow) !important; }

/* Panel 2: THERMAL.STRIP */
.panel--thermal {
    grid-column: 6 / span 7;
    grid-row: 2 / span 1;
    --tx: 5px; --ty: -2px; /* the strip slid right a smidge in 2021 */
    transform: translate(var(--tx), var(--ty));
    padding: 14px 8px 6px;
    animation-delay: 0.1s;
}
.thermal-row {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    height: 38px;
    border: 1px solid var(--basalt);
}
.thermal-row > span {
    border-right: 1px solid var(--basalt);
}
.thermal-row > span:last-child { border-right: none; }
.thermal-legend {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-log);
    font-size: 9px;
    color: var(--basalt);
    margin-top: 3px;
    letter-spacing: 0.03em;
}

/* Panel 1: LOG / CHAPTER 07 (largest) */
.panel--log {
    grid-column: 1 / span 6;
    grid-row: 3 / span 7;
    --tx: -4px; --ty: 3px; /* slight lean toward the window */
    transform: translate(var(--tx), var(--ty));
    background: var(--parchment-pale);
    z-index: 3;
    animation-delay: 0.35s;
}
.panel--log .panel__body { cursor: text; }
.log-stream {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-log);
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--peak-shadow);
    padding-top: 8px;
    padding-right: 4px;
    position: relative;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-line {
    margin: 0 0 6px;
    padding: 0;
}
.log-line .ts { color: var(--ink-red); margin-right: 6px; }
.log-stream::after {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 24px;
    background: var(--parchment-pale);
    /* hard-edge fade not allowed (no gradient). use solid mask line. */
    border-bottom: 1px dotted var(--basalt);
    opacity: 0.85;
    pointer-events: none;
}

/* Panel 7: AI.MARGINALIA inset on the log */
.ai-marginalia {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 44%;
    background: var(--parchment-shadow);
    border-left: 2px solid var(--alpenglow);
    padding: 6px 8px 6px 10px;
    font-family: var(--font-margin);
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--alpenglow);
    text-transform: uppercase;
    transform: rotate(-0.6deg);
    z-index: 4;
    mix-blend-mode: multiply;
}
.ai-marginalia .margin-tag {
    display: inline-block;
    font-size: 10px;
    color: var(--basalt);
    margin-right: 6px;
    border: 1px solid var(--basalt);
    padding: 0 4px;
}
.ai-marginalia .margin-line { margin: 4px 0 0; }

/* Panel 3: ALICE.CORRESPONDENCE */
.panel--alice {
    grid-column: 7 / span 4;
    grid-row: 3 / span 5;
    --tx: 8px; --ty: -1px; /* paper slid out from under the rock paperweight */
    transform: translate(var(--tx), var(--ty));
    background: var(--parchment-pale);
    animation-delay: 0.5s;
}
.alice-paper {
    background: #ede2cc;
    border: 1px solid #c8b894;
    padding: 14px 16px 10px;
    margin-top: 10px;
    transform: rotate(-1.2deg);
    box-shadow: 2px 3px 0 rgba(31,28,23,0.12);
    height: calc(100% - 56px);
    overflow: hidden;
    position: relative;
    z-index: 2;
}
.alice-header {
    font-family: var(--font-log);
    font-size: 9px;
    color: var(--basalt);
    margin: 0 0 6px;
    letter-spacing: 0.05em;
    border-bottom: 1px dotted var(--basalt);
    padding-bottom: 4px;
}
.alice-text {
    font-family: var(--font-alice);
    font-size: 21px;
    line-height: 1.32;
    color: #3a2e22;
    margin: 0;
    font-weight: 500;
}
.alice-sign {
    font-family: var(--font-alice);
    font-size: 22px;
    color: var(--ink-red);
    margin: 6px 0 0;
    text-align: right;
    font-weight: 700;
}
.alice-controls {
    position: absolute;
    bottom: 8px;
    left: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
}
.alice-arrow {
    background: transparent;
    border: 1px solid var(--basalt);
    padding: 2px 6px;
    color: var(--basalt);
    cursor: pointer;
    font-family: var(--font-log);
}
.alice-arrow:hover { background: var(--birch-bark); }
.alice-pip {
    font-family: var(--font-log);
    color: var(--basalt);
    font-size: 14px;
    letter-spacing: 0.4em;
}
.alice-pip .on { color: var(--alpenglow); }
.rabbit-silhouette {
    position: absolute;
    bottom: -4px;
    right: -8px;
    z-index: 1;
    pointer-events: none;
}

/* Panel 6: GLACIER.TELEMETRY */
.panel--telemetry {
    grid-column: 11 / span 2;
    grid-row: 3 / span 5;
    --tx: 4px; --ty: 6px; /* sidebar nudged south to clear the cable run */
    transform: translate(var(--tx), var(--ty));
    animation-delay: 0.55s;
}
.gauge-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}
.gauge {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    margin-bottom: 6px;
    border-bottom: 1px dotted var(--basalt);
    padding-bottom: 4px;
}
.gauge__name {
    font-family: var(--font-label);
    font-size: 9px;
    color: var(--basalt);
    letter-spacing: 0.04em;
}
.gauge__swatch {
    height: 8px;
    width: 100%;
    border: 1px solid var(--basalt);
    display: block;
}
.gauge__val {
    font-family: var(--font-log);
    font-size: 11px;
    color: var(--peak-shadow);
}

/* Panel 8: SUMMIT.DICTIONARY */
.panel--dictionary {
    grid-column: 1 / span 2;
    grid-row: 10 / span 2;
    --tx: -6px; --ty: -3px; /* the dictionary is older than the dashboard */
    transform: translate(var(--tx), var(--ty));
    animation-delay: 0.7s;
}
.dict-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    height: calc(100% - 14px);
    overflow: hidden;
    position: relative;
}
.dict-list li {
    font-family: var(--font-log);
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--peak-shadow);
    border-bottom: 1px dotted var(--meltwater);
    padding: 1px 0;
}
.dict-list li b { color: var(--moss-damp); font-weight: 400; margin-right: 4px; }
.dict-list li i { font-style: italic; color: var(--basalt); }

/* Panel 4: RIDGE.PROFILE (centerpiece, bottom-wide) */
.panel--ridge {
    grid-column: 3 / span 9;
    grid-row: 8 / span 4;
    --tx: 7px; --ty: -4px; /* the east ridge runs slightly higher than the panel allows */
    transform: translate(var(--tx), var(--ty));
    background: var(--parchment-pale);
    z-index: 2;
    animation-delay: 0.85s;
}
.ridge-svg {
    width: 100%;
    height: calc(100% - 22px);
    margin-top: 12px;
    display: block;
    overflow: visible;
}
.ridge-features text {
    font-family: var(--font-log);
    font-size: 8.5px;
    fill: var(--basalt);
}
.ridge-caption {
    font-family: var(--font-alice);
    font-size: 13px;
    color: var(--ink-red);
    margin: 0;
    transform: rotate(-0.4deg);
    text-align: right;
    padding-right: 12px;
}

/* Panel 15: BAROGRAPH */
.panel--barograph {
    grid-column: 7 / span 4;
    grid-row: 8 / span 1;
    --tx: -5px; --ty: 4px; /* barograph drifts when it senses snowfall */
    transform: translate(var(--tx), var(--ty));
    z-index: 1;
    animation-delay: 0.95s;
}
.barograph-bars {
    display: flex;
    align-items: flex-end;
    height: calc(100% - 28px);
    margin-top: 12px;
    gap: 1px;
    border-bottom: 1px solid var(--basalt);
    border-left: 1px solid var(--basalt);
}
.barograph-bars > span {
    flex: 1;
    background: var(--ink-red);
    min-height: 2px;
    border-right: 1px solid var(--parchment-pale);
}
.barograph-axis {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-log);
    font-size: 8px;
    color: var(--basalt);
    margin-top: 2px;
}

/* Panel 13: LICHEN.SAMPLES (4x4) */
.panel--lichen {
    grid-column: 11 / span 2;
    grid-row: 8 / span 4;
    --tx: 3px; --ty: -5px;
    transform: translate(var(--tx), var(--ty));
    animation-delay: 1.05s;
}
.lichen-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 12px;
}
.lichen-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.lichen-tile {
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--basalt);
}
.lichen-name {
    font-family: var(--font-label);
    font-size: 7px;
    color: var(--basalt);
    text-align: center;
    margin-top: 2px;
    line-height: 1.05;
}

/* Panel 14: ROUTE.NOTES */
.panel--route {
    grid-column: 7 / span 3;
    grid-row: 9 / span 2;
    --tx: 9px; --ty: 2px; /* stapled on slightly crooked */
    transform: translate(var(--tx), var(--ty));
    background: #ede2cc;
    animation-delay: 1.15s;
}
.route-note {
    font-family: var(--font-alice);
    font-size: 17px;
    line-height: 1.3;
    color: var(--basalt);
    margin: 4px 0;
    transform: rotate(0.8deg);
    font-weight: 500;
}
.route-note em { color: var(--ink-red); font-style: italic; }
.route-compass {
    position: absolute;
    bottom: 4px;
    right: 6px;
}

/* Panel 12: PING.SCHEDULE */
.panel--ping {
    grid-column: 6 / span 1;
    grid-row: 3 / span 5;
    --tx: 11px; --ty: -2px; /* a thin vertical sliver */
    transform: translate(var(--tx), var(--ty));
    padding: 14px 6px 4px;
    animation-delay: 0.6s;
}
.ping-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}
.ping-list li {
    font-family: var(--font-log);
    font-size: 10px;
    color: var(--peak-shadow);
    border-bottom: 1px dotted var(--meltwater);
    padding: 1px 0;
    display: flex;
    justify-content: space-between;
}
.ping-list li b { color: var(--moss-damp); font-weight: 400; }
.ping-list li.ok::after { content: "OK"; color: var(--lichen-rhizocarpon); }
.ping-list li.lost::after { content: "—"; color: var(--alpenglow); }

/* Panel 11: QUOTES.RABBIT-HOLE */
.panel--quotes {
    grid-column: 3 / span 4;
    grid-row: 12 / span 1;
    --tx: -2px; --ty: -7px;
    transform: translate(var(--tx), var(--ty));
    background: var(--basalt);
    color: var(--parchment-pale);
    border-color: var(--peak-shadow);
    animation-delay: 1.25s;
}
.panel--quotes .panel__title { color: var(--parchment-pale); }
.pocket-watch {
    position: absolute;
    top: 6px;
    right: 8px;
}
.quote-line {
    font-family: var(--font-alice);
    font-size: 18px;
    margin: 18px 50px 0 0;
    color: var(--parchment-pale);
    line-height: 1.2;
    font-weight: 500;
}
.quote-attr {
    font-family: var(--font-log);
    font-size: 9px;
    color: var(--summit-sky);
    margin: 4px 0 0;
}

/* Panel 10: WIND.SOCK */
.panel--wind {
    grid-column: 7 / span 1;
    grid-row: 12 / span 1;
    --tx: 6px; --ty: -8px;
    transform: translate(var(--tx), var(--ty));
    padding: 14px 6px 4px;
    animation-delay: 1.35s;
}
.wind-svg {
    display: block;
    margin: 6px auto 0;
}
.wind-bearing {
    display: block;
    font-family: var(--font-log);
    font-size: 9px;
    color: var(--basalt);
    text-align: center;
    margin-top: 2px;
}

/* Panel 17: AIICE.SIGNET (lower-left) */
.panel--signet {
    grid-column: 1 / span 2;
    grid-row: 12 / span 1;
    --tx: -4px; --ty: -10px;
    transform: translate(var(--tx), var(--ty));
    background: var(--parchment-pale);
    border-color: var(--basalt);
    border-width: 2px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation-delay: 1.45s;
}
.signet {
    font-family: var(--font-signet);
    font-size: clamp(2.2rem, 4.6vw, 4.4rem);
    letter-spacing: -0.02em;
    color: var(--basalt);
    margin: 0;
    line-height: 0.9;
}
.signet-elev {
    font-family: var(--font-label);
    font-size: 10px;
    color: var(--basalt);
    opacity: 0.7;
    margin-top: 2px;
}

/* Panel 5: ICE.GROWTH overlay */
.ice-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50;
    mix-blend-mode: multiply;
}
.ice-overlay path {
    fill: none;
    stroke: var(--meltwater);
    stroke-width: 0.7px;
    stroke-linecap: round;
    opacity: 0.65;
}
.ice-grow {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: iceDraw 1.8s ease-out forwards;
}
@keyframes iceDraw {
    to { stroke-dashoffset: 0; }
}

/* ============================================================
   Wind sock flap — randomized per JS, two-frame skeleton
   ============================================================ */
.wind-flap-a #windCone { d: path("M7 12 L36 14 L34 22 L7 20 Z"); }
.wind-flap-b #windCone { d: path("M7 12 L34 10 L36 24 L7 20 Z"); }

/* ============================================================
   Responsive: keep dashboard structure but allow soft scaling
   ============================================================ */
@media (max-width: 1100px) {
    .dashboard {
        grid-template-rows: 38px 80px repeat(10, minmax(36px, 1fr)) 50px;
    }
    .signet { font-size: clamp(1.8rem, 4vw, 3.4rem); }
    .alice-text { font-size: 18px; }
    .quote-line { font-size: 16px; }
}

@media (max-width: 760px) {
    html, body { overflow: auto; height: auto; }
    .dashboard {
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: auto;
        height: auto;
        min-height: 100vh;
    }
    .panel {
        grid-column: 1 / -1 !important;
        grid-row: auto !important;
        transform: none !important;
        animation: paneRise 0.4s ease-out forwards;
    }
    .ice-overlay { display: none; }
}
