/* ─────────────────────────────────────────────────────────
   STUDIES LISTING — "The Evidence Room"
   Intelligence briefing index. Dark panels, data-forward,
   numbered case files, forensic structure.
   ───────────────────────────────────────────────────────── */

/* ─── Studies Hero — custom intelligence-themed hero ─────
   Replaces the generic page-hero for studies.
   Adds abstract network SVG bg, classified stamp, unique feel.
   ───────────────────────────────────────────────────────── */
.studies-hero {
  padding-top: clamp(160px, 18vh, 220px);
  padding-bottom: clamp(48px, 6vw, 80px);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

/* Abstract intelligence network — positioned right */
.studies-hero__bg {
  position: absolute;
  top: 50%;
  right: clamp(-120px, -6vw, -20px);
  transform: translateY(-50%);
  width: clamp(440px, 55vw, 800px);
  height: auto;
  opacity: 0.07;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.studies-hero > .container {
  position: relative;
  z-index: 1;
}

.studies-hero .hero-headline {
  max-width: 22ch;
  margin-top: 24px;
}

.studies-hero .lede {
  margin-top: 32px;
  max-width: 60ch;
  font-size: clamp(1.05rem, 0.8vw + 0.85rem, 1.2rem);
  color: var(--ink-soft);
  line-height: 1.55;
}

/* Classified stamp — monospace intelligence tag */
.studies-hero__stamp {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 6px 14px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  margin-bottom: 28px;
}
.studies-hero__stamp::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse-dot 2.4s var(--ease-out-strong) infinite;
}

/* Dark mode adjustments */
html.dark .studies-hero__bg {
  opacity: 0.04;
}
html.dark .studies-hero__stamp {
  border-color: oklch(0.6 0.18 258);
  color: oklch(0.6 0.18 258);
}

/* Mobile: hide background SVG at small widths */
@media (max-width: 768px) {
  .studies-hero__bg {
    display: none;
  }
}

/* ─── Flagship — two-column with visual ─────────────────
   Grid layout: content left, illustration right.
   ───────────────────────────────────────────────────────── */
.study-flagship__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 4vw, 56px);
  align-items: center;
}
.study-flagship__content {
  display: flex;
  flex-direction: column;
}
.study-flagship__visual {
  display: flex;
  align-items: center;
  justify-content: center;
}
.study-flagship__art {
  width: 100%;
  max-width: 420px;
  height: auto;
}

@media (max-width: 900px) {
  .study-flagship__inner {
    grid-template-columns: 1fr;
  }
  .study-flagship__visual {
    order: -1;
    max-height: 260px;
    overflow: hidden;
  }
  .study-flagship__art {
    max-width: 320px;
  }
}

/* ─── Evidence Counter Strip ─────────────────────────────
   Dashboard readout below the hero lede.
   Dark panel with dot-grid texture, monospace stats.
   ───────────────────────────────────────────────────────── */
.studies-counter {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0;
  margin-top: 48px;
  background: oklch(0.14 0.02 260);
  border: 1px solid oklch(0.28 0.02 260);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 8px 32px -12px oklch(0 0 0 / 0.25),
    inset 0 1px 0 oklch(1 0 0 / 0.05);
}

/* Dot-grid texture */
.studies-counter::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, oklch(1 0 0 / 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.studies-counter__stat {
  flex: 1;
  padding: clamp(24px, 3vw, 36px) clamp(20px, 2.5vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.studies-counter__stat + .studies-counter__stat {
  border-left: 1px solid oklch(1 0 0 / 0.08);
}

.studies-counter__num {
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 700;
  color: oklch(0.870 0.180 130);
  letter-spacing: -0.03em;
  line-height: 1;
  font-feature-settings: "tnum";
}

.studies-counter__label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: oklch(1 0 0 / 0.40);
}


/* ─── Featured Study — Dark Flagship Treatment ───────────
   Full-width dark card with dot-grid, scan line, radial glow.
   Stays dark in both light and dark mode.
   ───────────────────────────────────────────────────────── */
.study-flagship {
  display: block;
  text-decoration: none;
  color: inherit;
  background: oklch(0.14 0.02 260);
  border: 1px solid oklch(0.28 0.02 260);
  border-radius: 2px;
  padding: clamp(40px, 5vw, 64px);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 16px 48px -20px oklch(0 0 0 / 0.3),
    inset 0 1px 0 oklch(1 0 0 / 0.05);
  transition:
    border-color 300ms var(--ease-out-strong),
    transform 300ms var(--ease-out-strong),
    box-shadow 300ms var(--ease-out-strong);
}
.study-flagship:hover {
  border-color: oklch(0.870 0.180 130 / 0.2);
  transform: translateY(-1px);
  box-shadow:
    0 20px 56px -24px oklch(0 0 0 / 0.35),
    inset 0 1px 0 oklch(1 0 0 / 0.06);
}

/* Dot-grid texture overlay */
.study-flagship__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, oklch(1 0 0 / 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* Scan line animation — green horizontal sweep */
.study-flagship__scan {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, oklch(0.870 0.180 130 / 0.2), transparent);
  animation: study-scan 8s linear 2s infinite;
}
@keyframes study-scan {
  0%   { top: 0; }
  100% { top: 100%; }
}

/* Radial accent glow — top-right corner */
.study-flagship::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 85% 25%, oklch(0.870 0.180 130 / 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* All content above texture layers */
.study-flagship > *:not(.study-flagship__dots):not(.study-flagship__scan) {
  position: relative;
  z-index: 1;
}

/* Study number — large monospace */
.study-flagship__num {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1.5vw + 0.5rem, 1.5rem);
  font-weight: 600;
  color: oklch(0.870 0.180 130);
  letter-spacing: 0.04em;
  line-height: 1;
}

/* Category tags — lime green mono */
.study-flagship__tags {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(0.870 0.180 130 / 0.7);
}

/* Title */
.study-flagship__title {
  font-family: var(--font-sans);
  font-size: clamp(1.6rem, 2.4vw + 0.5rem, 2.6rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: oklch(0.96 0 0);
  margin-top: 24px;
  max-width: 32ch;
  text-wrap: balance;
}

/* Excerpt */
.study-flagship__excerpt {
  font-size: 15px;
  color: oklch(1 0 0 / 0.55);
  line-height: 1.65;
  margin-top: 18px;
  max-width: 64ch;
}

/* Key metric highlight */
.study-flagship__metric {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 24px;
  padding: 12px 18px;
  background: oklch(0.10 0.025 260);
  border: 1px solid oklch(1 0 0 / 0.06);
  border-radius: 2px;
}
.study-flagship__metric-num {
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 1.2vw + 0.5rem, 1.4rem);
  font-weight: 700;
  color: oklch(0.870 0.180 130);
  letter-spacing: -0.02em;
}
.study-flagship__metric-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: oklch(1 0 0 / 0.40);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Read link — lime green */
.study-flagship__read {
  display: inline-block;
  margin-top: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: oklch(0.870 0.180 130);
  letter-spacing: 0;
  transition: letter-spacing 300ms var(--ease-out-strong);
}
.study-flagship:hover .study-flagship__read {
  letter-spacing: 0.04em;
}


/* ─── Studies Grid — 3-column case file layout ───────────
   Compact, information-dense, 12-col grid (4-4-4).
   ───────────────────────────────────────────────────────── */
.studies-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 48px;
}


/* ─── Study Card — Case File Treatment ───────────────────
   Left accent bar always visible. Prominent numbering.
   Key metric panel. Compact, forensic.
   ───────────────────────────────────────────────────────── */
.study-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 28px 28px 31px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--paper);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition:
    border-color 300ms var(--ease-out-strong),
    transform 300ms var(--ease-out-strong),
    box-shadow 300ms var(--ease-out-strong);
}

/* Left accent bar — always visible */
.study-card__bar {
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent);
  z-index: 2;
  transition: background 300ms var(--ease-out-strong);
}

.study-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px -8px oklch(0 0 0 / 0.08);
}
.study-card:hover .study-card__bar {
  background: oklch(0.870 0.180 130);
}

/* Study number — large monospace at top */
.study-card__num {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  line-height: 1;
}

/* Category badge — filled mono chip */
.study-card__badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--paper-deeper);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  line-height: 1;
  width: fit-content;
}

/* Title */
.study-card__title {
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 0.6vw + 0.7rem, 1.25rem);
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.016em;
  color: var(--ink);
  text-wrap: balance;
}

/* Key metric highlight box */
.study-card__metric {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 14px;
  background: oklch(0.14 0.02 260);
  border: 1px solid oklch(0.28 0.02 260);
  border-radius: 2px;
}
.study-card__metric-num {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: oklch(0.870 0.180 130);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.study-card__metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: oklch(1 0 0 / 0.45);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.3;
}

/* Excerpt — tight, 2 lines max */
.study-card__excerpt {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
  max-width: 48ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Read link */
.study-card__read {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0;
  transition: letter-spacing 300ms var(--ease-out-strong);
}
.study-card:hover .study-card__read {
  letter-spacing: 0.04em;
}


/* ─── Section Header for Study Grid ──────────────────────
   Eyebrow + subtitle layout above the grid.
   ───────────────────────────────────────────────────────── */
.studies-section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  flex-wrap: wrap;
  gap: 24px;
}
.studies-section-sub {
  max-width: 42ch;
  color: var(--ink-mute);
  font-size: 14.5px;
  line-height: 1.55;
}


/* ─────────────────────────────────────────────────────────
   DARK MODE
   Flagship & counter panels are already dark — stays as-is.
   Adjust study-card surfaces and badges.
   ───────────────────────────────────────────────────────── */
html.dark .studies-counter {
  background: oklch(0.10 0.025 260);
  border-color: oklch(0.22 0.02 260);
}

html.dark .study-flagship {
  background: oklch(0.10 0.025 260);
  border-color: oklch(0.22 0.02 260);
}

html.dark .study-card {
  border-color: oklch(0.24 0.015 260);
}
html.dark .study-card:hover {
  border-color: oklch(0.40 0.02 260);
}

html.dark .study-card__badge {
  background: oklch(0.18 0.02 260);
  border-color: oklch(0.26 0.015 260);
  color: var(--ink-mute);
}

html.dark .study-card__metric {
  background: oklch(0.10 0.025 260);
  border-color: oklch(0.22 0.02 260);
}


/* ─────────────────────────────────────────────────────────
   RESPONSIVE — tablet (768px) → 2 cols, phone (480px) → 1 col
   ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .studies-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .study-flagship__title {
    font-size: clamp(1.4rem, 4vw, 2rem);
  }

  .studies-counter {
    flex-wrap: wrap;
  }
  .studies-counter__stat {
    flex: 1 1 auto;
    min-width: 140px;
  }
  .studies-counter__stat + .studies-counter__stat {
    border-left: none;
    border-top: 1px solid oklch(1 0 0 / 0.08);
  }
  /* Restore left borders for the items that stay on the same row */
  .studies-counter__stat:nth-child(2) {
    border-left: 1px solid oklch(1 0 0 / 0.08);
    border-top: none;
  }
}

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

  .study-flagship {
    padding: clamp(28px, 5vw, 40px);
  }
  .study-flagship__title {
    font-size: clamp(1.2rem, 5vw, 1.7rem);
  }

  .studies-counter {
    flex-direction: column;
  }
  .studies-counter__stat + .studies-counter__stat {
    border-left: none;
    border-top: 1px solid oklch(1 0 0 / 0.08);
  }
  .studies-counter__stat:nth-child(2) {
    border-left: none;
    border-top: 1px solid oklch(1 0 0 / 0.08);
  }

  .studies-section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}


/* ─────────────────────────────────────────────────────────
   REDUCED MOTION
   ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .study-flagship__scan { animation: none; }
  .study-card { transition: none; }
  .study-card__bar { transition: none; }
  .study-card__read { transition: none; }
  .study-flagship { transition: none; }
  .study-flagship__read { transition: none; }
}
