/* Chaineye ---------------------------------------------------------------- */

:root {
  --paper:    #F6F1E7;
  --card:     #FFFDF8;
  --ink:      #17140F;
  --ink-2:    #5E574B;
  --ink-3:    #9C9384;
  --rule:     #E3DACA;
  --rule-2:   #D2C7B3;
  --red:      #C8161D;
  --red-deep: #7E0D12;
  --red-wash: rgba(200, 22, 29, 0.07);
  --up:       #1B7A4A;
  --field:    0.72;
  --wall:     0.8;

  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --gutter: clamp(28px, 4.4vw, 72px);
  --max: 1240px;
}

[data-theme='dark'] {
  --paper:    #0E0D0C;
  --card:     #161513;
  --ink:      #F1ECE2;
  --ink-2:    #A39C8F;
  --ink-3:    #625C53;
  --rule:     #24221E;
  --rule-2:   #34312B;
  --red:      #FF4036;
  --red-deep: #B5231C;
  --red-wash: rgba(255, 64, 54, 0.09);
  --up:       #3CC47F;
  --field:    0.64;
  --wall:     0.72;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 380ms var(--ease), color 380ms var(--ease);
}

body.is-booting { overflow: hidden; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
button { font: inherit; color: inherit; }

/* --- ASCII eye glyph classes ------------------------------------------ */

.eye { margin: 0; font-family: var(--mono); line-height: 1; letter-spacing: 0; white-space: pre; user-select: none; }
.eye i { font-style: normal; }
.eye .k { color: var(--ink); }
.eye .p { color: var(--ink); font-weight: 700; }
.eye .s { color: color-mix(in srgb, var(--ink) 58%, transparent); }
.eye .f { color: color-mix(in srgb, var(--ink) 30%, transparent); }
.eye .r { color: var(--red); }
.eye .d { color: var(--red-deep); font-weight: 600; }
.eye .g { color: var(--ink); }

/* --- Boot ------------------------------------------------------------- */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 34px;
  background: var(--paper);
  transition: opacity 650ms var(--ease) 380ms, visibility 0s linear 1050ms;
}

#boot.is-open { opacity: 0; visibility: hidden; pointer-events: none; }

#boot-eye { position: relative; z-index: 1; font-size: clamp(6px, 0.612vw, 9px); width: 84em; height: 38em; }
#boot .boot-copy { position: relative; z-index: 1; }

/* --- Eye wall (hero) --------------------------------------------------- */

.grid-eye { position: absolute; opacity: 0; transition: opacity 700ms var(--ease); }
.grid-eye.on { opacity: var(--wall); }

/* --- Cursor and trail -------------------------------------------------- */

html.eye-cursor, html.eye-cursor body { cursor: var(--cursor-eye); }
html.eye-cursor a, html.eye-cursor button, html.eye-cursor summary, html.eye-cursor [role='button'] { cursor: var(--cursor-eye-hot); }
html.eye-cursor input, html.eye-cursor textarea { cursor: text; }

.trail { position: fixed; inset: 0; z-index: 300; pointer-events: none; overflow: hidden; }
.trail span {
  position: absolute;
  font-family: var(--mono);
  line-height: 1;
  color: var(--ink-3);
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}
.trail span.hot { color: var(--red); }

/* --- Linked eye network ---------------------------------------------- */

.net { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.net-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.net-eye { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform, opacity; }
.net-box { fill: none; stroke: var(--red); stroke-width: 1; }
.net-ticks { fill: none; stroke: var(--red); stroke-width: 2; }
.net-line { stroke: var(--red); stroke-width: 1; stroke-opacity: 0.7; }
.net-dot { fill: var(--red); }
.net-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.02em; fill: var(--red); }

.boot-copy { display: grid; justify-items: center; gap: 14px; }

.boot-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 26px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}

.btn-primary:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.55; cursor: progress; }

.btn-primary .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red);
  transition: background-color 180ms var(--ease);
}
.btn-primary:hover .dot { background: #fff; }

/* --- Masthead --------------------------------------------------------- */

.masthead {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 26px var(--gutter) 0;
  pointer-events: none;
}

.masthead::before {
  content: '';
  position: absolute;
  inset: 0 0 -40px 0;
  background: linear-gradient(var(--paper) 55%, color-mix(in srgb, var(--paper) 0%, transparent));
  opacity: 0;
  transition: opacity 260ms var(--ease);
  z-index: -1;
}

body.is-scrolled .masthead::before { opacity: 1; }
.masthead > * { pointer-events: auto; }

.brand { text-decoration: none; display: block; }

.wordmark {
  display: block;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 27px;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.wordmark span { transition: color 60ms linear; }

.strap {
  display: block;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink-2);
}

.strap span, .wordmark span { transition: color 60ms linear; }

/* On the loading screen only the brand shows, above the overlay. */
body.is-booting .masthead { z-index: 120; }
.controls { transition: opacity 500ms var(--ease); }
body.is-booting .controls { opacity: 0; pointer-events: none; }

.controls { display: flex; align-items: center; gap: 10px; }

.seg {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--rule-2);
  background: var(--card);
  border-radius: 999px;
}

.seg button {
  height: 30px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 180ms var(--ease), color 180ms var(--ease);
}

.seg button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

.pill {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}

.pill:hover { color: var(--ink); border-color: var(--ink); }

.theme-switch { gap: 9px; padding: 0 14px 0 6px; }

.theme-switch .knob {
  position: relative;
  width: 34px; height: 24px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
}

.theme-switch .knob::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 260ms var(--ease);
}

[data-theme='dark'] .theme-switch .knob::after { transform: translateX(10px); background: var(--red); }

/* --- Hero ------------------------------------------------------------- */

.hero {
  position: relative;
  height: 100vh;
  min-height: 780px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.field-eye {
  position: absolute;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 1100ms var(--ease);
}

.field-eye.awake { opacity: var(--field); }
.field-eye .d, .field-eye .r { color: var(--red); }

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  text-align: center;
  padding-top: 20px;
}

.hero h1 { font-size: clamp(48px, 5.4vw, 80px) !important; }

#hero-eye { font-size: clamp(4.6px, 0.46vw, 6.8px); width: 90em; height: 42em; margin-bottom: 24px; }

.hero h1 {
  margin: 0;
  font-size: clamp(40px, 4.3vw, 62px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.hero .lede {
  margin: 16px 0 30px;
  max-width: 48ch;
  font-size: 16.5px;
  color: var(--ink-2);
}

.scanner {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(680px, 86vw);
  padding: 7px;
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(23, 20, 15, 0.03), 0 18px 40px -26px rgba(23, 20, 15, 0.35);
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}

[data-theme='dark'] .scanner { box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.9); }

.scanner:focus-within { border-color: var(--ink); }

.scanner .chain-tag {
  flex: none;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 9px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
}

.chain-tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }

.scanner input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
}

.scanner input::placeholder { color: var(--ink-3); }
.scanner input:focus { outline: none; }
.scanner .btn-primary { height: 44px; border-radius: 9px; }

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(680px, 86vw);
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
}

.phantom {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}

.phantom svg { width: 18px; height: 18px; }
.phantom:hover { color: var(--red); }

.hero-error {
  min-height: 20px;
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--red);
}

.scrollcue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  z-index: 2;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
  text-decoration: none;
}

.scrollcue i {
  width: 1px; height: 26px;
  background: linear-gradient(var(--ink-3), transparent);
  animation: cue 2.4s var(--ease) infinite;
  transform-origin: top;
}

@keyframes cue { 0% { transform: scaleY(0); } 50% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* --- Sections --------------------------------------------------------- */

.section {
  position: relative;
  padding: 120px var(--gutter);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 40px;
}

.wrap { max-width: var(--max); margin: 0 auto; }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 56px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(34px, 3.4vw, 50px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.section-head p { margin: 0; max-width: 50ch; color: var(--ink-2); font-size: 16.5px; justify-self: end; }

/* --- Report ----------------------------------------------------------- */

#report { display: none; }
#report.is-shown { display: block; }

.report-id {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
}

.report-id .addr {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--rule);
  color: var(--ink);
}

.verdict {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 20px;
  overflow: hidden;
}

.verdict-eye {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 26px;
  padding: 48px 32px 40px;
  border-right: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 46%, var(--red-wash), transparent 62%),
    var(--card);
}

#report-eye { font-size: 7.4px; width: 57.6em; height: 28em; }

.score-row { display: flex; align-items: baseline; gap: 14px; }

.score {
  font-family: var(--mono);
  font-size: 84px;
  font-weight: 600;
  letter-spacing: -0.06em;
  line-height: 0.9;
  color: var(--red);
}

.score small { font-size: 18px; letter-spacing: 0; color: var(--ink-3); font-weight: 400; margin-left: 4px; }

.band { text-align: left; }
.band b { display: block; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.band span { font-size: 14px; color: var(--ink-2); }

.meter {
  position: relative;
  width: min(420px, 100%);
  height: 6px;
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}

.meter i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 999px;
  background: var(--red);
  transition: width 1100ms var(--ease);
}

.meter-scale {
  display: flex;
  justify-content: space-between;
  width: min(420px, 100%);
  margin-top: -16px;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }

.fact { padding: 26px 30px; border-bottom: 1px solid var(--rule); }
.fact:nth-child(odd) { border-right: 1px solid var(--rule); }
.fact:nth-last-child(-n + 2) { border-bottom: 0; }

.fact dt { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.fact dd { margin: 0; font-family: var(--mono); font-size: 24px; letter-spacing: -0.03em; }

.partial-note {
  margin: 18px 0 0;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px dashed var(--rule-2);
  font-size: 14px;
  color: var(--ink-2);
}

.signals { margin-top: 30px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.signal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 24px 24px 22px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
}

.signal[data-status='match'] { border-color: color-mix(in srgb, var(--red) 34%, var(--rule)); }

.signal-top { display: flex; justify-content: space-between; align-items: center; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11.5px;
}

.tag::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.signal[data-status='match'] .tag { color: var(--red); }
.signal[data-status='match'] .tag::before { background: var(--red); }
.signal[data-status='pass'] .tag { color: var(--ink-3); }
.signal[data-status='pass'] .tag::before { background: transparent; border: 1px solid var(--ink-3); }

.weight { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

.signal h3 { margin: 4px 0 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.signal p { margin: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }

.signal .evidence {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}

.subhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 64px 0 18px;
}

.subhead h3 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.subhead span { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* --- Token cards (report positions and live feed) --------------------- */

.tokens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.token {
  display: grid;
  gap: 14px;
  padding: 20px 22px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 16px;
  text-decoration: none;
  transition: border-color 180ms var(--ease);
}

a.token:hover { border-color: var(--ink-3); }

.token-head { display: flex; align-items: center; gap: 12px; }

.token-mark {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}

.token-mark img { width: 100%; height: 100%; object-fit: cover; }

.token-name { min-width: 0; }
.token-name b { display: block; font-family: var(--mono); font-size: 14px; font-weight: 600; }
.token-name span { display: block; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.token-price { margin-left: auto; text-align: right; font-family: var(--mono); }
.token-price b { display: block; font-size: 14px; font-weight: 500; }
.chg { font-size: 12px; }
.chg.up { color: var(--up); }
.chg.down { color: var(--red); }

.token svg { display: block; width: 100%; height: 56px; }

.token-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
}

.token-stats dt { color: var(--ink-3); font-family: var(--sans); font-size: 11.5px; }
.token-stats dd { margin: 2px 0 0; }

.feed-empty {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  border: 1px dashed var(--rule-2);
  border-radius: 16px;
  color: var(--ink-2);
  font-size: 14.5px;
}

.skeleton { height: 214px; border-radius: 16px; background: var(--card); border: 1px solid var(--rule); position: relative; overflow: hidden; }
.skeleton::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--rule) 70%, transparent), transparent);
  animation: shimmer 1.4s infinite;
  transform: translateX(-100%);
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* --- Guide ------------------------------------------------------------ */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
}

.step {
  padding: 32px 30px 36px 0;
  border-bottom: 1px solid var(--rule);
}

.step:not(:nth-child(3n + 1)) { padding-left: 30px; border-left: 1px solid var(--rule); }

.step .n { font-family: var(--mono); font-size: 12px; color: var(--red); }
.step h3 { margin: 18px 0 10px; font-size: 20px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; }
.step p { margin: 0; font-size: 15px; color: var(--ink-2); }

.reading {
  display: grid;
  grid-template-columns: 200px repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-top: 56px;
  align-items: stretch;
}

.reading h3 { margin: 0; padding-top: 18px; font-size: 15px; font-weight: 600; }

.read {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  min-height: 150px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  text-decoration: none;
  font-size: 15px;
  line-height: 1.35;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}

.read:hover { border-color: var(--ink); }
.read em { font-style: normal; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }

/* --- Citations under steps ------------------------------------------- */

.cite {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 18px 0 0 !important;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3) !important;
}

.cite button {
  padding: 3px 9px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--card);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.cite button:hover { border-color: var(--red); color: var(--red); }

/* --- Research list ----------------------------------------------------- */

.research { margin-top: 88px; }

.research-head {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 26px;
}

.research-head h3 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; }
.research-head p { margin: 0; justify-self: end; max-width: 50ch; color: var(--ink-2); font-size: 15px; }

.papers { border-top: 1px solid var(--ink); }

.paper {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) 200px;
  gap: 32px;
  align-items: center;
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
}

.paper-eye { font-size: 5.2px; width: 26.4em; height: 12em; justify-self: center; }

.paper-ref { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--red); white-space: pre; }

.paper h4 { margin: 8px 0 6px; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; }
.paper h4 button { padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; }
.paper h4 button:hover { color: var(--red); }

.paper-authors { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-3); }
.paper-sum { margin: 0; max-width: 72ch; font-size: 15px; color: var(--ink-2); }

.paper-actions { display: grid; justify-items: end; gap: 12px; }
.paper-actions .btn-primary { height: 40px; padding: 0 18px; border-radius: 10px; }
.paper-link { font-family: var(--mono); font-size: 12px; color: var(--ink-2); text-decoration: none; border-bottom: 1px solid var(--rule-2); }
.paper-link:hover { color: var(--red); border-color: var(--red); }

/* --- PDF viewer ------------------------------------------------------- */

.viewer {
  width: min(1180px, 92vw);
  height: 92vh;
  max-height: none;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  overflow: hidden;
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.5);
}

.viewer[open] { display: flex; flex-direction: column; animation: viewer-in 320ms var(--ease); }
@keyframes viewer-in { from { opacity: 0; transform: translateY(12px) scale(0.99); } }

.viewer::backdrop { background: rgba(14, 13, 12, 0.55); backdrop-filter: blur(6px); }

.viewer-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 22px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule);
}

#viewer-eye { font-size: 4px; width: 26.4em; height: 12em; }
.viewer-meta h3 { margin: 4px 0 2px; font-size: 17px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.viewer-meta p { margin: 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-actions { display: flex; gap: 8px; }

.viewer-body { position: relative; flex: 1; background: var(--paper); }
.viewer-body iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity 300ms var(--ease); }
.viewer-body iframe.ready { opacity: 1; }
.viewer-wait { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.viewer-wait a { color: var(--red); }

/* --- Ask -------------------------------------------------------------- */

.ask {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 22px;
  overflow: hidden;
  min-height: 520px;
}

.ask-side {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 40px;
  border-right: 1px solid var(--rule);
  background:
    radial-gradient(ellipse at 50% 45%, var(--red-wash), transparent 60%),
    var(--card);
}

#ask-eye { font-size: 7px; width: 57.6em; height: 28em; }

.ask-side p { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: center; }

.ask-main { display: flex; flex-direction: column; padding: 30px 30px 26px; }

.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 300px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 6px;
}

.msg { max-width: 88%; font-size: 15px; line-height: 1.55; }

.msg-eye {
  align-self: flex-start;
  padding: 14px 18px;
  border-radius: 4px 16px 16px 16px;
  background: var(--paper);
}

.msg-eye::before {
  content: 'the eye';
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--red);
}

.msg-you {
  align-self: flex-end;
  padding: 10px 16px;
  border-radius: 16px 4px 16px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
}

.prompts { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 14px; }

.prompts button {
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color 160ms var(--ease), color 160ms var(--ease);
}

.prompts button:hover { border-color: var(--ink); color: var(--ink); }

.ask-form {
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--rule-2);
  border-radius: 12px;
  background: var(--paper);
}

.ask-form:focus-within { border-color: var(--ink); }

.ask-form input {
  flex: 1;
  min-width: 0;
  padding: 0 10px;
  border: 0;
  background: transparent;
  font-size: 14.5px;
  color: var(--ink);
}

.ask-form input:focus { outline: none; }
.ask-form .btn-primary { height: 38px; padding: 0 18px; border-radius: 8px; }

/* --- Footer ----------------------------------------------------------- */

.foot {
  padding: 34px var(--gutter) 42px;
  border-top: 1px solid var(--rule);
}

.foot .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; font-size: 13px; color: var(--ink-3); }
.foot .wordmark { font-size: 15px; color: var(--ink); }
.foot nav { display: flex; gap: 22px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--red); }

/* --- Docs ------------------------------------------------------------- */

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 72px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 150px var(--gutter) 110px;
}

.toc { position: sticky; top: 130px; align-self: start; }
.toc #doc-eye { font-size: 3.6px; margin-bottom: 26px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 6px 0 6px 16px; margin-left: -1px; border-left: 1px solid transparent; font-size: 14px; color: var(--ink-2); text-decoration: none; }
.toc a:hover, .toc a.on { color: var(--ink); border-left-color: var(--red); }

.doc { max-width: 720px; }
.doc h1 { margin: 0 0 18px; font-size: clamp(42px, 4.4vw, 60px); font-weight: 600; letter-spacing: -0.045em; line-height: 1; }
.doc .lede { margin: 0 0 54px; font-size: 19px; color: var(--ink-2); max-width: 54ch; }
.doc section { padding-top: 46px; margin-top: 46px; border-top: 1px solid var(--rule); scroll-margin-top: 110px; }
.doc section:first-of-type { margin-top: 0; }
.doc h2 { margin: 0 0 14px; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.doc h3 { margin: 30px 0 10px; font-size: 17px; font-weight: 600; }
.doc p, .doc li { color: var(--ink-2); }
.doc p { margin: 0 0 14px; }
.doc ul { padding-left: 20px; margin: 0 0 14px; }
.doc li { margin-bottom: 8px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc code { font-family: var(--mono); font-size: 13px; padding: 2px 6px; border-radius: 5px; background: var(--card); border: 1px solid var(--rule); color: var(--ink); }

.doc pre.code {
  margin: 18px 0;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
}

[data-theme='dark'] .doc pre.code { background: var(--card); color: var(--ink); border: 1px solid var(--rule); }
.doc pre.code code { padding: 0; border: 0; background: none; color: inherit; }

.doc table { width: 100%; border-collapse: collapse; margin: 18px 0 20px; font-size: 14.5px; }
.doc th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-3); padding: 0 16px 10px 0; border-bottom: 1px solid var(--rule-2); }
.doc td { padding: 13px 16px 13px 0; border-bottom: 1px solid var(--rule); color: var(--ink-2); vertical-align: top; }
.doc td:first-child { color: var(--ink); }
.doc td.num { font-family: var(--mono); color: var(--red); }

.bands { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.bands div { padding: 16px; border-radius: 12px; background: var(--card); border: 1px solid var(--rule); }
.bands b { display: block; font-family: var(--mono); font-size: 13px; color: var(--red); }
.bands span { display: block; margin-top: 6px; font-weight: 600; }

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

/* Eyes paint onto canvas; the <pre> is just the sized box. */
.eye-canvas { display: block; }

/* Research as a 3 x 2 grid of scrollable PDF previews */
.papers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; border-top: 0; }
.paper { display: flex; flex-direction: column; gap: 14px; padding: 18px; border: 1px solid var(--rule); border-radius: 16px; background: var(--card); }
.paper-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; min-height: 112px; }
.paper .paper-eye { font-size: 3.4px; }
.paper h4 { font-size: 15.5px; margin: 6px 0 4px; }
.paper-authors { font-size: 12.5px; margin: 0; }
.paper-pdf { width: 100%; height: 420px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); }
.paper-actions { display: flex; justify-content: space-between; align-items: center; justify-items: initial; }
