/* matsurika.date — gilded chronograph: Art Deco appointment salon as circuitboard cathedral */

:root {
    --onyx: #0A0908;
    --bistre: #141210;
    --gold: #C9A14A;
    --gilt: #8E7332;
    --vellum: #E8D9B5;
    --smoke: #3B3530;
    --verdigris: #2A6F6A;
    --scroll-y: 0px;
    --grout: 14px;
}

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

html, body {
    background: var(--onyx);
    color: var(--vellum);
    font-family: "Cormorant Garamond", Georgia, serif;
    overflow-x: hidden;
}

body { min-height: 100vh; }

/* the tall invisible spine that gives us something to scroll */
.scroll-spine {
    position: absolute;
    top: 0; left: 0;
    width: 1px;
    height: 360vh;
    pointer-events: none;
}

/* ---------- top meridian ---------- */
.meridian {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    z-index: 50;
    background: linear-gradient(180deg, rgba(10,9,8,0.95), rgba(10,9,8,0.0));
}
.meridian-line {
    flex: 1;
    max-width: 26vw;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.domain {
    font-family: "Poiret One", "Oswald", sans-serif;
    font-weight: 400;
    letter-spacing: 0.42em;
    color: var(--gold);
    font-size: clamp(1.4rem, 2.2vw, 2.1rem);
    text-transform: lowercase;
    white-space: nowrap;
    padding-left: 0.42em;
}

/* ---------- fixed gilded vitrine: the bento lattice ---------- */
.vitrine {
    position: fixed;
    top: 46px; left: 0;
    width: 100vw;
    height: calc(100vh - 46px);
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    grid-template-rows: minmax(120px, 16vh) minmax(200px, 30vh) minmax(200px, 30vh) minmax(120px, 16vh);
    gap: var(--grout);
    padding: var(--grout);
    background: var(--onyx);
}

/* ziggurat stepped-corner clip path used on every panel */
.panel {
    position: relative;
    background: var(--bistre);
    border: 2px double var(--gold);
    overflow: hidden;
    clip-path: polygon(
        0 8px, 8px 8px, 8px 0,
        calc(100% - 8px) 0, calc(100% - 8px) 8px, 100% 8px,
        100% calc(100% - 8px), calc(100% - 8px) calc(100% - 8px), calc(100% - 8px) 100%,
        8px 100%, 8px calc(100% - 8px), 0 calc(100% - 8px)
    );
    box-shadow: inset 0 0 0 1px rgba(201,161,74,0.18), 0 1px 0 rgba(232,217,181,0.18), 0 -1px 0 rgba(232,217,181,0.10);
}

/* panel placements */
.panel-a       { grid-area: 1 / 1 / 2 / 2; }
.panel-b       { grid-area: 1 / 2 / 2 / 3; }
.panel-c       { grid-area: 1 / 3 / 3 / 4; }
.panel-feature { grid-area: 2 / 1 / 4 / 3; }
.panel-d       { grid-area: 3 / 3 / 5 / 4; }
.panel-e       { grid-area: 4 / 1 / 5 / 2; }
.panel-f       { grid-area: 4 / 2 / 5 / 3; }
.panel-g       { grid-area: 2 / 3 / 3 / 4; display: none; } /* folded into c; kept for richness on wide */

/* marble plaques */
.panel.marble {
    background: radial-gradient(ellipse at 30% 20%, #f4ede0 0%, #e8d9b5 35%, #cabea4 70%, #9c907a 100%);
    color: var(--smoke);
    box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 8px rgba(201,161,74,0.15), 0 1px 0 rgba(232,217,181,0.18);
}
.panel.marble::after {
    content: "";
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(115deg, rgba(156,144,122,0.0) 0 18px, rgba(156,144,122,0.30) 18px 19px, rgba(156,144,122,0.0) 19px 60px),
        repeating-linear-gradient(-72deg, rgba(156,144,122,0.0) 0 26px, rgba(156,144,122,0.22) 26px 27px, rgba(156,144,122,0.0) 27px 80px),
        repeating-linear-gradient(40deg, rgba(156,144,122,0.0) 0 40px, rgba(156,144,122,0.18) 40px 41px, rgba(156,144,122,0.0) 41px 100px);
    filter: blur(0.4px);
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* inner content tier — this is what parallaxes */
.panel-inner {
    position: relative;
    z-index: 2;
    padding: clamp(0.9rem, 1.6vw, 1.8rem);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.65rem;
    transform: translateY(calc(var(--scroll-y) * var(--scroll-rate, 0)));
    will-change: transform;
}

/* ---------- typography ---------- */
.eyebrow {
    font-family: "Oswald", sans-serif;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 0.72rem;
    color: var(--gilt);
}
.panel.marble .eyebrow { color: #7a6326; }

.panel-title {
    font-family: "Yeseva One", serif;
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: var(--gold);
    line-height: 1.05;
}
.panel.marble .panel-title { color: #6e5722; text-shadow: 0 1px 0 rgba(255,255,255,0.35); }

.body {
    font-family: "Cormorant Garamond", serif;
    font-style: italic;
    font-weight: 300;
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--vellum);
    max-width: 34ch;
}
.panel.marble .body { color: #4a423a; }

/* ---------- panel A: sunburst fan ---------- */
.fan {
    position: absolute;
    top: -10px; left: -10px;
    width: 62%;
    height: auto;
    overflow: visible;
    opacity: 0.85;
}
.fan line { stroke: var(--gold); stroke-width: 1.4; }

/* ---------- panel C: circuit trace art ---------- */
.trace-art {
    width: 100%;
    max-width: 220px;
    margin-top: 0.5rem;
}

/* ---------- panel G: chevron stack ---------- */
.chevron-stack {
    position: absolute;
    bottom: -6px; right: -6px;
    width: 60%;
    height: auto;
    opacity: 0.9;
}

/* ---------- feature panel: marble medallion ---------- */
.panel-feature .panel-inner.medallion-wrap {
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 0.8rem;
}
.feature-title {
    font-family: "Poiret One", sans-serif;
    font-weight: 400;
    letter-spacing: 0.3em;
    color: #6e5722;
    font-size: clamp(1.8rem, 3.4vw, 3rem);
    text-transform: lowercase;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.medallion {
    width: clamp(220px, 26vw, 320px);
    height: auto;
    filter: drop-shadow(0 0 12px rgba(201,161,74,0.25));
}
.feature-body { max-width: 38ch; }
.now-label { color: var(--verdigris); letter-spacing: 0.32em; }

/* clock hands */
#hourHand   { transition: transform 0.4s linear; }
#minuteHand { transition: transform 0.4s linear; }
#secondHand {
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: chrono 60s steps(60) infinite;
}
@keyframes chrono {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
/* but we drive it precisely from JS; the animation is a fallback. */
#secondHand.js-driven { animation: none; transition: transform 0.18s cubic-bezier(.4,2.2,.55,.9); }

.chapter-tick   { stroke: var(--gold); stroke-width: 1; }
.chapter-tick.major { stroke: var(--gold); stroke-width: 1.6; }
.chapter-chevron { fill: var(--gold); }
.hour-marker { stroke: var(--gold); stroke-width: 2; }

/* ---------- circuit filigree along grout ---------- */
.grout-circuit {
    position: absolute;
    top: 46px; left: 0;
    width: 100vw;
    height: calc(100vh - 46px);
    pointer-events: none;
    z-index: 40;
    overflow: visible;
}
.grout-circuit .trace { stroke: var(--gold); stroke-width: 1; fill: none; opacity: 0.55; }
.grout-circuit .pad   { fill: var(--gold); }
.grout-circuit .electron { fill: url(#electron); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .vitrine {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(6, minmax(120px, auto));
        height: auto;
        position: static;
        min-height: calc(100vh - 46px);
    }
    .panel-a       { grid-area: 1 / 1 / 2 / 2; }
    .panel-b       { grid-area: 1 / 2 / 2 / 3; }
    .panel-c       { grid-area: 2 / 1 / 3 / 3; }
    .panel-feature { grid-area: 3 / 1 / 4 / 3; }
    .panel-d       { grid-area: 4 / 1 / 5 / 2; }
    .panel-e       { grid-area: 4 / 2 / 5 / 3; }
    .panel-f       { grid-area: 5 / 1 / 6 / 3; }
    .panel-g       { display: none; }
    .grout-circuit { display: none; }
    .scroll-spine  { display: none; }
    body { overflow-y: auto; }
    .panel-inner { transform: none !important; }
}

@media (prefers-reduced-motion: reduce) {
    #secondHand { animation: none; }
    .panel-inner { transform: none !important; }
    .grout-circuit .electron { display: none; }
}
