:root {
  color-scheme: dark light;
  --erebrix-obsidian: #090c11;
  --erebrix-graphite: #111720;
  --erebrix-carbon: #1a222d;
  --erebrix-frost: #f3f7fa;
  --erebrix-mist: #a9b4c2;
  --brand-cyan: #29d3ff;
  --brand-blue: #536dff;
  --brand-violet: #8468ff;
  --erebrix-spectrum: linear-gradient(120deg, #29d3ff 0%, #536dff 52%, #8468ff 100%);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 18px;
  --space-1: .5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4.5rem;
  --space-7: 7rem;
  --space-8: 9rem;
  --content-max: 1320px;
  --reading-max: 740px;
  --nav-height: 80px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #090c11;
  --surface-1: #111720;
  --surface-2: #1a222d;
  --surface-elevated: rgba(17, 23, 32, .94);
  --surface-soft: rgba(255, 255, 255, .025);
  --text-primary: #f3f7fa;
  --text-secondary: #a9b4c2;
  --text-muted: #8794a4;
  --border-subtle: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .18);
  --header-bg: rgba(9, 12, 17, .93);
  --grid-line: rgba(255, 255, 255, .025);
  --hero-center: #121b29;
  --contrast-bg: #f3f7fa;
  --contrast-text: #090c11;
  --footer-bg: #07090d;
  --input-bg: rgba(0, 0, 0, .18);
  --shadow: 0 18px 55px rgba(0, 0, 0, .2);
}

html[data-theme="light"] {
  color-scheme: light;
  --page-bg: #f4f7fa;
  --surface-1: #ffffff;
  --surface-2: #edf2f6;
  --surface-elevated: rgba(255, 255, 255, .96);
  --surface-soft: rgba(9, 12, 17, .025);
  --text-primary: #090c11;
  --text-secondary: #4f5d6b;
  --text-muted: #667687;
  --border-subtle: rgba(9, 12, 17, .11);
  --border-strong: rgba(9, 12, 17, .2);
  --header-bg: rgba(244, 247, 250, .94);
  --grid-line: rgba(9, 12, 17, .045);
  --hero-center: #e7eef5;
  --contrast-bg: #111720;
  --contrast-text: #f3f7fa;
  --footer-bg: #e9eff4;
  --input-bg: rgba(255, 255, 255, .78);
  --shadow: 0 18px 55px rgba(20, 34, 48, .08);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page-bg); }
body { margin: 0; overflow-x: hidden; background: var(--page-bg); color: var(--text-primary); font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 1rem; line-height: 1.7; -webkit-font-smoothing: antialiased; transition: background-color .25s ease, color .25s ease; }
body.menu-open { overflow: hidden; }
::selection { background: rgba(41, 211, 255, .25); color: var(--text-primary); }
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 4px; }
.skip-link { position: fixed; z-index: 2000; top: -100px; left: 1rem; padding: .7rem 1rem; background: var(--brand-cyan); color: var(--erebrix-obsidian); border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
.container-erebrix { width: min(calc(100% - 3rem), var(--content-max)); margin-inline: auto; }
.reading-width { max-width: var(--reading-max); }
.page-main { min-height: 70vh; }
.section { position: relative; padding: var(--space-8) 0; }
.section-compact { position: relative; padding: var(--space-7) 0; }
.section-surface { background: var(--surface-1); }
.section-soft { background: var(--surface-2); }
.section-contrast { background: var(--contrast-bg); color: var(--contrast-text); }
.section-contrast p, .section-contrast .text-muted { color: color-mix(in srgb, var(--contrast-text) 72%, transparent) !important; }
.section-rule { border-top: 1px solid var(--border-subtle); }
.eyebrow { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.3rem; color: color-mix(in srgb, var(--brand-cyan) 78%, var(--text-primary)); font-size: .71rem; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--brand-cyan); }
h1, h2, h3, h4, h5 { margin: 0; color: inherit; font-family: "Space Grotesk", "Inter", sans-serif; font-weight: 500; line-height: 1.08; letter-spacing: -.035em; }
h1 { font-size: clamp(3.25rem, 7vw, 7.4rem); }
h2 { font-size: clamp(2.35rem, 4.8vw, 5.2rem); }
h3 { font-size: clamp(1.45rem, 2.3vw, 2.35rem); }
p { margin: 0; color: var(--text-secondary); }
.lead { max-width: 700px; font-size: clamp(1.08rem, 1.5vw, 1.3rem); line-height: 1.65; }
.display-copy { max-width: 980px; font-family: "Space Grotesk", sans-serif; font-size: clamp(2rem, 4.5vw, 4.9rem); line-height: 1.12; letter-spacing: -.04em; color: var(--text-primary); }
.text-gradient { color: transparent; background: var(--erebrix-spectrum); background-clip: text; -webkit-background-clip: text; }
.text-primary-theme { color: var(--text-primary); }
.text-muted { color: var(--text-muted) !important; }
.link-arrow { display: inline-flex; align-items: center; gap: .55rem; color: var(--text-primary); font-weight: 650; }
.link-arrow span { transition: transform .25s ease; }
.link-arrow:hover span { transform: translateX(5px); color: var(--brand-cyan); }
.coordinate { color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .68rem; letter-spacing: .12em; }
.topology-grid { background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 72px 72px; }

.site-header { position: fixed; z-index: 1050; top: 0; width: 100%; height: var(--nav-height); border-bottom: 1px solid transparent; transition: background .3s ease, border-color .3s ease, box-shadow .3s ease; }
.site-header.scrolled { background: var(--header-bg); border-color: var(--border-subtle); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.nav-wrap { min-width: 0; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.brand-lockup { position: relative; z-index: 1100; display: block; flex: 0 0 auto; width: 156px; }
.brand-lockup img { width: 156px; height: auto; }
.theme-logo-light { display: none; }
html[data-theme="light"] .theme-logo-dark { display: none; }
html[data-theme="light"] .theme-logo-light { display: block; }
.desktop-nav { display: flex; align-items: center; gap: clamp(.9rem, 1.5vw, 1.7rem); }
.nav-link { position: relative; padding: .7rem 0 !important; color: var(--text-secondary); font-size: .86rem; white-space: nowrap; }
.nav-link::after { content: ""; position: absolute; bottom: .3rem; left: 0; width: 100%; height: 1px; background: var(--erebrix-spectrum); transform: scaleX(0); transform-origin: right; transition: transform .25s ease; }
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link:hover::after, .nav-link.active::after { transform: scaleX(1); transform-origin: left; }
.nav-actions { display: flex; min-width: 0; align-items: center; gap: .7rem; }
.menu-toggle { display: none; width: 44px; height: 44px; align-items: center; justify-content: center; border: 1px solid var(--border-subtle); background: var(--surface-soft); color: var(--text-primary); border-radius: var(--radius-sm); }
.menu-toggle-lines, .menu-toggle-lines::before, .menu-toggle-lines::after { display: block; width: 18px; height: 1px; background: currentColor; transition: transform .25s ease; }
.menu-toggle-lines { position: relative; }
.menu-toggle-lines::before, .menu-toggle-lines::after { content: ""; position: absolute; left: 0; }
.menu-toggle-lines::before { top: -6px; }
.menu-toggle-lines::after { top: 6px; }
.menu-toggle[aria-expanded="true"] .menu-toggle-lines { background: transparent; }
.menu-toggle[aria-expanded="true"] .menu-toggle-lines::before { top: 0; transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] .menu-toggle-lines::after { top: 0; transform: rotate(-45deg); }
.mobile-nav { display: none; }
.scroll-line { position: absolute; bottom: -1px; left: 0; width: 0; height: 1px; background: var(--erebrix-spectrum); }

.theme-picker { position: relative; z-index: 1100; }
.theme-picker fieldset { display: flex; margin: 0; padding: 3px; border: 1px solid var(--border-subtle); border-radius: 8px; background: var(--surface-soft); }
.theme-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-option { position: relative; }
.theme-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.theme-option label { display: grid; width: 30px; height: 30px; place-items: center; margin: 0; border-radius: 5px; color: var(--text-muted); cursor: pointer; }
.theme-option input:checked + label { background: var(--surface-2); color: var(--text-primary); box-shadow: 0 0 0 1px var(--border-subtle); }
.theme-option input:focus-visible + label { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }
.theme-label-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mobile-theme { margin-top: 1.5rem; }
.mobile-theme .theme-picker fieldset { width: max-content; }

.button { position: relative; display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: .6rem; padding: .73rem 1.25rem; overflow: hidden; border: 1px solid transparent; border-radius: 8px; font-size: .9rem; font-weight: 650; letter-spacing: .01em; transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.button::before { content: ""; position: absolute; inset: 0; transform: translateX(-110%); background: linear-gradient(100deg, transparent, rgba(255,255,255,.28), transparent); transition: transform .55s ease; }
.button:hover::before { transform: translateX(110%); }
.button-primary { background: var(--brand-cyan); color: var(--erebrix-obsidian); }
.button-primary:hover { color: var(--erebrix-obsidian); background: #61ddff; transform: translateY(-2px); }
.button-secondary { border-color: var(--border-strong); background: var(--surface-soft); color: var(--text-primary); }
.button-secondary:hover { border-color: color-mix(in srgb, var(--brand-cyan) 60%, var(--border-strong)); background: color-mix(in srgb, var(--brand-cyan) 6%, transparent); transform: translateY(-2px); }
.button-sm { min-height: 42px; padding: .58rem 1rem; }
.button-group { display: flex; flex-wrap: wrap; gap: .8rem; }

.page-hero { position: relative; min-height: 64vh; padding: calc(var(--nav-height) + 8rem) 0 7rem; overflow: hidden; border-bottom: 1px solid var(--border-subtle); }
.page-hero::after { content: ""; position: absolute; inset: 0; z-index: -2; background: radial-gradient(circle at 72% 34%, rgba(83,109,255,.1), transparent 30%), linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface-1) 45%, transparent)); }
.page-hero h1 { max-width: 1080px; font-size: clamp(3rem, 6.3vw, 6.8rem); }
.page-hero .lead { margin-top: 2rem; }

.site-footer { position: relative; padding: 7rem 0 2rem; background: var(--footer-bg); border-top: 1px solid var(--border-subtle); }
.footer-brand { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 4.5rem; }
.footer-brand-mark { width: min(310px, 65vw); }
.footer-tagline { max-width: 340px; font-size: 1.05rem; text-align: right; }
.footer-heading { margin-bottom: 1.15rem; color: var(--text-muted); font-size: .67rem; font-weight: 700; letter-spacing: .15em; }
.footer-list { display: grid; gap: .62rem; margin: 0; padding: 0; list-style: none; }
.footer-list a { color: var(--text-secondary); font-size: .87rem; transition: color .2s ease; }
.footer-list a:hover { color: color-mix(in srgb, var(--brand-cyan) 78%, var(--text-primary)); }
.footer-bottom { display: flex; justify-content: space-between; gap: 2rem; margin-top: 5rem; padding-top: 1.5rem; border-top: 1px solid var(--border-subtle); color: var(--text-muted); font-size: .75rem; }
.brand-values { display: flex; flex-wrap: wrap; gap: 1.5rem; letter-spacing: .12em; }

.modal-content { background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.modal-header, .modal-footer { border-color: var(--border-subtle); }
html[data-theme="dark"] .btn-close { filter: invert(1); }
.form-label { margin-bottom: .45rem; color: var(--text-primary); font-size: .82rem; }
.form-control, .form-select { min-height: 50px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background-color: var(--input-bg); color: var(--text-primary); }
.form-control:focus, .form-select:focus { border-color: var(--brand-cyan); background-color: var(--surface-1); color: var(--text-primary); box-shadow: 0 0 0 .2rem rgba(41,211,255,.12); }
.form-control::placeholder { color: var(--text-muted); }
.form-select option { color: var(--erebrix-obsidian); background: #fff; }
.invalid-feedback { color: #e64d62; }
html[data-theme="dark"] .invalid-feedback { color: #ff9ba8; }
.form-status { display: none; margin-top: 1rem; padding: .9rem 1rem; border: 1px solid rgba(41,211,255,.3); background: rgba(41,211,255,.07); color: var(--text-primary); border-radius: var(--radius-sm); }
.form-status.visible { display: block; }

@media (min-width: 1600px) { .container-erebrix { width: min(calc(100% - 8rem), var(--content-max)); } }
@media (max-width: 1180px) { .desktop-nav { gap: .8rem; } .nav-actions .button { display: none; } }
@media (max-width: 991.98px) {
  :root { --space-8: 7rem; }
  .desktop-nav, .nav-actions > .theme-picker, .nav-actions .button { display: none; }
  .menu-toggle { display: inline-flex; position: relative; z-index: 1100; }
  .mobile-nav { display: block; position: fixed; z-index: 1090; inset: 0; padding: calc(var(--nav-height) + 2rem) 1.5rem 2rem; visibility: hidden; opacity: 0; background: var(--page-bg); transform: translateY(-10px); transition: opacity .25s ease, transform .25s ease, visibility .25s; }
  .mobile-nav.open { visibility: visible; opacity: 1; transform: none; }
  .mobile-nav-inner { display: flex; height: 100%; flex-direction: column; justify-content: space-between; overflow-y: auto; }
  .mobile-nav-links { display: grid; }
  .mobile-nav .nav-link { padding: .65rem 0 !important; border-bottom: 1px solid var(--border-subtle); font-family: "Space Grotesk", sans-serif; font-size: clamp(1.35rem, 5vw, 2.1rem); }
  .mobile-nav .button { margin-top: 1.5rem; }
  .page-hero { min-height: auto; padding-top: calc(var(--nav-height) + 6rem); }
}
@media (max-width: 767.98px) {
  :root { --space-7: 5rem; --space-8: 5.5rem; --nav-height: 70px; }
  .container-erebrix { width: min(calc(100% - 2rem), var(--content-max)); }
  .section { padding: var(--space-8) 0; }
  .button-group { align-items: stretch; flex-direction: column; }
  .button-group .button { width: 100%; }
  .footer-brand, .footer-bottom { align-items: flex-start; flex-direction: column; }
  .footer-tagline { text-align: left; }
  .brand-values { gap: .7rem 1rem; }
}
@media (max-width: 575.98px) {
  h1 { font-size: clamp(2.75rem, 15vw, 4.2rem); }
  h2 { font-size: clamp(2.15rem, 11vw, 3.2rem); }
  .page-hero h1 { font-size: clamp(2.7rem, 14vw, 4rem); }
  .brand-lockup, .brand-lockup img { width: 138px; }
}
