/* ═══════════════════════════════════════════════════════════════
   CHEMRING ZINE — Stylesheet
   Zine aesthetic: raw, editorial, asymmetric, typographically bold
   ═══════════════════════════════════════════════════════════════ */

/* ── Fonts ─────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:ital,wght@0,400;0,700;1,400&family=IBM+Plex+Serif:ital,wght@0,300;0,400;0,600;1,400&display=swap');

/* ── Variables ──────────────────────────────────────────────── */
:root {
  --bg:        #F5F0E8;   /* dirty paper */
  --bg-dark:   #1A1A1A;   /* near-black */
  --bg-mid:    #2C2620;   /* warm dark */
  --text:      #1A1A1A;
  --text-inv:  #F5F0E8;
  --text-dim:  #5A5046;
  --accent:    #D4FF00;   /* acid yellow */
  --danger:    #C8002D;   /* blood red */
  --blue:      #2B4B8C;   /* institutional slate blue */
  --cream:     #F5F0E8;
  --border:    rgba(26,26,26,0.15);
  --border-inv: rgba(245,240,232,0.15);

  --ff-head:   'Bebas Neue', 'Impact', sans-serif;
  --ff-body:   'IBM Plex Serif', 'Georgia', serif;
  --ff-mono:   'IBM Plex Mono', 'Courier New', monospace;

  --max-w:     1400px;
  --gap:       clamp(1rem, 3vw, 3rem);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-body);
  font-size: clamp(15px, 1.1vw, 17px);
  line-height: 1.65;
}
body.nav-open,
body.modal-open { overflow: hidden; }
/* Wrap behaviour: prose can break long compounds, but display type never does. */
:where(p, li) { overflow-wrap: anywhere; }
:where(h1, h2, h3, h4, h5, h6, .hero__title, .cover__title, .pull-quote__text, .section-header__title, .chapter-card__title) {
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: manual;
}
/* Long Norwegian compounds shouldn't bust narrow viewports */
:where(.hit-card, .entity-card, .detail-panel, .timeline__text, .chapter-card) :where(h1,h2,h3,h4,h5,h6,p,li) {
  overflow-wrap: anywhere;
  hyphens: auto;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }

/* ── Grain overlay ──────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
  mix-blend-mode: multiply;
}

/* ── Utility ────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }
.container { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 0 var(--gap); }
.mono { font-family: var(--ff-mono); }
.danger-text { color: var(--danger); }
.accent-text { color: var(--accent); }
.blue-text { color: var(--blue); }

/* ── Language Toggle ────────────────────────────────────────── */
.lang-toggle {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: var(--accent);
  color: var(--bg-dark);
  border: none;
  padding: 0.35em 0.9em;
  cursor: pointer;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.lang-toggle:hover { background: var(--danger); color: var(--text-inv); }

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem var(--gap);
  background: var(--bg-dark);
  border-bottom: 2px solid var(--accent);
}
.site-header__logo {
  font-family: var(--ff-head);
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--text-inv);
  text-decoration: none;
}
.site-header__logo span { color: var(--accent); }
.site-header__nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
}
.site-header__nav a {
  font-family: var(--ff-mono);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-inv);
  text-decoration: none;
  opacity: 0.95;
  transition: opacity 0.15s, color 0.15s;
}
.site-header__nav a:hover { opacity: 1; color: var(--accent); }

/* ── HERO ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  min-height: 70svh;
  background: var(--bg-dark);
  display: flex;
  align-items: flex-end;
  padding: calc(var(--gap) * 1.5) var(--gap) calc(var(--gap) * 2);
  overflow: hidden;
}

.hero__bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  opacity: 0.08;
  mix-blend-mode: screen;
  filter: hue-rotate(180deg) saturate(0.5);
}

.hero__bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(26,26,26,0.2) 0%,
    rgba(26,26,26,0.5) 50%,
    rgba(26,26,26,0.9) 100%
  );
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.hero__kicker {
  font-family: var(--ff-mono);
  font-size: clamp(0.65rem, 1.2vw, 0.9rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero__title {
  font-family: var(--ff-head);
  font-size: clamp(5rem, 15vw, 16rem);
  line-height: 0.88;
  color: var(--text-inv);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.hero__title em {
  display: block;
  color: var(--accent);
  font-style: normal;
  font-size: 0.45em;
  letter-spacing: 0.06em;
}

.hero__stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin: 1.5rem 0 2rem;
}

.hero__stat {
  font-family: var(--ff-mono);
  font-size: clamp(0.7rem, 1.4vw, 0.95rem);
  color: var(--text-inv);
  opacity: 0.7;
}

.hero__stat strong {
  display: block;
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-family: var(--ff-head);
  letter-spacing: 0.04em;
  color: var(--text-inv);
  opacity: 1;
  line-height: 1;
}

.hero__stat.is-danger strong { color: var(--danger); opacity: 1; }
.hero__stat.is-accent strong { color: var(--accent); opacity: 1; }

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--accent);
  color: var(--bg-dark);
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85em 1.8em;
  transition: background 0.15s, color 0.15s;
}
.hero__cta:hover { background: var(--danger); color: var(--text-inv); }

/* ── TICKER ─────────────────────────────────────────────────── */
.ticker {
  background: var(--danger);
  color: var(--text-inv);
  overflow: hidden;
  padding: 0.6rem 0;
  font-family: var(--ff-mono);
  font-size: clamp(0.7rem, 1.3vw, 0.85rem);
  letter-spacing: 0.08em;
  white-space: nowrap;
  border-top: 1px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.ticker__inner {
  display: inline-flex;
  gap: 4rem;
  animation: ticker-scroll 40s linear infinite;
}
.ticker__inner:hover { animation-play-state: paused; }
.ticker__item { display: inline-flex; align-items: center; gap: 0.6rem; }
.ticker__item::before {
  content: '◆';
  font-size: 0.5em;
  opacity: 0.6;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── SECTION HEADER ─────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 3rem;
}
.section-header__num {
  font-family: var(--ff-head);
  font-size: 5rem;
  line-height: 1;
  color: var(--border);
  flex-shrink: 0;
  user-select: none;
}
.section-header__text {}
.section-header__label {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--danger);
  margin-bottom: 0.3rem;
}
.section-header__title {
  font-family: var(--ff-head);
  font-size: clamp(2.5rem, 6vw, 5rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--text);
}
.section-header__subtitle {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.5rem;
  letter-spacing: 0.08em;
}

/* ── CHAPTERS SECTION ───────────────────────────────────────── */
.chapters {
  padding: 5rem 0;
  background: var(--bg);
}

.chapters__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
}

@media (max-width: 768px) {
  .chapters__grid { grid-template-columns: 1fr; }
}

.chapter-card {
  position: relative;
  background: var(--bg-dark);
  padding: 3rem 2.5rem;
  overflow: hidden;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
  transition: transform 0.2s;
}
.chapter-card:hover { z-index: 2; transform: scale(1.01); }

.chapter-card__bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.16;
  mix-blend-mode: screen;
}

.chapter-card--i   .chapter-card__bg-svg { filter: hue-rotate(0deg)   saturate(2); }
.chapter-card--ii  .chapter-card__bg-svg { filter: hue-rotate(120deg) saturate(2); }
.chapter-card--iii .chapter-card__bg-svg { filter: hue-rotate(280deg) saturate(2); }

.chapter-card__label {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 2;
}

.chapter-card__title {
  font-family: var(--ff-head);
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 0.9;
  color: var(--text-inv);
  margin-bottom: 0.5rem;
  position: relative;
  z-index: 2;
}

.chapter-card__sub {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  position: relative;
  z-index: 2;
  opacity: 0.8;
}

.chapter-card__desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(245,240,232,0.65);
  position: relative;
  z-index: 2;
  max-width: 38ch;
}

.chapter-card__arrow {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  font-family: var(--ff-head);
  font-size: 2rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
}
.chapter-card:hover .chapter-card__arrow { opacity: 1; transform: translateX(4px); }

/* ── PULL QUOTE ──────────────────────────────────────────────── */
.pull-quote {
  padding: 5rem var(--gap);
  background: var(--bg-dark);
  position: relative;
  overflow: hidden;
  text-align: center;
}

.pull-quote__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.04;
  filter: grayscale(1);
}

.pull-quote__text {
  position: relative;
  z-index: 2;
  font-family: var(--ff-head);
  font-size: clamp(2rem, 5vw, 5.5rem);
  line-height: 1;
  color: var(--text-inv);
  letter-spacing: 0.03em;
  max-width: 900px;
  margin: 0 auto 1.5rem;
}

.pull-quote__text em { color: var(--accent); font-style: normal; }
.pull-quote__text.is-danger em { color: var(--danger); }

.pull-quote__source {
  position: relative;
  z-index: 2;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-inv);
  opacity: 0.4;
}

/* ── ENTITY GRID ─────────────────────────────────────────────── */
.entities {
  padding: 5rem 0;
  background: var(--bg);
}

.entities__header {
  margin-bottom: 3rem;
}

.entities__header h2 {
  font-family: var(--ff-head);
  font-size: clamp(2rem, 5vw, 4rem);
  letter-spacing: 0.04em;
}

.entities__header p {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 0.5rem;
}

.entities__filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.filter-btn {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 0.35em 0.9em;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover,
.filter-btn.is-active { background: var(--bg-dark); color: var(--text-inv); border-color: var(--bg-dark); }
.filter-btn.is-active.type-person      { background: var(--blue);   border-color: var(--blue); }
.filter-btn.is-active.type-company     { background: var(--bg-dark); }
.filter-btn.is-active.type-event       { background: var(--danger); border-color: var(--danger); }
.filter-btn.is-active.type-controversy { background: var(--danger); border-color: var(--danger); }
.filter-btn.is-active.type-contract    { background: #2A6D2A; border-color: #2A6D2A; }
.filter-btn.is-active.type-statistic   { background: var(--blue);   border-color: var(--blue); }

.entities__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2px;
}

/* ── ENTITY CARD ─────────────────────────────────────────────── */
.entity-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1.5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.entity-card:hover {
  background: var(--bg-dark);
  color: var(--text-inv);
  transform: translateY(-2px);
  z-index: 2;
  border-color: var(--bg-dark);
}

.entity-card__type {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  display: inline-block;
  align-self: flex-start;
}

.entity-card[data-type="person"]       .entity-card__type { background: var(--blue);   color: var(--text-inv); }
.entity-card[data-type="company"]      .entity-card__type { background: var(--bg-dark); color: var(--text-inv); }
.entity-card[data-type="organization"] .entity-card__type { background: var(--text-dim); color: var(--text-inv); }
.entity-card[data-type="event"]        .entity-card__type { background: var(--danger); color: var(--text-inv); }
.entity-card[data-type="controversy"]  .entity-card__type { background: var(--danger); color: var(--text-inv); }
.entity-card[data-type="contract"]     .entity-card__type { background: #2A6D2A;       color: var(--text-inv); }
.entity-card[data-type="statistic"]    .entity-card__type { background: var(--blue);   color: var(--text-inv); }

.entity-card__silhouette {
  display: flex;
  justify-content: center;
  opacity: 0.15;
  margin: -0.5rem 0;
}
.entity-card:hover .entity-card__silhouette { opacity: 0.2; }

.entity-card__title {
  font-family: var(--ff-head);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  line-height: 1;
  letter-spacing: 0.02em;
}

.entity-card__subtitle {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}
.entity-card:hover .entity-card__subtitle { color: rgba(245,240,232,0.55); }

.entity-card__amount {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
}

.entity-card__level {
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
}
.entity-card[data-level="critical"] .entity-card__level { background: var(--danger); }
.entity-card[data-level="high"]     .entity-card__level { background: #E84000; }
.entity-card[data-level="medium"]   .entity-card__level { background: #C89000; }
.entity-card[data-level="low"]      .entity-card__level { background: #4A8C4A; }

/* ── SILHOUETTE SVG ──────────────────────────────────────────── */
.silhouette-person {
  width: 64px;
  height: 64px;
  fill: currentColor;
}

/* ── TIMELINE ────────────────────────────────────────────────── */
.timeline {
  padding: 5rem 0;
  background: var(--bg-mid);
  color: var(--text-inv);
  position: relative;
  overflow: hidden;
}

.timeline__bg-svg {
  position: absolute;
  right: -5%;
  top: 50%;
  transform: translateY(-50%);
  width: 40%;
  opacity: 0.04;
  filter: invert(1);
}

.timeline__title {
  font-family: var(--ff-head);
  font-size: clamp(3rem, 7vw, 6rem);
  letter-spacing: 0.04em;
  margin-bottom: 3rem;
  color: var(--text-inv);
}

.timeline__line {
  position: relative;
  padding-left: 2rem;
}

.timeline__line::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-inv);
}

.timeline__item {
  position: relative;
  padding: 0.75rem 0 0.75rem 2rem;
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  border-top: 1px solid var(--border-inv);
  transition: background 0.15s;
}
.timeline__item:hover { background: rgba(245,240,232,0.04); }

.timeline__item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

.timeline__item.is-critical::before { background: var(--danger); }
.timeline__item.is-high::before     { background: #E84000; }

.timeline__year {
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.timeline__text {
  font-family: var(--ff-body);
  font-size: 0.9rem;
  color: rgba(245,240,232,0.75);
  line-height: 1.4;
}
.timeline__text strong {
  color: var(--text-inv);
  font-weight: 600;
}

/* ── TORN EDGE DIVIDER ───────────────────────────────────────── */
.torn-edge {
  height: 60px;
  position: relative;
  overflow: hidden;
}
.torn-edge::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  clip-path: polygon(
    0% 0%, 2% 80%, 5% 30%, 8% 90%, 12% 20%, 16% 85%, 20% 10%,
    25% 75%, 30% 5%, 34% 95%, 38% 15%, 43% 80%, 47% 0%, 52% 90%,
    56% 20%, 60% 70%, 65% 5%, 69% 85%, 74% 30%, 78% 90%, 83% 10%,
    87% 80%, 91% 25%, 95% 75%, 100% 0%, 100% 100%, 0% 100%
  );
}
.torn-edge--dark { background: var(--bg-dark); }
.torn-edge--mid  { background: var(--bg-mid);  }
.torn-edge--bg   { background: var(--bg);      }

/* ── ROTATED LABEL ───────────────────────────────────────────── */
.rotated-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── INLINE ILLUSTRATION (scattered SVGs) ────────────────────── */
.illustration-scatter {
  position: relative;
}
.illustration-scatter__img {
  width: 100%;
  height: auto;
}

.svg-recolor-red    { filter: hue-rotate(330deg) saturate(3) brightness(0.5); }
.svg-recolor-blue   { filter: hue-rotate(190deg) saturate(2) brightness(0.6); }
.svg-recolor-yellow { filter: hue-rotate(60deg)  saturate(3) brightness(0.7); }
.svg-recolor-dark   { filter: grayscale(1) brightness(0.3); }
.svg-recolor-acid   { filter: hue-rotate(30deg)  saturate(5) brightness(0.6); }
.svg-recolor-ghost  { filter: grayscale(1) brightness(0.8) opacity(0.08); }

/* Full-width background SVG strip */
.svg-strip {
  width: 100%;
  overflow: hidden;
  line-height: 0;
}
.svg-strip img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  object-position: center;
}

/* Floating inset SVG */
.svg-inset {
  float: right;
  width: clamp(150px, 25%, 320px);
  margin: 0 0 1.5rem 2rem;
  shape-outside: margin-box;
}
.svg-inset--left {
  float: left;
  margin: 0 2rem 1.5rem 0;
}

/* Corner decoration */
.svg-corner {
  position: absolute;
  width: 120px;
  opacity: 0.07;
  pointer-events: none;
}
.svg-corner--tl { top: 0; left: 0; }
.svg-corner--tr { top: 0; right: 0; transform: scaleX(-1); }
.svg-corner--bl { bottom: 0; left: 0; transform: scaleY(-1); }
.svg-corner--br { bottom: 0; right: 0; transform: scale(-1); }

/* ── SEARCH PAGE ─────────────────────────────────────────────── */
.search-page {
  min-height: 100svh;
  background: var(--bg);
  padding-top: 5rem;
}

.search-header {
  background: var(--bg-dark);
  padding: 3rem var(--gap) 2rem;
  position: relative;
  overflow: hidden;
}

.search-header__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.04;
  mix-blend-mode: screen;
}

.search-header__title {
  font-family: var(--ff-head);
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: 0.04em;
  color: var(--text-inv);
  position: relative;
  z-index: 2;
}

.search-header__title span { color: var(--accent); }

.search-box-wrap {
  position: relative;
  z-index: 2;
  margin-top: 1.5rem;
}

/* InstantSearch / Typesense widget overrides */
.ais-SearchBox-form {
  display: flex;
  gap: 0;
}

.ais-SearchBox-input {
  flex: 1;
  font-family: var(--ff-mono);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--accent);
  border-right: none;
  padding: 0.85em 1.2em;
  outline: none;
}
.ais-SearchBox-input::placeholder { color: var(--text-dim); opacity: 0.5; }
.ais-SearchBox-input:focus { background: #fff; }

.ais-SearchBox-submit {
  background: var(--accent);
  color: var(--bg-dark);
  border: 2px solid var(--accent);
  padding: 0 1.5em;
  cursor: pointer;
  font-family: var(--ff-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: background 0.15s;
}
.ais-SearchBox-submit:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.ais-SearchBox-submit svg { display: none; }
.ais-SearchBox-submit::before { content: 'SØK'; }

.ais-SearchBox-reset { display: none; }

/* Stats */
.ais-Stats {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 0.75rem 0;
}

/* Filters sidebar */
.search-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2px;
  padding: 2px;
}
@media (max-width: 768px) {
  .search-layout { grid-template-columns: 1fr; }
}

.search-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
}

.search-sidebar__section {
  margin-bottom: 2rem;
}

.search-sidebar__label {
  font-family: var(--ff-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Refinement list */
.ais-RefinementList-list { list-style: none; }
.ais-RefinementList-item { margin-bottom: 0.4rem; }

.ais-RefinementList-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--ff-mono);
  color: var(--text);
  transition: color 0.15s;
}
.ais-RefinementList-label:hover { color: var(--danger); }

.ais-RefinementList-checkbox { accent-color: var(--danger); }

.ais-RefinementList-count {
  margin-left: auto;
  font-size: 0.65rem;
  background: var(--border);
  padding: 0.1em 0.4em;
  border-radius: 2px;
  color: var(--text-dim);
}

.ais-RefinementList-item--selected .ais-RefinementList-label { color: var(--danger); font-weight: 600; }

/* Hits */
.search-results {
  padding: 1.5rem;
}

.ais-Hits-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2px;
  list-style: none;
}

.ais-Hits-item {
  padding: 0;
}

.hit-card {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1.25rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.hit-card:hover {
  background: var(--bg-dark);
  color: var(--text-inv);
  border-color: transparent;
}

.hit-card__type {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  display: inline-block;
  align-self: flex-start;
}

.hit-card[data-type="person"]       .hit-card__type { background: var(--blue);   color: #fff; }
.hit-card[data-type="company"]      .hit-card__type { background: var(--bg-dark); color: #fff; }
.hit-card[data-type="organization"] .hit-card__type { background: var(--text-dim); color: #fff; }
.hit-card[data-type="event"]        .hit-card__type { background: var(--danger); color: #fff; }
.hit-card[data-type="controversy"]  .hit-card__type { background: var(--danger); color: #fff; }
.hit-card[data-type="contract"]     .hit-card__type { background: #2A6D2A;       color: #fff; }
.hit-card[data-type="statistic"]    .hit-card__type { background: var(--blue);   color: #fff; }

.hit-card__title {
  font-family: var(--ff-head);
  font-size: 1.3rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.hit-card__subtitle {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  line-height: 1.35;
}
.hit-card:hover .hit-card__subtitle { color: rgba(245,240,232,0.5); }

.hit-card__snippet {
  font-size: 0.83rem;
  line-height: 1.5;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.25rem;
}
.hit-card:hover .hit-card__snippet { color: rgba(245,240,232,0.55); }

.hit-card__meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.hit-card:hover .hit-card__meta { border-top-color: var(--border-inv); }

.hit-card__meta-item {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.hit-card:hover .hit-card__meta-item { color: rgba(245,240,232,0.45); }
.hit-card__meta-item strong { color: var(--text); display: block; font-size: 0.75rem; }
.hit-card:hover .hit-card__meta-item strong { color: var(--text-inv); }

.hit-card__level {
  position: absolute;
  top: 0; right: 0;
  width: 3px; height: 100%;
}
.hit-card[data-level="critical"] .hit-card__level { background: var(--danger); }
.hit-card[data-level="high"]     .hit-card__level { background: #E84000; }
.hit-card[data-level="medium"]   .hit-card__level { background: #C89000; }
.hit-card[data-level="low"]      .hit-card__level { background: #4A8C4A; }

/* Highlight snippets */
.ais-Highlight-highlighted,
mark {
  background: var(--accent);
  color: var(--bg-dark);
  font-style: normal;
  padding: 0 0.1em;
}

/* Pagination */
.ais-Pagination {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  gap: 0.25rem;
}
.ais-Pagination-list { display: flex; gap: 0.25rem; list-style: none; }
.ais-Pagination-item a,
.ais-Pagination-item button {
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  padding: 0.4em 0.7em;
  background: transparent;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  transition: all 0.15s;
}
.ais-Pagination-item--selected a,
.ais-Pagination-item--selected button {
  background: var(--bg-dark);
  color: var(--text-inv);
  border-color: var(--bg-dark);
}
.ais-Pagination-item a:hover,
.ais-Pagination-item button:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* No results */
.ais-EmptyQueryBoundary,
.ais-Configure { display: none; }

/* ── DETAIL PANEL (entity overlay) ──────────────────────────── */
.detail-panel {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: stretch;
  background: rgba(26,26,26,0.7);
  backdrop-filter: blur(4px);
}
.detail-panel.is-open { display: flex; }

.detail-panel__drawer {
  margin-left: auto;
  width: min(600px, 100vw);
  background: var(--bg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slide-in 0.25s ease-out;
}
@keyframes slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

.detail-panel__header {
  background: var(--bg-dark);
  padding: 1.5rem;
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.detail-panel__close {
  background: none;
  border: 1px solid var(--border-inv);
  color: var(--text-inv);
  font-family: var(--ff-mono);
  font-size: 0.75rem;
  padding: 0.35em 0.75em;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.detail-panel__close:hover { background: var(--danger); border-color: var(--danger); }

.detail-panel__type {
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.detail-panel__title {
  font-family: var(--ff-head);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 0.95;
  color: var(--text-inv);
}

.detail-panel__subtitle {
  font-family: var(--ff-mono);
  font-size: 0.72rem;
  color: rgba(245,240,232,0.5);
  margin-top: 0.35rem;
}

.detail-panel__body {
  padding: 2rem 1.5rem;
  flex: 1;
}

.detail-panel__section {
  margin-bottom: 2rem;
}

.detail-panel__section-label {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
  margin-bottom: 0.75rem;
}

.detail-panel__text {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-dim);
}

.detail-panel__amount {
  font-family: var(--ff-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-dark);
  padding: 0.5em 1em;
  display: inline-block;
  margin-bottom: 1rem;
}

.detail-panel__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag-chip {
  font-family: var(--ff-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  background: var(--border);
  color: var(--text-dim);
  padding: 0.25em 0.6em;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.tag-chip:hover { background: var(--bg-dark); color: var(--text-inv); }

.detail-panel__connections {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.connection-chip {
  font-family: var(--ff-mono);
  font-size: 0.68rem;
  background: var(--bg-dark);
  color: var(--text-inv);
  padding: 0.3em 0.8em;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  border: 1px solid transparent;
}
.connection-chip:hover { background: var(--blue); }

/* ── FOOTER ──────────────────────────────────────────────────── */
.site-footer {
  background: var(--bg-dark);
  color: var(--text-inv);
  padding: 3rem var(--gap);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  border-top: 2px solid var(--accent);
}
@media (max-width: 600px) { .site-footer { grid-template-columns: 1fr; } }

.site-footer__brand {
  font-family: var(--ff-head);
  font-size: 3rem;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--text-inv);
}
.site-footer__brand span { color: var(--accent); }

.site-footer__meta {
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(245,240,232,0.6);
  line-height: 1.8;
}

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ais-Hits-list { grid-template-columns: 1fr; }
  .entities__grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
}
@media (max-width: 768px) {
  .site-header__nav {
    display: none !important;
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(26,26,26,0.97); z-index: 999;
    flex-direction: column; justify-content: center; align-items: center;
    gap: 2rem; margin: 0; padding: 0;
  }
  .site-header__nav.is-open {
    display: flex !important;
  }
  .site-header__nav.is-open li {
    list-style: none;
  }
  .site-header__nav.is-open a {
    font-size: 1.5rem; opacity: 1; color: var(--text-inv);
  }
  .menu-toggle { display: flex !important; order: 10; }
  .lang-toggle { order: 9; }
  .site-header {
    gap: 0.5rem;
  }
  .site-header__logo { flex: 1; }
}
@media (max-width: 640px) {
  .hero { min-height: auto; padding: 6rem var(--gap) 2.5rem; align-items: flex-start; }
  .hero__title { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .hero__stats { gap: 0.75rem 1.5rem; }
  .hero__cta { width: 100%; justify-content: center; }
  .entities__grid { grid-template-columns: 1fr; }
  .ais-Hits-list { grid-template-columns: 1fr; }
  .site-footer__brand { font-size: 2rem; }
}
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--text-inv); font-size: 1.4rem; padding: 0.25rem;
  font-family: var(--ff-mono); z-index: 1000;
}

/* ── SCROLL ANIMATIONS (simple) ─────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}


/* ── LANGUAGE TOGGLE — CSS-only bilingual content ─────────────────── */
/* Usage: <span lang="no">Norsk tekst</span><span lang="en">English text</span> */
/* setLang() in i18n.js sets document.documentElement.lang automatically    */
body [lang="en"] { display: none; }
html[lang="en"] [lang="en"] { display: revert; }
html[lang="en"] [lang="no"] { display: none; }

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY ADDITIONS (WCAG 2.2 AA)
   ═══════════════════════════════════════════════════════════════ */

/* ── Skip link ──────────────────────────────────────────────── */
.skip-link {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  background: var(--accent);
  color: var(--bg-dark);
  font-family: var(--ff-mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75em 1.2em;
  text-decoration: none;
  border: 3px solid var(--bg-dark);
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible { transform: translateY(0); outline: none; }

/* ── Global focus indicator ─────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(0,0,0,0.85);
}
/* Dark surfaces flip the box-shadow color */
.site-header :focus-visible,
.hero :focus-visible,
.ticker :focus-visible,
.pull-quote :focus-visible,
.timeline :focus-visible,
.chapter-card:focus-visible,
.detail-panel :focus-visible,
.site-footer :focus-visible,
[class*="cover"]:focus-visible {
  outline-color: var(--accent);
  box-shadow: 0 0 0 5px rgba(245,240,232,0.95);
}
.entity-card:focus-visible,
.hit-card:focus-visible {
  outline: 3px solid var(--bg-dark);
  outline-offset: -3px;
  box-shadow: inset 0 0 0 6px var(--accent);
}

/* ── Touch target sizes (WCAG 2.2 SC 2.5.8) ─────────────────── */
.lang-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55em 1.1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.menu-toggle {
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.75rem;
  align-items: center;
  justify-content: center;
}
.filter-btn {
  min-height: 44px;
  padding: 0.65em 1em;
  display: inline-flex;
  align-items: center;
}
.detail-panel__close {
  min-height: 44px;
  min-width: 44px;
  padding: 0.55em 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tag-chip,
.connection-chip {
  min-height: 32px;
  padding: 0.5em 0.85em;
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
}
.site-header__nav a {
  padding: 0.6em 0.4em;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}
.ais-Pagination-item a,
.ais-Pagination-item button {
  min-height: 44px;
  min-width: 44px;
  padding: 0.6em 0.9em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Contrast fixes ─────────────────────────────────────────── */
.ais-SearchBox-input::placeholder {
  color: var(--text-dim);
  opacity: 1; /* was 0.5 → ~2.2:1 contrast failure */
}
.section-header__subtitle { color: var(--text-dim); } /* override inline rgba(245,240,232,0.4) where used in light context */
.detail-panel__subtitle { color: rgba(245,240,232,0.75); } /* was 0.5 → ~4.7:1 borderline */
.entity-card:hover .entity-card__subtitle { color: rgba(245,240,232,0.8); }
.hit-card:hover .hit-card__subtitle { color: rgba(245,240,232,0.75); }
.hit-card:hover .hit-card__snippet { color: rgba(245,240,232,0.8); }
.hit-card:hover .hit-card__meta-item { color: rgba(245,240,232,0.7); }
.timeline__text { color: rgba(245,240,232,0.85); }
.site-footer__meta { color: rgba(245,240,232,0.75); }

/* ── Severity indicators — add icon + label, not just color ─ */
.severity-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--ff-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.25em 0.55em;
  border-left: 4px solid currentColor;
  background: rgba(26,26,26,0.06);
}
.entity-card:hover .severity-flag,
.hit-card:hover .severity-flag { background: rgba(245,240,232,0.08); }
.severity-flag[data-level="critical"] { color: var(--danger); }
.severity-flag[data-level="high"]     { color: #B83A00; }
.severity-flag[data-level="medium"]   { color: #8A6500; }
.severity-flag[data-level="low"]      { color: #2A6D2A; }
.severity-flag__glyph {
  font-size: 0.85em;
  line-height: 1;
}

/* ── Native button reset for cards (we now use real <button>) ─ */
.entity-card,
.hit-card {
  font: inherit;
  text-align: left;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Hero title — safer mobile/tablet scaling ───────────────── */
@media (max-width: 768px) {
  .hero__title { font-size: clamp(3rem, 12vw, 6rem); }
}
@media (max-width: 380px) {
  .hero__title { font-size: clamp(2.4rem, 14vw, 3.2rem); }
  .hero__stat { font-size: 0.75rem; }
  .hero__stat strong { font-size: 1.4rem; }
}

/* ── Radical-press strip — mobile fallback ──────────────────── */
@media (max-width: 768px) {
  /* Inline-styled press strip in index.html — make it scrollable */
  [data-press-strip] {
    flex-wrap: wrap !important;
    overflow: visible !important;
  }
  [data-press-strip] img {
    height: 80px !important;
    width: auto;
  }
}

/* ── Reduced-motion: stop ticker + drawer animation ─────────── */
@media (prefers-reduced-motion: reduce) {
  .ticker__inner { animation: none !important; }
  .detail-panel__drawer { animation: none !important; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Ticker pause/play button ───────────────────────────────── */
.ticker { position: relative; }
.ticker__pause {
  position: absolute;
  top: 50%;
  right: var(--gap);
  transform: translateY(-50%);
  background: var(--bg-dark);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 32px;
  padding: 0.4em 0.7em;
  z-index: 3;
}
.ticker__pause:hover,
.ticker__pause:focus-visible { background: var(--accent); color: var(--bg-dark); }
@media (max-width: 480px) {
  .ticker__pause { right: 0.5rem; font-size: 0.65rem; min-height: 28px; min-width: 36px; }
}

/* ── Search input — visible label support ───────────────────── */
.search-label {
  display: block;
  font-family: var(--ff-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
}
.search-label--inline {
  position: absolute;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0,0,0,0); clip-path: inset(50%);
  white-space: nowrap;
}


