/*
  Slashdream — public web site.

  Colors are the Slashdream/Brand palette: Night, Moon, Gold/Amber (sparkle) and the Dusk gradient, which is
  kept to the trail (mark, step line, dividers) and never used on letters. Dark is the default sky; light
  follows the visitor's system setting. System fonts, no scripts, no third-party requests.
*/

:root {
    --night: #16132e;
    --moon: #f3eee0;
    --gold: #ffd166;
    --amber: #f7b84b;
    --violet: #b69cff;
    --sky: #5cc8ff;

    --bg: var(--night);
    --surface: #1f1b3f;
    --ink: var(--moon);
    --muted: rgb(243 238 224 / 0.72);
    --line: rgb(243 238 224 / 0.14);
    --accent: var(--sky);
    --spark: var(--gold);
    --spark-ink: var(--gold);
    --star: rgb(243 238 224 / 0.55);
    --btn-ink: var(--night);
    --btn-bg: var(--gold);
    --btn-bg-hover: #ffdf91;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    --slant: -16deg;
    --radius: 0.9rem;
    --wrap: 68rem;

    color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: var(--moon);
        --surface: #fbf9f2;
        --ink: var(--night);
        --muted: rgb(22 19 46 / 0.72);
        --line: rgb(22 19 46 / 0.14);
        --accent: #4a2fc2;
        --spark: var(--amber);
        --spark-ink: #8f5b00;
        --star: transparent;
        --btn-ink: var(--moon);
        --btn-bg: var(--night);
        --btn-bg-hover: #2b2652;
    }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 1.0625rem;
    line-height: 1.6;
    /* A sparse starfield: a few one-pixel dots in a tile, repeated. Gone in the light theme. */
    background-image:
        radial-gradient(1px 1px at 12% 18%, var(--star), transparent),
        radial-gradient(1px 1px at 78% 9%, var(--star), transparent),
        radial-gradient(1.5px 1.5px at 41% 52%, var(--star), transparent),
        radial-gradient(1px 1px at 91% 64%, var(--star), transparent),
        radial-gradient(1px 1px at 23% 83%, var(--star), transparent),
        radial-gradient(1.5px 1.5px at 62% 91%, var(--star), transparent);
    background-size: 520px 520px;
}

main { flex: 1; }

img { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.6em; }
h1 { font-size: clamp(2.4rem, 6vw + 0.5rem, 4.4rem); font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.6rem, 2.4vw + 0.8rem, 2.3rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }

/* Same lean as the wordmark and the trail of the mark. */
h1 em { font-style: italic; }
/* The slash is drawn, not typed: a rounded bar leaning at the mark's own 16deg (the trail goes from (221,398) to (286,172)),
   so it matches the logo whatever the font. It scales with the text around it. */
.slash { display: inline-block; width: 0.2em; height: 0.95em; margin-right: 0.3em; border-radius: 999px; background: var(--spark); transform: rotate(16deg); vertical-align: -0.08em; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.skip-link { position: absolute; left: 1rem; top: -4rem; background: var(--btn-bg); color: var(--btn-ink); padding: 0.5rem 1rem; border-radius: 0.5rem; z-index: 10; }
.skip-link:focus { top: 1rem; }

/* Header */
/* Not sticky: the wordmark overhangs the bar, which would cover the text scrolling under it. The overhang gets its own room. */
.site-header { position: relative; z-index: 5; border-bottom: 1px solid var(--line); margin-bottom: 3.4rem; }
.bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; height: 4.2rem; }
/* The wordmark is scaled up so that "slash" sits on the navigation's line and "dream" hangs just below the header. */
.brand { display: inline-flex; line-height: 0; position: relative; z-index: 1; margin-top: 0.15rem; }
.brand-logo { height: 7.2rem; width: auto; display: block; }
.site-header nav { padding-top: 1.1rem; }
.site-header nav { display: flex; align-items: center; gap: clamp(0.6rem, 2.5vw, 1.6rem); }
.nav-link { color: var(--ink); text-decoration: none; font-family: var(--mono); font-size: 0.95rem; padding: 0.3rem 0.1rem; border-bottom: 2px solid transparent; }
.nav-link:hover, .nav-link.active { border-bottom-color: var(--spark); }

/* Buttons */
.btn { display: inline-block; background: var(--btn-bg); color: var(--btn-ink); text-decoration: none; font-weight: 700; padding: 0.8rem 1.4rem; border-radius: 999px; border: 2px solid var(--btn-bg); transition: background-color 0.15s, transform 0.15s; }
.btn:hover { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); transform: translateY(-1px); }
.btn-small { padding: 0.4rem 1rem; font-size: 0.92rem; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: transparent; border-color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.6rem 0 0; }

.eyebrow { font-family: var(--mono); font-size: 0.95rem; color: var(--muted); margin-bottom: 1rem; }
.lead { font-size: clamp(1.1rem, 0.6vw + 1rem, 1.35rem); color: var(--muted); max-width: 40rem; }

/* Hero */
.hero { position: relative; overflow: hidden; padding-block: clamp(0.5rem, 3vw, 2rem) 2rem; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; align-items: center; gap: 2rem; }
.hero-art { display: flex; justify-content: center; }
.hero-art .stardust { width: min(100%, 22rem); height: auto; }

/* A single meteor streaking across the sky, now and then. */
.hero::before {
    content: "";
    position: absolute;
    top: 8%;
    right: -10%;
    width: 9rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--sky));
    transform: rotate(-24deg);
    opacity: 0;
    animation: meteor 14s ease-in 3s infinite;
}
@media (prefers-color-scheme: light) { .hero::before { display: none; } }

/* The mark: the trail streaks in from the tail, then the sparkle lights up. */
.stardust path[pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; animation: streak 1.1s cubic-bezier(0.3, 0.6, 0.2, 1) forwards; }
.stardust-left { animation-delay: 0.35s; }
.stardust-right { animation-delay: 0.55s; }
.stardust-sparkle { fill: var(--spark); transform-origin: center; transform-box: fill-box; animation: sparkle-in 0.6s ease-out 0.9s backwards, twinkle 4.5s ease-in-out 1.6s infinite; }

@keyframes streak { to { stroke-dashoffset: 0; } }
@keyframes sparkle-in { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes twinkle { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.82); } }
@keyframes meteor {
    0% { opacity: 0; transform: translate(0, 0) rotate(-24deg); }
    4% { opacity: 0.9; }
    12% { opacity: 0; transform: translate(-32rem, 14rem) rotate(-24deg); }
    100% { opacity: 0; transform: translate(-32rem, 14rem) rotate(-24deg); }
}

/* Make-believe terminal */
.terminal { margin: clamp(2rem, 5vw, 3.5rem) 0 0; max-width: 40rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.terminal-bar { display: flex; gap: 0.4rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--line); }
.terminal-bar span { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--line); }
.terminal pre { margin: 0; padding: 1rem 1.2rem 1.2rem; overflow-x: auto; font-family: var(--mono); font-size: 0.92rem; line-height: 1.7; }
.terminal code { font-family: inherit; }
.terminal .prompt { color: var(--accent); }
.terminal .ok { color: var(--spark-ink); }
.cursor { display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.4em; vertical-align: text-bottom; background: var(--spark); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Sections */
.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.page-head { padding-block: clamp(0.5rem, 3vw, 2rem) 0; }
.page-head h1 { font-size: clamp(2.2rem, 5vw + 0.5rem, 3.8rem); }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin-top: 1.6rem; }
.cards-2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.card p:last-child { margin-bottom: 0; color: var(--muted); }
.card-index { font-family: var(--mono); font-size: 0.85rem; color: var(--spark-ink); margin-bottom: 0.4rem; }

/* "From wish to shipped": a vertical trail with a sparkle at every step. */
.trail-steps { list-style: none; margin: 1.8rem 0 0; padding: 0 0 0 2.2rem; position: relative; counter-reset: step; }
.trail-steps::before { content: ""; position: absolute; left: 0.6rem; top: 0.4rem; bottom: 0.4rem; width: 4px; border-radius: 4px; background: linear-gradient(to top, var(--violet), var(--sky)); }
.trail-steps li { position: relative; padding-bottom: 1.6rem; }
.trail-steps li:last-child { padding-bottom: 0; }
.trail-steps li::before { content: "✦"; position: absolute; left: -2.2rem; top: -0.1rem; width: 1.5rem; text-align: center; color: var(--spark-ink); background: var(--bg); line-height: 1.6; }
.trail-steps p { color: var(--muted); margin: 0; }
.trail-steps h3 { margin-bottom: 0.2em; }


.prose-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: center; }
.about-mark { display: flex; justify-content: center; }
.about-mark .stardust { width: min(100%, 15rem); height: auto; }

/* Toolbox constellations */
.constellations { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.2rem; margin: 1.6rem 0; }
.constellation { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1rem 1.2rem; }
.constellation svg { display: block; width: 100%; height: auto; }
.constellation figcaption { margin-top: 0.4rem; }
.constellation h3 { margin: 0; font-family: var(--mono); font-size: 1rem; font-weight: 600; }
.constellation figcaption p { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.92rem; }
.constellation .lines { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 5; stroke-linecap: round; opacity: 0.7; }
.constellation text { fill: var(--ink); font-family: var(--mono); font-size: 14px; opacity: 0.85; transition: opacity 0.15s; }
.constellation .spark { fill: var(--spark); transform-box: fill-box; transform-origin: center; animation: twinkle 4.5s ease-in-out infinite; transition: filter 0.15s; }
.constellation .star:nth-of-type(2n) .spark { animation-delay: -1.3s; }
.constellation .star:nth-of-type(3n) .spark { animation-delay: -2.6s; }
.constellation .star:nth-of-type(5n) .spark { animation-delay: -3.4s; }
.constellation .star:hover text { opacity: 1; font-weight: 700; }
.constellation .star:hover .spark { filter: drop-shadow(0 0 6px var(--spark)); }

/* Call-to-action band */
.band { border-block: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.band-grid { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; }
.band-grid .lead { margin-bottom: 0; }
.band-grid .actions { margin: 0; }
.band h2 { margin-bottom: 0.3em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 1.2rem; margin-top: auto; font-size: 0.92rem; color: var(--muted); }
.foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1.6rem; }
.foot a { color: var(--muted); text-decoration: none; }
.motto { margin: 0.5rem auto 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.foot a:hover { color: var(--ink); text-decoration: underline; }

/* Cookie notice: a plain form, no script. */
.cookie-banner { position: sticky; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(0 0 0 / 0.25); padding-block: 1rem; }
.cookie-banner-content { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.cookie-banner p { margin: 0; font-size: 0.95rem; }
.cookie-banner form { flex-shrink: 0; margin: 0; }
.cookie-banner button { cursor: pointer; font: inherit; font-weight: 700; }

/* Policy pages */
.prose { padding-block: 1rem clamp(2.5rem, 6vw, 4rem); }
.prose section { margin-top: 2.2rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { margin-top: 1.4rem; }
.prose li { margin-bottom: 0.3em; }
.prose .card { margin: 1.2rem 0; }
.prose .card h3 { margin-top: 0; }
.prose .note { margin-top: 2.5rem; padding: 1rem 1.3rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.spec { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.spec th { width: 9rem; padding-right: 1rem; font-weight: 600; }
code { font-family: var(--mono); font-size: 0.92em; }

/* Error pages */
.error-page { padding-block: clamp(3rem, 10vw, 7rem); }
.error-code { font-family: var(--mono); font-size: clamp(4rem, 14vw, 9rem); font-weight: 800; line-height: 1; margin: 0 0 0.2em; color: var(--spark-ink); opacity: 0.9; }

@media (max-width: 52rem) {
    .brand-logo { height: 5.4rem; }
    .bar { height: 3.6rem; }
    .site-header { margin-bottom: 2.4rem; }
    .site-header nav { padding-top: 0.8rem; }
    .cookie-banner-content { flex-direction: column; align-items: stretch; gap: 0.8rem; }
    .hero-grid, .prose-grid { grid-template-columns: 1fr; }
    .hero-art { order: -1; }
    .hero-art .stardust { width: 11rem; }
    .cards, .cards-2 { grid-template-columns: 1fr; }
}

@media (max-width: 30rem) {
    .site-header .btn { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .stardust path[pathLength] { stroke-dashoffset: 0; }
}
