/* ============================================================
   pmt.moe — A Twilight Observatory
   Palette derived strictly from twilight color temperatures.
   ============================================================ */

:root {
    --bg-civil: #1B2838;
    --bg-nautical: #0F1B2D;
    --bg-astronomical: #080E1A;
    --bg-night: #030508;
    --text-primary: #C8D6E5;
    --text-secondary: #6B7D8E;
    --accent-cyan: #7DF9FF;
    --accent-radium: #39FF14;
    --highlight-violet: #4A2D73;

    --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
    --font-body: 'IBM Plex Sans', 'Inter', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
    --font-serif: 'Cormorant Garamond', 'Lora', Georgia, serif;

    --max-width: 1140px;
    --easing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--bg-civil);
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--text-primary);
    background-color: var(--bg-civil);
    line-height: 1.75;
    overflow-x: hidden;
    transition: background-color 2s ease;
    min-height: 100vh;
}

body[data-active="civil"] { background-color: var(--bg-civil); }
body[data-active="nautical"] { background-color: var(--bg-nautical); }
body[data-active="astronomical"] { background-color: var(--bg-astronomical); }
body[data-active="night"], body[data-active="outro"] { background-color: var(--bg-night); }
body[data-active="intro"] { background-color: var(--bg-civil); }

/* ----------------------------------------
   Noise grain overlay
   ---------------------------------------- */
.noise-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.04;
    mix-blend-mode: overlay;
    will-change: transform;
}

.noise-overlay svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ----------------------------------------
   Phase navigation dots
   ---------------------------------------- */
.phase-nav {
    position: fixed;
    top: 50%;
    right: 32px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 22px;
    z-index: 8000;
}

.phase-dot {
    display: block;
    width: 14px;
    height: 14px;
    cursor: crosshair;
    color: var(--accent-cyan);
    text-decoration: none;
    transition: opacity 0.4s var(--easing);
    opacity: 0.45;
}

.phase-dot svg {
    overflow: visible;
}

.phase-dot .ring {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 0.6;
    stroke-opacity: 0.7;
}

.phase-dot .core {
    fill: var(--accent-cyan);
    opacity: 0;
    transition: opacity 0.6s var(--easing);
}

.phase-dot.active {
    opacity: 1;
}

.phase-dot.active .core {
    opacity: 1;
    animation: phase-pulse 4s var(--easing) infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.phase-dot.active .ring {
    stroke-opacity: 1;
}

@keyframes phase-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ----------------------------------------
   Section base
   ---------------------------------------- */
.twilight-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 100px 0;
    width: 100%;
    transition: background-color 1.6s var(--easing);
}

.twilight-section.intro,
.twilight-section.civil { background-color: var(--bg-civil); }
.twilight-section.nautical { background-color: var(--bg-nautical); }
.twilight-section.astronomical { background-color: var(--bg-astronomical); }
.twilight-section.night,
.twilight-section.outro { background-color: var(--bg-night); }

.twilight-section.outro {
    min-height: 60vh;
    padding: 80px 0;
}

/* ----------------------------------------
   Grid (1:2:3:3:2:1 ratio at desktop)
   ---------------------------------------- */
.grid {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 32px;
    display: grid;
    grid-template-columns: 1fr 2fr 3fr 3fr 2fr 1fr;
    gap: 28px;
    align-items: start;
}

.grid > .masthead {
    grid-column: 2 / span 4;
    margin-bottom: 36px;
}

.grid > .intro-body {
    grid-column: 2 / span 4;
}

.grid > .margin-left {
    grid-column: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: start;
    padding-top: 8px;
}

.grid > .content {
    grid-column: 3 / span 2;
}

.grid > .margin-right {
    grid-column: 5 / span 2;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 8px;
}

.grid.narrow > .content {
    grid-column: 2 / span 4;
    max-width: 580px;
}

.grid.narrow > .margin-right.narrow {
    grid-column: 5 / span 2;
}

.grid.singular > .content {
    grid-column: 3 / span 2;
    max-width: 480px;
    margin: 0 auto;
    text-align: center;
}

/* ----------------------------------------
   Masthead / intro
   ---------------------------------------- */
.masthead {
    display: flex;
    flex-direction: column;
    gap: 14px;
    color: var(--text-secondary);
}

.logo-mark {
    color: var(--accent-cyan);
    line-height: 0;
}

.logo-svg {
    display: block;
    color: var(--accent-cyan);
}

.callsign {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 0 0 12px rgba(125, 249, 255, 0.15);
}

.callsign .dot-sep {
    color: var(--accent-cyan);
}

.meta-line {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.intro-body {
    margin-top: 24px;
}

.display-headline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.4rem, 5.6vw, 5rem);
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin: 18px 0 28px 0;
    text-shadow: 0 0 16px rgba(125, 249, 255, 0.12);
    text-transform: none;
}

.lede {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    color: var(--text-primary);
    max-width: 56ch;
    line-height: 1.75;
}

.instructional {
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-top: 36px;
}

.instructional .mono {
    margin-right: 8px;
    font-size: 1rem;
    display: inline-block;
    animation: descend 2.4s var(--easing) infinite;
}

@keyframes descend {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(4px); opacity: 1; }
}

/* ----------------------------------------
   Content typography
   ---------------------------------------- */
.caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    color: var(--accent-cyan);
    text-transform: uppercase;
    margin-bottom: 18px;
}

.section-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1.1;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 36px;
    text-shadow: 0 0 12px rgba(125, 249, 255, 0.15);
}

.body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.75;
    color: var(--text-primary);
    margin-bottom: 22px;
    max-width: 56ch;
}

.civil .body,
.intro .lede {
    font-weight: 300;
}

.body.small {
    font-size: 0.92rem;
    color: var(--text-secondary);
    max-width: 60ch;
    margin-left: auto;
    margin-right: auto;
}

.quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: 300;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    line-height: 1.45;
    color: var(--text-primary);
    background-color: rgba(74, 45, 115, 0.18);
    border-left: 1px solid var(--highlight-violet);
    padding: 22px 28px;
    margin: 32px 0;
    max-width: 50ch;
}

/* ----------------------------------------
   Data list
   ---------------------------------------- */
.data-list {
    list-style: none;
    margin-top: 36px;
    border-top: 0.5px solid rgba(125, 249, 255, 0.18);
    padding-top: 18px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    max-width: 48ch;
}

.data-list li {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 8px 0;
    border-bottom: 0.5px solid rgba(125, 249, 255, 0.08);
}

.data-list .data-key {
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.data-list .data-val {
    color: var(--accent-cyan);
    text-align: right;
}

.data-list.compact {
    margin-top: 28px;
    font-size: 0.74rem;
}

.data-list.center {
    margin-left: auto;
    margin-right: auto;
}

/* ----------------------------------------
   Mono helpers
   ---------------------------------------- */
.mono {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.dim {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* ----------------------------------------
   Constellation diagrams
   ---------------------------------------- */
.constellation {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.constellation svg {
    overflow: visible;
}

.constellation .stars circle {
    fill: var(--accent-cyan);
    fill-opacity: 0.55;
}

.constellation .lines .con-line {
    stroke: var(--text-primary);
    stroke-width: 0.5;
    stroke-opacity: 0.22;
    fill: none;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.6s var(--easing);
}

.constellation.in-view .lines .con-line {
    stroke-dashoffset: 0;
}

.constellation.in-view .lines .con-line:nth-child(1) { transition-delay: 0ms; }
.constellation.in-view .lines .con-line:nth-child(2) { transition-delay: 200ms; }
.constellation.in-view .lines .con-line:nth-child(3) { transition-delay: 400ms; }
.constellation.in-view .lines .con-line:nth-child(4) { transition-delay: 600ms; }
.constellation.in-view .lines .con-line:nth-child(5) { transition-delay: 800ms; }
.constellation.in-view .lines .con-line:nth-child(6) { transition-delay: 1000ms; }

.constellation figcaption {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

/* ----------------------------------------
   Polaris (full night)
   ---------------------------------------- */
.polaris {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 40px auto;
}

.polaris .polaris-core {
    fill: var(--accent-cyan);
    animation: polaris-pulse 4s var(--easing) infinite;
    transform-origin: center;
    transform-box: fill-box;
}

.polaris .polaris-halo {
    fill: none;
    stroke: var(--accent-cyan);
    stroke-width: 0.5;
    stroke-opacity: 0.4;
    animation: polaris-halo 4s var(--easing) infinite;
    transform-origin: center;
    transform-box: fill-box;
}

@keyframes polaris-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes polaris-halo {
    0%, 100% { stroke-opacity: 0.18; transform: scale(1); }
    50% { stroke-opacity: 0.5; transform: scale(1.2); }
}

/* ----------------------------------------
   Horizon dividers (seismograph)
   ---------------------------------------- */
.horizon-divider {
    width: 100%;
    height: 60px;
    overflow: hidden;
    position: relative;
    z-index: 5;
    background: transparent;
    margin: -30px 0;
    pointer-events: none;
}

.horizon-svg {
    display: block;
    transform: rotate(-2.5deg);
    transform-origin: center;
    width: 110%;
    margin-left: -5%;
    transition: transform 8s var(--easing);
}

.horizon-divider.tilt .horizon-svg {
    transform: rotate(-3deg);
}

/* ----------------------------------------
   Telescope reticle (astronomical)
   ---------------------------------------- */
.reticle {
    position: absolute;
    inset: 15%;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 1.4s var(--easing);
}

.astronomical.in-view .reticle {
    opacity: 1;
}

.reticle-line {
    position: absolute;
    background-color: var(--accent-cyan);
    opacity: 0.15;
}

.reticle-line.vertical {
    width: 0.5px;
    top: 0;
    bottom: 0;
}

.reticle-line.vertical.left { left: 0; }
.reticle-line.vertical.right { right: 0; }

.reticle-line.horizontal {
    height: 0.5px;
    left: 0;
    right: 0;
}

.reticle-line.horizontal.top { top: 0; }
.reticle-line.horizontal.bottom { bottom: 0; }

/* ----------------------------------------
   Outro
   ---------------------------------------- */
.outro {
    min-height: 60vh;
}

.center-content {
    text-align: center;
    max-width: 480px;
    margin: 0 auto;
}

.link-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 32px 0 28px 0;
    flex-wrap: wrap;
    align-items: center;
}

.text-link {
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.06em;
    text-transform: lowercase;
    border-bottom: 0.5px solid rgba(200, 214, 229, 0.3);
    padding-bottom: 2px;
    cursor: crosshair;
    transition: color 300ms var(--easing), text-shadow 300ms var(--easing), border-color 300ms var(--easing);
}

.text-link:hover {
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(125, 249, 255, 0.3);
    border-bottom-color: var(--accent-cyan);
}

.callsign-small {
    margin-top: 24px;
    font-size: 0.7rem;
}

/* ----------------------------------------
   Progressive disclosure (reveal)
   ---------------------------------------- */
.twilight-section .caption,
.twilight-section .section-title,
.twilight-section .display-headline,
.twilight-section .body,
.twilight-section .lede,
.twilight-section .quote,
.twilight-section .data-list,
.twilight-section .constellation,
.twilight-section .polaris,
.twilight-section .margin-left,
.twilight-section .meta-line,
.twilight-section .callsign,
.twilight-section .logo-mark,
.twilight-section .instructional,
.twilight-section .link-row,
.twilight-section .callsign-small {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1s var(--easing), transform 1s var(--easing), filter 600ms var(--easing);
}

.twilight-section .section-title,
.twilight-section .display-headline {
    filter: blur(3px);
}

.twilight-section.in-view .caption { opacity: 0.85; transform: translateY(0); transition-delay: 0ms; }
.twilight-section.in-view .section-title,
.twilight-section.in-view .display-headline {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0px);
    transition-delay: 150ms;
}
.twilight-section.in-view .lede,
.twilight-section.in-view .body { opacity: 1; transform: translateY(0); transition-delay: 300ms; }
.twilight-section.in-view .body:nth-of-type(2) { transition-delay: 450ms; }
.twilight-section.in-view .quote { opacity: 1; transform: translateY(0); transition-delay: 600ms; }
.twilight-section.in-view .data-list { opacity: 1; transform: translateY(0); transition-delay: 750ms; }
.twilight-section.in-view .constellation,
.twilight-section.in-view .polaris,
.twilight-section.in-view .margin-left { opacity: 1; transform: translateY(0); transition-delay: 900ms; }
.twilight-section.in-view .meta-line { opacity: 0.8; transform: translateY(0); transition-delay: 600ms; }
.twilight-section.in-view .callsign { opacity: 1; transform: translateY(0); transition-delay: 200ms; }
.twilight-section.in-view .logo-mark { opacity: 1; transform: translateY(0); transition-delay: 0ms; }
.twilight-section.in-view .instructional { opacity: 1; transform: translateY(0); transition-delay: 900ms; }
.twilight-section.in-view .link-row { opacity: 1; transform: translateY(0); transition-delay: 300ms; }
.twilight-section.in-view .callsign-small { opacity: 0.7; transform: translateY(0); transition-delay: 600ms; }

/* ----------------------------------------
   Responsive
   ---------------------------------------- */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 24px;
    }
    .grid > .masthead { grid-column: 1 / span 4; }
    .grid > .intro-body { grid-column: 1 / span 4; }
    .grid > .margin-left { grid-column: 1 / span 4; flex-direction: row; gap: 18px; }
    .grid > .content { grid-column: 1 / span 3; }
    .grid > .margin-right { grid-column: 4 / span 1; }
    .grid.narrow > .content { grid-column: 1 / span 4; }
    .grid.narrow > .margin-right.narrow { grid-column: 1 / span 4; align-items: flex-start; padding-top: 24px; }
    .grid.singular > .content { grid-column: 1 / span 4; }

    .phase-nav { right: 18px; gap: 16px; }
}

@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 0 24px;
    }
    .grid > .masthead,
    .grid > .intro-body,
    .grid > .margin-left,
    .grid > .content,
    .grid > .margin-right,
    .grid.narrow > .content,
    .grid.narrow > .margin-right.narrow,
    .grid.singular > .content {
        grid-column: 1;
    }

    .grid > .margin-right {
        align-items: flex-start;
        margin-top: 16px;
    }

    .twilight-section {
        padding: 80px 0;
    }

    .phase-nav {
        right: 12px;
        gap: 14px;
    }

    .display-headline {
        font-size: clamp(2rem, 8vw, 2.8rem);
    }

    .section-title {
        font-size: clamp(1.6rem, 7vw, 2.4rem);
    }

    .reticle {
        inset: 8%;
    }
}

@media (max-width: 480px) {
    .grid {
        padding: 0 24px;
    }
    .data-list li {
        flex-direction: column;
        gap: 4px;
    }
    .data-list .data-val {
        text-align: left;
    }
}
