/* ============================================================
   THE AGENCY // LUX LETIFERA
   Tactical dossier · mobile-first · refined cyberpunk
   ============================================================ */

:root {
  --glow-x: calc(50vw - 600px);
  --glow-y: calc(50vh - 600px);
  --ink: #ff4b0a;
  --ink-soft: rgba(255, 75, 10, 0.55);
  --ink-glow: rgba(255, 75, 10, 0.35);

  --bone: #FAFAE5;
  --bone-dim: rgba(250, 250, 229, 0.82);

  --ash: #9f9b8c;
  --ash-dim: rgba(138, 133, 119, 0.28);

  --void: #07050a;
  --void-2: #0d0907;
  --surface: rgba(18, 12, 8, 0.72);
  --surface-line: rgba(255, 75, 10, 0.22);

  --go: #7bdc8e;
  --stop: #ff3a4a;

  --font-display: 'Rajdhani', system-ui, sans-serif;
  --font-heading: 'Orbitron', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  /* Typography Scale */
  --text-xs: clamp(0.6rem, 1.5vw, 0.75rem);
  --text-sm: clamp(0.7rem, 2vw, 0.875rem);
  --text-base: clamp(0.875rem, 2vw, 1.05rem);
  --text-lg: clamp(1rem, 3vw, 1.25rem);
  --text-xl: clamp(1.5rem, 4vw, 2rem);
  --text-display: clamp(2.5rem, 8vw, 4rem);

  /* Spacing Scale */
  --space-xs: clamp(0.25rem, 1vw, 0.5rem);
  --space-sm: clamp(0.5rem, 2vw, 1rem);
  --space-md: clamp(1rem, 3vw, 2rem);
  --space-lg: clamp(2rem, 5vw, 4rem);
  --space-xl: clamp(4rem, 8vw, 8rem);

  --gutter: clamp(1rem, 5vw, 2.5rem);
  --max: 1180px;

  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

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

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

body {
  min-height: 100vh;
  background: #000;
  color: var(--bone);
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.72;
  text-align: justify;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  background-repeat: no-repeat;
  width: 100%;
}

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

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  min-height: 44px;
}

::selection { background: var(--ink); color: var(--void); }

/* --- Accessibility helpers ----------------------------------- */

.skip-link {
  position: absolute;
  top: -100px; left: 1rem;
  background: var(--ink); color: var(--void);
  padding: 0.6rem 1rem;
  font-family: var(--font-mono); font-weight: 700;
  z-index: 100;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 1rem; }

:focus-visible {
  outline: none !important;
  box-shadow: 0 0 0 2px var(--void), 0 0 0 4px var(--ink) !important;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Global atmosphere --------------------------------------- */

.ambient-glow {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  overflow: hidden;
  contain: strict;
}
.ambient-glow::before {
  content: '';
  position: absolute;
  width: 1200px; height: 1200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 75, 10, 0.06) 0%, transparent 70%);
  left: 0;
  top: 0;
  transform: translate3d(var(--glow-x), var(--glow-y), 0);
  will-change: transform;
}

.grid-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  background-image:
    linear-gradient(to right, rgba(255, 95, 20, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 95, 20, 0.22) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9), transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,0.9), transparent 78%);
  opacity: 0.52;
  contain: strict;
  transform: translateZ(0);
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,0.55) 100%);
  contain: strict;
  transform: translateZ(0);
}

/* Phosphor sweep — slow amber refresh band, no harsh scanlines */
.scanline-overlay {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 4;
  background:
    linear-gradient(
      180deg,
      rgba(255, 120, 40, 0) 0%,
      rgba(255, 120, 40, 0) 38%,
      rgba(255, 150, 60, 0.020) 50%,
      rgba(255, 120, 40, 0) 62%,
      rgba(255, 120, 40, 0) 100%
    );
  background-size: 100% 320%;
  background-repeat: no-repeat;
  background-position: 0 50%;
  contain: strict;
  transform: translateZ(0);
}

@keyframes phosphorSweep {
  0%   { background-position: 0 -90%; }
  45%  { background-position: 0 190%; }
  100% { background-position: 0 190%; }
}

/* Animated phosphor grain — hardware accelerated translation */
body::before {
  content: '';
  position: fixed;
  inset: -100px;
  pointer-events: none;
  z-index: 5;
  opacity: 0.034;
  background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMjAiIGhlaWdodD0iMjIwIj48ZmlsdGVyIGlkPSJuIj48ZmVUdXJidWxlbmNlIHR5cGU9ImZyYWN0YWxOb2lzZSIgYmFzZUZyZXF1ZW5jeT0iMC45IiBudW1PY3RhdmVzPSIyIiBzdGl0Y2hUaWxlcz0ic3RpdGNoIi8+PGZlQ29sb3JNYXRyaXggdmFsdWVzPSIwIDAgMCAwIDEgIDAgMCAwIDAgMC43OCAgMCAwIDAgMCAwLjQgIDAgMCAwIDEuNiAwIi8+PC9maWx0ZXI+PHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsdGVyPSJ1cmwoI24pIi8+PC9zdmc+");
  background-size: 220px 220px;
  transform: translate3d(0, 0, 0);
  contain: strict;
}

@keyframes phosphorHiss {
  0%   { transform: translate3d(0, 0, 0); }
  20%  { transform: translate3d(-44px, 36px, 0); }
  40%  { transform: translate3d(72px, -28px, 0); }
  60%  { transform: translate3d(-32px, -58px, 0); }
  80%  { transform: translate3d(58px, 64px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Slow ambient phosphor breathing — a barely perceptible warm bloom */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(135deg, rgba(255, 140, 55, 0.02) 0%, rgba(255, 140, 55, 0) 100%),
    radial-gradient(150vw 150vh at 45% 30%, rgba(255, 140, 55, 0.035) 0%, rgba(255, 140, 55, 0) 100%);
  background-repeat: no-repeat, no-repeat;
  opacity: 0.52;
  contain: strict;
  transform: translateZ(0);
}

@keyframes phosphorBreathe {
  0%, 100% { opacity: 0.38; }
  50%      { opacity: 0.68; }
}

/* --- Shared section chrome ----------------------------------- */

main, .hero, .site-footer { position: relative; z-index: 3; }
.modal { z-index: 1000; }

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-xl) var(--gutter);
  contain: content;
  content-visibility: auto;
  contain-intrinsic-size: auto 720px;
}

.section.section--compact {
  padding-top: var(--space-sm);
  margin-top: 0;
}

.section__head,
.section__header {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs) var(--space-md);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--surface-line);
  row-gap: var(--space-xs);
}

.section__head {
  grid-template-areas:
    'num'
    'title'
    'kicker';
}

.section__header {
  grid-template-areas:
    'num'
    'title';
}

.section__title-group {
  grid-area: title;
}

.section__title-group .section__kicker {
  display: block;
  margin: 0 0 var(--space-xs);
  justify-self: start;
}

.section__num {
  grid-area: num;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  letter-spacing: 0.3em;
  color: var(--ink);
}

.section__title {
  grid-area: title;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-display);
  line-height: 0.95;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--bone);
}

.section__kicker {
  grid-area: kicker;
  align-self: end;
  justify-self: start;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--ash);
  letter-spacing: 0.15em;
  margin: var(--space-xs) 0 0;
}

@media (min-width: 720px) {
  .section__head {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      'num    kicker'
      'title  kicker';
  }
  .section__header {
    grid-template-columns: 1fr;
    grid-template-areas:
      'num'
      'title';
  }
  .section__kicker {
    justify-self: end;
    align-self: end;
    margin: 0;
  }
  .section__title-group .section__kicker {
    justify-self: start;
    align-self: auto;
    margin: 0 0 var(--space-xs);
  }
}

.accent { color: var(--ink); font-weight: 600; }
.text-link {
  color: var(--ink);
  border-bottom: 1px dashed var(--ink-soft);
  transition: border-color 0.2s var(--ease), text-shadow 0.2s var(--ease);
}
.text-link:hover { border-bottom-color: var(--ink); text-shadow: 0 0 12px var(--ink-glow); }

/* ============================================================
   HERO
   ============================================================ */

.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5rem var(--gutter) 6rem;
  position: relative;
}

.hero.hero--compact {
  min-height: auto;
  padding: 3rem var(--gutter) 1.25rem;
  align-items: flex-start;
}

.hero__frame {
  width: 100%;
  max-width: var(--max);
  display: grid;
  gap: 1.5rem;
  justify-items: center;
  text-align: center;
  position: relative;
}

/* --- Hero Navigation --- */
.hero__nav {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.nav-link {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ash);
  text-decoration: none;
  letter-spacing: 0.1em;
  transition: color 0.2s var(--ease), text-shadow 0.2s var(--ease);
}

.nav-link:hover, .nav-link:focus-visible {
  color: var(--bone);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

.hero__meta {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  color: var(--ash);
  text-transform: uppercase;
  margin-bottom: var(--space-xs);
  width: 100%;
  max-width: 640px;
}
@media (min-width: 560px) {
  .hero__meta {
    font-size: 0.7rem;
    gap: 0.75rem;
    letter-spacing: 0.2em;
  }
  .hero__meta::before,
.hero__meta::after {
  flex: 1;
  height: 1px;
  background: var(--ink-soft);
    height: 1px;
    background: linear-gradient(to right, transparent, var(--ink-soft));
  }
  .hero__meta::after {
    background: linear-gradient(to left, transparent, var(--ink-soft));
  }
}
.hero__meta-dot {
  width: 4px; height: 4px;
  background: var(--ink); display: inline-block;
}

.hero__logo {
  width: min(78vw, 420px);
  margin: 0.5rem 0;
  position: relative;
  animation: logoFloat 1.2s var(--ease) both;
  transform: translateZ(0);
}
.hero__logo img {
  width: 100%;
  filter: drop-shadow(0 0 20px rgba(255, 75, 10, 0.24));
}
.hero__wordmark {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 2rem 1rem;
  border: 1px solid var(--ink-soft);
  border-left-width: 2px;
  border-right-width: 2px;
  background: linear-gradient(180deg, rgba(255,75,10,0.05), transparent);
  text-shadow: 0 0 24px var(--ink-glow);
}
.hero__wordmark-the {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.4em;
  color: var(--ink);
}
.hero__wordmark-agency {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: var(--bone);
  text-transform: uppercase;
}
.hero__wordmark-sub {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--ash);
  margin-top: 0.4rem;
}
.hero__logo.is-fallback img { display: none; }
.hero__logo.is-fallback .hero__wordmark { display: flex; }

@media (min-width: 720px) {
  .hero__logo { width: min(55vw, 480px); }
}

.hero__tagline {
  max-width: 48ch;
  font-size: clamp(1.05rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--bone-dim);
  letter-spacing: 0.005em;
  animation: fadeUp 1s 0.2s var(--ease) both;
}

.hero__actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.9rem;
  width: min(100%, 420px);
  margin-top: 0.5rem;
  animation: fadeUp 1s 0.4s var(--ease) both;
}

@media (min-width: 560px) {
  .hero__actions { flex-direction: row; width: auto; }
}

.hero__footnote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.5rem;
  animation: fadeUp 1s 0.55s var(--ease) both;
}
.hero__status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ash);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.btn--compact { padding: 0.7rem 1.2rem; font-size: 0.72rem; }

.hero__actions-or {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ash);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  align-self: center;
}

.hero__scroll {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  color: var(--ash);
}
.hero__scroll span {
  display: block;
  text-align: center;
}
.hero__scroll-line {
  width: 1px; height: 40px;
  margin: 0 auto;
  background: linear-gradient(to bottom, var(--ink), transparent);
  animation: scrollPulse 2.4s var(--ease) infinite;
}
@media (min-width: 640px) {
  .hero__scroll { display: flex; }
}

@keyframes logoFloat {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes scrollPulse {
  0%,100% { opacity: 0.3; transform: scaleY(0.6); transform-origin: top; }
  50%     { opacity: 1;   transform: scaleY(1); }
}

.hero__tagline.hero__justified-text {
  text-align: justify;
  max-width: 64ch;
  width: 100%;
}

.hero__intro {
  margin-bottom: 2rem;
  text-align: center;
}

.hero__system-kicker {
  text-align: right;
  border-bottom: 1px solid var(--surface-line);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--ash);
  letter-spacing: 0.15em;
}

.hero__justified-list {
  margin-bottom: 2rem;
  line-height: 1.78;
  text-align: justify;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--bone-dim);
}

.hero__justified-text {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  line-height: 1.78;
  color: var(--bone-dim);
}

/* --- CINEMATIC HERO UPGRADE --- */
.cinematic-hero {
  overflow: hidden;
}

/* Ambient glow tracks mouse (hidden in favor of global ambient-glow) */
.hero__ambient-glow {
  display: none !important;
}

/* Reactive Frame */
.cinematic-hero .hero__frame {
  z-index: 3;
}

/* Fallback for mobile/reduced motion */
@media (hover: none), (prefers-reduced-motion: reduce) {
  .cinematic-hero .hero__frame { transform: none !important; transition: none !important; }
}

.cinematic-hero .hero__logo-wrapper {
  filter: drop-shadow(0 0 18px rgba(255, 75, 10, 0.28));
  transition: transform 0.3s var(--ease), filter 0.3s var(--ease);
}
.cinematic-hero .hero__logo:hover .hero__logo-wrapper {
  transform: scale(1.02);
  filter: drop-shadow(0 0 28px rgba(255, 75, 10, 0.42));
}

.btn--heavy-cta {
  background: linear-gradient(135deg, rgba(255, 75, 10, 0.15), rgba(255, 75, 10, 0.02)) !important;
  border: 1px solid var(--ink) !important;
  box-shadow: 0 0 20px rgba(255, 75, 10, 0.2), inset 0 0 10px rgba(255, 75, 10, 0.1);
}

/* Sequencing */
.reveal-stagger {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  animation: cinematicReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.reveal-stagger:nth-child(1) { animation-delay: 0.1s; }
.reveal-stagger:nth-child(2) { animation-delay: 0.3s; }
.reveal-stagger:nth-child(3) { animation-delay: 0.5s; }
.reveal-stagger:nth-child(4) { animation-delay: 0.6s; }
.reveal-stagger:nth-child(5) { animation-delay: 0.7s; }

@keyframes cinematicReveal {
  0% { opacity: 0; transform: translate3d(0, 30px, 0) scale(0.98); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255, 140, 55, 0.4);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.1s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  min-height: 44px;
}
.btn:active {
  transform: scale(0.97);
}

.btn::after {
  content: '';
  position: absolute;
  inset: -2px;
  background-color: transparent;
  z-index: 100;
  pointer-events: none;
  contain: layout style;
}

.btn:hover::after {
  animation: btn-bg-glitch 0.9s infinite;
  mix-blend-mode: difference;
}

.btn:not([class*="btn--glitch-"]):hover::after {
  background-color: var(--ink);
}

.btn--glitch-1:hover::after {
  background-image: linear-gradient(
    180deg,
    var(--ink) 0%,
    var(--ink) 15%,
    transparent 15%,
    transparent 35%,
    var(--ink) 35%,
    var(--ink) 65%,
    transparent 65%,
    transparent 85%,
    var(--ink) 85%,
    var(--ink) 100%
  );
}

.btn--glitch-2:hover::after {
  background-image: linear-gradient(
    105deg,
    transparent 0%,
    transparent 25%,
    var(--ink) 25%,
    var(--ink) 45%,
    transparent 45%,
    transparent 55%,
    var(--ink) 55%,
    var(--ink) 90%,
    transparent 90%
  );
}

.btn--glitch-3:hover::after {
  background-image: radial-gradient(
    circle at center,
    transparent 0%,
    transparent 35%,
    var(--ink) 35%,
    var(--ink) 65%,
    transparent 65%,
    transparent 100%
  );
}

.btn--glitch-4:hover::after {
  background-image: repeating-linear-gradient(
    45deg,
    var(--ink) 0px,
    var(--ink) 30px,
    transparent 30px,
    transparent 60px
  );
}

@keyframes btn-bg-glitch {
  0%, 14%  { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  15%, 24% { clip-path: inset(10% 0 10% 0); transform: translate(2px, 0); }
  25%, 34% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  35%, 44% { clip-path: inset(50% 0 10% 0); transform: translate(-2px, 0); }
  45%, 54% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  55%, 64% { clip-path: inset(10% 0 60% 0); transform: translate(2px, 2px); }
  65%, 74% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  75%, 84% { clip-path: inset(20% 0 20% 0); transform: translate(-2px, -2px); }
  85%, 94% { clip-path: inset(0 0 0 0); transform: translate(0, 0); }
  95%, 100%{ clip-path: inset(0 0 80% 0); transform: translate(1px, 0); }
}

.char.is-eve {
  font-family: 'Eve Frontier', 'eve frontier', sans-serif;
  font-size: 0.75em;
  vertical-align: baseline;
}

.btn--primary {
  background: rgba(255, 75, 10, 0.08);
  border-color: var(--ink);
}
.btn--ghost {
  color: var(--bone);
  border-color: rgba(138, 133, 119, 0.28);
}
.btn--terminal {
  color: var(--bone);
  border: 1px solid rgba(255, 75, 10, 0.35);
  border-left: 4px solid var(--ink);
  background-image: 
    linear-gradient(rgba(255, 75, 10, 0.03) 50%, transparent 50%),
    linear-gradient(to bottom, rgba(10, 7, 5, 0.9), rgba(18, 12, 8, 0.95));
  background-size: 100% 4px, 100% 100%;
  box-shadow: 0 0 10px rgba(255, 75, 10, 0.05), inset 0 0 10px rgba(0, 0, 0, 0.8);
}
.btn--terminal:hover,
.btn--terminal:focus-visible {
  border-color: var(--ink);
  border-left-color: var(--bone);
  background-image: 
    linear-gradient(rgba(255, 75, 10, 0.06) 50%, transparent 50%),
    linear-gradient(to bottom, rgba(255, 75, 10, 0.08), rgba(255, 75, 10, 0.03));
  box-shadow: 0 0 15px var(--ink-glow), inset 0 0 10px rgba(255, 75, 10, 0.15);
  color: var(--bone) !important;
}
.btn__terminal-prompt {
  color: var(--ink);
  margin-right: -0.25rem;
  font-weight: 700;
  transition: color 0.2s var(--ease);
}
.btn--terminal:hover .btn__terminal-prompt,
.btn--terminal:focus-visible .btn__terminal-prompt {
  color: var(--bone);
}
.btn__terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 14px;
  background-color: var(--ink);
  margin-left: -0.2rem;
  animation: btn-cursor-blink 1s step-start infinite;
  transition: background-color 0.2s var(--ease);
}
.btn--terminal:hover .btn__terminal-cursor,
.btn--terminal:focus-visible .btn__terminal-cursor {
  background-color: var(--bone);
}
@keyframes btn-cursor-blink {
  50% { opacity: 0; }
}

.btn--large { padding: 1.15rem 2.2rem; font-size: 0.9rem; }
.btn__icon { width: 18px; height: 14px; position: relative; z-index: 2; }
.btn__bracket { color: var(--ink); position: relative; z-index: 2; }

.btn__label {
  position: relative;
  z-index: 2;
  display: inline-block;
  line-height: 1;
}

.char {
  position: relative;
  z-index: 2;
}

.btn__label::before,
.btn__label::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  animation: none;
}

.btn__label::before {
  color: rgba(255, 170, 90, 1);
  margin-left: -3px;
}

.btn__label::after {
  color: rgba(255, 110, 30, 1);
  margin-left: 3px;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--ink);
  color: var(--ink) !important;
}

.btn:hover .btn__label::before {
  animation: glitch-anim-before 0.9s steps(2, end) infinite;
  mix-blend-mode: screen;
}

.btn:hover .btn__label::after {
  animation: glitch-anim-after 0.9s steps(2, end) infinite;
  mix-blend-mode: screen;
}

@keyframes glitch-anim-before {
  0%   { clip-path: inset(0 0 0 0); opacity: 1; transform: translate(-4px, 2px); }
  10%  { clip-path: inset(20% 0 60% 0); opacity: 0.7; transform: translate(5px, -3px); }
  20%  { clip-path: inset(60% 0 10% 0); opacity: 1; transform: translate(-6px, 1px); }
  30%  { clip-path: inset(10% 0 80% 0); opacity: 0.4; transform: translate(3px, 3px); }
  40%  { clip-path: inset(80% 0 5% 0); opacity: 1; transform: translate(-2px, -2px); }
  50%  { clip-path: inset(30% 0 40% 0); opacity: 0.9; transform: translate(6px, -1px); }
  60%  { clip-path: inset(70% 0 20% 0); opacity: 0.3; transform: translate(-5px, 2px); }
  70%  { clip-path: inset(5% 0 90% 0); opacity: 1; transform: translate(4px, -3px); }
  80%  { clip-path: inset(45% 0 35% 0); opacity: 0.8; transform: translate(-3px, 1px); }
  90%  { clip-path: inset(90% 0 0 0); opacity: 1; transform: translate(2px, 3px); }
  100% { clip-path: inset(0 0 0 0); opacity: 1; transform: translate(-4px, 2px); }
}

@keyframes glitch-anim-after {
  0%   { clip-path: inset(0 0 0 0); opacity: 1; transform: translate(4px, -2px); }
  10%  { clip-path: inset(40% 0 20% 0); opacity: 0.8; transform: translate(-5px, 3px); }
  20%  { clip-path: inset(10% 0 60% 0); opacity: 1; transform: translate(6px, -1px); }
  30%  { clip-path: inset(80% 0 10% 0); opacity: 0.3; transform: translate(-3px, -3px); }
  40%  { clip-path: inset(5% 0 80% 0); opacity: 1; transform: translate(2px, 2px); }
  50%  { clip-path: inset(40% 0 30% 0); opacity: 0.9; transform: translate(-6px, 1px); }
  60%  { clip-path: inset(20% 0 70% 0); opacity: 0.4; transform: translate(5px, -2px); }
  70%  { clip-path: inset(90% 0 5% 0); opacity: 1; transform: translate(-4px, 3px); }
  80%  { clip-path: inset(35% 0 45% 0); opacity: 0.7; transform: translate(3px, -1px); }
  90%  { clip-path: inset(0 0 90% 0); opacity: 1; transform: translate(-2px, -3px); }
  100% { clip-path: inset(0 0 0 0); opacity: 1; transform: translate(4px, -2px); }
}

/* ============================================================
   DOCTRINE LEDGER
   ============================================================ */

.doctrine-ledger {
  list-style: none;
  position: relative;
  border-top: 1px solid var(--surface-line);
}

.doctrine-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--surface-line);
  position: relative;
}

.doctrine-row::before {
  content: '';
  position: absolute;
  left: -1rem; top: 0; bottom: 0;
  width: 3px;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease);
}

.doctrine-row:hover::before {
  transform: scaleY(1);
}

.doctrine-row__idx {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--ink);
  letter-spacing: 0.25em;
  margin-bottom: var(--space-xs);
}

.doctrine-row__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xl);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bone);
  line-height: 1.15;
  transition: color 0.35s var(--ease);
}

.doctrine-row__body p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-base);
  line-height: 1.78;
  color: var(--bone-dim);
  margin-bottom: 1.3rem;
  max-width: 62ch;
}
.doctrine-row__body p:last-child { margin-bottom: 0; }

.doctrine-row__kicker {
  text-align: right;
  border-bottom: 1px solid var(--surface-line);
  padding-bottom: 0.5rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.doctrine-row__metrics {
  line-height: 2;
  margin-top: 0.75rem;
  color: var(--bone-dim);
  width: max-content;
  margin-left: auto;
  margin-right: 2rem;
  text-align: left;
}

@media (min-width: 820px) {
  .doctrine-row {
    display: grid;
    grid-template-columns: minmax(200px, 24%) 1fr;
    gap: var(--space-lg);
    align-items: start;
    padding: var(--space-lg) 0 var(--space-lg) var(--space-md);
  }
  .doctrine-row::before { top: var(--space-lg); }
  .doctrine-row__idx { margin-bottom: var(--space-sm); font-size: var(--text-sm); }
  .doctrine-row__title { font-size: 1.85rem; line-height: 1.05; }
}

/* ============================================================
   CLEARANCE
   ============================================================ */

.clearance-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .clearance-grid { grid-template-columns: 1fr 1fr; }
}

.clearance-block {
  position: relative;
  padding: 1.75rem;
  border: 1px dashed;
  background: rgba(0,0,0,0.3);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
@media (hover: hover) {
  .clearance-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 75, 10, 0.08);
  }
}
.clearance-block__readout {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  color: var(--ash);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  opacity: 0.7;
}
.clearance-block__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
}
.clearance-block__status {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.clearance-block__blink {
  width: 8px; height: 8px;
  border-radius: 50%;
  animation: blink 2.2s var(--ease) infinite;
}
.clearance-block p {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 0.98rem;
  line-height: 1.78;
  color: var(--bone-dim);
  margin-bottom: 1.15rem;
}
.clearance-block p:last-child { margin-bottom: 0; }

.clearance-block__card {
  margin: 1.5rem auto 0;
}

.clearance-block__actions {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
  width: 100%;
}

.clearance-block--authorized {
  border-color: rgba(123, 220, 142, 0.45);
  background: linear-gradient(180deg, rgba(123, 220, 142, 0.06), transparent 70%), rgba(0,0,0,0.3);
}
.clearance-block--authorized .clearance-block__status { color: var(--go); text-shadow: 0 0 12px rgba(123, 220, 142, 0.35); }
.clearance-block--authorized .clearance-block__blink { background: var(--go); box-shadow: 0 0 12px var(--go); }

.clearance-block--denied {
  border-color: rgba(255, 58, 74, 0.45);
  background: linear-gradient(180deg, rgba(255, 58, 74, 0.06), transparent 70%), rgba(0,0,0,0.3);
}
.clearance-block--denied .clearance-block__status { color: var(--stop); text-shadow: 0 0 12px rgba(255, 58, 74, 0.35); }
.clearance-block--denied .clearance-block__blink { background: var(--stop); box-shadow: 0 0 12px var(--stop); }

@keyframes blink {
  0%, 60%, 100% { opacity: 1; }
  70%, 90%      { opacity: 0.2; }
}

.archives-cta {
  display: flex;
  justify-content: center;
}

/* ============================================================
   CONTACT
   ============================================================ */

.contact-card {
  display: grid;
  gap: 0;
  grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--surface-line);
  border-top: 2px solid var(--ink);
  position: relative;
  overflow: hidden;
}
.contact-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 40px; height: 40px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  z-index: 2;
}

.contact-card__body {
  padding: 2rem;
}

@media (min-width: 760px) {
  .contact-card {
    grid-template-columns: 1.1fr 0.9fr;
    align-items: stretch;
  }
  .contact-card__body {
    padding: 3rem;
  }
}

.contact-card__lead {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.1rem;
  line-height: 1.78;
  color: var(--bone-dim);
  margin-bottom: 2.2rem;
  max-width: 42ch;
}

.contact-card__fine {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--ash);
  text-transform: uppercase;
}

.contact-card__figure {
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: transparent;
}
.contact-card__figure img {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: 50% bottom;
  filter: contrast(1.05) saturate(0.9);
  display: block;
}

@media (min-width: 760px) {
  .contact-card__figure {
    min-height: 480px;
  }
  .contact-card__figure img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
  }
}


/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
  border-top: 1px solid var(--surface-line);
  text-align: center;
}
.site-footer__line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.25em;
  color: var(--ash);
  text-transform: uppercase;
}
.site-footer__sep { color: var(--ink); }
.site-footer__fine {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(138, 133, 119, 0.6);
  letter-spacing: 0.1em;
}

/* ============================================================
   FOOTER SOCIAL LINKS
   ============================================================ */
.site-footer__socials {
  margin-bottom: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.site-footer__socials-kicker {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.site-footer__socials-list {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__social-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--ash);
  transition: color 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
  padding: 0.5rem 1.25rem;
  border: 1px dashed transparent;
  position: relative;
}

.site-footer__social-item:hover,
.site-footer__social-item:focus-visible {
  color: var(--ink);
  transform: translateY(-2px);
  border-color: var(--surface-line);
  background: rgba(255, 75, 10, 0.02);
}

.site-footer__social-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  fill: currentColor;
  transition: filter 0.25s var(--ease);
}

.site-footer__social-item:hover .site-footer__social-icon {
  filter: drop-shadow(0 0 4px var(--ink-glow));
}

.site-footer__social-label {
  font-weight: 500;
}

/* Bracket hover animations */
.site-footer__social-item::before,
.site-footer__social-item::after {
  content: '';
  color: var(--ink);
  opacity: 0;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  position: absolute;
  top: 50%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  pointer-events: none;
}

.site-footer__social-item::before {
  content: '[';
  left: 6px;
  transform: translateY(-50%) translateX(5px);
}

.site-footer__social-item::after {
  content: ']';
  right: 6px;
  transform: translateY(-50%) translateX(-5px);
}

.site-footer__social-item:hover::before,
.site-footer__social-item:focus-visible::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.site-footer__social-item:hover::after,
.site-footer__social-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ============================================================
   MODAL — ARCHIVES
   ============================================================ */

.modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}
.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(7, 5, 10, 0.92), rgba(0, 0, 0, 0.96));
  animation: fadeBackdrop 0.3s var(--ease);
}
@supports (backdrop-filter: blur(8px)) {
  .modal__backdrop {
    background: rgba(4, 3, 5, 0.86);
    backdrop-filter: blur(8px) saturate(0.82);
    -webkit-backdrop-filter: blur(8px) saturate(0.82);
  }
}

.modal__frame {
  position: relative;
  width: min(95vw, 1400px);
  height: 90vh;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.modal__frame::before,
.modal__frame::after {
  content: '';
  position: absolute;
  width: 24px; height: 24px;
  z-index: 10;
  pointer-events: none;
}
.modal__frame::before {
  top: -1px; left: -1px;
  border-top: 2px solid var(--ink);
  border-left: 2px solid var(--ink);
}
.modal__frame::after {
  bottom: -1px; right: -1px;
  border-bottom: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
}
.modal__frame-bl,
.modal__frame-br {
  position: absolute;
  width: 24px; height: 24px;
  pointer-events: none;
  z-index: 10;
}
.modal__frame-bl { top: -1px; right: -1px; border-top: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.modal__frame-br { bottom: -1px; left: -1px; border-bottom: 2px solid var(--ink); border-left: 2px solid var(--ink); }

.modal__panel {
  position: relative;
  width: 100%;
  height: 100%;
  background:
    linear-gradient(rgba(255, 75, 10, 0.025) 50%, transparent 50%),
    linear-gradient(90deg, rgba(255, 75, 10, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(18, 12, 8, 0.96), rgba(7, 5, 10, 0.98));
  background-size: 100% 4px, 64px 64px, 100% 100%;
  border: 1px solid var(--surface-line);
  border-top: 2px solid var(--ink);
  box-shadow:
    0 0 0 1px rgba(255, 75, 10, 0.06),
    0 24px 64px rgba(0, 0, 0, 0.7),
    inset 0 0 34px rgba(0, 0, 0, 0.66);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.4s var(--ease);
}

.modal__panel::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 75, 10, 0.18), transparent 16%, transparent 84%, rgba(255, 75, 10, 0.12)),
    radial-gradient(120% 70% at 50% 0%, rgba(255, 75, 10, 0.07), transparent 64%);
  opacity: 0.62;
  z-index: 1;
}

.modal__scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    to bottom, transparent 0 2px, rgba(255, 75, 10, 0.015) 2px 3px
  );
  pointer-events: none;
  z-index: 7;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.35rem 0.9rem 1.5rem;
  border-bottom: 1px solid var(--surface-line);
  background:
    linear-gradient(90deg, rgba(255, 75, 10, 0.12), transparent 34%),
    rgba(0, 0, 0, 0.34);
  position: relative;
  z-index: 8;
  gap: 1rem;
  flex-wrap: wrap;
}

.modal__header::after {
  content: '';
  position: absolute;
  left: 1.5rem;
  right: 1.35rem;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, var(--ink), transparent 52%, rgba(250, 250, 229, 0.24));
}

.modal__title {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(255, 75, 10, 0.24);
}

.modal__close {
  min-height: 38px;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(255, 140, 55, 0.34);
  border-left: 3px solid var(--ink);
  background: rgba(0, 0, 0, 0.28);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  cursor: pointer;
}
.modal__close:hover,
.modal__close:focus-visible {
  border-color: var(--ink);
  background: rgba(255, 75, 10, 0.1);
  box-shadow: inset 0 0 18px rgba(255, 75, 10, 0.12);
  color: var(--bone);
}

.modal__body {
  padding: 0;
  overflow: hidden;
  height: 100%;
}

/* --- TERMINAL OS FRAMEWORK --- */
.terminal-os__state {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--bone-dim);
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  min-height: 32px;
  padding: 0.28rem 0.68rem;
  border: 1px solid rgba(123, 220, 142, 0.32);
  background: rgba(123, 220, 142, 0.045);
}
.terminal-os__state::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background-color: var(--go);
  box-shadow: 0 0 8px rgba(123, 220, 142, 0.72);
  animation: pulseStateIndicator 1.5s infinite alternate;
}

@keyframes pulseStateIndicator {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

.terminal-os__grid {
  display: grid;
  grid-template-columns: 1fr;
  height: 100%;
  overflow: hidden;
  padding: 0;
  position: relative;
  z-index: 2;
}

.terminal-os__grid[hidden],
.terminal-os__root-menu[hidden] {
  display: none;
}

@media (min-width: 760px) {
  .terminal-os__grid {
    grid-template-columns: 280px 1fr;
  }
}

.terminal-os__sidebar {
  border-right: 1px solid var(--surface-line);
  background:
    linear-gradient(180deg, rgba(255, 75, 10, 0.055), transparent 36%),
    rgba(0, 0, 0, 0.38);
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: var(--ink-soft) transparent;
  box-shadow: inset -1px 0 0 rgba(255, 75, 10, 0.08);
}
.terminal-os__sidebar::-webkit-scrollbar { width: 4px; }
.terminal-os__sidebar::-webkit-scrollbar-thumb { background: var(--ink-soft); }

.terminal-os {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.terminal-os__root-menu {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg) var(--gutter);
  background:
    linear-gradient(rgba(255, 75, 10, 0.028) 50%, transparent 50%),
    radial-gradient(80% 80% at 50% 50%, rgba(255, 75, 10, 0.08), transparent 64%),
    rgba(0, 0, 0, 0.24);
  background-size: 100% 4px, 100% 100%, 100% 100%;
  gap: 0.85rem;
  position: relative;
  z-index: 2;
}
.terminal-os__root-menu .term-category__btn {
  max-width: 460px;
  margin-bottom: 0;
}

.terminal-os__main {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(255, 75, 10, 0.08), transparent 1px),
    rgba(0, 0, 0, 0.14);
  background-size: 48px 100%, 100% 100%;
}

.term-waveform {
  height: 42px;
  border-bottom: 1px solid var(--surface-line);
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 0 1.6rem;
  overflow: hidden;
  opacity: 0.16;
  transition: opacity 0.4s var(--ease);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.22);
}
.term-waveform.is-active {
  opacity: 0.62;
}
.term-waveform-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--bone), var(--ink));
  height: 2px;
  transform-origin: bottom;
  will-change: transform;
  box-shadow: 0 0 12px rgba(255, 75, 10, 0.35);
}

.term-content {
  flex: 1;
  margin: 1.5rem;
  padding: 2.5rem 2.5rem 2.5rem 3rem;
  overflow-y: auto;
  scroll-behavior: auto;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-lg);
  line-height: 1.85;
  color: var(--bone);
  scrollbar-width: thin;
  scrollbar-color: var(--ink-soft) transparent;
  text-align: justify;
  border: 1px solid rgba(255, 75, 10, 0.18);
  border-left: 3px solid rgba(255, 75, 10, 0.62);
  background:
    linear-gradient(rgba(255, 75, 10, 0.018) 50%, transparent 50%),
    linear-gradient(180deg, rgba(7, 5, 10, 0.68), rgba(0, 0, 0, 0.42));
  background-size: 100% 4px, 100% 100%;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.45);
}
.term-content::-webkit-scrollbar { width: 4px; }
.term-content::-webkit-scrollbar-thumb { background: var(--ink-soft); }

.term-content br {
  content: "";
  display: block;
  margin-bottom: 0.85rem;
}

.term-content strong {
  color: var(--bone);
  font-weight: 600;
}

.term-category {
  margin-bottom: 0;
}
.term-category__btn {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.76rem;
  letter-spacing: 0.15em;
  color: var(--ink);
  text-transform: uppercase;
  background:
    linear-gradient(90deg, rgba(255, 75, 10, 0.08), transparent 55%),
    rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 140, 55, 0.34);
  border-left: 3px solid rgba(255, 75, 10, 0.74);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: transform 0.1s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  position: relative;
  overflow: hidden;
}
.term-category__btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--ink);
  transform: translateX(-101%);
  transform-origin: left;
  opacity: 0.08;
  transition: transform 0.3s var(--ease);
}
.term-category__btn:hover {
  border-color: var(--ink);
  color: var(--bone);
  box-shadow: inset 0 0 18px rgba(255, 75, 10, 0.12);
}
.term-category__btn:hover::before {
  transform: translateX(0);
}
.term-category__btn:active {
  transform: scale(0.97);
}

.term-category__content {
  padding-left: 0;
  margin-top: 0.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.term-category__content[hidden] {
  display: none;
}
.term-category__header {
  margin-bottom: 0.75rem;
  color: var(--ash);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  line-height: 1.5;
  text-transform: uppercase;
}
.term-file {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  min-height: 48px;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  color: var(--bone-dim);
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid transparent;
  border-bottom-color: var(--surface-line);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease), padding 0.2s var(--ease);
  cursor: pointer;
  position: relative;
}
.term-file::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--ink);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s var(--ease);
}
.term-file:hover, .term-file.is-active {
  color: var(--bone);
  padding-left: 1.5rem;
  background: rgba(255, 75, 10, 0.08);
  border-color: rgba(255, 75, 10, 0.2);
}
.term-file:hover::before, .term-file.is-active::before {
  transform: scaleY(1);
}
.term-file.is-active {
  color: var(--ink);
  box-shadow: inset 0 0 14px rgba(255, 75, 10, 0.08);
}
.term-file--encrypted {
  color: var(--stop);
}
.term-file--encrypted:hover {
  color: var(--stop);
}
.term-file--encrypted::before {
  background: var(--stop);
}

.term-scramble {
  font-family: var(--font-mono);
  color: var(--ink);
  letter-spacing: 0.04em;
}
.term-caret {
  display: inline-block;
  width: 8px;
  height: 1em;
  background: var(--ink);
  vertical-align: middle;
  animation: blink 1s step-end infinite;
  margin-left: 4px;
}
.term-attachment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 2rem;
  padding: 0.95rem 1.3rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.24);
  border: 1px solid rgba(255, 140, 55, 0.34);
  border-left: 4px solid var(--ink);
  text-decoration: none;
  transition: transform 0.1s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
  width: 100%;
  text-align: center;
  letter-spacing: 0.14em;
  position: relative;
  text-transform: uppercase;
  overflow: hidden;
}
.term-attachment::before {
  content: '[';
  color: var(--ink);
}
.term-attachment::after {
  content: ']';
  color: var(--ink);
}
.term-attachment:hover {
  border-color: var(--ink);
  background: rgba(255, 75, 10, 0.12);
  color: var(--bone);
  box-shadow: inset 0 0 18px rgba(255, 75, 10, 0.12);
}
.term-attachment:active {
  transform: scale(0.97);
}

.term-mobile-back {
  display: none;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--ink);
  background: rgba(255, 75, 10, 0.05);
  border: 1px solid rgba(255, 75, 10, 0.2);
  border-left: 3px solid var(--ink);
  text-align: left;
  cursor: pointer;
  text-transform: uppercase;
}
.term-mobile-back:hover {
  background: rgba(255, 75, 10, 0.1);
  color: var(--bone);
}
@media (max-width: 759px) {
  .terminal-os__grid.is-reading .term-mobile-back {
    display: block;
  }
}

@keyframes fadeBackdrop {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modalIn {
  0% { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 759px) {
  .modal__frame {
    height: 92vh;
    max-height: none;
    width: 100%;
    margin: 0;
  }
  .modal__panel {
    clip-path: none;
  }
  .modal__header {
    padding: 0.85rem 1.25rem;
  }
  .modal__header::after {
    left: 1.25rem;
    right: 1.25rem;
  }
  .modal__title {
    font-size: 0.65rem;
  }
  .terminal-os__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    transition: transform 0.3s var(--ease);
  }
  .terminal-os__grid.is-reading .terminal-os__sidebar {
    display: none;
  }
  .terminal-os__sidebar {
    border-right: none;
    border-bottom: 1px solid var(--surface-line);
    max-height: 45vh;
    padding: 1rem;
  }
  .terminal-os__sidebar::before {
    display: none;
  }
  .term-content {
    margin: 0;
    padding: 1.5rem 1.25rem 1.5rem 1.5rem;
    font-size: 0.95rem;
    line-height: 1.8;
  }
  .term-content::before {
    left: 0.5rem;
    top: 1rem;
    bottom: 1rem;
  }
  .term-waveform {
    padding: 0 1.25rem;
    height: 36px;
  }
  .terminal-os__root-menu {
    padding: 2rem 1.5rem;
  }
}

@-moz-document url-prefix() {
  .scanline-overlay,
  body::before,
  body::after {
    animation: none;
  }

  .modal__backdrop {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

/* ============================================================
   WIDE SCREEN ATMOSPHERE
   ============================================================ */

@media (min-width: 1440px) {
  .ambient-glow::before {
    display: none;
  }

  .grid-overlay {
    background-size: 88px 88px;
    opacity: 0.44;
    mask-image: none;
    -webkit-mask-image: none;
  }

  .vignette {
    background: transparent;
    box-shadow:
      inset 0 0 220px 110px rgba(0,0,0,0.78),
      inset 0 0 60px 20px rgba(0,0,0,0.42);
  }

  .scanline-overlay {
    display: none;
  }

  body::before {
    opacity: 0.022;
  }

  body::after {
    display: none;
  }
}

/* ============================================================
   REVEAL ANIMATIONS
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger doctrine cards */
.doctrine-ledger .reveal:nth-child(1) { transition-delay: 0s; }
.doctrine-ledger .reveal:nth-child(2) { transition-delay: 0.08s; }
.doctrine-ledger .reveal:nth-child(3) { transition-delay: 0.16s; }
.doctrine-ledger .reveal:nth-child(4) { transition-delay: 0.24s; }
.doctrine-ledger .reveal:nth-child(5) { transition-delay: 0.32s; }

/* Stagger clearance blocks */
.clearance-grid .clearance-block:nth-child(1) { transition-delay: 0.1s; }
.clearance-grid .clearance-block:nth-child(2) { transition-delay: 0.2s; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */

/* REDUCED MOTION OVERRIDE */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .scanline-overlay,
  body::before,
  body::after,
  .grid-overlay,
  .vignette,
  #term-waveform {
    animation: none !important;
    display: none !important;
  }
  
  .btn::before,
  .btn::after {
    display: none !important;
    animation: none !important;
  }
  
  .cinematic-hero .hero__frame,
  .cinematic-hero .hero__logo-wrapper,
  .reveal {
    transform: none !important;
    transition: none !important;
  }
  
  .hero__ambient-glow,
  .ambient-glow {
    display: none !important;
  }
}
