/* ============================================
   ALT V2 — Engineering Editorial Design System
   Violet edition
   ============================================ */

/* ---------- Tokens ---------- */
:root {
  --bg: #fafaf8;
  --bg-alt: #f3f1ec;
  --surface: #ffffff;
  --text: #0e1116;
  --text-muted: #5a6168;
  --text-faint: #8b9199;
  --line: #e4e2dc;
  --line-strong: #c9c6bd;

  --accent: #7c5cff;
  --accent-hover: #6243db;
  --accent-bright: #9b85ff;
  --accent-soft: rgba(124, 92, 255, 0.10);

  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, #f093fb 0%, #7c5cff 100%);

  --shadow-sm: 0 1px 2px rgba(10, 12, 16, 0.05);
  --shadow-md: 0 12px 28px -10px rgba(118, 75, 162, 0.20);
  --shadow-violet: 0 0 0 1px rgba(124, 92, 255, 0.18), 0 16px 36px -14px rgba(124, 92, 255, 0.40);

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --container: 1440px;
  --reading: 920px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 4px;
}

[data-theme='dark'] {
  --bg: #0b0c12;
  --bg-alt: #14161e;
  --surface: #181b24;
  --text: #f0ede6;
  --text-muted: #a0a6b3;
  --text-faint: #6b7280;
  --line: #21242d;
  --line-strong: #2d313c;

  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-bright: #c4b5fd;
  --accent-soft: rgba(167, 139, 250, 0.14);

  --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  --gradient-accent: linear-gradient(135deg, #f0abfc 0%, #a78bfa 100%);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
  --shadow-violet: 0 0 0 1px rgba(167, 139, 250, 0.25), 0 16px 36px -14px rgba(167, 139, 250, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0c12;
    --bg-alt: #14161e;
    --surface: #181b24;
    --text: #f0ede6;
    --text-muted: #a0a6b3;
    --text-faint: #6b7280;
    --line: #21242d;
    --line-strong: #2d313c;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-bright: #c4b5fd;
    --accent-soft: rgba(167, 139, 250, 0.14);
    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    --gradient-accent: linear-gradient(135deg, #f0abfc 0%, #a78bfa 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 12px 28px -10px rgba(0, 0, 0, 0.55);
    --shadow-violet: 0 0 0 1px rgba(167, 139, 250, 0.25), 0 16px 36px -14px rgba(167, 139, 250, 0.35);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
}

h1 { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1.02; font-weight: 500; }
h2 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; }
h3 { font-size: clamp(1.4rem, 2.2vw, 1.75rem); line-height: 1.2; font-weight: 600; }
h4 { font-size: 1.1rem; line-height: 1.3; font-weight: 600; }

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

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: clamp(80px, 12vh, 140px) 0;
  border-top: 1px solid var(--line);
}

.section--tight { padding: clamp(60px, 8vh, 90px) 0; }

.section:first-of-type { border-top: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.site-header.is-scrolled { border-bottom-color: var(--line); }

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gradient-primary);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.site-nav a {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.site-nav a:hover { color: var(--text); }
.site-nav a.is-active { color: var(--accent); }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--line);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  background: var(--bg-alt);
}

.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-sun { display: none; }
[data-theme='dark'] .theme-toggle .icon-moon { display: none; }
[data-theme='dark'] .theme-toggle .icon-sun { display: block; }

@media (max-width: 720px) {
  .site-nav { gap: 14px; }
  .site-nav a:not(.theme-toggle) { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  padding: clamp(56px, 11vh, 120px) 0 clamp(56px, 10vh, 100px);
  position: relative;
  overflow: hidden;
}

.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 72px);
  align-items: center;
}

@media (min-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1.45fr) minmax(280px, 1fr);
  }
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero__eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.hero__title {
  margin-bottom: 28px;
  max-width: 14ch;
}

.hero__title em {
  font-style: normal;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero__lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 56ch;
  margin-bottom: 40px;
}

.hero__cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* Portrait */
.portrait {
  position: relative;
  width: 100%;
  max-width: 360px;
  margin-left: auto;
  aspect-ratio: 4 / 5;
}

.portrait__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  filter: grayscale(0.35) contrast(1.05);
  transition: filter 0.5s ease;
  background: var(--bg-alt);
}

.portrait:hover .portrait__img { filter: grayscale(0) contrast(1); }

.portrait::before {
  content: '';
  position: absolute;
  inset: 18px -18px -18px 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  z-index: -1;
  pointer-events: none;
}

.portrait__caption {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
  padding: 6px 10px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  border-radius: 3px;
}

@media (max-width: 899px) {
  .portrait { max-width: 280px; margin: 0 auto; }
}

/* ---------- Fact Strip ---------- */
.fact-strip {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 28px 0;
  background: var(--bg-alt);
}

.fact-strip__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: baseline;
}

@media (min-width: 700px) {
  .fact-strip__grid { grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 4vw, 56px); }
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fact__num {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}

.fact__num em {
  font-style: normal;
  color: var(--accent);
}

.fact__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent);
  color: #fff;
}

.btn--gradient {
  background: var(--gradient-primary);
  color: #fff;
  border: 0;
}

.btn--gradient:hover {
  filter: brightness(1.08);
  box-shadow: var(--shadow-violet);
  color: #fff;
}

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

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn__arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.btn:hover .btn__arrow { transform: translateX(4px); }

.btn__icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
}

/* ---------- Pillars ---------- */
.pillars {
  display: grid;
  gap: clamp(40px, 5vw, 64px);
}

.pillar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-top: 36px;
  border-top: 1px solid var(--line);
}

@media (min-width: 900px) {
  .pillar {
    grid-template-columns: 80px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
  }
}

.pillar__num {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.06em;
  padding-top: 6px;
}

.pillar__title { margin-bottom: 14px; }

.pillar__body {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.pillar__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 6px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  color: var(--text-muted);
  border-radius: 999px;
  transition: border-color .15s, color .15s;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pillar__anchor {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.pillar__anchor a {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}

.pillar__anchor a:hover { color: var(--accent-hover); }

/* ---------- Section Header ---------- */
.section-head {
  display: grid;
  gap: 16px;
  margin-bottom: clamp(48px, 6vw, 80px);
}

@media (min-width: 800px) {
  .section-head {
    grid-template-columns: 1fr 2fr;
    align-items: end;
    gap: 56px;
  }
}

.section-head__kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-head__kicker::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.section-head__title { max-width: 18ch; }
.section-head__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 56ch;
}

/* ---------- Featured Case ---------- */
.case-featured {
  display: grid;
  gap: clamp(28px, 4vw, 48px);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  transition: border-color 0.25s ease, transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.case-featured::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.case-featured:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.case-featured:hover::before { opacity: 1; }

@media (min-width: 900px) {
  .case-featured {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.case-featured + .case-featured { margin-top: 24px; }

.case-featured__meta {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.case-featured__meta span + span { color: var(--text-faint); }

.case-featured__meta span + span::before {
  content: '·';
  margin-right: 12px;
  color: var(--text-faint);
}

.case-featured__title {
  margin-bottom: 18px;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  letter-spacing: -0.02em;
}

.case-featured__hook {
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.case-featured__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
  transition: border-color 0.15s, color 0.15s;
}

.case-featured__link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.case-featured__link .btn__arrow { transition: transform .2s; }
.case-featured__link:hover .btn__arrow { transform: translateX(4px); }

.case-featured__specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  padding: 24px;
  background: var(--bg-alt);
  border-radius: 6px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
}

.case-featured__spec dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  font-size: 10px;
  margin-bottom: 4px;
}

.case-featured__spec dd { margin: 0; color: var(--text); }

/* ---------- Other Cases List ---------- */
.cases-list { display: grid; gap: 0; }

.case-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  transition: background 0.15s ease;
  margin: 0 calc(var(--gutter) * -1);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

@media (min-width: 800px) {
  .case-row {
    grid-template-columns: 130px minmax(0, 2fr) minmax(0, 1.4fr) 80px;
    align-items: center;
    gap: 32px;
  }
}

.case-row:hover { background: var(--bg-alt); }
.case-row:last-child { border-bottom: 1px solid var(--line); }

.case-row__tag {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.case-row__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

.case-row__desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.case-row__arrow {
  text-align: right;
  color: var(--text-faint);
  transition: transform 0.2s ease, color 0.2s ease;
}

.case-row:hover .case-row__arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ---------- Security Principles ---------- */
.principles {
  display: grid;
  gap: clamp(28px, 3.5vw, 40px);
  margin-bottom: clamp(40px, 6vh, 60px);
}

@media (min-width: 720px) {
  .principles { grid-template-columns: 1fr 1fr; }
}

.principle {
  padding: 32px 0 0;
  border-top: 1px solid var(--line-strong);
  position: relative;
}

.principle::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent);
}

.principle__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
  background: var(--accent-soft);
  padding: 6px 10px;
  border-radius: 6px;
}

.principle__title {
  font-size: 1.45rem;
  margin-bottom: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.principle__body {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

.principle__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  text-decoration: none;
}

.principle__link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ---------- Tech Stack ---------- */
.stack { display: grid; gap: clamp(28px, 4vw, 48px); }

.stack-group {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

@media (min-width: 800px) {
  .stack-group {
    grid-template-columns: 200px 1fr;
    gap: 48px;
    align-items: baseline;
  }
}

.stack-group__label {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.stack-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.stack-group__items span:not(:last-child)::after {
  content: '·';
  margin-left: 22px;
  color: var(--text-faint);
}

/* ---------- Contact Channels ---------- */
.channels {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  max-width: 800px;
  margin: 0 auto 32px;
}

@media (min-width: 700px) {
  .channels { grid-template-columns: repeat(3, 1fr); }
}

.channel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: border-color .25s ease, transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease;
}

.channel::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-bright), transparent 60%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .3s ease;
}

.channel:hover {
  border-color: transparent;
  transform: translateY(-4px);
  box-shadow: var(--shadow-violet);
}

.channel:hover::before {
  opacity: 1;
}

.channel__icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  color: var(--accent);
  transition: transform .3s ease;
}

.channel:hover .channel__icon {
  transform: scale(1.1);
}

.channel__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}

.channel__value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.channel__hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
}

/* ---------- CTA Block ---------- */
.cta {
  text-align: center;
  padding: clamp(80px, 12vh, 120px) 0;
  border-top: 1px solid var(--line);
}

.cta__title {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin-bottom: 18px;
  max-width: 22ch;
  margin-left: auto;
  margin-right: auto;
}

.cta__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0 auto 36px;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  justify-content: space-between;
  align-items: center;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Scroll-to-top ---------- */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  width: 44px;
  height: 44px;
  background: var(--text);
  color: var(--bg);
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease, color 0.15s ease;
  box-shadow: var(--shadow-md);
}

.scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.scroll-top:hover {
  background: var(--accent);
  color: #fff;
}

.scroll-top svg { width: 16px; height: 16px; }

@media (max-width: 600px) {
  .scroll-top { width: 40px; height: 40px; bottom: 16px; right: 16px; }
}

/* ---------- Article (case detail pages) ---------- */
.article-hero {
  padding: clamp(80px, 12vh, 140px) 0 clamp(40px, 6vh, 60px);
}

.article-hero__meta {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 28px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.article-hero__meta span { color: var(--text-faint); }
.article-hero__meta a { color: var(--text-faint); }
.article-hero__meta a:hover { color: var(--accent); }

.article-hero__title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.05;
  max-width: 22ch;
  margin-bottom: 32px;
}

.article-hero__hook {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 60ch;
}

.article { padding-bottom: clamp(80px, 12vh, 140px); }

.article__body {
  max-width: var(--reading);
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.7;
}

.article__body h2 {
  margin: clamp(48px, 6vw, 72px) 0 20px;
  font-size: clamp(1.5rem, 2.5vw, 1.9rem);
}

.article__body h2::before {
  content: attr(data-num);
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-right: 14px;
  vertical-align: 0.18em;
  font-weight: 400;
}

.article__body h3 {
  margin: 32px 0 12px;
  font-size: 1.18rem;
  font-weight: 600;
}

.article__body p { margin: 0 0 18px; color: var(--text); }
.article__body p strong { color: var(--text); font-weight: 600; }
.article__body em { font-style: italic; color: var(--text-muted); }

.article__body ul,
.article__body ol {
  padding-left: 0;
  list-style: none;
  margin: 0 0 24px;
}

.article__body li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 10px;
}

.article__body ul li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 14px;
  height: 1px;
  background: var(--accent);
}

.article__body ol { counter-reset: list; }
.article__body ol li { counter-increment: list; }
.article__body ol li::before {
  content: counter(list, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.pullquote {
  margin: 40px 0;
  padding: 28px 32px;
  border-left: 2px solid var(--accent);
  background: var(--bg-alt);
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--text);
  border-radius: 0 6px 6px 0;
}

.spec-table {
  margin: 24px 0 32px;
  padding: 18px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: grid;
  gap: 10px 20px;
}

.spec-table dt + dd { margin-top: -4px; }

@media (min-width: 600px) {
  .spec-table {
    padding: 22px 24px;
    gap: 14px 24px;
    grid-template-columns: 140px 1fr;
  }
  .spec-table dt + dd { margin-top: 0; }
}

@media (min-width: 900px) {
  .spec-table {
    padding: 28px;
    gap: 16px 24px;
    grid-template-columns: 180px 1fr;
  }
}

.spec-table dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 11px;
  color: var(--text-faint);
}

.spec-table dd { margin: 0; color: var(--text); }

.callout {
  margin: 28px 0;
  padding: 20px 24px;
  background: var(--accent-soft);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: 0.98rem;
  color: var(--text);
}

.callout__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.back-link:hover { color: var(--accent); }

/* ROI cards (case B) */
.roi-grid { display: grid; gap: 16px; margin: 28px 0 32px; }

.roi-card {
  padding: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.roi-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.roi-card__num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.roi-card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}

.roi-card__risk {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-muted);
}

.roi-card__risk--low { color: var(--accent); border-color: var(--accent); }
.roi-card__risk--mid { color: #f5a623; border-color: #f5a623; }
.roi-card__risk--high { color: #e94e4e; border-color: #e94e4e; }

.roi-card__body { font-size: 0.95rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 16px; }

.roi-card__metrics {
  display: grid;
  gap: 8px 24px;
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (min-width: 600px) { .roi-card__metrics { grid-template-columns: 1fr 1fr; } }

.roi-card__metrics dt {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 10px;
  color: var(--text-faint);
  margin-bottom: 2px;
}

.roi-card__metrics dd { margin: 0 0 6px; color: var(--text); }

/* ---------- Methodology timeline ---------- */
.timeline {
  display: grid;
  gap: 0;
  margin-bottom: clamp(48px, 6vw, 64px);
}

.phase {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
  position: relative;
}

@media (min-width: 800px) {
  .phase {
    grid-template-columns: 110px minmax(0, 1.4fr) minmax(0, 1fr);
    gap: clamp(24px, 4vw, 56px);
  }
}

.phase:last-child { border-bottom: 1px solid var(--line); }

.phase__num {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--accent);
  padding-top: 6px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.phase__num::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.phase__title { margin-bottom: 12px; }

.phase__body {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.phase__deliverables {
  font-family: var(--font-mono);
  font-size: 12px;
}

.phase__deliverables-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.phase__deliverables ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.phase__deliverables li {
  padding: 6px 0 6px 18px;
  position: relative;
  color: var(--text);
  font-size: 12.5px;
}

.phase__deliverables li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 14px;
  width: 8px;
  height: 1px;
  background: var(--accent);
}

/* ---------- Cooperation principles (methodology) ---------- */
.coop {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.coop__row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 800px) {
  .coop__row {
    grid-template-columns: 1fr 1.5fr 1.5fr;
    gap: 32px;
    align-items: baseline;
  }
}

.coop__label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.coop__col h4 {
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-body);
  color: var(--text);
}

.coop__col p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
}

/* ---------- Figure (screenshots / images in articles) ---------- */
.figure {
  margin: 32px 0;
}

.figure__frame {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-alt);
  overflow: hidden;
}

.figure__frame img {
  display: block;
  width: 100%;
  height: auto;
}

.figure__placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 280px;
  padding: 40px 32px;
  text-align: center;
  background:
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 12px,
      var(--line) 12px,
      var(--line) 13px
    );
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
}

.figure__placeholder-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.figure__placeholder-hint {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  max-width: 44ch;
  line-height: 1.5;
}

.figure__placeholder-path {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.figure__caption {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}

.figure-grid {
  display: grid;
  gap: 20px;
  margin: 32px 0;
}

@media (min-width: 800px) {
  .figure-grid--2 { grid-template-columns: 1fr 1fr; }
}

.figure-grid .figure { margin: 0; }

/* ============================================
   Reusable case-page components
   (вынесены из inline-стилей, общие для всех кейсов)
   ============================================ */

/* ---------- cycle-flow: нумерованные карточки шагов процесса ---------- */
.cycle-flow {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, 1fr);
  margin: 28px 0 18px;
}
@media (max-width: 899px) { .cycle-flow { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .cycle-flow { grid-template-columns: 1fr; } }

.cycle-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
}
.cycle-step__num {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  text-align: center;
  line-height: 26px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cycle-step__title {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 15px;
  color: var(--text);
}
.cycle-step__desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ---------- compare-table: адаптивная сравнительная таблица ----------
   На мобильном (<=720px) каждая строка превращается в карточку, заголовок
   столбца берётся из data-label атрибута td. */
.compare-table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
}
.compare-table th,
.compare-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--text);
}
.compare-table th {
  background: var(--bg-alt);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}
.compare-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .compare-table {
    display: block;
    max-width: 100%;
  }
  .compare-table thead { display: none; }
  .compare-table tbody {
    display: block;
    width: 100%;
  }
  .compare-table tbody tr {
    display: block;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    box-sizing: border-box;
    max-width: 100%;
  }
  .compare-table tbody td,
  .compare-table tbody td:first-child {
    display: block;
    border: none;
    padding: 4px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
  }
  .compare-table tbody td:first-child {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--line);
  }
  .compare-table tbody td:not(:first-child)::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--text-muted);
  }
}

/* ---------- protocol-cycle: блок с цветной полосой и нумерованным списком ---------- */
.protocol-cycle {
  margin: 20px 0;
  padding: 14px 14px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}
.protocol-cycle ol {
  margin: 0;
  padding-left: 0;
}
.protocol-cycle ol li {
  margin-bottom: 10px;
  line-height: 1.55;
}
.protocol-cycle ol li strong { color: var(--text); }
@media (min-width: 600px) {
  .protocol-cycle { padding: 18px 22px; }
}

/* ---------- status-pill: статус-бейджи ---------- */
.status-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.status-pill--ok   { background: #d1fae5; color: #065f46; }
.status-pill--warn { background: #fef3c7; color: #92400e; }
.status-pill--build { background: #dbeafe; color: #1e40af; }
.status-pill--note { background: #e5e7eb; color: #374151; }

/* ---------- draft-banner: плашка-уведомление наверху страницы ---------- */
.draft-banner {
  padding: 12px 18px;
  border-radius: 8px;
  margin: 18px 0 24px;
  font-size: 14px;
  line-height: 1.5;
}
.draft-banner--note    { background: linear-gradient(135deg, #e0e7ff, #c7d2fe); color: #312e81; }
.draft-banner--note strong    { color: #1e1b4b; }
.draft-banner--warn    { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.draft-banner--warn strong    { color: #78350f; }

/* ---------- arch-ascii: блок ASCII-схемы ---------- */
.arch-ascii {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
  margin: 18px 0;
  color: var(--text);
}
@media (max-width: 600px) {
  .arch-ascii { font-size: 10px; padding: 12px; }
}

/* ---------- feature-grid / feature-card: сетка с карточками возможностей ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.feature-card h4 {
  margin: 0 0 10px;
  font-size: 16px;
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}
.feature-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 14px;
}
.feature-card li { margin-bottom: 4px; }

/* ============================================
   /Reusable case-page components
   ============================================ */

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
