:root {
  --tech-blue: #1E90FF;
  --vibrant-orange: #FFA500;
  --deep-space-gray: #1A1A2E;
  --midnight-surface: #16213E;
  --neon-green: #39FF14;
  --jewel-teal: #0F4C5C;
  --jewel-burgundy: #722F37;
  --jewel-indigo: #4A148C;
  --text-primary: #E0E0E0;
  --text-muted: #A0A0A0;
  --rail-width: 250px;
  --header-h: 72px;
  --container-max: 1280px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 2rem;
  --space-4: 4rem;
  --border-color: rgba(255, 255, 255, 0.12);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  --font-head: 'Exo 2', 'Montserrat', 'Segoe UI', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Roboto Mono', 'IBM Plex Mono', 'SFMono-Regular', monospace;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--deep-space-gray);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-feature-settings: "liga", "kern";
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--tech-blue);
  text-decoration: none;
}

a:hover {
  color: #ffffff;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

address {
  font-style: normal;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
}

h2 {
  font-size: clamp(2rem, 3vw, 3rem);
}

p {
  color: var(--text-primary);
}

:focus-visible {
  outline: 3px solid var(--neon-green);
  outline-offset: 3px;
  border-radius: 2px;
}

::selection {
  background: var(--tech-blue);
  color: #ffffff;
}

main {
  width: 100%;
  flex: 1 0 auto;
  padding-top: var(--header-h);
}

main:focus {
  outline: none;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-3);
}

.prose {
  max-width: 72ch;
}

.prose > * + * {
  margin-top: 1.25rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: var(--space-2) 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.5rem;
  color: var(--neon-green);
}

.breadcrumb a {
  color: var(--tech-blue);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--tech-blue);
  color: #ffffff;
  font-weight: 700;
  font-family: var(--font-head);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  background: #0077ea;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(30, 144, 255, 0.35);
}

.btn--orange {
  background: var(--vibrant-orange);
  color: var(--deep-space-gray);
}

.btn--orange:hover {
  background: #ffb224;
  color: var(--deep-space-gray);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn--ghost:hover {
  border-color: var(--tech-blue);
  background: rgba(30, 144, 255, 0.08);
  color: var(--text-primary);
}

.section {
  padding-block: var(--space-4);
}

.section--teal {
  background: var(--jewel-teal);
}

.section--burgundy {
  background: var(--jewel-burgundy);
}

.section--indigo {
  background: var(--jewel-indigo);
}

.image-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(rgba(30, 144, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 144, 255, 0.08) 1px, transparent 1px),
    var(--midnight-surface);
  background-size: 24px 24px;
  border: 1px solid var(--border-color);
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 12px),
    var(--midnight-surface);
  border: 1px solid var(--border-color);
}

.image-frame > .image-placeholder {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: -999rem;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  background: var(--neon-green);
  color: var(--deep-space-gray);
  font-weight: 800;
  font-family: var(--font-head);
  border-radius: 0 4px 4px 0;
}

.skip-link:focus {
  left: 0.5rem;
  color: var(--deep-space-gray);
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
  background-color: var(--midnight-surface);
  background-image:
    linear-gradient(rgba(30, 144, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 144, 255, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  border-bottom: 1px solid var(--border-color);
}

.site-header::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 0;
  height: 0;
  border-top: 18px solid var(--vibrant-orange);
  border-left: 18px solid transparent;
  opacity: 0.9;
}

.site-brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  color: var(--text-primary);
}

.site-brand:hover {
  color: var(--text-primary);
}

.site-brand__mark {
  font-family: var(--font-head);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--tech-blue);
}

.site-brand__mark em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.62em;
  color: var(--neon-green);
  margin-left: 0.25rem;
  vertical-align: super;
}

.site-brand__sub {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  border-left: 2px solid var(--vibrant-orange);
  padding-left: 0.5rem;
}

.site-nav {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1100;
  width: min(80vw, 320px);
  display: flex;
  flex-direction: column;
  padding: var(--space-3);
  background: var(--midnight-surface);
  border-right: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0.3s ease;
  overflow-y: auto;
}

.site-nav[data-open] {
  transform: translateX(0);
  visibility: visible;
}

.site-nav__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.site-nav__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.nav-close {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.25rem;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nav-close:hover {
  border-color: var(--vibrant-orange);
  color: var(--vibrant-orange);
}

.site-nav__list {
  display: grid;
  gap: 0.25rem;
}

.site-nav__link {
  display: block;
  padding: 0.75rem 0.875rem;
  border-left: 2px solid transparent;
  color: var(--text-primary);
  font-family: var(--font-head);
  font-weight: 700;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.site-nav__link::before {
  content: "●";
  display: inline-block;
  font-size: 0.5rem;
  vertical-align: middle;
  color: var(--tech-blue);
  margin-right: 0.75rem;
  opacity: 0.6;
  transition: transform 0.2s ease, color 0.2s ease;
}

.site-nav__link:hover {
  color: var(--tech-blue);
  background: rgba(30, 144, 255, 0.08);
  border-left-color: var(--tech-blue);
}

.site-nav__link:hover::before {
  transform: translateX(4px);
  color: var(--tech-blue);
  opacity: 1;
}

.site-nav__link[aria-current="page"] {
  color: var(--neon-green);
  background: rgba(57, 255, 20, 0.06);
  border-left-color: var(--neon-green);
}

.site-nav__link[aria-current="page"]::before {
  content: "◆";
  color: var(--neon-green);
  opacity: 1;
}

.site-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: var(--space-3);
}

.header-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  background: rgba(30, 144, 255, 0.06);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.4;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.header-button:hover {
  border-color: var(--tech-blue);
  color: var(--tech-blue);
  background: rgba(30, 144, 255, 0.12);
}

.header-button[aria-expanded="true"] {
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.header-button--accent {
  border-color: var(--vibrant-orange);
  background: var(--vibrant-orange);
  color: var(--deep-space-gray);
  font-weight: 700;
}

.header-button--accent:hover {
  border-color: #ffb224;
  background: #ffb224;
  color: var(--deep-space-gray);
}

.header-button--lang {
  border-color: rgba(57, 255, 20, 0.4);
  color: var(--neon-green);
}

.header-button--lang:hover {
  border-color: var(--neon-green);
  color: var(--neon-green);
}

.header-button--lang[aria-pressed="true"] {
  background: var(--neon-green);
  border-color: var(--neon-green);
  color: var(--deep-space-gray);
}

.records-panel {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0.5rem;
  right: 0.5rem;
  z-index: 1300;
  width: auto;
  padding: var(--space-2);
  background: var(--midnight-surface);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
}

.records-panel[hidden] {
  display: none;
}

.records-panel__title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--neon-green);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.records-panel__list {
  display: grid;
  gap: 0.25rem;
}

.records-panel__list a {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

.records-panel__list a:hover {
  color: var(--tech-blue);
}

.records-idx {
  display: inline-block;
  min-width: 3.5em;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--vibrant-orange);
  margin-right: 0.5rem;
}

.nav-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  transition: border-color 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--tech-blue);
}

.nav-toggle[aria-expanded="true"] {
  border-color: var(--vibrant-orange);
}

.nav-toggle__bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--neon-green);
  box-shadow: 0 6px 0 var(--neon-green), 0 -6px 0 var(--neon-green);
}

.nav-toggle__label {
  display: none;
}

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  position: relative;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--jewel-teal);
  background-size: 32px 32px;
  border-top: 2px solid var(--neon-green);
}

.site-footer::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--vibrant-orange), var(--tech-blue), var(--neon-green));
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  padding-block: var(--space-4);
}

.footer-brand {
  display: grid;
  gap: 0.25rem;
  align-content: start;
}

.footer-brand__mark {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  color: var(--vibrant-orange);
  line-height: 1;
}

.footer-brand__sub {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.footer-about {
  max-width: 40ch;
  color: var(--text-primary);
}

.footer-links {
  display: grid;
  align-content: start;
  gap: 0.25rem;
}

.footer-links a {
  display: block;
  padding: 0.25rem 0.75rem;
  border-left: 2px solid transparent;
  color: var(--text-primary);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.footer-links a:hover {
  border-left-color: var(--vibrant-orange);
  color: var(--vibrant-orange);
  transform: translateX(4px);
}

.footer-contact {
  display: grid;
  gap: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
  padding-block: var(--space-2);
  border-top: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.footer-trust {
  max-width: 80ch;
  padding-bottom: var(--space-3);
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.back-to-top {
  position: fixed;
  right: var(--space-2);
  bottom: var(--space-2);
  z-index: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1rem;
  background: var(--vibrant-orange);
  border: 1px solid var(--vibrant-orange);
  color: var(--deep-space-gray);
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, background 0.2s ease;
}

.back-to-top:hover {
  background: #ffb224;
  transform: translateY(-4px);
}

.back-to-top[hidden] {
  display: none;
}

@media (min-width: 1024px) {
  body {
    margin-left: var(--rail-width);
  }

  main {
    padding-top: 0;
  }

  .site-header {
    right: auto;
    width: var(--rail-width);
    height: 100vh;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3) var(--space-3);
    border-bottom: 0;
    border-right: 1px solid var(--border-color);
  }

  .site-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: var(--space-3);
  }

  .site-brand__mark {
    font-size: 2rem;
  }

  .site-nav {
    position: static;
    width: auto;
    flex: 1 1 auto;
    min-height: 0;
    padding: 0;
    border-right: 0;
    box-shadow: none;
    transform: none;
    visibility: visible;
    overflow-y: auto;
  }

  .site-nav__head,
  .nav-close,
  .nav-toggle {
    display: none;
  }

  .site-nav__list {
    gap: 0.125rem;
  }

  .site-header__meta {
    flex-direction: column;
    align-items: stretch;
  }

  .records-panel {
    top: auto;
    bottom: 1rem;
    left: calc(100% + 0.75rem);
    right: auto;
    width: 320px;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr 1fr 1.5fr;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 639px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle__label {
    display: inline;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
