:root {
    /* compliance lexicon: creates specific retro signage labels */
    --abyss-ink: #031014;
    --deep-protocol-teal: #063B46;
    --reef-cyan: #26F3E2;
    --algae-electric: #A6FF3D;
    --shell-lavender: #C6A8FF;
    --coral-checksum: #FF6B9A;
    --foam-parchment: #E8FFF9;
    --display: "Monoton", cursive;
    --serif: "Spectral", serif;
    --mono: "IBM Plex Mono", monospace;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--abyss-ink);
    color: var(--foam-parchment);
}

body {
    margin: 0;
    min-width: 320px;
    overflow-x: hidden;
    font-family: var(--serif);
    background: var(--abyss-ink);
}

.abyss-field {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 19%, rgba(38, 243, 226, 0.16), transparent 26rem),
        radial-gradient(circle at 86% 41%, rgba(198, 168, 255, 0.12), transparent 30rem),
        linear-gradient(124deg, var(--abyss-ink) 0%, #031014 38%, var(--deep-protocol-teal) 66%, #07121d 100%);
}

.noise-veil {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.34;
    background-image:
        repeating-radial-gradient(circle at 23% 31%, rgba(232, 255, 249, 0.12) 0 1px, transparent 1px 5px),
        repeating-linear-gradient(90deg, rgba(38, 243, 226, 0.05) 0 1px, transparent 1px 9px),
        linear-gradient(180deg, transparent, rgba(255, 107, 154, 0.06), transparent);
    mix-blend-mode: screen;
    animation: saltDrift 18s steps(9) infinite;
}

.scanline-orbit {
    position: fixed;
    inset: -20% 0 auto;
    height: 45vh;
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(38, 243, 226, 0.10), transparent 58%);
    transform: translateY(-40vh);
    animation: slowScan 11s linear infinite;
    z-index: 2;
}

.chamber {
    position: relative;
    min-height: 100vh;
    padding: clamp(2rem, 5vw, 5rem);
}

.hero-chamber {
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.coordinate-label,
.section-kicker,
.figure-label,
.marginalia,
.tide-band span,
.wave-diagram text {
    font-family: var(--mono);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.coordinate-label {
    margin: 0;
    color: var(--shell-lavender);
    font-size: clamp(0.62rem, 1.4vw, 0.82rem);
}

.hero-void {
    position: relative;
    display: flex;
    min-height: 72vh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.protocol-mask {
    position: absolute;
    top: 13%;
    left: clamp(5rem, 18vw, 22rem);
    width: clamp(14rem, 32vw, 30rem);
    filter: drop-shadow(0 0 1.6rem rgba(38, 243, 226, 0.45));
    animation: maskFloat 8s ease-in-out infinite;
}

.protocol-mask::before,
.protocol-mask::after {
    content: attr(data-specimen);
    position: absolute;
    font-family: var(--mono);
    font-size: 0.58rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--algae-electric);
}

.protocol-mask::before {
    top: -1.4rem;
    right: -3rem;
}

.protocol-mask::after {
    content: "archival acetate / scan active";
    left: -2rem;
    bottom: -1.4rem;
    color: var(--coral-checksum);
}

.protocol-mask svg {
    display: block;
    width: 100%;
    overflow: visible;
}

.mask-shell {
    fill: rgba(232, 255, 249, 0.08);
    stroke: url(#maskPearl);
    stroke-width: 4;
    filter: url(#softGlow);
}

.mask-edge,
.mask-circuit {
    fill: none;
    stroke: var(--reef-cyan);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 8 10;
}

.mask-circuit {
    stroke: var(--shell-lavender);
    stroke-dasharray: 4 8;
}

.mask-eye {
    fill: rgba(3, 16, 20, 0.76);
    stroke: var(--coral-checksum);
    stroke-width: 2;
}

.pearl-node {
    fill: var(--foam-parchment);
    stroke: var(--algae-electric);
    stroke-width: 3;
}

.pearl-node.small {
    fill: var(--algae-electric);
}

.mask-scan {
    position: absolute;
    left: 3%;
    right: 3%;
    top: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--reef-cyan), var(--foam-parchment), transparent);
    box-shadow: 0 0 22px var(--reef-cyan);
    animation: maskScan 5.4s ease-in-out infinite;
}

.wordmark {
    position: relative;
    max-width: 14ch;
    margin: 0;
    padding-top: 15vh;
    font-family: var(--display);
    font-size: clamp(3.4rem, 11vw, 10rem);
    line-height: 0.97;
    letter-spacing: 0.02em;
    color: var(--foam-parchment);
    text-shadow: 0 0 22px rgba(38, 243, 226, 0.32), 0.06em 0 rgba(255, 107, 154, 0.28), -0.04em 0 rgba(198, 168, 255, 0.28);
}

.glitch-title::before,
.glitch-title::after {
    content: attr(data-text);
    position: absolute;
    inset: 15vh auto auto 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
}

.glitch-title::before {
    color: var(--reef-cyan);
    transform: translateX(-0.06em);
}

.glitch-title::after {
    color: var(--coral-checksum);
    transform: translateX(0.06em);
}

.glitch-title.glitching::before,
.glitch-title:hover::before {
    opacity: 0.75;
    clip-path: inset(12% 0 57% 0);
}

.glitch-title.glitching::after,
.glitch-title:hover::after {
    opacity: 0.65;
    clip-path: inset(58% 0 19% 0);
}

.hero-note {
    margin: 2rem 0 0 auto;
    max-width: 31rem;
}

.scholarly-note {
    font-size: clamp(1rem, 1.4vw, 1.28rem);
    line-height: 1.65;
    color: rgba(232, 255, 249, 0.84);
}

.scholarly-note strong {
    color: var(--shell-lavender);
    font-family: var(--mono);
    font-size: 0.8em;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.marginalia {
    max-width: 22rem;
    margin: 0;
    border-left: 1px solid var(--reef-cyan);
    padding-left: 1rem;
    color: rgba(232, 255, 249, 0.66);
    font-size: 0.7rem;
}

.marginalia span {
    color: var(--coral-checksum);
}

.tide-chamber {
    padding-top: 18vh;
}

.section-kicker {
    display: inline-block;
    color: var(--algae-electric);
    font-size: 0.72rem;
}

.glitch-bracket {
    position: relative;
}

.glitch-bracket::before,
.glitch-bracket::after {
    content: "";
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    border-color: var(--coral-checksum);
    border-style: solid;
}

.glitch-bracket::before {
    left: -1.8rem;
    top: -0.6rem;
    border-width: 1px 0 0 1px;
}

.glitch-bracket::after {
    right: -1.8rem;
    bottom: -0.6rem;
    border-width: 0 1px 1px 0;
}

.ceremonial-heading {
    max-width: 12ch;
    margin: 1.1rem 0 10vh;
    font-family: var(--display);
    font-size: clamp(2.6rem, 6vw, 6.4rem);
    font-weight: 400;
    line-height: 1.05;
    color: var(--foam-parchment);
}

.tide-chart {
    display: grid;
    gap: clamp(1.2rem, 3vw, 2.6rem);
    max-width: 78rem;
    margin-left: auto;
}

.tide-band {
    position: relative;
    display: grid;
    grid-template-columns: minmax(8rem, 16rem) minmax(0, 1fr);
    gap: clamp(1rem, 4vw, 6rem);
    align-items: center;
    min-height: 7rem;
    padding: 1rem 0;
    border-top: 1px solid rgba(38, 243, 226, 0.45);
    background: linear-gradient(90deg, rgba(6, 59, 70, 0.52), transparent 75%);
    transform: translateX(var(--tide-offset, 0));
}

.tide-band:nth-child(2) { --tide-offset: -8vw; }
.tide-band:nth-child(3) { --tide-offset: 3vw; }
.tide-band:nth-child(4) { --tide-offset: -3vw; }

.tide-band::before {
    content: attr(data-phase);
    position: absolute;
    left: -2.4rem;
    top: -0.5rem;
    color: var(--shell-lavender);
    font-family: var(--mono);
    font-size: 0.72rem;
}

.tide-band span {
    color: var(--reef-cyan);
    font-size: clamp(0.86rem, 1.7vw, 1.1rem);
}

.tide-band p {
    margin: 0;
    max-width: 43rem;
    color: rgba(232, 255, 249, 0.78);
    font-size: clamp(1.02rem, 1.65vw, 1.34rem);
    line-height: 1.55;
}

.manuscript-chamber {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(16rem, 0.55fr);
    gap: clamp(2rem, 7vw, 8rem);
    align-items: center;
}

.diagram-plate {
    position: relative;
    min-height: 56vh;
    border: 1px solid rgba(198, 168, 255, 0.34);
    background:
        linear-gradient(135deg, rgba(232, 255, 249, 0.08), transparent 38%),
        linear-gradient(90deg, rgba(6, 59, 70, 0.36), rgba(3, 16, 20, 0.25));
    box-shadow: inset 0 0 0 1px rgba(38, 243, 226, 0.12), 0 0 80px rgba(38, 243, 226, 0.08);
}

.figure-label {
    position: absolute;
    left: 1.2rem;
    top: 1rem;
    z-index: 2;
    margin: 0;
    color: var(--shell-lavender);
    font-size: 0.66rem;
}

.wave-diagram {
    position: absolute;
    inset: 8% 4%;
    width: 92%;
    height: 84%;
}

.diagram-grid {
    fill: none;
    stroke: rgba(232, 255, 249, 0.12);
    stroke-width: 1;
}

.wave-a,
.wave-b {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 900;
    stroke-dashoffset: 900;
}

.wave-a {
    stroke: var(--reef-cyan);
}

.wave-b {
    stroke: var(--coral-checksum);
}

.diagram-plate.in-view .wave-a,
.diagram-plate.in-view .wave-b {
    animation: drawWave 2.2s ease forwards;
}

.diagram-plate.in-view .wave-b {
    animation-delay: 0.32s;
}

.diagram-node {
    fill: var(--foam-parchment);
    stroke: var(--algae-electric);
    stroke-width: 4;
}

.consent-veil {
    fill: rgba(198, 168, 255, 0.13);
    stroke: rgba(198, 168, 255, 0.62);
    stroke-width: 2;
    stroke-dasharray: 7 9;
}

.wave-diagram text {
    fill: var(--foam-parchment);
    font-size: 16px;
}

.annotation-stack {
    display: grid;
    gap: 2rem;
}

.annotation-stack .scholarly-note {
    margin: 0;
    border-left: 1px solid rgba(166, 255, 61, 0.42);
    padding-left: 1rem;
}

.lagoon-chamber {
    display: grid;
    place-items: center;
    min-height: 110vh;
}

.glyph-field {
    position: absolute;
    inset: 0;
}

.mask-glyph {
    position: absolute;
    color: var(--shell-lavender);
    font-family: var(--mono);
    font-size: clamp(0.72rem, 1.4vw, 1rem);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.64;
    filter: drop-shadow(0 0 13px rgba(198, 168, 255, 0.35));
    animation: glyphDrift 12s ease-in-out infinite;
}

.mask-glyph:nth-child(1) { left: 16%; top: 25%; color: var(--reef-cyan); }
.mask-glyph:nth-child(2) { right: 14%; top: 18%; animation-delay: -2s; }
.mask-glyph:nth-child(3) { left: 9%; bottom: 21%; color: var(--coral-checksum); animation-delay: -5s; }
.mask-glyph:nth-child(4) { right: 30%; bottom: 14%; color: var(--algae-electric); animation-delay: -3s; }
.mask-glyph:nth-child(5) { left: 43%; top: 10%; animation-delay: -7s; }
.mask-glyph:nth-child(6) { right: 8%; bottom: 34%; color: var(--reef-cyan); animation-delay: -9s; }

.closing-plate {
    width: min(46rem, 78vw);
    padding: clamp(1.5rem, 4vw, 4rem);
    border: 1px solid rgba(38, 243, 226, 0.26);
    background: linear-gradient(135deg, rgba(3, 16, 20, 0.82), rgba(6, 59, 70, 0.48));
    backdrop-filter: blur(12px);
}

.closing-plate .ceremonial-heading {
    max-width: 13ch;
    margin-bottom: 2rem;
    font-size: clamp(2.2rem, 5vw, 5.2rem);
}

@keyframes saltDrift {
    0%, 100% { transform: translate3d(0, 0, 0); }
    40% { transform: translate3d(-1.5%, 1%, 0); }
    70% { transform: translate3d(1%, -1.3%, 0); }
}

@keyframes slowScan {
    0% { transform: translateY(-45vh); opacity: 0; }
    12% { opacity: 1; }
    100% { transform: translateY(125vh); opacity: 0; }
}

@keyframes maskFloat {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
    50% { transform: translate3d(0.8rem, -1rem, 0) rotate(1deg); }
}

@keyframes maskScan {
    0%, 100% { transform: translateY(1.2rem); opacity: 0; }
    20%, 78% { opacity: 1; }
    50% { transform: translateY(93%); }
}

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

@keyframes glyphDrift {
    0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.36; }
    45% { transform: translate3d(1rem, -1.4rem, 0); opacity: 0.88; }
    62% { text-shadow: 0.08em 0 var(--coral-checksum), -0.08em 0 var(--reef-cyan); }
}

@media (max-width: 840px) {
    .protocol-mask {
        position: relative;
        left: auto;
        top: auto;
        margin: 6vh 0 0 8vw;
    }

    .wordmark {
        padding-top: 4vh;
        font-size: clamp(2.7rem, 16vw, 5.6rem);
    }

    .glitch-title::before,
    .glitch-title::after {
        inset: 4vh auto auto 0;
    }

    .tide-band,
    .manuscript-chamber {
        grid-template-columns: 1fr;
    }

    .tide-band:nth-child(n) {
        transform: none;
    }

    .ceremonial-heading {
        max-width: 11ch;
    }

    .diagram-plate {
        min-height: 44vh;
    }
}
