/* ==========================================================================
   Magestica — shared stylesheet
   1. Base            4. Components (buttons, cards, sections)
   2. Header          5. Closing block (contact + footer)
   3. Hero & type     6. Document pages, responsive
   ========================================================================== */

/* 1. Base ----------------------------------------------------------------- */

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

:root {
    --background: #fbfaf8;
    --foreground: #171214;
    --ink: #171214;
    --muted: #756d70;
    --accent: #DC143C;
    --accent-light: #FF2400;
    --emblem-disc: var(--accent);       /* About page: the circle behind the M */
    --secondary: #FF2400;           /* point cloud: 36% of dots (accent is 50%) */
    --tertiary: #800020;    /* point cloud: the remaining 14% */
    --link: var(--accent);
    --border: rgba(23, 18, 20, 0.11);
    --card: #fff;
    --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
    --header: 56px;
}

html {
    overflow-x: clip;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header) + 24px);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    min-height: 100svh;
    background: var(--background);
    color: var(--foreground);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
.link { color: var(--link); text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color 160ms ease; }
.link:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }

.page {
    position: relative;
    z-index: 1;
    width: min(1180px, calc(100% - clamp(32px, 6vw, 96px)));
    min-height: 100svh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}
main { flex: 1; }
section { padding: clamp(64px, 9vw, 120px) 0 0; }
.hero { padding-top: clamp(48px, 9vw, 120px); }

/* 2. Header --------------------------------------------------------------- */

header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: var(--header);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
/* Full-width bar behind the centred header content. Fully clear at the very top of the page; once you scroll
   (class toggled by site.js) it becomes frosted glass that fades out toward its bottom edge. */
header::before {
    content: "";
    position: absolute;
    inset: 0 calc(50% - 50vw) -14px;
    z-index: -1;
    background: transparent;
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent);
    mask-image: linear-gradient(to bottom, #000 50%, transparent);
    pointer-events: none;
    transition: background 250ms ease, backdrop-filter 250ms ease, -webkit-backdrop-filter 250ms ease;
}
body.scrolled header::before {
    background: color-mix(in srgb, var(--background) 62%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
}

.logo { transition: opacity 160ms ease; }
.logo img {
    display: block;
    /* The SVG is used as a mask and filled with --accent, so the logo takes its colour from :root.
       the image's own pixels are pushed far out of its box (object-fit: none + a pixel offset) so only the fill shows. */
    background: var(--accent);
    -webkit-mask: url(../magestica.svg) center / contain no-repeat;
    mask: url(../magestica.svg) center / contain no-repeat;
    object-fit: none;
    object-position: -9999px 0;
}
.logo:hover { opacity: 0.75; }

header nav { display: flex; gap: 4px; margin-right: -12px; }
.nav-link { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 500; transition: color 160ms ease, background 160ms ease; }
.nav-link:hover, .nav-link[aria-current="page"] { color: var(--accent); background: rgba(31, 124, 152, 0.06); }

/* Home page: the header is dark while it sits over the hero (class toggled by site.js) */
body.header-dark .nav-link { color: rgba(255, 255, 255, 0.72); }
body.header-dark .nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }

/* 3. Hero & type ---------------------------------------------------------- */

h1 {
    max-width: 980px;
    overflow-wrap: break-word;
    font-size: clamp(40px, 8vw + 4px, 104px);
    font-weight: 550;
    line-height: 0.98;
    letter-spacing: -0.055em;
}
h1 .accent { color: var(--accent) !important; }
.secondary { color: var(--secondary); }
h1 .line { display: block; }
.accent { color: var(--accent) !important; }

h2 {
    font-size: clamp(28px, 3.6vw + 8px, 52px);
    font-weight: 550;
    line-height: 1.05;
    letter-spacing: -0.045em;
}

.lead { max-width: 540px; margin-top: 36px; color: var(--muted); font-size: 17px; line-height: 1.7; letter-spacing: -0.01em; }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-light); }

/* Dark, full-screen panels over one fixed cloud of points (assets/js/hero.js). Used by every page. */
body.home {
    --background: #0b0809;
    --foreground: #fff;
    --muted: rgba(255, 255, 255, 0.62);
    --border: rgba(255, 255, 255, 0.14);
    --card: rgba(18, 14, 16, 0.72);
    --link: #7fd0ea;
}
.cloud-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.cloud-layer canvas { display: block; width: 100%; height: 100%; }
.ring-text {
    position: absolute;
    translate: -50% -50%;
    fill: rgba(255, 255, 255, 0.72);
    font: 500 7.4px var(--mono);
    letter-spacing: 2.8px;
    opacity: 0;
    visibility: hidden;
}

.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100svh;
    padding: calc(var(--header) + 32px) 0 64px;
}
main > .panel:first-child { margin-top: calc(var(--header) * -1); }
.panel-end { justify-content: flex-end; }
.panel-hero .panel-copy { max-width: none; }
.panel-copy { max-width: 560px; }
.panel-copy.wide { max-width: min(620px, 54%); }
.panel[data-side="right"] .panel-copy { margin-left: auto; text-align: right; }
.panel[data-side="right"] .lead { margin-left: auto; }
.panel[data-side="center"] { justify-content: flex-end; align-items: center; text-align: center; }
.panel[data-side="center"] .lead { margin-inline: auto; }
.panel-title { font-size: clamp(32px, 5vw, 64px); line-height: 1.02; }
.panel .lead { margin-top: 20px; }
.panel .products { margin-top: 36px; }
.panel .grid3, .panel .specs { margin-top: 40px; }
.panel .features { margin-top: 36px; }
.panel-doc { justify-content: flex-start; }
.panel-doc .doc > h2:first-child { margin-top: 0; }
.panel-hero .app-logo.lg { margin-bottom: 24px; }

.panel-hero h1 { font-size: clamp(40px, 5.2vw, 80px); }
.panel-hero h1 .line { white-space: nowrap; }
.panel-hero h1 .accent { color: rgba(255, 255, 255, 0.5); }

/* Emblem behind the About hero: the script M on a disc, with a ring of text turning around it */
.panel-hero > .panel-copy { position: relative; }
.emblem {
    position: absolute;
    top: 50%;
    right: 0;
    width: clamp(260px, 38vw, 500px);
    height: auto;
    aspect-ratio: 1;
    translate: 0 -46%;
    filter: drop-shadow(0 0 60px rgba(41, 130, 189, 0.35));
    pointer-events: none;
}
.emblem-line { fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 0.6; }
.emblem-ring { fill: rgba(255, 255, 255, 0.7); font: 500 13px var(--mono); letter-spacing: 4.7px; transform-box: view-box; transform-origin: 100px 100px; }
.emblem-disc { fill: var(--emblem-disc); transform-box: fill-box; transform-origin: center; }
.emblem-pulse { fill: var(--emblem-disc); opacity: 0; transform-box: fill-box; transform-origin: center; }
.emblem-mark { fill: #fff; }
.panel-hero .lead { margin-top: 28px; }

/* The last panel is exactly as tall as the screen minus the footer (--footer-h is measured by site.js),
   so when you reach the end of the page its text sits centred above the footer. */
.panel-contact { align-items: center; text-align: center; min-height: max(300px, calc(100svh - var(--footer-h, 0px))); padding: calc(var(--header) + 24px) 0 24px; }
.panel-contact .panel-copy { max-width: 820px; }
.panel-contact .panel-title { font-size: clamp(28px, min(5vw, 7vh), 64px); }
.panel-contact small { display: block; margin-bottom: 16px; color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.panel-contact .mail {
    display: inline-block;
    margin-top: clamp(16px, 3vh, 28px);
    padding-bottom: 6px;
    font-size: clamp(20px, min(2.6vw, 4.4vh), 34px);
    letter-spacing: -0.02em;
    background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
    transition: color 160ms ease;
}
.panel-contact .mail:hover { color: var(--link); }
.contact-alt { margin-top: 18px; color: var(--muted); font-size: 15px; }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }

/* Light-on-dark versions of the shared components */
body.home main .button { border-color: #fff; background: #fff; color: #0b0809; }
body.home main .button:hover { border-color: #ece8e9; background: #ece8e9; }
body.home main .button.ghost { border-color: rgba(255, 255, 255, 0.28); background: transparent; color: #fff; }
body.home main .button.ghost:hover { border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.08); }
body.home .card { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
body.home .badge { background: rgba(255, 255, 255, 0.08); color: #a6e1f2; }
body.home .badge.soon { color: var(--muted); }
body.home .num { color: var(--link); }
body.home h1 .accent { color: rgba(255, 255, 255, 0.5); }
body.header-dark .nav-link[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, 0.1); }
body.home footer { margin-top: 0; }
/* Glass footer: same frosted effect as the navbar, fading out toward its top edge */
body.home footer::before {
    inset: -14px calc(50% - 50vw) 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--background) 62%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-mask-image: linear-gradient(to top, #000 50%, transparent);
    mask-image: linear-gradient(to top, #000 50%, transparent);
    border: 0;
    box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
    .ring-text { animation: spin 48s linear infinite; transition: opacity 300ms ease; }
    .emblem-ring { animation: spin 30s linear infinite; }
    .emblem-disc { animation: breathe 4s ease-in-out infinite; }
    .emblem-pulse { animation: ripple 4s ease-out infinite; }
    .emblem-pulse + .emblem-pulse { animation-delay: 2s; }

    /* Entrance: headline lines, text and buttons rise in one after another */
    .panel-hero h1 .line, .panel-hero .lead, .panel-hero .actions { animation: rise 900ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
    .panel-hero h1 .line:nth-child(2) { animation-delay: 140ms; }
    .panel-hero .lead { animation-delay: 300ms; }
    .panel-hero .actions { animation-delay: 440ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
@keyframes spin { to { rotate: 1turn; } }
@keyframes breathe { 50% { transform: scale(1.04); } }
@keyframes ripple { 0% { transform: scale(1); opacity: 0.35; } 100% { transform: scale(1.5); opacity: 0; } }

/* 4. Components ----------------------------------------------------------- */

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.button {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid var(--accent);
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.button:hover { background: var(--accent-light); border-color: var(--accent-light); }
.button.ghost { background: var(--card); color: var(--foreground); border-color: var(--border); }
.button.ghost:hover { color: var(--accent); border-color: rgba(31, 124, 152, 0.35); background: #fff; }
.msicon { flex: none; }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 40px; }
.section-head p { max-width: 360px; color: var(--muted); font-size: 14px; line-height: 1.65; }

.card {
    display: flex; flex-direction: column; gap: 14px;
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
}
.card h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.035em; }
.card p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.card .more { margin-top: auto; padding-top: 10px; color: var(--link); font-size: 13px; font-weight: 600; }

.badge {
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: 6px;
    background: rgba(31, 124, 152, 0.08);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px; font-weight: 500;
}
.badge.soon { background: rgba(23, 18, 20, 0.06); color: var(--muted); }

/* Products list on the home page */
.products { display: grid; gap: 16px; }
.card.product { flex-direction: row; align-items: center; gap: 28px; padding: 28px 32px; }
.product-body { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.product-body p { max-width: 520px; }
.product-body .actions { margin-top: 8px; }
.card.placeholder { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 32px; border-style: dashed; background: transparent; }
.card.placeholder .badge { align-self: center; }
.card.placeholder p { margin-top: 6px; }

.app-logo { display: block; width: 72px; height: 72px; flex: none; border-radius: 16px; object-fit: cover; }
.app-logo.lg { width: clamp(96px, 16vw, 148px); height: auto; aspect-ratio: 1; border-radius: 28px; margin-bottom: 28px; }
.app-hero { display: flex; flex-direction: column; align-items: flex-start; }

.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; margin-top: 40px; }
.features .card h3 { font-size: 18px; }

/* Principles and spec rows */
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.grid3 > * { padding-top: 24px; border-top: 1px solid var(--border); }
.grid3 h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 10px; }
.grid3 p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.num { display: block; margin-bottom: 18px; color: var(--accent); font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: 0.08em; }

.specs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 40px; }
.specs > div { padding: 22px 0 8px; border-top: 1px solid var(--border); }
.specs dt { color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.specs dd { margin-top: 12px; font-size: clamp(17px, 1.6vw, 21px); font-weight: 550; letter-spacing: -0.025em; line-height: 1.35; }

.story { width: min(100%, 570px); margin: 56px 0 0 auto; color: var(--muted); font-size: 17px; line-height: 1.75; }
.story p + p { margin-top: 22px; }

/* 5. Closing block (contact + footer) ------------------------------------- */

.cta, footer {
    --foreground: #fbfaf8;
    --muted: rgba(251, 250, 248, 0.62);
    --border: rgba(255, 255, 255, 0.14);
    --link: #7fd0ea;
    position: relative;
    isolation: isolate;
    color: var(--foreground);
}
.cta::before, footer::before {
    content: "";
    position: absolute;
    inset: 0 calc(50% - 50vw);
    z-index: -1;
    background: var(--ink);
}

.cta {
    margin-top: clamp(72px, 10vw, 140px);
    padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 64px);
    display: flex; justify-content: space-between; align-items: end; gap: 40px; flex-wrap: wrap;
}
.cta::before { border-radius: clamp(24px, 4vw, 44px) clamp(24px, 4vw, 44px) 0 0; }
.cta h2 { max-width: 720px; font-size: clamp(34px, 4.6vw, 68px); line-height: 1.02; }
.cta small { display: block; margin-bottom: 12px; color: var(--muted); font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; }
.cta a.mail {
    display: inline-block;
    padding-bottom: 6px;
    font-size: clamp(20px, 2.4vw, 30px);
    letter-spacing: -0.02em;
    background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
    transition: color 160ms ease;
}
.cta a.mail:hover { color: var(--link); }
.cta .button.ghost { background: rgba(255, 255, 255, 0.06); color: var(--foreground); }
.cta .button.ghost:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.cta .contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

footer { margin-top: clamp(48px, 7vw, 96px); padding-top: clamp(22px, 2.6vw, 32px); color: var(--muted); font-size: 12px; }
footer::before { border-radius: 20px 20px 0 0; }
/* A contact block directly above merges with the footer into one dark block */
.page:has(main > .cta) footer { margin-top: 0; border-top: 1px solid var(--border); }
.page:has(main > .cta) footer::before { border-radius: 0; }

.footer-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px 48px; padding-bottom: clamp(16px, 2vw, 24px); }
.footer-brand { max-width: 260px; }
.footer-brand .logo { display: inline-block; }
.footer-brand .logo img { width: 80px; height: 27px; }
.footer-brand p { margin-top: 8px; line-height: 1.5; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 16px clamp(32px, 5vw, 72px); }
.footer-title { margin-bottom: 6px; color: var(--foreground); font-family: var(--mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.12em; }
.footer-nav a { display: block; width: fit-content; padding: 2px 0; transition: color 160ms ease; }
.footer-nav a:hover, .footer-bottom a:hover { color: #fff; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; padding: 10px 0 12px; border-top: 1px solid var(--border); font-size: 11.5px; }
.footer-bottom a { transition: color 160ms ease; }

/* Back-to-top button (created by site.js) */
.to-top {
    position: fixed;
    right: max(20px, env(safe-area-inset-right));
    bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 20;
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border: 1px solid rgba(23, 18, 20, 0.11);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--accent);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: opacity 200ms ease, transform 200ms ease, visibility 200ms, background 160ms ease, color 160ms ease;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 6. Document pages, responsive ------------------------------------------- */

.doc { max-width: 720px; padding-bottom: 40px; }
.doc h1 { font-size: clamp(44px, 7vw, 84px); }
.doc .meta { margin-top: 28px; color: var(--muted); font-size: 13px; }
.doc h2 { margin-top: 56px; font-size: 24px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.2; }
.doc h3 { margin-top: 28px; font-size: 16px; font-weight: 600; }
.doc p, .doc li { margin-top: 14px; color: var(--muted); font-size: 15.5px; line-height: 1.8; }
.doc ul { padding-left: 22px; }
.doc a:not(.button) { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.doc strong { color: var(--foreground); font-weight: 600; }

.toc { margin-top: 36px; padding: 22px 26px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.toc strong { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.toc ol { margin-top: 10px; padding-left: 20px; columns: 2; column-gap: 32px; }
.toc li { margin-top: 6px; font-size: 14px; }

/* Keep the footer's last line clear of the back-to-top button */
@media (max-width: 1340px) {
    .footer-bottom { padding-right: 60px; }
}

@media (max-width: 800px) {
    .panel { justify-content: flex-end; padding-bottom: 48px; }
    .panel-hero h1 { font-size: clamp(34px, 9.6vw, 72px); }
    .panel-hero h1 .line { white-space: normal; }
    .emblem { top: calc(var(--header) + 20px); right: 50%; width: min(64vw, 260px); translate: 50% 0; opacity: 0.4; }
    .panel[data-side="right"] .panel-copy { margin-left: 0; text-align: left; }
    .panel[data-side="right"] .lead { margin-left: 0; }
    .panel[data-side="center"] { align-items: flex-start; text-align: left; }
    .panel[data-side="center"] .lead { margin-inline: 0; }
    .panel-copy.wide { max-width: none; }
    .panel-contact { justify-content: center; }
    .specs { grid-template-columns: repeat(2, 1fr); }
    .grid3 { grid-template-columns: 1fr; gap: 32px; }
    .section-head { flex-direction: column; align-items: start; }
    .toc ol { columns: 1; }
    .story { margin-left: 0; }
}

@media (max-width: 700px) {
    :root { --header: 52px; }
    .page { width: calc(100% - max(32px, env(safe-area-inset-left) + env(safe-area-inset-right))); }
    .lead { margin-top: 24px; font-size: 15px; }
    .card { padding: 24px; }
    .card.product { flex-direction: column; align-items: flex-start; gap: 20px; padding: 24px; }
    .story { margin-top: 36px; font-size: 15px; }
}

@media (max-width: 380px) {
    .nav-link { padding: 8px 8px; }
    header nav { margin-right: -8px; }
    .actions .button { width: 100%; justify-content: center; }
    .toc { padding: 18px; }
}

@media (min-width: 1600px) {
    .page { width: min(1360px, 80%); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .to-top { transition: none; }
}

/* 7. Light theme ----------------------------------------------------------
   The inline head script follows the browser's light/dark setting (prefers-color-scheme) unless the visitor chose a theme with the header toggle (saved in localStorage); it sets <html data-theme="light"> for light. */

.theme-toggle {
    display: grid; place-items: center;
    width: 36px; height: 36px;
    margin-left: 4px;
    border: 0; border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease;
}
.theme-toggle:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: block; }
html[data-theme="light"] .theme-toggle .sun { display: block; }
html[data-theme="light"] .theme-toggle .moon { display: none; }

html[data-theme="light"] { color-scheme: light; }
html[data-theme="light"] body.home {
    --background: #fbfaf8;
    --foreground: #171214;
    --muted: #6a6265;
    --border: rgba(23, 18, 20, 0.12);
    --card: rgba(255, 255, 255, 0.78);
    --link: var(--accent);
}
html[data-theme="light"] .theme-toggle { color: var(--muted); }
html[data-theme="light"] .theme-toggle:hover { color: var(--accent); background: rgba(31, 124, 152, 0.06); }

/* Header */
html[data-theme="light"] body.header-dark .nav-link { color: var(--muted); }
html[data-theme="light"] body.header-dark .nav-link:hover,
html[data-theme="light"] body.header-dark .nav-link[aria-current="page"] { color: var(--accent); background: rgba(31, 124, 152, 0.06); }

/* Hero, emblem, ring text */
html[data-theme="light"] .panel-hero h1 .accent,
html[data-theme="light"] body.home h1 .accent { color: rgba(23, 18, 20, 0.45); }
html[data-theme="light"] .ring-text { fill: rgba(23, 18, 20, 0.62); }
html[data-theme="light"] .emblem { filter: drop-shadow(0 0 60px rgba(41, 130, 189, 0.22)); }
html[data-theme="light"] .emblem-line { stroke: rgba(23, 18, 20, 0.16); }
html[data-theme="light"] .emblem-ring { fill: rgba(23, 18, 20, 0.62); }

/* Buttons and small components */
html[data-theme="light"] body.home main .button { border-color: var(--accent); background: var(--accent); color: #fff; }
html[data-theme="light"] body.home main .button:hover { border-color: var(--accent-light); background: var(--accent-light); }
html[data-theme="light"] body.home main .button.ghost { border-color: var(--border); background: var(--card); color: var(--foreground); }
html[data-theme="light"] body.home main .button.ghost:hover { border-color: rgba(31, 124, 152, 0.35); background: #fff; color: var(--accent); }
html[data-theme="light"] body.home .badge { background: rgba(31, 124, 152, 0.08); color: var(--accent); }
html[data-theme="light"] body.home .badge.soon { background: rgba(23, 18, 20, 0.06); color: var(--muted); }

/* Footer */
html[data-theme="light"] body.home footer {
    --foreground: #171214;
    --muted: #6a6265;
    --border: rgba(23, 18, 20, 0.12);
    --link: var(--accent);
}
html[data-theme="light"] .footer-nav a:hover,
html[data-theme="light"] .footer-bottom a:hover { color: var(--accent); }
html[data-theme="light"] ::selection { background: var(--accent); color: #fff; }
