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

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

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul, ol { padding: 0; }

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

button, input, select, textarea { font: inherit; color: inherit; }

/* ===== Tokens ===== */
:root {
  --ink-950: #07121C;
  --ink-900: #0B1B2B;
  --ink-800: #12293D;
  --ink-700: #18344A;
  --line: #2E4A5F;
  --paper: #F2EFE7;
  --paper-ink: #14202B;
  --cyan: #26F0D8;
  --amber: #FF9F1C;
  --steel: #7C93A8;
  --green: #3DDC97;
  --coral: #FF5C5C;
  --muted: #C6D3DE;

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --radius-pill: 999px;

  --shell-max: 1200px;
  --gutter: clamp(16px, 4vw, 40px);

  --font-display: "Barlow Condensed", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", Consolas, "Courier New", monospace;

  --shadow-panel: 0 28px 60px -40px rgba(0, 0, 0, 0.95);
}

/* ===== Base ===== */
html { font-size: 100%; }

body {
  min-height: 100vh;
  background-color: var(--ink-900);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(46, 74, 95, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 74, 95, 0.18) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.55;
}

main,
.site-header,
.site-footer {
  position: relative;
  z-index: 1;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.01em;
  margin-bottom: 0.5em;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.3rem); }
h3 { font-size: clamp(1.2rem, 2.2vw, 1.6rem); }
h4 { font-size: 1.05rem; letter-spacing: 0.03em; }

p { margin-bottom: 1.2em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover { color: var(--paper); }

strong { font-weight: 700; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

[id] { scroll-margin-top: clamp(88px, 12vw, 120px); }

/* ===== Utilities ===== */
.shell {
  width: min(100% - 2 * var(--gutter), var(--shell-max));
  margin-inline: auto;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 10px;
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.lede {
  max-width: 62ch;
  font-size: clamp(1rem, 1.5vw, 1.12rem);
  color: var(--muted);
}

.section { padding-block: clamp(32px, 5vw, 64px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: clamp(18px, 3vw, 28px);
}

.section-head__title { margin-bottom: 0; }

.section-head__note {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--steel);
  margin-bottom: 6px;
}

/* ===== Buttons & tags ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.7em 1.2em;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.btn--primary {
  background: var(--amber);
  color: #17110A;
  box-shadow: 0 10px 24px -16px rgba(255, 159, 28, 0.9);
}

.btn--primary:hover {
  background: #FFB347;
  color: #17110A;
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--paper);
}

.btn--ghost:hover {
  border-color: rgba(38, 240, 216, 0.6);
  color: var(--cyan);
  background: rgba(38, 240, 216, 0.06);
}

.btn--sm {
  padding: 0.5em 0.95em;
  font-size: 0.85rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  line-height: 1.5;
  color: var(--steel);
  background: rgba(7, 18, 28, 0.5);
  white-space: nowrap;
}

.tag--cyan {
  color: var(--cyan);
  border-color: rgba(38, 240, 216, 0.4);
  background: rgba(38, 240, 216, 0.1);
}

.tag--amber {
  color: var(--amber);
  border-color: rgba(255, 159, 28, 0.45);
  background: rgba(255, 159, 28, 0.1);
}

.tag--steel {
  color: var(--steel);
  border-color: rgba(124, 147, 168, 0.4);
  background: rgba(124, 147, 168, 0.08);
}

/* ===== Panels & grids ===== */
.panel {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid rgba(46, 74, 95, 0.85);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--ink-800), rgba(18, 41, 61, 0.86));
  box-shadow: var(--shadow-panel);
}

.panel--paper {
  background: var(--paper);
  border-color: rgba(242, 239, 231, 0.7);
  color: var(--paper-ink);
}

.panel--paper a { color: #0E6E63; }

.grid {
  display: grid;
  gap: clamp(16px, 2.4vw, 28px);
}

.grid--split {
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  align-items: start;
}

.grid--cards {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ===== Prose ===== */
.prose {
  max-width: 68ch;
  color: #DCE5EC;
}

.prose h2,
.prose h3 { color: var(--paper); }

.prose h2 { margin-top: 1.4em; }
.prose h3 { margin-top: 1.2em; }

.prose ul,
.prose ol {
  margin: 0 0 1.2em;
  padding-inline-start: 1.3em;
}

.prose li { margin-bottom: 0.4em; }

.prose a { color: var(--cyan); }

/* ===== Breadcrumbs ===== */
.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--steel);
  margin-bottom: 14px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-inline-end: 6px;
  color: var(--line);
}

.breadcrumbs a {
  color: var(--steel);
  text-decoration: none;
}

.breadcrumbs a:hover { color: var(--cyan); }

.breadcrumbs [aria-current="page"] { color: var(--paper); }

/* ===== Index rail ===== */
.index-rail {
  position: sticky;
  top: 104px;
  align-self: start;
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid rgba(46, 74, 95, 0.85);
  border-radius: 20px;
  background: rgba(7, 18, 28, 0.62);
  box-shadow: var(--shadow-panel);
}

.index-rail__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--steel);
}

.index-rail__list {
  display: grid;
  gap: 2px;
  list-style: none;
}

.index-rail__link {
  display: block;
  padding: 7px 12px;
  border-inline-start: 2px solid transparent;
  border-radius: 0 10px 10px 0;
  color: var(--steel);
  font-size: 0.92rem;
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.index-rail__link:hover {
  color: var(--paper);
  background: rgba(38, 240, 216, 0.08);
}

.index-rail__link[aria-current="true"] {
  color: var(--cyan);
  border-inline-start-color: var(--cyan);
  background: rgba(38, 240, 216, 0.1);
  font-weight: 600;
}

/* ===== Media container ===== */
.media {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(46, 74, 95, 0.9);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 28% 18%, rgba(38, 240, 216, 0.16), transparent 62%),
    var(--ink-800);
}

.media__frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
}

.media--wide .media__frame { aspect-ratio: 21 / 9; }
.media--tall .media__frame { aspect-ratio: 4 / 5; }

.media__frame img,
.media__frame picture,
.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(7, 18, 28, 0.28) 0 1px, transparent 1px 4px),
    linear-gradient(120deg, rgba(38, 240, 216, 0.08), transparent 46%);
}

.media__caption {
  padding: 10px 14px;
  border-top: 1px solid rgba(46, 74, 95, 0.85);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--steel);
}

/* ===== Reveal ===== */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

html.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ===== Skip link ===== */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--cyan);
  color: var(--ink-950);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.skip-link:focus-visible { transform: translateY(0); }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(180deg, rgba(11, 27, 43, 0.97), rgba(11, 27, 43, 0.85));
  border-bottom: 1px solid rgba(46, 74, 95, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  width: min(100% - 2 * var(--gutter), 1360px);
  margin-inline: auto;
  padding-block: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
}

.brand:hover { color: var(--paper); }

.brand__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid rgba(38, 240, 216, 0.45);
  border-radius: 14px;
  background: linear-gradient(150deg, rgba(38, 240, 216, 0.18), rgba(18, 41, 61, 0.92));
  color: var(--cyan);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.06rem;
  letter-spacing: 0.05em;
}

.brand__sub {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--steel);
}

.nav-capsule {
  display: flex;
  justify-content: center;
  justify-self: center;
}

.nav-list {
  display: flex;
  gap: 4px;
  list-style: none;
  padding: 6px;
  border: 1px solid rgba(46, 74, 95, 0.9);
  border-radius: var(--radius-pill);
  background: rgba(18, 41, 61, 0.78);
  box-shadow: inset 0 1px 0 rgba(242, 239, 231, 0.05);
}

.nav-link {
  display: block;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-link:hover {
  color: var(--paper);
  background: rgba(38, 240, 216, 0.1);
}

.nav-link[aria-current="page"] {
  background: var(--cyan);
  color: var(--ink-950);
  font-weight: 700;
  box-shadow: 0 8px 20px -14px rgba(38, 240, 216, 0.95);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(18, 41, 61, 0.9);
  color: var(--paper);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.nav-toggle:hover { border-color: rgba(38, 240, 216, 0.55); }

.nav-toggle__bars {
  position: relative;
  display: block;
  width: 18px;
  height: 12px;
}

.nav-toggle__bars span {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle__bars span:nth-child(1) { top: 0; }
.nav-toggle__bars span:nth-child(2) { top: 5px; }
.nav-toggle__bars span:nth-child(3) { top: 10px; }

.site-header[data-open="true"] .nav-toggle__bars span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.site-header[data-open="true"] .nav-toggle__bars span:nth-child(2) {
  opacity: 0;
}

.site-header[data-open="true"] .nav-toggle__bars span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.scroll-meter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  overflow: hidden;
  background: rgba(46, 74, 95, 0.5);
}

.scroll-meter__bar {
  display: block;
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  transition: transform 0.1s linear;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: clamp(56px, 8vw, 110px);
  background: var(--ink-950);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.footer-inner {
  display: grid;
  gap: clamp(28px, 5vw, 48px);
  width: min(100% - 2 * var(--gutter), 1360px);
  margin-inline: auto;
  padding-block: clamp(40px, 6vw, 72px) 26px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(230px, 1.1fr) 2fr;
  gap: clamp(28px, 5vw, 64px);
}

.footer-brand {
  display: grid;
  align-content: start;
  gap: 14px;
}

.footer-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  border: 1px solid rgba(38, 240, 216, 0.4);
  border-radius: 15px;
  background: linear-gradient(150deg, rgba(38, 240, 216, 0.16), rgba(18, 41, 61, 0.9));
  color: var(--cyan);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: 0.06em;
}

.footer-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: 0.05em;
  color: var(--paper);
}

.footer-tagline {
  max-width: 34ch;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--steel);
  margin: 0;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: rgba(124, 147, 168, 0.8);
  margin: 0;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
}

.footer-col__title {
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.footer-links {
  display: grid;
  gap: 9px;
  list-style: none;
}

.footer-link {
  width: fit-content;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  font-size: 0.93rem;
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.footer-link:hover {
  color: var(--cyan);
  border-bottom-color: rgba(38, 240, 216, 0.5);
}

.footer-contact {
  display: grid;
  gap: 12px;
  font-style: normal;
  font-size: 0.9rem;
}

.footer-contact__row {
  display: grid;
  gap: 2px;
}

.footer-contact__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--steel);
}

.footer-contact__value {
  color: var(--paper);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.footer-contact__value:hover { color: var(--cyan); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid rgba(46, 74, 95, 0.7);
}

.footer-meta {
  margin: 0;
  font-size: 0.78rem;
  color: rgba(124, 147, 168, 0.9);
}

/* ===== Responsive ===== */
@media (max-width: 1100px) {
  .nav-link { padding: 8px 11px; font-size: 0.88rem; }
}

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: 1fr auto;
    padding-block: 10px;
  }

  .nav-toggle { display: inline-flex; }

  .nav-capsule {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    display: block;
    justify-self: stretch;
    padding: 10px;
    border: 1px solid rgba(46, 74, 95, 0.95);
    border-radius: 24px;
    background: rgba(7, 18, 28, 0.98);
    box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.95);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .site-header[data-open="true"] .nav-capsule {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    gap: 2px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .nav-link {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 1rem;
  }

  .nav-link[aria-current="page"] {
    border-radius: 16px;
    box-shadow: none;
  }

  .grid--split { grid-template-columns: 1fr; }

  .index-rail {
    position: static;
    top: auto;
  }

  .index-rail__list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 4px;
  }

  .index-rail__link {
    border-inline-start: 0;
    border: 1px solid rgba(46, 74, 95, 0.8);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    white-space: nowrap;
  }

  .index-rail__link[aria-current="true"] {
    border-color: rgba(38, 240, 216, 0.55);
  }

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

@media (max-width: 720px) {
  body { font-size: 15px; }

  .header-actions .btn--ghost { display: none; }

  .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
  .brand__sub { display: none; }

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

  .panel { border-radius: 20px; }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  html.js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
