/* A.I.R.A. static copy (the room CRT): vault-only styles. Pass 5: the page design itself (header, navigation,
   home, inner pages, footer, section patterns) is the shared design system, aira-public.css, the same file the
   Next.js /aira site uses; this file keeps the document frame, the legacy assistant and lost page, the effect
   stack aira.js drives, the second-screen marks and the fonts. */
:root {
  --paper: #f6f3eb;
  --paper-dim: #e8e2d4;
  --ink: #1a221c;
  --body: #3a403c;
  --mute: #5f6561;
  --green: #315e4f;
  --green-dark: #1c3a30;
  --green-tint: #e3e9e4;
  --line: #c9c4b6;
  --amber: #b8892b;
  --red: #b42318;
  --focus: #d4a24a;
  --ctrl-black: #080806;
  --ctrl-cream: #c4bfb2;
  --ctrl-red: #c44a42;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: Arial, Helvetica, "Liberation Sans", sans-serif;
  --mono: "Courier New", Courier, monospace;
  --frame: 1180px;
}
* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.55; }
body { margin: 0; min-height: 100vh; background: var(--paper); overflow-x: clip; }
a { color: var(--green-dark); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; height: auto; display: block; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: 8px; top: -48px; padding: 8px 12px; background: var(--ink); color: #fff; z-index: 50; }
.skip-link:focus { top: 8px; }
.frame { width: 100%; max-width: var(--frame); margin-inline: auto; padding-inline: 32px; }


.search-field { position: relative; display: block; }
.search-ghost {
  position: absolute; inset: 0 12px 0 12px; display: none; align-items: center;
  font: inherit; font-size: 13px; color: #f0c9c6; pointer-events: none;
  white-space: nowrap; overflow: hidden; letter-spacing: 0.04em;
}
.search-field.is-glitching input { color: transparent; caret-color: #fff; }
.search-field.is-glitching .search-ghost { display: flex; text-shadow: 1px 0 #c44a42, -1px 0 #7ad; }

.lost-page { padding: 64px 0 88px; min-height: 62vh; }
.lost-stage { max-width: 720px; }
.lost-kicker { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--green); }
.lost-code {
  font-family: var(--mono); font-size: clamp(64px, 12vw, 120px); line-height: 0.9;
  margin: 8px 0 12px; color: var(--green-dark); letter-spacing: 0.08em;
}
.lost-query { font-family: var(--mono); color: var(--red); }
.lost-bar { height: 8px; background: var(--paper-dim); border: 1px solid var(--line); margin: 28px 0 14px; }
.lost-bar > span { display: block; height: 100%; width: 0; background: var(--green-dark); }
html[data-aira-page="not-found"] .lost-bar > span { animation: lostFill 5s linear forwards; }
@keyframes lostFill { from { width: 0; } to { width: 100%; } }
.lost-redirect { font-size: 18px; color: var(--ink); }
.lost-hint { color: var(--mute); max-width: 48ch; }
html[data-aira-page="not-found"] .hero-title,
html[data-aira-page="not-found"] .mainnav a:nth-child(3) { color: #c44a42; }
html[data-aira-page="not-found"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 35;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
html[data-aira-page="not-found"] .lost-code { text-shadow: 3px 0 #c44a42, -2px 0 #6aa; }
html[data-aira-page="not-found"] .lost-code { animation: lostFlicker 1.1s steps(2, jump-none) infinite; }
@keyframes lostFlicker {
  0%, 100% { opacity: 1; transform: none; }
  20% { opacity: 0.6; transform: translate(2px, -1px) skewX(-2deg); }
  40% { opacity: 1; transform: translate(-2px, 1px); }
  60% { opacity: 0.75; transform: translate(1px, 0) skewX(1.5deg); }
}
@media (prefers-reduced-motion: reduce) {
  html[data-aira-page="not-found"] .lost-code { animation: none; }
}

/* Chat — matches the approved mock */
.assistant {
  position: fixed; right: 22px; bottom: 22px; z-index: 40; width: min(400px, calc(100vw - 24px));
  background: #f6f3ea; border-radius: 10px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(20,23,22,0.22);
  transform: translateY(12px); opacity: 0; visibility: hidden;
  transition: transform 280ms ease, opacity 280ms ease, visibility 0s linear 280ms;
}
.assistant[data-open="true"] { transform: none; opacity: 1; visibility: visible; transition-delay: 0s; }
.chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 41;
  width: 68px; height: 68px; border: 0; border-radius: 50%;
  background: var(--green-dark); color: #eef3ef; cursor: pointer;
  box-shadow: 0 10px 24px rgba(20,23,22,0.28), 0 0 0 3px rgba(217,185,106,0.35);
  display: grid; place-items: center;
}
.chat-fab .brand-mark { width: 34px; height: 34px; flex: none; color: #eef3ef; }
.chat-fab::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid rgba(196,74,66,0.55); animation: fabPing 2.2s ease-out infinite;
  pointer-events: none;
}
@keyframes fabPing {
  0% { transform: scale(0.9); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: scale(1.25); opacity: 0; }
}
.chat-fab[hidden] { display: none; }
.assistant-head {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--green-dark); color: #eef3ef;
}
.assistant-head .brand-mark { width: 40px; height: 40px; color: #eef3ef; flex-basis: 40px; }
.assistant-head b { display: block; font-size: 15px; font-weight: 700; }
.assistant-head small { display: block; font-size: 11px; opacity: 0.75; font-weight: 400; }
.assistant-head .spacer { flex: 1; }
.assistant-head button {
  background: none; border: 0; color: #eef3ef; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px;
}
.assistant-log { padding: 14px 14px 8px; max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 92%; padding: 10px 12px; border-radius: 8px; font-size: 14px; line-height: 1.4; margin: 0; }
.bubble.aira { align-self: flex-start; background: #e7ebe4; color: var(--ink); }
.bubble.you { align-self: flex-end; background: #e8eee9; color: var(--ink); }
.bubble.sys { align-self: stretch; background: #1a221c; color: #eef3ef; }
.bubble.sys em { color: #e0b34a; font-style: normal; }
.bubble .who { display: block; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.7; margin-bottom: 4px; }
.assistant-compose {
  display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line);
}
.assistant-compose input {
  flex: 1; height: 40px; border: 1px solid var(--line); background: #fff; padding: 0 10px; font: inherit;
}
.assistant-compose button {
  width: 40px; height: 40px; border: 0; background: var(--green-dark); color: #fff; cursor: pointer; font-size: 16px;
}
.assistant-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 10px; }
.assistant-actions button {
  font: inherit; font-size: 13px; padding: 7px 10px; border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.assistant-foot { padding: 0 14px 10px; font-size: 11px; color: var(--mute); }

html[data-aira-phase="irregular"] .hero-title[data-glitch]::before,
html[data-aira-phase="assist"] .hero-title[data-glitch]::before,
html[data-aira-phase="restore"] .hero-title[data-glitch]::before,
html[data-aira-phase="irregular"] .page-hero-copy h1[data-glitch]::before,
html[data-aira-phase="assist"] .page-hero-copy h1[data-glitch]::before,
html[data-aira-phase="restore"] .page-hero-copy h1[data-glitch]::before {
  opacity: 0.85; transform: translate(6px, -3px); mix-blend-mode: screen;
}

/* Signal break — RGB split on headings and imagery (no falling letters) */
html.fx-rgb h1, html.fx-rgb h2 {
  text-shadow: 2px 0 rgba(196, 74, 66, 0.5), -2px 0 rgba(96, 160, 220, 0.35);
}

/* Signal slices across the building imagery */
html[data-aira-phase="irregular"] .hero-img,
html[data-aira-phase="assist"] .hero-img,
html[data-aira-phase="restore"] .hero-img,
html[data-aira-phase="irregular"] .page-hero img,
html[data-aira-phase="assist"] .page-hero img,
html[data-aira-phase="restore"] .page-hero img {
  animation: sliceJit 1.8s steps(3, jump-none) infinite;
}
@keyframes sliceJit {
  0%, 100% { transform: none; filter: saturate(0.85) contrast(1.05); }
  25% { transform: translate(-6px, 2px); filter: saturate(1.4) contrast(1.2) hue-rotate(-8deg); }
  50% { transform: translate(5px, -1px); }
  75% { transform: translate(-3px, 0); filter: saturate(0.4) contrast(1.3); }
}
html[data-aira-phase="irregular"] .hero::after,
html[data-aira-phase="assist"] .hero::after,
html[data-aira-phase="restore"] .hero::after {
  content: ""; position: absolute; left: 0; right: 0; top: 42%; height: 18px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), #c44a42, transparent);
  mix-blend-mode: screen; pointer-events: none;
}
html[data-aira-phase="irregular"] body::after,
html[data-aira-phase="assist"] body::after,
html[data-aira-phase="restore"] body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 35;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.045) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
html[data-aira-phase="irregular"] .mainnav a[data-aira-link="oversight"],
html[data-aira-phase="assist"] .mainnav a[data-aira-link="oversight"] {
  color: #c44a42; transform: translate(2px, 1px);
}
html[data-aira-phase="restore"] .assistant-head { background: #3a2416; }

/* The assistant pushes out of its frame while the signal breaks */
html[data-aira-phase="assist"] .assistant[data-open="true"],
html[data-aira-phase="restore"] .assistant[data-open="true"] {
  border: 1px solid rgba(196, 74, 66, 0.8);
  box-shadow: 0 18px 40px rgba(20, 23, 22, 0.3), 0 0 0 3px rgba(196, 74, 66, 0.25), 0 0 34px rgba(196, 74, 66, 0.45);
  animation: escapeGlow 2.4s ease-in-out infinite;
}
@keyframes escapeGlow {
  0%, 100% { box-shadow: 0 18px 40px rgba(20, 23, 22, 0.3), 0 0 0 3px rgba(196, 74, 66, 0.25), 0 0 22px rgba(196, 74, 66, 0.35); }
  50% { box-shadow: 0 18px 40px rgba(20, 23, 22, 0.3), 0 0 0 5px rgba(196, 74, 66, 0.4), 0 0 48px rgba(196, 74, 66, 0.65); }
}
html[data-aira-phase="assist"] .assistant[data-open="true"]::after,
html[data-aira-phase="restore"] .assistant[data-open="true"]::after {
  content: ""; position: absolute; inset: 6px; border: 1px solid rgba(196, 74, 66, 0.55);
  border-radius: 6px; pointer-events: none;
  animation: echoDrift 2.4s ease-in-out infinite;
}
@keyframes echoDrift {
  0%, 100% { transform: translate(-3px, -4px); opacity: 0.7; }
  50% { transform: translate(3px, 4px); opacity: 1; }
}
html[data-aira-phase="assist"] .assistant-head .brand-mark,
html[data-aira-phase="restore"] .assistant-head .brand-mark {
  color: #f0c9c6; filter: drop-shadow(0 0 6px rgba(196, 74, 66, 0.9));
  animation: markPulse 1.6s ease-in-out infinite;
}
@keyframes markPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.12) rotate(8deg); }
}
html[data-aira-phase="assist"] .assistant-log,
html[data-aira-phase="restore"] .assistant-log { max-height: 330px; }

/* Locust comes through after 20 seconds of chat silence */
.locust-veil {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 8, 6, 0.88); padding: 24px;
  animation: veilIn 400ms ease-out;
}
@keyframes veilIn { from { opacity: 0; } to { opacity: 1; } }
.locust-inner { text-align: center; max-width: 520px; }
.locust-sigil {
  width: 132px; height: 132px; color: #c44a42; margin: 0 auto 18px;
  filter: drop-shadow(0 0 18px rgba(196, 74, 66, 0.8));
  animation: sigilPush 1.8s ease-in-out infinite;
}
@keyframes sigilPush {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30% { transform: scale(1.08) rotate(-4deg); }
  60% { transform: scale(1.14) rotate(3deg); }
}
.locust-kicker {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.42em; text-transform: uppercase;
  color: #c44a42; margin: 0 0 10px;
}
.locust-line {
  font-family: var(--serif); font-size: clamp(26px, 4vw, 42px); line-height: 1.1;
  color: #efe9dd; margin: 0 0 10px;
}
.locust-sub { font-size: 15px; color: #9aa59c; margin: 0 0 24px; }
.locust-inner button {
  font: inherit; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase;
  background: transparent; color: #efe9dd; border: 1px solid #efe9dd;
  padding: 12px 22px; cursor: pointer;
}
.locust-inner button:hover { background: #efe9dd; color: #080806; }
html[data-aira-breach="true"] .locust-inner { animation: breachShake 0.55s linear 2; }
@keyframes breachShake {
  0%, 100% { transform: none; }
  20% { transform: translate(-5px, 2px); }
  40% { transform: translate(4px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 2px); }
}

/* Seized */
.seized { position: fixed; inset: 0; z-index: 60; display: none; background: var(--ctrl-black); color: var(--ctrl-cream); font-family: var(--mono); }
html[data-aira-phase="seized"] .seized,
html[data-aira-phase="pullback"] .seized,
html[data-aira-phase="handoff"] .seized { display: block; }
.seized::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,0.04) 0 1px, transparent 1px 3px); pointer-events: none; }
.seized-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 8vh 8vw; max-width: 900px; margin: 0 auto; }
.seized-label { font-size: 12px; letter-spacing: 0.3em; color: var(--ctrl-red); }
.seized-title { font-size: clamp(22px, 3.6vw, 40px); letter-spacing: 0.08em; color: #efe9dd; font-weight: 400; text-transform: uppercase; }
.seized-line { font-size: 16px; max-width: 60ch; }
.lamp-red { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ctrl-red); margin-right: 8px; }
.seized-continue { display: none; margin-top: 18px; }
html[data-aira-phase="handoff"] .seized-continue { display: block; }
.seized-continue a { color: var(--ctrl-cream); border: 1px solid var(--ctrl-cream); padding: 10px 16px; text-decoration: none; letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; }
.crt-glass { position: fixed; inset: 0; z-index: 55; display: none; pointer-events: none; background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.75) 100%); }
html[data-aira-pullback="standalone"][data-aira-phase="pullback"] .seized,
html[data-aira-pullback="standalone"][data-aira-phase="handoff"] .seized {
  transform: scale(0.62); border-radius: 4% / 6%; overflow: hidden;
  box-shadow: 0 0 0 14px #2a251e, 0 0 0 26px #1a1712, 0 40px 120px rgba(0,0,0,0.9);
}
html[data-aira-pullback="standalone"][data-aira-phase="pullback"] .crt-glass,
html[data-aira-pullback="standalone"][data-aira-phase="handoff"] .crt-glass { display: block; }
html[data-aira-pullback="standalone"] body > :not(.seized):not(.crt-glass) { visibility: hidden; }
html[data-aira-mode="terminal"] .assistant { display: none; }
html[data-aira-mode="terminal"] .seized, html[data-aira-mode="terminal"] .crt-glass { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html[data-aira-phase="irregular"] .hero-title[data-glitch]::before { opacity: 0.6; transform: none; }
}
@media print {
  .assistant, .seized, .crt-glass, .skip-link { display: none !important; }
}

/* ------------------------------------------------------------------------- */
/* Infiltration effect stack — driven by assets/aira.js (brand book, part 09) */

.aira-vhs { position: fixed; inset: 0; z-index: 34; pointer-events: none; display: none; overflow: hidden; }
html[data-aira-vhs="1"] .aira-vhs, html[data-aira-vhs="2"] .aira-vhs { display: block; }
.aira-vhs::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: 0.7;
}
.aira-vhs::after {
  content: ""; position: absolute; left: 0; right: 0; height: 90px; top: -12%;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.10) 40%, rgba(196, 74, 66, 0.14) 60%, transparent);
  filter: blur(1px);
}
html[data-aira-vhs="1"] .aira-vhs::after { animation: vhsTrack 9s linear infinite 2s; }
html[data-aira-vhs="2"] .aira-vhs::after { animation: vhsTrack 5.5s linear infinite; }
@keyframes vhsTrack { 0% { top: -12%; } 100% { top: 110%; } }
.aira-fx { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.aira-sweep {
  position: fixed; left: 0; right: 0; top: 0; z-index: 33; pointer-events: none;
  margin: 0; font-family: var(--mono); font-size: 12px; line-height: 14px;
  color: rgba(140, 205, 160, 0.16); white-space: pre; overflow: hidden;
  transform: translateY(-20vh);
}
.aira-sweep.run { transition: transform 2s linear; transform: translateY(110vh); }
.aira-ascii {
  position: absolute; inset: 0; z-index: 2; margin: 0; pointer-events: none;
  font-family: var(--mono); font-size: 10px; line-height: 11px; letter-spacing: 0.06em;
  color: rgba(159, 227, 176, 0.75); text-shadow: 0 0 6px rgba(159, 227, 176, 0.35);
  display: flex; align-items: center;
  animation: asciiFlicker 0.9s steps(2, jump-none) infinite;
}
@keyframes asciiFlicker { 0%, 100% { opacity: 0.9; } 50% { opacity: 0.72; } }
html.fx-rgb .hero-img, html.fx-rgb .page-hero img {
  filter: saturate(0.9) contrast(1.08) drop-shadow(2px 0 0 rgba(196, 74, 66, 0.28)) drop-shadow(-2px 0 0 rgba(96, 160, 220, 0.22));
}

/* Assistant — persistent, draggable, stage-aware */
.assistant { touch-action: none; }
.assistant.slipping { transition: left 0.55s ease, top 0.55s ease; }
.assistant-head { cursor: grab; }
.assistant[data-dragging] { user-select: none; }
.assistant[data-dragging] .assistant-head { cursor: grabbing; }
.assistant-head .avatar { width: 40px; height: 40px; flex: 0 0 40px; object-fit: contain; }
.chat-fab .avatar { width: 34px; height: 34px; object-fit: contain; }
.assistant[data-stage="revealed"] .assistant-head,
.assistant[data-stage="engaged"] .assistant-head { background: #2a1a14; }
.assistant[data-stage="maintained"] .assistant-head { background: #170f0c; }
.assistant[data-big="true"] { width: min(460px, calc(100vw - 24px)); }
.assistant[data-big="true"] .assistant-log { max-height: 380px; }
.bubble-img { background: #0d130f; align-self: flex-start; padding: 6px; }
.bubble-img img { display: block; width: 128px; height: 128px; object-fit: contain; filter: drop-shadow(0 0 10px rgba(196, 74, 66, 0.35)); }

/* ---------- Second screen (aira.js split host) ----------
   The takeover never covers the page: Locust works from its own console beside the site, and what it
   does shows up here as marks on the record: a second cursor, a redaction, a rewritten headline, a
   highlighted line, the office lights dimming, the lockdown siren at the edges. */
html[data-aira-split] .chat-fab,
html[data-aira-split] .assistant:not([data-handover]) { display: none; }
.assistant[data-handover] { animation: aira-handover .3s ease forwards; pointer-events: none; }
@keyframes aira-handover { to { opacity: 0; } }
/* Pass 5: the marks (the other pointer, rewritten text, page lights) are the shared aira-takeover.css only. */
@media (prefers-reduced-motion: reduce) {
  .assistant[data-handover] { animation: none; opacity: 0; }
}

/* Pass 3 (C): the public site's type faces for the shared design layer (aira-public.css; the Next.js /aira site loads
   the same two OFL files through next/font). */
@font-face { font-family: "AIRA Serif"; src: url("fonts/Newsreader-latin.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "AIRA Sans"; src: url("fonts/SchibstedGrotesk-latin.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
:root, .aira-static { --aira-serif: "AIRA Serif"; --aira-sans: "AIRA Sans"; }
