/* clogged.link / najdi.link – shared landing & error page */

:root {
    --bg:        #111;
    --text:      #888;
    --text-dim:  #444;
    --logo:      none;        /* filter for <img> fallback */
    --logo-fill: #fff;        /* fill for inline SVG */
}

/* najdi.link */
.light {
    --bg:        #e3f3ff;
    --text:      #6b7f8f;
    --text-dim:  #a9bccb;
    --logo:      invert(0.75);
    --logo-fill: #404040;
}

/* cyberpunk (data-theme="cyber" or ?theme=cyber) – overrides dark / light */
.cyber {
    --bg:               #0b0716;
    --text:             #b07cff;
    --text-dim:         #4d3a73;
    --logo:             none;
    --logo-fill:        #e9f7ff;
    --space-fill:       #05d9e8;    /* upper half + "space" */
    --time-fill:        #ff2a6d;    /* lower half + "time"  */
    --void-from:        #05d9e8;    /* field gradient, left → right */
    --void-to:          #ff2a6d;
    --void-glitch:      0.6;        /* glitches per second */
    --void-glitch-color:#f9f002;
    --line-fill:        #f9f002;    /* SPACE / TIME line + time block */
    --glow-line:        drop-shadow(0 0 4px rgba(249, 240, 2, .7));
    --glow-space:       drop-shadow(0 0 6px rgba(5, 217, 232, .55));
    --glow-time:        drop-shadow(0 0 6px rgba(255, 42, 109, .55));
    --glow-void:        drop-shadow(0 0 5px rgba(176, 124, 255, .45));
}

/* ---------------------------------------------------------------------------
 *  More themes – set with ?theme=… / ?preset=… (logo.js), all only CSS variables
 *  --label-fill  SPACE / TIME letters      --line-fill  line + time block
 *  --void-fill   blocks in void mode       --glow-*     filters (glow, emboss)
 * ------------------------------------------------------------------------- */

/* auto: colors follow the time of day (logo.js sets tod-dawn … tod-night) */
.tod-night {
    --bg: #111;    --text: #888;    --text-dim: #444;
    --logo: none;  --logo-fill: #fff;
    --line-fill: #fff;
}
.tod-dawn {
    --bg: #f3e5da; --text: #a3807a; --text-dim: #d3bab0;
    --logo: invert(0.78); --logo-fill: #3e3542;
    --label-fill: #7a6168; --line-fill: #e8875a;
}
.tod-day {
    --bg: #e3f3ff; --text: #6b7f8f; --text-dim: #a9bccb;
    --logo: invert(0.75); --logo-fill: #404040;
    --line-fill: #3a86c8;
}
.tod-dusk {
    --bg: #2a2036; --text: #b593ad; --text-dim: #5c4661;
    --logo: none;  --logo-fill: #f4d6bb;
    --label-fill: #e2b9a6; --line-fill: #ff9a66;
}

/* blueprint: the logo's grid drawn on the page */
.blueprint {
    --bg: #0e2747; --text: #7fa6d6; --text-dim: #36577f;
    --logo: none;  --logo-fill: #e8f1ff;
    --label-fill: #a9c6ec; --line-fill: #7fb6ff; --void-fill: #cfe2ff;
    --glow-line: drop-shadow(0 0 3px rgba(127, 182, 255, .6));
}
body.blueprint {
    /* 10 px grid (half the logo pitch), lines fall into the gaps between blocks */
    background-image:
        linear-gradient(rgba(127, 182, 255, .08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(127, 182, 255, .08) 1px, transparent 1px);
    background-size: 10px 10px;
    background-position: calc(50% + 5px) calc(50% + 5.2px);
}

/* emboss: blocks pressed into paper */
.emboss {
    --bg: #e6e1d6; --text: #8f8676; --text-dim: #bdb4a3;
    --logo: none;  --logo-fill: #ece8df;
    --label-fill: #8f8676; --line-fill: #b1a793; --void-fill: #ece8df;
    --emboss: drop-shadow(1px 1px 0 rgba(90, 75, 50, .3)) drop-shadow(-1px -1px 0 rgba(255, 255, 255, .9));
    --glow-space: var(--emboss); --glow-time: var(--emboss); --glow-void: var(--emboss);
    --glow-line: drop-shadow(0 1px 0 rgba(255, 255, 255, .9));
}

/* phosphor: green terminal, scanlines, the time block blinks like a cursor */
.phosphor {
    --bg: #040a06; --text: #2bd165; --text-dim: #146b35;
    --logo: none;  --logo-fill: #39ff7a;
    --line-fill: #39ff7a; --void-fill: #39ff7a;
    --glow-space: drop-shadow(0 0 5px rgba(57, 255, 122, .5));
    --glow-time:  var(--glow-space); --glow-void: var(--glow-space); --glow-line: var(--glow-space);
}
body.phosphor::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px);
}
.phosphor .split-tick { animation: cursor 1s steps(1) infinite; }
@keyframes cursor { 50% { visibility: hidden; } }

/* eclipse: the logo almost disappears, only the line between shines */
.eclipse {
    --bg: #000;    --text: #3d3d3d; --text-dim: #1f1f1f;
    --logo: none;  --logo-fill: #1a1a1a;
    --label-fill: #777; --line-fill: #fff; --void-fill: #2a2a2a;
    --glow-line: drop-shadow(0 0 4px rgba(255, 255, 255, .9)) drop-shadow(0 0 14px rgba(255, 255, 255, .45));
}
.eclipse .logos > svg.logo rect.lit { fill: #fff; }

body { transition: background-color 1.5s ease, color 1.5s ease; }

* { margin: 0; padding: 0; }

html, body { width: 100%; height: 100%; }

html { touch-action: manipulation; }  /* no double-tap zoom on phones */

body {
    background: var(--bg);
    font-family: 'Roboto', sans-serif;
    font-weight: 400;
}

.centered {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.logos {
    position: relative;
    user-select: none;
    touch-action: manipulation;       /* no double-tap zoom on phones */
    -webkit-tap-highlight-color: transparent;
}

.logo {
    display: block;
    margin: 0 auto;
    overflow: visible;        /* blocks may fly outside the SVG box */
}

img.logo { filter: var(--logo); }

svg.logo rect {
    fill: var(--logo-fill);
    cursor: pointer;
    transform-box: fill-box;
    transform-origin: center;
}

.separator { height: 2px; }

/* Word written between "space" and "time" on double-click (logo.js) */
.word {
    position: absolute;
    left: 50%;
    width: max-content;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    visibility: hidden;
    pointer-events: none;
}

/* Default double-click: SPACE / line / TIME (logo.js createSplit) */
.split {
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    visibility: hidden;
    pointer-events: none;
}

.split-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 300;
    line-height: 1;
    text-transform: uppercase;
    color: var(--label-fill, var(--logo-fill));
}

.split-row span {
    display: inline-block;
    text-align: center;
    opacity: 0;
}

/* captions that don't match the column count: spaced and centered */
.split-free { justify-content: center; letter-spacing: 0.4em; padding-left: 0.4em; }

.split-space { color: var(--space-fill, var(--label-fill, var(--logo-fill))); }
.split-time  { color: var(--time-fill,  var(--label-fill, var(--logo-fill))); }

/* legend (?legend=1): letters can be hovered, their Morse column lights up */
.split.legend .split-row span {
    pointer-events: auto;
    cursor: default;
    padding: 6px 0;                   /* bigger hover target, same layout */
    margin: -6px 0;
    transition: color .2s ease;
}
.split-row span.on { color: var(--line-fill, var(--logo-fill)); }
svg.logo rect { transition: opacity .25s ease; }
svg.logo.focus rect:not(.lit) { opacity: .18; }

.split-line {
    position: relative;               /* width set by logo.js (columns) */
    filter: var(--glow-line, none);
    height: 1px;
    margin: 10px 0;
}

.split-seg,
.split-tick {
    position: absolute;
    left: 0;
    background: var(--line-fill, var(--logo-fill));
    opacity: 0;
}

.split-seg  { top: 0;    height: 1px; }
.split-tick { top: -1px; height: 3px; }

.morse { display: block; overflow: visible; }

.morse rect {
    fill: var(--logo-fill);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}

.word-caption {
    margin-top: 18px;
    font-size: 11px;
    letter-spacing: 0.45em;
    padding-left: 0.45em;             /* balances trailing letter-spacing */
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text);
    opacity: 0;
}

.message {
    margin-top: 48px;
    font-size: 14px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text);
}

.host {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-dim);
}

/* data-mode="void" (void.js): dust canvas behind the logo */
.void-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    visibility: hidden;
}

/* halves get their own color + glow when a theme defines it */
.logos > svg.logo:first-of-type        { filter: var(--glow-space, none); }
.logos > svg.logo:last-of-type         { filter: var(--glow-time, none); }
.logos > svg.logo:first-of-type rect   { fill: var(--space-fill, var(--logo-fill)); }
.logos > svg.logo:last-of-type rect    { fill: var(--time-fill, var(--logo-fill)); }
.void-canvas                           { filter: var(--glow-void, none); }

/* telegraph (?tick=morse): the column being played dims, each sign lights up */
svg.logo rect.tg-col { opacity: .28; transition: none; }
.logos > svg.logo rect.sig { opacity: 1; fill: var(--line-fill, var(--logo-fill)) !important; }
.split.telegraph .split-tick:not(.sig) { opacity: .35 !important; }

/* telegraph: tick hidden during a word space */
.split.telegraph .split-tick.away { opacity: 0 !important; transition: opacity .15s ease; }

/* error pages: the status code as a telegraph tape under the message */
.code-tape { display: block; margin: 12px auto 4px; overflow: visible; }
.code-tape rect {
    fill: var(--line-fill, var(--logo-fill));
    opacity: 0;
    transition: opacity .6s ease;
}
.code-tape.on rect        { opacity: .3; }
.code-tape.on rect.tg-col { opacity: .55; transition: none; }
.code-tape.on rect.sig    { opacity: 1;   transition: none; }
.code-digit    { transition: color .15s ease; }
.code-digit.on { color: var(--line-fill, var(--logo-fill)); }
