/* ============================================================
   TOKENS — cream / Claude orange / pastel
   ============================================================ */
:root {
  --bg: #F7F2E9;
  --bg-deep: #F0E8D9;
  --surface: #FFFFFF;
  --surface-warm: #FDFBF6;
  --surface-border: #E7DECD;
  --ink: #1F1E1B;
  --text: #2A2825;
  --text-muted: #6B6759;
  --text-faint: #A39B88;
  --accent: #D97757;        /* Claude orange */
  --accent-deep: #B0512F;   /* readable small-text orange */
  --accent-btn: #C4603D;    /* button bg, white text passes contrast */
  --accent-dim: rgba(217, 119, 87, 0.14);
  --sage: #3E6B52;
  --sage-dim: #DEEBE2;
  --butter-ink: #7A601A;
  --butter-dim: #F2E7C8;
  --blush-ink: #A84E2F;
  --blush-dim: #F4DCD0;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  --max-width: 940px;
  --edge: clamp(24px, 6vw, 64px);

  --z-canvas: 0;
  --z-content: 1;
  --z-header: 10;
  --z-chat: 35;
  --z-palette: 40;
  --z-pong: 50;
  --z-toast: 60;
  --z-cursor: 80;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: auto; } /* Lenis handles smooth scroll */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

::selection { background: var(--accent-dim); color: var(--ink); }

a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); }

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: var(--z-cursor);
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
  transform: translate(-50%, -50%);
}
.cursor-ring {
  width: 30px; height: 30px;
  border: 1px solid rgba(217, 119, 87, 0.45);
  transform: translate(-50%, -50%);
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease;
}
.cursor-ring.big {
  width: 48px; height: 48px;
  border-color: var(--accent);
}
body.has-cursor, body.has-cursor * { cursor: none !important; }
body.has-cursor .cursor-dot, body.has-cursor .cursor-ring { opacity: 1; }

/* ============================================================
   NEURAL CANVAS
   ============================================================ */
#neural-canvas {
  position: fixed;
  inset: 0;
  z-index: var(--z-canvas);
  pointer-events: none;
  opacity: 0.62;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--edge);
  background: transparent;
  transition: background 0.4s ease, border-color 0.4s ease;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: rgba(247, 242, 233, 0.9);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--surface-border);
}

.logo-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--accent-deep);
  border: 1px solid var(--surface-border);
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--surface-warm);
  transition: border-color 0.2s ease;
}
.logo-mark:hover { border-color: var(--accent); }

.site-nav {
  display: flex;
  gap: clamp(14px, 2.5vw, 28px);
  font-size: 13.5px;
  margin-left: auto;
}
.site-nav a {
  color: var(--text-muted);
  transition: color 0.2s ease;
  letter-spacing: 0.01em;
}
.site-nav a:hover,
.site-nav a.active { color: var(--ink); }

.palette-chip {
  background: var(--surface-warm);
  border: 1px solid var(--surface-border);
  border-radius: 5px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.palette-chip:hover { color: var(--accent-deep); border-color: var(--accent); }

@media (max-width: 640px) {
  .site-nav { gap: 12px; font-size: 12px; }
  .site-header { padding: 14px var(--edge); }
  .palette-chip { display: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  height: 100vh;
  z-index: var(--z-content);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-stage {
  position: relative;
  width: 100%;
  max-width: var(--max-width);
  padding: 0 var(--edge);
  display: flex;
  flex-direction: column;
}

.hero-layer { position: relative; will-change: transform, opacity; }

.hero-eyebrow {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin: 0 0 24px;
}

.hero-name {
  display: flex;
  flex-direction: column;
  font-family: var(--font-display);
  font-weight: 700;
  font-optical-sizing: auto;
  font-size: clamp(52px, 10vw, 96px);
  line-height: 0.95;
  margin: 0 0 36px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.name-line { display: block; overflow: hidden; }
.name-line-inner { display: block; will-change: transform; }

.hero-tagline {
  font-size: clamp(15px, 1.8vw, 18px);
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0 0 40px;
  max-width: 520px;
  will-change: transform, opacity;
}
.hero-tagline strong { color: var(--ink); font-weight: 600; }

.hero-links { display: flex; flex-wrap: wrap; will-change: transform, opacity; }

.hero-links a {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 10px 20px;
  border: 1px solid var(--surface-border);
  background: var(--surface-warm);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.hero-links a:first-child { border-radius: 6px 0 0 6px; }
.hero-links a:last-child  { border-radius: 0 6px 6px 0; }
.hero-links a + a { border-left: none; }
.hero-links a:hover {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.scroll-hint {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 32px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.scroll-hint::after {
  content: '';
  display: block;
  width: 32px;
  height: 1px;
  background: var(--text-faint);
  animation: scroll-line 2s ease-in-out infinite;
}
@keyframes scroll-line {
  0%   { width: 0; opacity: 0; }
  30%  { opacity: 1; }
  70%  { width: 32px; opacity: 1; }
  100% { width: 32px; opacity: 0; }
}

/* ============================================================
   MARQUEE
   ============================================================ */
.marquee {
  position: relative;
  z-index: var(--z-content);
  overflow: hidden;
  border-top: 1px solid var(--surface-border);
  border-bottom: 1px solid var(--surface-border);
  padding: 14px 0;
  background: var(--bg-deep);
}
.marquee-track {
  display: flex;
  width: max-content;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  animation: marquee 108s linear infinite;
}
.marquee-track span { white-space: pre; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ============================================================
   CONTENT SECTIONS
   ============================================================ */
.content-section { position: relative; z-index: var(--z-content); }

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(72px, 11vw, 112px) var(--edge);
}

.reveal-heading {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-wrap: balance;
}

.reveal-sub {
  color: var(--text-muted);
  font-size: 15.5px;
  max-width: 540px;
  margin: 0 0 52px;
}

.reveal-item { will-change: transform, opacity; }

.content-section + .content-section .section-inner {
  border-top: 1px solid var(--surface-border);
}

/* ============================================================
   PUBLICATIONS
   ============================================================ */
.citation-ledger { display: flex; flex-direction: column; }

.citation {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--surface-border);
}

.citation-status {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 5px 9px;
  border-radius: 3px;
  height: fit-content;
  white-space: nowrap;
  font-weight: 600;
  margin-top: 3px;
}

.status-review { background: var(--sage-dim);   color: var(--sage); }
.status-prep   { background: var(--butter-dim); color: var(--butter-ink); }
.status-award  { background: var(--blush-dim);  color: var(--blush-ink); }
.status-pub    { background: var(--surface);    color: var(--text-muted); border: 1px solid var(--surface-border); }

.citation-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 8px;
  line-height: 1.4;
  color: var(--ink);
}
.citation-meta {
  font-size: 12px;
  color: var(--accent-deep);
  margin: 0 0 10px;
  letter-spacing: 0.01em;
}
.citation-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  max-width: 560px;
  line-height: 1.6;
}

.citation-code {
  display: inline-block;
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.citation-code:hover { border-bottom-color: var(--accent); }
.citation-code + .citation-code { margin-left: 20px; }

@media (max-width: 600px) {
  .citation { grid-template-columns: 1fr; gap: 10px; }
  .citation-status { width: fit-content; }
}

/* ============================================================
   DEMO
   ============================================================ */
.demo-stage { max-width: 680px; }

.demo-frame {
  --p: 0;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-deep);
}

.demo-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#demo-noisy { z-index: 2; }
#demo-clean { z-index: 1; }

.demo-divider {
  position: absolute;
  top: 0; bottom: 0;
  left: calc(var(--p) * 1%);
  width: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(217, 119, 87, 0.75);
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.demo-frame.active .demo-divider { opacity: 1; }

#demo-slider {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  margin: 0;
  z-index: 4;
  cursor: ew-resize;
}

.demo-tag {
  position: absolute;
  top: 12px;
  z-index: 3;
  font-size: 10px;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.demo-tag-l { left: 12px; color: var(--accent-deep); }
.demo-tag-r { right: 12px; opacity: 1; }
.demo-frame.active .demo-tag-l { opacity: 1; }
.demo-frame.done .demo-tag-r  { opacity: 1; }

.demo-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn-primary {
  background: var(--accent-btn);
  border: 1px solid var(--accent-btn);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn-primary:disabled { opacity: 0.55; cursor: default; }

.btn-ghost {
  background: var(--surface-warm);
  border: 1px solid var(--surface-border);
  color: var(--text-muted);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); }

.demo-psnr {
  margin: 0 0 0 auto;
  font-size: 12.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
#demo-psnr-val { color: var(--accent-deep); }

/* ============================================================
   PROJECTS
   ============================================================ */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.25s ease, background 0.25s ease;
}
.project-card.featured { grid-column: 1 / -1; }
.project-card:hover { border-color: var(--accent); background: var(--surface-warm); }

.project-top { display: flex; justify-content: space-between; align-items: flex-start; }
.project-top h3 { font-size: 17px; font-weight: 600; margin: 0; color: var(--ink); }
.project-card.featured .project-top h3 { font-size: 20px; }

.project-arrow {
  color: var(--text-faint);
  font-size: 16px;
  transition: color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}
.project-card:hover .project-arrow {
  color: var(--accent-deep);
  transform: translate(2px, -2px);
}
.project-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  flex-grow: 1;
  line-height: 1.6;
  max-width: 62ch;
}
.tag-row { display: flex; gap: 7px; flex-wrap: wrap; }
.tag {
  font-size: 10.5px;
  color: var(--text-muted);
  background: var(--bg-deep);
  border: 1px solid var(--surface-border);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 2px;
}
.project-demo-link {
  font-size: 12px;
  letter-spacing: 0.02em;
  font-weight: 600;
  color: #FFFFFF;
  background: var(--accent-btn);
  padding: 5px 12px;
  border-radius: 6px;
  transition: background 0.2s ease;
}
.project-demo-link:hover { background: var(--accent); }
.project-repo-link {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--accent-deep);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.project-repo-link:hover { border-bottom-color: var(--accent); }
.project-note {
  margin-top: 20px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* ============================================================
   ABOUT
   ============================================================ */
.about-content p {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 0 20px;
  line-height: 1.75;
}
.about-content p:last-child { margin-bottom: 0; }
.about-content strong { color: var(--ink); font-weight: 600; }

/* ============================================================
   OFF THE CLOCK — ledger list, matches publications rhythm
   ============================================================ */
.off-ledger {
  display: flex;
  flex-direction: column;
}

.off-entry {
  border-top: 1px solid var(--surface-border);
}
.off-entry:last-child {
  border-bottom: 1px solid var(--surface-border);
}

.off-entry-inner {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 24px;
  width: 100%;
  padding: 22px 4px;
  box-sizing: border-box;
  background: none;
  border: none;
  text-align: left;
  font: inherit;
  color: inherit;
  position: relative;
}

button.off-entry-inner,
a.off-entry-inner {
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.2s ease;
}
button.off-entry-inner:hover,
button.off-entry-inner:focus-visible,
a.off-entry-inner:hover,
a.off-entry-inner:focus-visible {
  background: var(--surface-warm);
}

.off-tag {
  position: relative;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  border-radius: 3px;
  font-weight: 600;
  justify-self: start;
  white-space: nowrap;
}
.off-tag-sage   { background: var(--sage-dim);   color: var(--sage); }
.off-tag-butter { background: var(--butter-dim); color: var(--butter-ink); }
.off-tag-blush  { background: var(--blush-dim);  color: var(--blush-ink); }
.off-tag-accent { background: var(--accent-dim); color: var(--accent-deep); }

.off-body { display: flex; flex-direction: column; }
.off-desc { font-size: 14.5px; color: var(--text-muted); line-height: 1.55; }

@media (max-width: 600px) {
  .off-entry-inner { grid-template-columns: 84px 1fr; gap: 16px; }
}

.lego-brick {
  position: absolute;
  width: 14px; height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 5;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-inner { text-align: center; }

.contact-heading {
  font-size: clamp(30px, 5vw, 52px) !important;
  margin-bottom: 16px !important;
}

.contact-sub {
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 40px;
  font-size: 15.5px;
}

.btn-magnet {
  display: inline-block;
  background: var(--accent-btn);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 15.5px;
  padding: 16px 36px;
  border-radius: 8px;
  margin-bottom: 44px;
  transition: background 0.2s ease;
  will-change: transform;
}
.btn-magnet:hover { background: var(--accent); }

.contact-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.contact-link {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s ease;
  letter-spacing: 0.01em;
}
.contact-link:hover { color: var(--accent-deep); }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 28px var(--edge) 44px;
  color: var(--text-faint);
  font-size: 12px;
  border-top: 1px solid var(--surface-border);
  position: relative;
  z-index: var(--z-content);
}

/* ============================================================
   ASK-MY-WORK CHAT WIDGET
   ============================================================ */
.askme-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--z-chat);
  height: 52px;
  padding: 0 22px 0 18px;
  gap: 10px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  background: var(--accent-btn);
  color: #FFFFFF;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(176, 81, 47, 0.35);
  transition: background 0.2s ease, transform 0.2s ease;
}
.askme-fab svg { width: 22px; height: 22px; flex: none; }
.askme-fab::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--accent);
  animation: askme-pulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes askme-pulse {
  0%   { opacity: 0.7; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(1.18, 1.35); }
  100% { opacity: 0;   transform: scale(1.18, 1.35); }
}
@media (prefers-reduced-motion: reduce) { .askme-fab::before { animation: none; opacity: 0; } }
@media (max-width: 480px) {
  .askme-fab { right: 14px; bottom: 14px; height: 48px; padding: 0 18px 0 14px; font-size: 14px; }
}

.hero-ask {
  margin-top: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  border: none;
  border-radius: 6px;
  background: var(--accent-btn);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}
.hero-ask:hover { background: var(--accent); transform: translateY(-1px); }
.hero-ask-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
  animation: hero-ask-dot 1.8s ease-out infinite;
}
@keyframes hero-ask-dot {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
  100% { box-shadow: 0 0 0 8px rgba(255, 255, 255, 0); }
}
@media (prefers-reduced-motion: reduce) { .hero-ask-dot { animation: none; } }
.askme-fab:hover { background: var(--accent); transform: translateY(-2px); }
.askme-fab.hidden-by-panel { display: none; }

.askme {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--z-chat);
}
.askme[hidden] { display: none; }

.askme-panel {
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 44px - env(safe-area-inset-bottom, 0px)));
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(31, 30, 27, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 480px) {
  .askme { right: 12px; bottom: 12px; left: 12px; }
  .askme-panel { width: 100%; }
}

.askme-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-warm);
}
.askme-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
}
.askme-sub {
  margin: 2px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--text-faint);
}
.askme-sub a { color: var(--accent-deep); }
.askme-sub a:hover { color: var(--accent); }

.askme-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--text-faint);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s ease;
}
.askme-close:hover { color: var(--ink); }

/* desktop: docked chat tab, always on screen */
.askme.docked { right: 24px; bottom: 0; }
.askme.docked .askme-panel {
  width: 360px;
  height: min(470px, calc(100vh - 110px));
  border-radius: 12px 12px 0 0;
  border-bottom: none;
  box-shadow: 0 -4px 36px rgba(31, 30, 27, 0.18);
}
.askme.docked .askme-head {
  cursor: pointer;
  background: var(--accent-btn);
  border-bottom-color: transparent;
}
.askme.docked .askme-title { color: #FFFFFF; }
.askme.docked .askme-sub,
.askme.docked .askme-sub a { color: rgba(255, 255, 255, 0.82); }
.askme.docked .askme-close { color: rgba(255, 255, 255, 0.85); font-size: 20px; }
.askme.docked .askme-close:hover { color: #FFFFFF; }
.askme.docked.collapsed .askme-panel { height: auto; }
.askme.docked.collapsed .askme-body,
.askme.docked.collapsed .askme-composer { display: none; }

.askme-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  background: var(--bg);
}

.askme-intro p {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
}
.askme-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.askme-chips button {
  text-align: left;
  font-size: 13px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.askme-chips button:hover { border-color: var(--accent); color: var(--ink); }

.askme-msg {
  max-width: 88%;
  margin-bottom: 12px;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.55;
  overflow-wrap: break-word;
}
.askme-msg.user {
  margin-left: auto;
  background: var(--accent-btn);
  color: #FFFFFF;
}
.askme-msg.bot {
  margin-right: auto;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text);
}
.askme-msg.bot p { margin: 0 0 8px; }
.askme-msg.bot p:last-child { margin-bottom: 0; }
.askme-msg.bot ul { margin: 0 0 8px; padding-left: 18px; list-style: disc; }
.askme-msg.bot li { margin-bottom: 3px; }
.askme-msg.bot code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-deep);
  padding: 1px 5px;
  border-radius: 3px;
}
.askme-sources {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--surface-border);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.askme-typing {
  display: inline-flex;
  gap: 5px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.askme-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: askme-dot 1.2s ease-in-out infinite;
}
.askme-typing span:nth-child(2) { animation-delay: 0.15s; }
.askme-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes askme-dot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.askme-error {
  background: var(--blush-dim);
  color: var(--blush-ink);
  font-size: 12.5px;
  padding: 9px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.askme-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--surface-border);
  background: var(--surface-warm);
}
.askme-composer input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
}
.askme-composer input::placeholder { color: var(--text-faint); }
.askme-composer input:focus { box-shadow: 0 0 0 2px var(--accent-dim); }
.askme-composer button {
  border: none;
  background: var(--accent-btn);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 13.5px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.askme-composer button:hover:not(:disabled) { background: var(--accent); }
.askme-composer button:disabled { opacity: 0.5; cursor: default; }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.palette {
  position: fixed;
  inset: 0;
  z-index: var(--z-palette);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
}
.palette[hidden] { display: none; }
.palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 30, 27, 0.35);
  backdrop-filter: blur(3px);
}
.palette-panel {
  position: relative;
  width: min(520px, 90vw);
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(31, 30, 27, 0.22);
}
.palette-input {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--surface-border);
  color: var(--ink);
  font-size: 14.5px;
  padding: 16px 18px;
  outline: none;
}
.palette-input::placeholder { color: var(--text-faint); }

.palette-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
}
.palette-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
}
.palette-list li.active {
  background: var(--accent-dim);
  color: var(--ink);
}
.palette-list li .hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.palette-hint {
  margin: 0;
  padding: 10px 16px;
  border-top: 1px solid var(--surface-border);
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.05em;
}

/* ============================================================
   PONG — clay court edition
   ============================================================ */
.pong {
  position: fixed;
  inset: 0;
  z-index: var(--z-pong);
  background: #B85C35;
}
.pong[hidden] { display: none; }
#pong-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.pong-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  white-space: nowrap;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 16px);
  z-index: var(--z-toast);
  background: var(--surface);
  border: 1px solid var(--accent);
  color: var(--accent-deep);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  padding: 10px 18px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(31, 30, 27, 0.12);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   FOCUS VISIBILITY
   ============================================================ */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .scroll-hint::after { animation: none; width: 32px; opacity: 0.5; }
}
