/* ============================================================================
   site.css — shared styles for the Data Terminal personal site.
   Tokens, left rail, toggles, hero, and all page components.
   ============================================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --accent: oklch(0.66 0.27 350);
  --accent-dim: oklch(0.66 0.27 350 / 0.16);
  --pride-grad: linear-gradient(90deg,
    rgb(228,80,90), rgb(235,150,60), rgb(240,205,80),
    rgb(90,190,120), rgb(80,140,225), rgb(150,90,210));
  --pride-grad-v: linear-gradient(180deg,
    rgb(228,80,90), rgb(235,150,60), rgb(240,205,80),
    rgb(90,190,120), rgb(80,140,225), rgb(150,90,210));
  --violet: oklch(0.6 0.2 300);
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --rail: 248px;
  --maxw: 1500px;
  --pad: clamp(28px, 4vw, 52px);
}
html[data-theme="dark"] {
  --bg: oklch(0.16 0.025 270);
  --panel: oklch(0.2 0.028 270);
  --panel-2: oklch(0.235 0.03 270);
  --fg: oklch(0.93 0.012 270);
  --fg-2: oklch(0.66 0.02 270);
  --line: oklch(0.34 0.03 270);
  --hero-fg: oklch(0.97 0.01 270);
}
html[data-theme="light"] {
  --bg: oklch(0.97 0.005 250);
  --panel: oklch(0.99 0.003 250);
  --panel-2: oklch(0.95 0.006 250);
  --fg: oklch(0.22 0.015 280);
  --fg-2: oklch(0.46 0.02 280);
  --line: oklch(0.86 0.012 270);
  --hero-fg: oklch(0.18 0.02 280);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--mono);
  background: var(--bg); color: var(--fg);
  -webkit-font-smoothing: antialiased;
  transition: background .45s ease, color .45s ease;
}
.sans { font-family: var(--sans); }
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

/* ---- left rail ---- */
.rail {
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line);
  background: var(--panel); display: flex; flex-direction: column; padding: 22px 0;
  transition: background .45s ease, border-color .45s ease; z-index: 5;
}
.rail .id { padding: 0 22px 22px; border-bottom: 1px solid var(--line); }
.rail .id .avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; display: block; margin-bottom: 14px; border: 1px solid var(--line); }
.rail .id a.nm { font-family: var(--sans); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: var(--hero-fg); line-height: 1.1; display: block; }
.rail .id .sub { font-size: 11px; color: var(--accent); margin-top: 7px; }
.rail .id .loc { font-size: 10.5px; color: var(--fg-2); margin-top: 10px; line-height: 1.7; }
.rail nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.rail nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 7px;
  font-size: 12.5px; color: var(--fg-2); transition: background .2s, color .2s;
  position: relative;
}
.rail nav a .ix { color: var(--accent); font-size: 11px; opacity: .7; }
.rail nav a:hover { background: var(--accent-dim); color: var(--fg); }
.rail nav a.active { background: var(--accent-dim); color: var(--fg); }
.rail nav a.active::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2.5px; border-radius: 2px; background: var(--accent); }
.rail nav a.cv { color: var(--accent); margin-top: 8px; }
.rail nav .navsep { height: 1px; background: var(--line); margin: 8px 12px; }
.rail .ctrls { padding: 14px 18px 4px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.tg {
  flex: 1; height: 34px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--fg); cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--mono);
  transition: border-color .2s, transform .15s;
}
.tg:hover { border-color: var(--accent); transform: translateY(-1px); }

/* day / night switch — a sliding thumb that crosses from sun to moon */
.theme-toggle { position: relative; padding: 0; gap: 0; overflow: hidden; transition: border-color .2s, background .45s ease; }
.theme-toggle .tt-ico {
  position: relative; z-index: 2; flex: 1;
  display: flex; align-items: center; justify-content: center;
  transition: color .3s ease, opacity .3s ease, transform .35s cubic-bezier(.34,1.4,.5,1);
}
.theme-toggle .tt-ico svg { width: 16px; height: 16px; display: block; }
.theme-toggle .tt-sun { color: var(--fg-2); }
.theme-toggle .tt-moon { color: var(--fg-2); }
.theme-toggle .tt-thumb {
  position: absolute; z-index: 1; top: 3px; left: 3px; bottom: 3px; width: calc(50% - 6px);
  border-radius: 5px; background: var(--accent-dim); border: 1px solid var(--accent);
  transition: transform .38s cubic-bezier(.4,0,.2,1);
}
html[data-theme="light"] .theme-toggle .tt-thumb { transform: translateX(0); }
html[data-theme="dark"]  .theme-toggle .tt-thumb { transform: translateX(calc(100% + 6px)); }
html[data-theme="light"] .theme-toggle .tt-sun  { color: var(--accent); }
html[data-theme="light"] .theme-toggle .tt-moon { opacity: .45; transform: scale(.85); }
html[data-theme="dark"]  .theme-toggle .tt-moon { color: var(--accent); }
html[data-theme="dark"]  .theme-toggle .tt-sun  { opacity: .45; transform: scale(.85); }

/* ---- pride skin: rainbow chrome layered over either light or dark ----
   Every rainbow element is always in the DOM and fades on opacity, so the
   toggle eases in/out smoothly even when View Transitions are unavailable. */
/* rainbow accent bar across the top of the left rail */
.rail::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: var(--pride-grad); z-index: 6; pointer-events: none;
  opacity: 0; transition: opacity .55s ease;
}
html[data-pride="on"] .rail::after { opacity: 1; }
/* active-nav indicator: spectrum overlay fades over the solid accent bar */
.rail nav a.active::after {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2.5px;
  border-radius: 2px; background: var(--pride-grad-v);
  opacity: 0; transition: opacity .55s ease;
}
html[data-pride="on"] .rail nav a.active::after { opacity: 1; }
/* day/night thumb: spectrum overlay fades over the accent-dim fill */
.theme-toggle .tt-thumb::after {
  content: ""; position: absolute; inset: -1px; border-radius: 5px;
  background: var(--pride-grad); opacity: 0; transition: opacity .55s ease;
}
html[data-pride="on"] .theme-toggle .tt-thumb::after { opacity: 1; }
/* the pride button: a rounded rainbow ring (masked border) that fades in */
.pride { position: relative; }
.pride::after {
  content: ""; position: absolute; inset: 0; border-radius: 7px; padding: 1px;
  background: var(--pride-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0; transition: opacity .55s ease; pointer-events: none;
}
html[data-pride="on"] .pride::after { opacity: 1; }
html[data-pride="on"] .pride { border-color: transparent; }
/* a hairline spectrum above the footer rule */
.ftr { position: relative; }
.ftr::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  background: var(--pride-grad); opacity: 0; transition: opacity .55s ease;
}
html[data-pride="on"] .ftr::before { opacity: 1; }

/* circular reveal between themes (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 9999; }
@media (prefers-reduced-motion: reduce) {
  body, .rail { transition: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail nav a.active::before { display: none; }
}

/* ---- main ---- */
main { min-width: 0; }

/* full hero (home) */
.hero { position: relative; height: 72vh; min-height: 560px; border-bottom: 1px solid var(--line); overflow: hidden; }
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#heroCanvas:active { cursor: grabbing; }
.hero-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent 52%, color-mix(in oklch, var(--bg) 26%, transparent) 80%, color-mix(in oklch, var(--bg) 70%, transparent) 93%, var(--bg) 100%); }
.hud { position: absolute; inset: 0; pointer-events: none; padding: 20px clamp(20px,4vw,44px); display: flex; flex-direction: column; justify-content: space-between; }
.hud-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chip {
  font-size: 11px; letter-spacing: 0.05em; color: var(--hero-fg);
  background: color-mix(in oklch, var(--bg) 40%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px;
}
.chip b { color: var(--accent); }
.readout { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-title { pointer-events: auto; max-width: none; }
.hero-title h1 { font-family: var(--sans); font-weight: 700; font-size: clamp(30px,4.6vw,56px); line-height: 1.02; letter-spacing: -0.025em; color: var(--hero-fg); text-shadow: 0 2px 18px color-mix(in oklch, var(--bg) 78%, transparent), 0 1px 4px color-mix(in oklch, var(--bg) 60%, transparent); }
.hero-title p { margin-top: 16px; font-size: clamp(13px,1.5vw,15px); color: var(--hero-fg); max-width: none; line-height: 1.7; text-shadow: 0 1px 12px color-mix(in oklch, var(--bg) 82%, transparent); }

/* compact page header (subpages) */
.phead { position: relative; padding: clamp(40px,7vw,84px) max(var(--pad), calc((100% - var(--maxw)) / 2 + var(--pad))) clamp(28px,4vw,40px); border-bottom: 1px solid var(--line); overflow: hidden; }
.phead::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: linear-gradient(to bottom, black, transparent); mask-image: linear-gradient(to bottom, black, transparent); }
.phead .crumb { position: relative; font-size: 12px; color: var(--accent); letter-spacing: 0.1em; margin-bottom: 16px; }
.phead h1 { position: relative; font-family: var(--sans); font-weight: 700; font-size: clamp(30px,5vw,52px); letter-spacing: -0.025em; line-height: 1.0; color: var(--hero-fg); }
.phead p.lede { position: relative; margin-top: 18px; max-width: none; font-size: clamp(13px,1.5vw,15px); color: var(--fg-2); line-height: 1.7; }

/* content shell */
.pad { padding: var(--pad); }
.wrap { max-width: var(--maxw); margin-inline: auto; }
.sec-h { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; font-size: 12px; color: var(--fg-2); letter-spacing: 0.08em; }
.sec-h .n { color: var(--accent); }
.sec-h .ln { flex: 1; height: 1px; background: var(--line); }
.sec-h .sans { font-family: var(--sans); font-weight: 700; font-size: clamp(18px,2.4vw,24px); color: var(--fg); letter-spacing: -0.01em; }
.sec-h .more { font-family: var(--mono); font-size: 11.5px; color: var(--accent); white-space: nowrap; transition: opacity .2s; }
.sec-h .more:hover { opacity: .7; }

/* research panels */
.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
@media (max-width: 720px){ .panels{ grid-template-columns: 1fr; } }
.panel { background: var(--panel); padding: 24px; transition: background .2s; position: relative; }
.panel:hover { background: var(--panel-2); }
.panel h3 { font-family: var(--sans); font-size: 18px; margin: 12px 0 10px; line-height: 1.25; color: var(--fg); }
.panel p { font-size: 12.5px; color: var(--fg-2); line-height: 1.7; }
.panel .kw { margin-top: 16px; font-size: 11.5px; color: var(--fg-2); line-height: 1.6; border-top: 1px dashed var(--line); padding-top: 12px; }
.panel .kw b { color: var(--accent); font-weight: 500; }

/* footer */
.ftr { padding: clamp(28px,4vw,52px); border-top: 1px solid var(--line); display:flex; justify-content:space-between; gap:20px; flex-wrap:wrap; font-size:11.5px; color:var(--fg-2); align-items: center; }
.ftr .links { display:flex; gap:16px; }
.ftr a:hover{ color: var(--accent); }

/* ============ subpage components ============ */

/* contact */
.contact-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
@media (max-width: 760px){ .contact-grid { grid-template-columns: 1fr; } }
.cblock { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 28px; }
.cblock h3 { font-family: var(--sans); font-size: 18px; color: var(--fg); margin-bottom: 16px; }
.clink { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-top: 1px dashed var(--line); transition: padding-left .2s; }
.clink:hover { padding-left: 8px; }
.clink:first-of-type { border-top: none; }
.clink .k { font-size: 12px; color: var(--fg-2); }
.clink .v { font-size: 13px; color: var(--fg); }
.clink:hover .v { color: var(--accent); }
.cnote { font-size: 12.5px; color: var(--fg-2); line-height: 1.8; }
.status-line { display:flex; align-items:center; gap:9px; font-size:12px; color:var(--fg-2); margin-top: 20px; }
.status-line .dot { width:8px; height:8px; border-radius:50%; background:#46b46e; box-shadow:0 0 0 0 rgba(70,180,110,.5); animation: ping 2s infinite; }
@keyframes ping { 0%{box-shadow:0 0 0 0 rgba(70,180,110,.45)} 70%{box-shadow:0 0 0 7px rgba(70,180,110,0)} 100%{box-shadow:0 0 0 0 rgba(70,180,110,0)} }

/* research — program cards */
.rprog { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); overflow: hidden; margin-bottom: 28px; }
.rprog .top { padding: 26px 28px; border-bottom: 1px solid var(--line); }
.rprog h2 { font-family: var(--sans); font-size: clamp(20px,2.8vw,28px); color: var(--fg); line-height: 1.2; margin: 12px 0; letter-spacing: -0.01em; }
.rprog .summary { font-size: 13.5px; color: var(--fg-2); line-height: 1.75; }
.rprog .kwline { padding: 18px 28px; border-top: 1px solid var(--line); font-size: 12px; color: var(--fg-2); background: var(--panel-2); }
.rprog .kwline b { color: var(--accent); font-weight: 500; }
/* utility */
.mb48 { margin-bottom: 48px; }
