/* =========================================================================
   Synthwave landing page
   Palettes live in index.php (generated from lib/themes.php) as
   html[data-theme="..."] custom properties. This file only consumes them.
   ========================================================================= */

:root {
    --horizon: 58%;
    --grid-cell: 62px;
    --font-display: "Monoton", "Orbitron", system-ui, sans-serif;
    --font-tech: "Orbitron", "SF Mono", ui-monospace, monospace;
    --font-body: "Rajdhani", "Avenir Next", system-ui, -apple-system, sans-serif;
    --radius: 14px;
}

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

html {
    background: #04010a;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--sky-top);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.45;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* -------------------------------------------------------------- the scene */

.scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
    contain: strict;
}

.sky {
    position: absolute;
    inset: 0 0 calc(100% - var(--horizon)) 0;
    background:
        linear-gradient(to bottom, transparent 46%, rgba(0, 0, 0, 0.42) 100%),
        radial-gradient(120% 78% at 50% 100%, var(--haze) 0%, transparent 55%),
        linear-gradient(to bottom,
            var(--sky-top) 0%,
            var(--sky-top) 18%,
            var(--sky-mid) 62%,
            var(--sky-low) 100%);
}

/* Stars: three 1px elements, each carrying a whole layer as box-shadows. */

.starfield {
    position: absolute;
    inset: 0 0 calc(100% - var(--horizon)) 0;
    overflow: hidden;
    mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 96%);
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 96%);
}

.stars {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    background: transparent;
    will-change: opacity;
}

.stars--far {
    width: 1px;
    height: 1px;
    animation: twinkle 5.5s ease-in-out infinite;
}

.stars--mid {
    width: 2px;
    height: 2px;
    opacity: 0.85;
    animation: twinkle 8s ease-in-out infinite reverse;
}

.stars--near {
    width: 3px;
    height: 3px;
    filter: drop-shadow(0 0 4px #fff);
    animation: twinkle 11s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: 0.35; }
    50%      { opacity: 1; }
}

/* The sun, sliced by widening slits toward its base.
   The halo lives outside the masked body -- a glow on the masked element
   itself gets clipped to its box and shows up as a bright rectangle. */

.sun {
    position: absolute;
    left: 50%;
    bottom: calc(100% - var(--horizon));
    width: min(40vh, 74vw);
    aspect-ratio: 1;
}

.sun__halo {
    position: absolute;
    inset: -46%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%,
        var(--haze) 0%,
        color-mix(in srgb, var(--haze) 45%, transparent) 26%,
        transparent 62%);
    opacity: 0.5;
    animation: sun-breathe 7s ease-in-out infinite;
}

.sun__body {
    position: absolute;
    inset: 0;
    mask-image: linear-gradient(to bottom,
        #000 0 57%,
        transparent 57% 58.6%,
        #000 58.6% 66%,
        transparent 66% 68.4%,
        #000 68.4% 75%,
        transparent 75% 78.2%,
        #000 78.2% 84%,
        transparent 84% 88%,
        #000 88% 93%,
        transparent 93% 97.5%,
        #000 97.5% 100%);
    -webkit-mask-image: linear-gradient(to bottom,
        #000 0 57%,
        transparent 57% 58.6%,
        #000 58.6% 66%,
        transparent 66% 68.4%,
        #000 68.4% 75%,
        transparent 75% 78.2%,
        #000 78.2% 84%,
        transparent 84% 88%,
        #000 88% 93%,
        transparent 93% 97.5%,
        #000 97.5% 100%);
}

.sun__disc {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(to bottom,
        var(--sun-top) 0%,
        var(--sun-mid) 46%,
        var(--sun-bottom) 100%);
}

.sun__sheen {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%,
        rgba(255, 255, 255, 0.22) 0%,
        transparent 48%);
}

@keyframes sun-breathe {
    0%, 100% { opacity: 0.42; transform: scale(0.97); }
    50%      { opacity: 0.68; transform: scale(1.04); }
}

/* Mountain silhouettes standing on the horizon. */

.ridge {
    position: absolute;
    left: -1%;
    width: 102%;
    top: calc(var(--horizon) - 17vh);
    height: 17vh;
    filter: drop-shadow(0 0 12px var(--haze));
}

.ridge__back,
.ridge__front {
    fill: color-mix(in srgb, var(--ridge) 78%, #000);
    stroke: var(--ridge-edge);
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
}

.ridge__back {
    opacity: 0.6;
}

.ridge__front {
    fill: #05010a;
}

.horizon {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--horizon);
    height: 2px;
    background: var(--neon);
    box-shadow:
        0 0 14px 3px var(--haze),
        0 0 44px 12px var(--haze),
        0 0 120px 40px var(--haze);
}

/* The infinite floor. */

.floor {
    position: absolute;
    left: -60%;
    right: -60%;
    top: var(--horizon);
    bottom: -2px;
    perspective: 30vh;
    perspective-origin: 50% 0%;
    overflow: hidden;
    background: linear-gradient(to bottom, #000 0%, var(--sky-top) 70%);
    mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 100%);
}

.floor__grid {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 340%;
    transform-origin: 50% 0%;
    transform: rotateX(77deg);
    background-image:
        repeating-linear-gradient(to right,
            var(--grid-line) 0 2px, transparent 2px var(--grid-cell)),
        repeating-linear-gradient(to bottom,
            var(--grid-line) 0 2px, transparent 2px var(--grid-cell));
    filter: drop-shadow(0 0 6px var(--grid-glow));
    animation: floor-run 2.6s linear infinite;
}

@keyframes floor-run {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 0 var(--grid-cell), 0 var(--grid-cell); }
}

/* CRT dressing. */

.scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(to bottom,
        rgba(0, 0, 0, 0.24) 0 1px,
        transparent 1px 3px);
    opacity: 0.55;
    mix-blend-mode: multiply;
}

.scanlines::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 22vh;
    background: linear-gradient(to bottom,
        transparent, rgba(255, 255, 255, 0.055), transparent);
    animation: sweep 7.5s linear infinite;
}

@keyframes sweep {
    from { transform: translateY(-24vh); }
    to   { transform: translateY(124vh); }
}

.vignette {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top,
            rgba(0, 0, 0, 0.86) 0%,
            rgba(0, 0, 0, 0.45) 16%,
            transparent 36%),
        radial-gradient(120% 92% at 50% 45%,
            transparent 42%, rgba(0, 0, 0, 0.55) 100%);
}

/* ------------------------------------------------------------- the layout */

.page {
    position: relative;
    z-index: 2;
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: clamp(18px, 3.5vw, 44px) clamp(16px, 4vw, 40px) clamp(32px, 6vw, 72px);
    display: flex;
    flex-direction: column;
    gap: clamp(22px, 3.4vw, 40px);
    min-height: 100vh;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.8rem, 6.2vw, 3.4rem);
    line-height: 1;
    letter-spacing: 0.02em;
    color: var(--ink);
    text-shadow:
        0 0 6px var(--neon),
        0 0 18px var(--neon),
        0 0 46px var(--haze),
        0 0 90px var(--haze);
    animation: sign-flicker 9s linear infinite;
}

@keyframes sign-flicker {
    0%, 42%, 44%, 47%, 100% { opacity: 1; }
    43%                     { opacity: 0.72; }
    45.5%                   { opacity: 0.55; }
}

.logo__sub {
    margin: 8px 0 0;
    font-size: 0.82rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.pulse {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 9px;
    border-radius: 50%;
    background: var(--neon-2);
    box-shadow: 0 0 10px 2px var(--neon-2);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.75); }
}

/* Theme chips ------------------------------------------------------------- */

.themes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 10px;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    background: var(--panel);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--ink-dim);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.chip:hover,
.chip:focus-visible {
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: 0 0 18px -2px var(--haze);
}

.chip--on {
    color: var(--ink);
    border-color: var(--neon);
    box-shadow: 0 0 16px -2px var(--neon), inset 0 0 14px -8px var(--neon);
}

.chip__dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chip-a), var(--chip-b));
    box-shadow: 0 0 8px 0 var(--chip-a);
}

/* Hero clock -------------------------------------------------------------- */

.hero {
    position: relative;
    text-align: center;
    margin-top: clamp(4px, 2vw, 24px);
}

/* A soft scrim: the sun stays visible, the clock stays legible. */
.hero::before {
    content: "";
    position: absolute;
    inset: -14% 0;
    z-index: -1;
    background: radial-gradient(closest-side ellipse at 50% 50%,
        rgba(0, 0, 0, 0.34) 0%,
        rgba(0, 0, 0, 0.2) 58%,
        transparent 100%);
    pointer-events: none;
}

.hero__label,
.hero__sub {
    margin: 0;
    color: var(--ink);
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 12px rgba(0, 0, 0, 0.9),
        0 2px 18px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    font-size: clamp(0.66rem, 1.6vw, 0.8rem);
}

.hero__sub {
    margin-top: 10px;
    letter-spacing: 0.18em;
    font-size: clamp(0.82rem, 2.2vw, 1.05rem);
    color: var(--ink);
}

.hero__tz {
    display: block;
    margin-top: 6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    font-size: 0.72rem;
    letter-spacing: 0.26em;
    color: var(--ink-dim);
}

.clock {
    margin: 6px 0 0;
    font-family: var(--font-tech);
    font-weight: 900;
    font-size: clamp(3.4rem, 17vw, 9.5rem);
    line-height: 1.05;
    letter-spacing: -0.01em;
    background: linear-gradient(to bottom,
        #ffffff 0%,
        #ffffff 18%,
        var(--sun-top) 40%,
        var(--neon) 74%,
        var(--neon-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter:
        drop-shadow(0 0 26px rgba(0, 0, 0, 0.85))
        drop-shadow(0 3px 0 rgba(0, 0, 0, 0.7))
        drop-shadow(0 0 22px var(--haze));
    font-variant-numeric: tabular-nums;
}

.clock__unit {
    display: inline-block;
    min-width: 2ch;
    text-align: center;
}

.clock__sep {
    display: inline-block;
    transform: translateY(-0.06em);
    animation: colon 1s steps(1, end) infinite;
}

@keyframes colon {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0.25; }
}

/* A line switched off in config.php keeps its box, so the clock keeps the
   white space around it. The non-breaking space gives the empty line height. */
.is-blank::after {
    content: "\00a0";
}

/* As the first child of a blank line the margin would collapse into the
   parent's; padding holds the same 6px open. */
.hero__tz.is-blank {
    margin-top: 0;
    padding-top: 6px;
}

/* Cards ------------------------------------------------------------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
    gap: clamp(12px, 1.6vw, 18px);
}

/* Once the four cards share a row, size them by what they hold rather than
   equally: the week is two digits, the name day can be three names. */
@media (min-width: 1060px) {
    .cards {
        grid-template-columns: 1.05fr 0.82fr 1fr 1.2fr;
    }
}

.card {
    position: relative;
    container-type: inline-size;
    overflow: hidden;
    padding: 18px 18px 20px;
    border: 1px solid var(--panel-edge);
    border-radius: var(--radius);
    background: var(--panel);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow:
        0 18px 40px -24px #000,
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--neon), transparent);
    opacity: 0.9;
}

.card::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -60px;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: var(--haze);
    filter: blur(46px);
    opacity: 0.22;
    pointer-events: none;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--neon);
    box-shadow:
        0 24px 46px -24px #000,
        0 0 28px -12px var(--neon),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.card__title {
    margin: 0 0 10px;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--neon-2);
}

.card__value {
    position: relative;
    margin: 0;
    font-family: var(--font-tech);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.4vw, 2.3rem);
    line-height: 1.1;
    background: linear-gradient(to bottom, #ffffff, var(--neon-3) 55%, var(--neon));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 12px var(--haze));
}

.card__value--mono {
    /* The ISO date has to hold one line. In the four-column layout the card
       gives it ~205px, and Orbitron is a wide face, so this is sized off the
       card with room to spare. The vw rule is the fallback for browsers
       without container query units. */
    font-size: clamp(1.05rem, 2.1vw, 1.7rem);
    font-size: clamp(1.05rem, 12cqi, 1.7rem);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.card__value--tight {
    font-size: clamp(1.3rem, 2.9vw, 1.8rem);
}

.card__value--names {
    word-break: break-word;
}

.card__prefix {
    font-size: 0.5em;
    opacity: 0.7;
    vertical-align: 0.28em;
    margin-right: 0.06em;
}

.card__note {
    margin: 10px 0 0;
    font-size: 0.94rem;
    color: var(--ink);
}

.card__meta {
    margin: 4px 0 0;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

/* Weekday strip ----------------------------------------------------------- */

.week-strip {
    display: flex;
    gap: 5px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.week-strip__day {
    flex: 1;
    padding: 5px 0;
    border: 1px solid var(--panel-edge);
    border-radius: 6px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--ink-dim);
}

.week-strip__day--on {
    color: #0b0110;
    background: var(--neon);
    border-color: var(--neon);
    box-shadow: 0 0 14px -1px var(--neon);
}

/* Meters ------------------------------------------------------------------ */

.meters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: clamp(12px, 1.6vw, 18px);
}

.meter__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.meter__value {
    font-family: var(--font-tech);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink);
}

.meter__track {
    height: 8px;
    border: 1px solid var(--panel-edge);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.meter__fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(to right, var(--neon-2), var(--neon), var(--neon-3));
    box-shadow: 0 0 14px 0 var(--neon);
    transition: width 0.6s ease;
}

/* Footer ------------------------------------------------------------------ */

.footer {
    margin-top: auto;
    padding-top: 6px;
    text-align: center;
}

.footer__line {
    margin: 3px 0;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.footer__line--dim {
    opacity: 0.66;
}

.footer code {
    font-family: var(--font-tech);
    font-size: 0.9em;
    color: var(--neon-2);
}

.footer__warn {
    color: var(--neon-3);
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 640px) {
    :root {
        --horizon: 52%;
        --grid-cell: 54px;
    }

    .masthead {
        flex-direction: column;
    }

    .clock {
        font-size: clamp(2.6rem, 14.5vw, 5rem);
    }

    .clock__unit {
        min-width: 1.8ch;
    }

    .hero__label {
        letter-spacing: 0.2em;
    }

    .card__note {
        font-size: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ------------------------------------------------- pointer parallax (JS) */

:root {
    --px: 0;
    --py: 0;
}

.starfield {
    transform: translate3d(calc(var(--px) * 8px), calc(var(--py) * 5px), 0);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.sun {
    transform: translateX(-50%) translate3d(calc(var(--px) * -12px), calc(var(--py) * -7px), 0);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.sun__halo {
    will-change: opacity, transform;
}

.ridge {
    transform: translate3d(calc(var(--px) * -20px), 0, 0);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
    .starfield,
    .sun,
    .ridge {
        transform: none;
    }

    .sun {
        transform: translateX(-50%);
    }
}
