/* Yunus Emre Kara — personal site */

/* Self-hosted fonts (SIL Open Font License, see assets/fonts/OFL.txt).
   "CV Sans" / "CV Mono" are static cuts used only by the print stylesheet. */
@font-face { font-family: "CV Sans"; font-weight: 400; src: url("../fonts/print/cv-sans-400.woff2") format("woff2"); }
@font-face { font-family: "CV Sans"; font-weight: 500; src: url("../fonts/print/cv-sans-500.woff2") format("woff2"); }
@font-face { font-family: "CV Sans"; font-weight: 600; src: url("../fonts/print/cv-sans-600.woff2") format("woff2"); }
@font-face { font-family: "CV Sans"; font-weight: 400; font-style: italic; src: url("../fonts/print/cv-sans-400-italic.woff2") format("woff2"); }
@font-face { font-family: "CV Mono"; font-weight: 400; src: url("../fonts/print/cv-mono-400.woff2") format("woff2"); }
@font-face { font-family: "CV Mono"; font-weight: 500; src: url("../fonts/print/cv-mono-500.woff2") format("woff2"); }
@font-face { font-family: "CV Mono"; font-weight: 600; src: url("../fonts/print/cv-mono-600.woff2") format("woff2"); }
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400 500; font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400 500; font-display: swap;
  src: url("../fonts/cormorant-garamond-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #fbfbfa;
  --text: #18181b;
  --muted: #5c5c66;
  --faint: #6e6e78;
  --border: #e7e7e4;
  --accent: #2f5bea;
  --robot-accent: #087e83;

  --font-sans: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-quote: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --bar-h: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e10;
    --text: #ededef;
    --muted: #9b9ba3;
    --faint: #84848c;
    --border: #232327;
    --accent: #7b9cff;
    --robot-accent: #5eead4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e0e10;
  --text: #ededef;
  --muted: #9b9ba3;
  --faint: #84848c;
  --border: #232327;
  --accent: #7b9cff;
  --robot-accent: #5eead4;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Hints that differ between mouse and touch screens */
.on-touch { display: none; }
@media (hover: none) {
  .on-hover { display: none; }
  .on-touch { display: inline; }
}
@media (hover: none) and (min-width: 601px) { .hint-phone { display: none; } }
@media (hover: none) and (max-width: 600px) { .hint-tablet { display: none; } }

.skip {
  position: fixed; top: 10px; left: 12px; z-index: 50;
  padding: 8px 14px; border-radius: 8px;
  background: var(--text); color: var(--bg);
  font-size: .82rem; font-weight: 500;
  transform: translateY(-160%);
  transition: transform .15s ease;
}
.skip:focus { transform: none; }
html { scroll-padding-top: calc(var(--bar-h) + 12px); }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 64px 24px 64px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--bar-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .2s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--border); }
.topbar__inner {
  max-width: 1240px; height: 100%;
  margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px;
}
.topbar__brand {
  display: inline-flex; align-items: center;
  flex-shrink: 0;
  font-weight: 600; font-size: .92rem; letter-spacing: -0.02em;
}
.topbar__home { display: none; }
.topbar__nav.is-overflowing {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 82%, transparent);
  margin-left: -12px;
  padding: 0 24px 0 12px;
}
.topbar__nav {
  position: relative;
  display: flex; gap: 4px;
  min-width: 0; overflow-x: auto;
  scrollbar-width: none;
}
.topbar__nav::-webkit-scrollbar { display: none; }
.topbar__nav a {
  flex-shrink: 0;
  padding: 6px 10px; border-radius: 8px;
  font-size: .82rem; font-weight: 500; color: var(--muted);
  transition: color .15s ease, background-color .15s ease;
}
.topbar__nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.topbar__nav a.is-active { color: var(--text); }
@media (max-width: 1100px) {
  .topbar__inner { gap: 16px; }
  .topbar__nav { gap: 0; }
  .tool__long { display: none; }
}

/* ---------- Intro ---------- */
.intro { position: relative; padding-bottom: 56px; }

.toolbar {
  margin-left: auto;
  display: flex; gap: 8px; flex-shrink: 0;
}
.tool {
  height: 32px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 8px;
  background: transparent; color: var(--muted);
  font: 500 .8rem var(--font-sans); cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.tool:hover { color: var(--text); border-color: var(--muted); }
#theme-toggle { width: 32px; padding: 0; }
.i-play { display: none; }
.motion-off .i-pause { display: none; }
.motion-off .i-play { display: block; }
.tool--cv, #motion-toggle { gap: 6px; }
/* Both words share one cell, so the button keeps its width when it toggles */
.tool__state { display: grid; }
.tool__state > span { grid-area: 1 / 1; }
.l-play, .motion-off .l-pause { visibility: hidden; }
.motion-off .l-play { visibility: visible; }
.tool svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

h1 {
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.subtitle {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: .92rem;
}
.subtitle::before { content: "❯ "; color: var(--accent); }
.summary {
  margin-top: 22px;
  font-family: var(--font-mono);
  font-size: .88rem;
  line-height: 1.75;
  color: var(--text);
}

.links { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 6px 20px; }

.robot-learning {
  color: var(--robot-accent);
  font-family: var(--font-quote);
  font-size: 1.3em;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

/* Portrait: beside the intro on wide screens, above the name on phones */
.intro--photo { display: grid; grid-template-columns: 1fr 168px; column-gap: 40px; }
.intro--photo > * { grid-column: 1; }
.portrait {
  grid-column: 2; grid-row: 1 / span 4;
  width: 168px; height: 168px; margin: 4px 0 0;
  border-radius: 50%; overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 3%, var(--bg));
}
.portrait img { display: block; width: 100%; height: 100%; object-fit: cover; }
.links a {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .9rem; color: var(--muted);
  border-bottom: 1px solid var(--border);
  transition: color .15s ease, border-color .15s ease;
}
.links a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid var(--border);
}
.section h2 {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
  padding-top: 3px;
}

.entries { display: grid; gap: 28px; }

/* Organisation logos: white tiles so dark marks stay visible in both themes */
.logo {
  width: 40px; height: 40px;
  padding: 4px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  object-fit: contain;
}
.entry { display: grid; grid-template-columns: 40px 1fr; column-gap: 16px; }
.entry > :not(.logo) { grid-column: 2; }
.entry > .logo { grid-column: 1; grid-row: 1 / span 4; margin-top: 2px; }
.entry__head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
}
.entry h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.4; }
.date {
  flex-shrink: 0;
  font-family: var(--font-mono); font-size: .75rem; color: var(--faint);
  white-space: nowrap;
}
.entry__sub { margin-top: 2px; color: var(--muted); font-size: .92rem; }
.entry__sub a { border-bottom: 1px solid var(--border); }
.entry__sub a:hover { color: var(--accent); border-color: var(--accent); }
.entry p + p { margin-top: 6px; }
.entry > p:not(.entry__sub) { color: color-mix(in srgb, var(--text) 85%, var(--bg)); font-size: .93rem; }

.courses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.courses li {
  font-size: .78rem; line-height: 1.4;
  padding: 3px 10px;
  border: 1px solid var(--border); border-radius: 999px;
  color: var(--muted);
}

.more {
  font-size: .85rem; color: var(--accent);
}
.more::after { content: " ↗"; }
.more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Experience with pictures ---------- */
/* The entries span the section: picture in the label column, then logo and text aligned with the other sections */
.section--media > .entries { grid-column: 1 / -1; }
.entry.entry--media { grid-template-columns: 200px 24px 40px 16px 1fr; column-gap: 0; }
.entry.entry--media > * { grid-column: 5; }
.entry.entry--media > .logo { grid-column: 3; }
.entry.entry--media > .entry__media { grid-column: 1; grid-row: 1 / span 6; margin: 3px 0 0; }
.entry__media img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }
.entry__media figcaption { margin-top: 6px; font-family: var(--font-mono); font-size: .64rem; line-height: 1.45; color: var(--faint); }
.entry__media figcaption a { text-decoration: underline; text-underline-offset: 2px; }
.entry__media figcaption a:hover { color: var(--accent); }

/* ---------- Project showcase ---------- */
/* Projects use the whole section width: methodology diagram in the label column, text beside it */
.section--projects > .entries { grid-column: 1 / -1; }
.entry.project { grid-template-columns: 200px 1fr; column-gap: 24px; }
.entry.project > * { grid-column: 2; }
.entry.project > .project__method { grid-column: 1; grid-row: 1 / span 8; margin: 3px 0 0; }
.mfig { display: block; width: 100%; height: auto; overflow: visible; }
.mfig text { font-family: var(--font-mono); }
.mfig .t { font-size: 11.5px; font-weight: 600; fill: var(--text); }
.mfig .s { font-size: 9.5px; fill: var(--muted); }
.mfig .n rect { fill: color-mix(in srgb, var(--text) 4%, var(--bg)); stroke: var(--border); stroke-width: 1; }
.mfig .n--a rect { fill: color-mix(in srgb, var(--accent) 12%, var(--bg)); stroke: color-mix(in srgb, var(--accent) 60%, var(--bg)); }
.mfig .n--a .t { fill: var(--accent); }
.mfig .ar { fill: none; stroke: var(--faint); stroke-width: 1.2; }
.mfig marker path { fill: var(--faint); }
.mfig .ar--loop { stroke: var(--accent); stroke-dasharray: 3 3; }
.mfig .lbl { font-size: 9px; fill: var(--accent); }
.mfig .prof { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
.mfig .ground { fill: none; stroke: var(--faint); stroke-dasharray: 2 3; }
.mfig .dot { fill: var(--accent); }
.project__body { margin-top: 6px; }
.project__body > p { color: color-mix(in srgb, var(--text) 85%, var(--bg)); font-size: .93rem; }
.project__fig {
  margin: 14px 0 0; padding: 14px 16px 10px;
  max-width: 420px;
  border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--text) 2.5%, var(--bg));
}
.project__fig figcaption { margin-top: 8px; font-family: var(--font-mono); font-size: .72rem; line-height: 1.5; color: var(--faint); }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font-mono); font-size: 10.5px; fill: var(--muted); }
.chart .chart__label { fill: var(--text); }
.chart .chart__value--b { fill: var(--accent); font-weight: 600; }
.chart .chart__legend { font-size: 10px; }
.chart__a { fill: color-mix(in srgb, var(--text) 22%, transparent); }
.chart__b { fill: var(--accent); }
.project__stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.project__stats li {
  padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--text) 2.5%, var(--bg));
  font-size: .8rem; color: var(--muted);
}
.project__stats b { display: block; font-family: var(--font-mono); font-size: 1rem; color: var(--text); }
.entry .project__links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 10px; }

.skills { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; }
.skills dt { font-weight: 500; font-size: .93rem; }
.skills dd { margin: 0; color: var(--muted); font-size: .93rem; }

.list { display: grid; gap: 14px; }
.list li { display: grid; grid-template-columns: 36px 1fr; gap: 2px 14px; align-items: start; }
.list li > :not(.logo) { grid-column: 2; }
.list li > .logo { grid-column: 1; grid-row: 1 / span 3; width: 36px; height: 36px; padding: 3px; border-radius: 9px; }
.list a { font-weight: 500; font-size: .95rem; transition: color .15s ease; }
.list a:hover { color: var(--accent); }
.list span { color: var(--muted); font-size: .88rem; }
.list__desc { margin-top: 4px; font-size: .9rem; color: color-mix(in srgb, var(--text) 85%, var(--bg)); }

.plain { font-size: .95rem; color: var(--muted); }
.plain + .plain { margin-top: 4px; }

/* ---------- News page ---------- */
.news-filter { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 6px; }
.news-filter button {
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent;
  font: 500 .78rem var(--font-sans); color: var(--muted); cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.news-filter button:hover { color: var(--text); border-color: var(--muted); }
.news-filter button[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }

.news__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 18px; }
.news__list li {
  --kind: var(--accent);
  position: relative;
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: baseline;
}
.news__list li[hidden] { display: none; }
.news__list li[data-kind="role"] { --kind: #0f766e; }
.news__list li[data-kind="project"] { --kind: #7c3aed; }
.news__list li[data-kind="award"] { --kind: #b45309; }
.news__list li[data-kind="paper"] { --kind: #e11d48; }
.news__list li[data-kind="event"] { --kind: var(--muted); }
:root[data-theme="dark"] .news__list li[data-kind="role"] { --kind: #5eead4; }
:root[data-theme="dark"] .news__list li[data-kind="project"] { --kind: #a78bfa; }
:root[data-theme="dark"] .news__list li[data-kind="award"] { --kind: #fbbf24; }
:root[data-theme="dark"] .news__list li[data-kind="paper"] { --kind: #fb7185; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .news__list li[data-kind="role"] { --kind: #5eead4; }
  :root:not([data-theme="light"]) .news__list li[data-kind="project"] { --kind: #a78bfa; }
  :root:not([data-theme="light"]) .news__list li[data-kind="award"] { --kind: #fbbf24; }
  :root:not([data-theme="light"]) .news__list li[data-kind="paper"] { --kind: #fb7185; }
}
.news__list time { font-family: var(--font-mono); font-size: .75rem; color: var(--faint); white-space: nowrap; }
.news__title { font-weight: 600; font-size: .98rem; letter-spacing: -0.01em; line-height: 1.4; }
.news__meta { margin-top: 3px; font-size: .88rem; color: var(--muted); }
.news__kind {
  display: inline-block; margin-right: 8px;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--kind);
}
.news__kind::before {
  content: ""; display: inline-block;
  width: 6px; height: 6px; margin-right: 6px; border-radius: 50%;
  background: var(--kind); vertical-align: .12em;
}
.footer__back { color: var(--muted); transition: color .15s ease; }
.footer__back:hover { color: var(--accent); }

.pubs { margin: 0; padding: 0; list-style: none; counter-reset: pub; display: grid; gap: 18px; }
.pubs li { counter-increment: pub; position: relative; padding-left: 36px; }
.pubs li::before {
  content: "[" counter(pub) "]";
  position: absolute; left: 0; top: 1px;
  font-family: var(--font-mono); font-size: .8rem; color: var(--faint);
}
.pub__title { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; line-height: 1.4; }
.pub__venue { margin-top: 2px; color: var(--muted); font-size: .92rem; }
.pub__venue em { font-style: normal; color: var(--accent); }
.pub__venue abbr { text-decoration: none; }
.pub__authors { margin-top: 2px; font-size: .9rem; color: var(--muted); }
.pub__links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.pub__authors strong { color: var(--text); font-weight: 600; }
.bib { margin-top: 6px; }
.section > *, .pubs li { min-width: 0; }
.bib summary {
  display: inline-block; cursor: pointer; list-style: none;
  font-size: .85rem; color: var(--accent);
}
.bib summary::-webkit-details-marker { display: none; }
.bib summary::before { content: "▸ "; }
.bib[open] summary::before { content: "▾ "; }
.bib summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.bib pre {
  margin: 8px 0 0; padding: 12px 14px; overflow-x: auto;
  border: 1px solid var(--border); border-radius: 10px;
  background: color-mix(in srgb, var(--text) 3%, var(--bg));
  font: .74rem/1.55 var(--font-mono); color: var(--text);
}
.pubs li p + p:not(.pub__venue) { margin-top: 4px; }

.footer {
  padding-top: 32px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  font-family: var(--font-mono); font-size: .75rem; color: var(--faint);
}
.footer__term {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit;
  transition: color .15s ease;
}
.footer__term:hover { color: var(--accent); }
.footer__term kbd {
  display: inline-block; min-width: 1.6em; padding: 0 4px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px;
  font: inherit; text-align: center;
}

/* ---------- Terminal (always dark, whatever the page theme) ---------- */
.term {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  width: min(580px, calc(100vw - 32px));
  height: min(400px, 60vh);
  display: flex; flex-direction: column;
  background: rgba(11, 11, 14, .94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #e4e4e7;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .65);
  font-family: var(--font-mono); font-size: .8rem;
  color-scheme: dark;
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .18s ease, transform .2s cubic-bezier(.2, .7, .2, 1);
}
.term.is-open { opacity: 1; transform: none; }
.term[hidden] { display: none; }
.term__bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.term__dots { display: flex; gap: 6px; }
.term__dots i { width: 10px; height: 10px; border-radius: 50%; background: #fb7185; }
.term__dots i:nth-child(2) { background: #fbbf24; }
.term__dots i:nth-child(3) { background: #5eead4; }
.term__title { flex: 1; text-align: center; font-size: .72rem; color: #a1a1aa; }
.term__close {
  width: 26px; height: 26px; border: 0; border-radius: 6px;
  background: none; color: #a1a1aa; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.term__close:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.term__out { flex: 1; overflow-y: auto; padding: 12px 14px 4px; line-height: 1.6; overscroll-behavior: contain; }
.term__line { white-space: pre-wrap; overflow-wrap: anywhere; }
.term__line a { color: #7b9cff; text-decoration: underline; text-underline-offset: 2px; }
.term__cmd {
  padding: 0; border: 0; background: none; cursor: pointer;
  font: inherit; color: #5eead4;
}
.term__cmd:hover { text-decoration: underline; text-underline-offset: 2px; }
.term__echo { margin-top: 6px; color: #fafafa; }
.term__ps, .term__prompt span { color: #7b9cff; }
.term__hl { color: #5eead4; }
.term__muted { color: #9b9ba3; }
.term__err { color: #fb7185; }
.term__ok { color: #86efac; }
.term__prompt { display: flex; align-items: center; gap: 8px; padding: 8px 14px 12px; }
.term__prompt input {
  flex: 1; min-width: 0; padding: 0;
  border: 0; outline: 0; background: transparent;
  color: #fafafa; font: inherit; caret-color: #5eead4;
}
.term__prompt input:focus-visible { outline: none; }
.term:focus-within { border-color: rgba(123, 156, 255, .35); }

.print-only { display: none; }

/* ---------- Closing quote ---------- */
.quote {
  margin: 0;
  padding: 72px 0 80px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.quote blockquote { position: relative; margin: 0 auto; max-width: 620px; }
.quote blockquote::before {
  content: "\201C";
  display: block;
  height: .5em;
  font: italic 500 5.5rem/1 var(--font-quote);
  color: var(--accent); opacity: .55;
}
.quote p {
  font-family: var(--font-quote);
  font-style: italic; font-weight: 400;
  font-size: clamp(1.45rem, 3.6vw, 2rem);
  line-height: 1.4;
  letter-spacing: .005em;
  color: var(--text);
}
.quote blockquote::after {
  content: "";
  display: block;
  width: 64px; height: 1px;
  margin: 28px auto 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

/* Words slide in one after another once the quote scrolls into view */
.quote .w { display: inline-block; }
.quote.is-armed .w {
  opacity: 0;
  transform: translateX(-18px) skewX(-10deg);
  filter: blur(5px);
  transition: opacity .7s ease, transform .9s cubic-bezier(.2, .7, .2, 1), filter .7s ease;
  transition-delay: calc(var(--i) * 65ms);
}
.quote.is-armed.is-in .w { opacity: 1; transform: none; filter: none; }
.quote.is-armed blockquote::after { transform: scaleX(0); transition: transform 1.2s cubic-bezier(.2, .7, .2, 1) 1.4s; }
.quote.is-armed.is-in blockquote::after { transform: none; }

/* ---------- Pixel space background ---------- */
#space {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Typing effect ---------- */
.type-cursor {
  display: inline-block;
  width: .55em; height: 1.05em;
  margin-left: .08em;
  vertical-align: -0.16em;
  background: currentColor;
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.js-typing .intro h1,
.js-typing .intro .subtitle,
.js-typing .intro .summary,
.js-typing .section h2,
.js-typing .focus h2 { visibility: hidden; }

.links { transition: opacity .6s ease; }
.links.is-hidden { opacity: 0; }

/* ---------- Focus cards ---------- */
.focus { padding: 32px 0 40px; border-top: 1px solid var(--border); }
.focus__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.focus h2 {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--faint);
}
.focus__hint { font-family: var(--font-mono); font-size: .72rem; color: var(--faint); }

.focus__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  width: min(1240px, calc(100vw - 32px));
  margin-left: 50%;
  transform: translateX(-50%);
}

.focus-card {
  --rgb: 94, 234, 212;
  --card-bg: linear-gradient(165deg, #10313a 0%, #0b1a24 55%, #080f17 100%);
  --card-end: #080f17;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 280px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 24px;
  color: #fff;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), var(--card-bg);
  background-size: 22px 22px, cover;
  border: 1px solid rgba(255, 255, 255, .07);
  box-shadow: 0 24px 48px -28px rgba(0, 0, 0, .55);
  transition: transform .35s cubic-bezier(.2, .7, .2, 1), border-color .35s ease;
}
.focus-card--estimation {
  --rgb: 167, 139, 250;
  --card-bg: linear-gradient(165deg, #22204a 0%, #13122e 55%, #0b0a1c 100%);
  --card-end: #0b0a1c;
}
.focus-card--robotics {
  --rgb: 251, 113, 133;
  --card-bg: linear-gradient(165deg, #3d1424 0%, #210b15 55%, #12070c 100%);
  --card-end: #12070c;
}
.focus-card--agents {
  --rgb: 251, 191, 36;
  --card-bg: linear-gradient(165deg, #3a2c0c 0%, #1e1607 55%, #100c04 100%);
  --card-end: #100c04;
}
.focus-card:hover { transform: translateY(-4px); border-color: rgba(var(--rgb), .28); }

.focus-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }

/* Pointer glow */
.focus-card::before {
  content: ""; position: absolute; inset: 0; z-index: -3; pointer-events: none;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 30%), rgba(var(--rgb), .16), transparent 70%);
  opacity: 0; transition: opacity .4s ease;
}
.focus-card:hover::before { opacity: 1; }

/* Fade the animation behind the text */
.focus-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent 45%, var(--card-end) 80%);
}

.focus-card__bg {
  position: absolute; top: -12px; right: -28px; z-index: -3;
  width: 160px; height: 160px;
  fill: none; stroke: rgba(var(--rgb), .1); stroke-width: .8; stroke-linecap: round; stroke-linejoin: round;
  transform: translate(var(--px, 0px), var(--py, 0px));
  transition: transform .3s ease-out;
}

.focus-card__icon {
  position: absolute; top: 20px; left: 20px;
  width: 44px; height: 44px; border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(var(--rgb), .1);
  border: 1px solid rgba(var(--rgb), .35);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, .025), inset 0 0 18px rgba(var(--rgb), .18);
  color: rgb(var(--rgb));
}
.focus-card__icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.focus-card h3 { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.focus-card p { margin-top: 8px; font-size: .84rem; line-height: 1.5; color: rgba(255, 255, 255, .68); }

@media (max-width: 1100px) {
  .focus__grid { grid-template-columns: repeat(2, 1fr); width: min(760px, calc(100vw - 32px)); }
}
@media (max-width: 600px) {
  .focus__grid {
    display: flex; gap: 12px;
    width: auto; margin: 0 -16px; padding: 4px 16px 10px; transform: none;
    overflow-x: auto; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding: 0 16px;
    scrollbar-width: none;
  }
  .focus__grid::-webkit-scrollbar { display: none; }
  .focus-card { flex: 0 0 84%; min-height: 280px; scroll-snap-align: start; }
  .focus-card:hover { transform: none; }
}

/* The robot card is draggable: keep vertical scrolling, hand horizontal drags to the page */
.focus-card--robotics { touch-action: pan-y; }
@media (max-width: 600px) { .focus-card--robotics { touch-action: pan-x pan-y; } }

@media (prefers-reduced-motion: reduce) {
  .focus-card, .focus-card__bg, .term { transition: none; }
  .focus-card:hover { transform: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .page { padding: 48px 16px 48px; }
  .topbar__inner { padding: 0 16px; gap: 12px; }
  /* The name stays in the link for screen readers; the icon gets a 40px touch target */
  .topbar__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .topbar__brand { min-width: 40px; min-height: 40px; justify-content: center; margin-left: -11px; }
  .topbar__home { display: block; }
  .topbar__nav a { padding: 6px 8px; }
  /* Course chips become a compact dotted list */
  .courses { display: block; }
  .courses li { display: inline; padding: 0; border: 0; font-size: .82rem; }
  .courses li + li::before { content: " · "; color: var(--faint); }
  .quote { padding: 56px 0 64px; }
  .term { left: 8px; right: 8px; bottom: 8px; width: auto; height: min(380px, 55vh); }
  .term__prompt input { font-size: 16px; }
  .section { grid-template-columns: 1fr; gap: 16px; }
  .entry__head { flex-direction: column; gap: 0; }
  .skills { grid-template-columns: 1fr; gap: 0; }
  .skills dd { margin-bottom: 10px; }
  .focus__head { flex-direction: column; gap: 4px; }
  .news__list li { grid-template-columns: 36px 1fr; gap: 10px; }
  .entry > .project__body, .entry > .project__links { grid-column: 1 / -1; }
  .entry.entry--media { grid-template-columns: 40px 1fr; column-gap: 16px; }
  .entry.entry--media > * { grid-column: 2; }
  .entry.entry--media > .logo { grid-column: 1; }
  .entry.entry--media > .entry__media { grid-column: 1 / -1; grid-row: auto; order: 1; max-width: 320px; margin: 12px 0 0; }
  .entry.project { grid-template-columns: 1fr; }
  .entry.project > *, .entry.project > .project__method { grid-column: 1; grid-row: auto; }
  /* Title first, then the diagram, then the write-up */
  .entry.project > .project__method { order: 1; width: min(100%, 240px); margin: 12px 0 4px; }
  .entry.project > .project__body, .entry.project > .project__links { order: 2; }
  .project__fig { max-width: none; padding: 12px 12px 8px; }
  .intro--photo { grid-template-columns: 1fr; }
  .portrait { grid-column: 1; grid-row: auto; order: -1; width: 112px; height: 112px; margin: 0 0 22px; }
}

/* ---------- Print: clean one-column CV ---------- */
@media print {
  @page { size: A4; margin: 8mm 12mm; }
  .intro--photo { display: block; }
  #space, .skip, .term, .portrait, .sr-only, .screen-only, .bib, .courses--eth, .type-cursor, .topbar, .quote, .focus, .footer, .links { display: none !important; }
  .print-only { display: block !important; }

  /* Always print light, whatever theme the screen is in */
  :root, :root:not([data-theme="light"]), :root[data-theme] {
    --bg: #fff; --text: #111; --muted: #444; --faint: #666; --border: #dcdcdc; --accent: #1d4ed8;
    --robot-accent: #087e83;
    --font-mono: "CV Mono", ui-monospace, monospace;
    color-scheme: light;
  }
  html, body { background: #fff !important; }
  .js-typing .intro h1, .js-typing .intro .subtitle, .js-typing .intro .summary,
  .js-typing .section h2 { visibility: visible !important; }

  /* Compact layout: a dense sans for running text, mono for labels */
  body { font-family: "CV Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 8.2pt; line-height: 1.2; }
  .page { max-width: none; padding: 0; }
  .intro { padding-bottom: 4px; }
  h1 { font-family: var(--font-mono); font-size: 17pt; letter-spacing: -0.02em; }
  .subtitle { margin-top: 2px; font-size: 8pt; }
  .subtitle::before { content: none; }
  .summary { margin-top: 5px; max-width: none; font-family: inherit; font-size: 8.4pt; line-height: 1.35; }
  .robot-learning { font-family: inherit; font-size: inherit; }
  .contact { margin-top: 4px; font-family: var(--font-mono); font-size: 7.6pt; color: var(--muted); }
  .contact a { color: var(--accent); }
  /* Personal details sit in the empty space right of the name, so the CV stays one page */
  .personal { position: absolute; top: 2px; right: 0; text-align: right; font-family: var(--font-mono); font-size: 7.6pt; line-height: 1.4; color: var(--muted); }

  .section { padding: 2px 0; grid-template-columns: 92px 1fr; gap: 8px; }
  .section h2 { font-size: 6.6pt; padding-top: 1px; letter-spacing: .04em; }
  .entries { gap: 3px; }
  .entry { column-gap: 7px; }
  .entry, .list li { break-inside: avoid; }
  .logo, .list li > .logo { width: 18px; height: 18px; padding: 1.5px; border-radius: 4px; }
  .entry h3 { font-size: 8.8pt; line-height: 1.25; }
  .entry__head { gap: 8px; }
  .date { font-size: 7pt; }
  .entry__sub { margin-top: 0; font-size: 8pt; }
  .entry p + p { margin-top: 1px; }
  .entry > p:not(.entry__sub) { font-size: 8pt; opacity: 1; }
  .more { font-size: 7.4pt; }
  /* Project links sit at the right of the entry's second line instead of their own line */
  .entry, .entry.project { grid-template-columns: 18px 1fr auto; }
  .entry.project > .logo { grid-column: 1; }
  .section--projects > .entries, .section--media > .entries { grid-column: 2; }
  .entry.entry--media { grid-template-columns: 18px 1fr auto; column-gap: 7px; }
  .entry.entry--media > * { grid-column: 2; }
  .entry.entry--media > .logo { grid-column: 1; }
  .entry.entry--media > .entry__head { grid-column: 2 / 4; }
  .entry.project { column-gap: 7px; }
  .entry > .entry__head { grid-column: 2 / 4; }
  .entry > p:has(> .more) { grid-column: 3; grid-row: 2; margin: 0; padding-left: 10px; }
  .more::after { content: ""; }

  .courses { display: block; margin-top: 1px; }
  .courses li { display: inline; padding: 0; border: 0; font-size: 7.8pt; }
  .courses li + li::before { content: " · "; }

  .skills { grid-template-columns: 112px 1fr; gap: 1px 8px; }
  .skills dt, .skills dd { font-size: 8.1pt; }

  .list { gap: 2px; }
  /* Honors and awards: the detail runs on after the title instead of taking its own line */
  .list li { display: block; position: relative; min-height: 14px; padding-left: 25px; }
  .list li > .logo { position: absolute; left: 2px; top: 0; width: 14px; height: 14px; padding: 1px; border-radius: 3.5px; }
  .list li > span { display: inline; }
  .list li > span::before { content: " · "; }
  .list__desc { display: block; }
  .list a { font-size: 8.4pt; }
  .list span, .list__desc { font-size: 7.8pt; }
  .list__desc { margin-top: 0; }
  .plain { font-size: 8.2pt; }
  .plain + .plain { margin-top: 0; }
  div > .plain { display: inline; }
  div > .plain + .plain::before { content: " · "; }

  /* One line per paper: title · venue, link at the right */
  .pubs { gap: 2px; }
  .pubs li { padding: 0 44px 0 21px; break-inside: avoid; }
  .pubs li::before { font-size: 7pt; top: 0; }
  .pub__title, .pub__authors, .pub__venue { display: inline; }
  .pub__authors { margin: 0; font-size: 8pt; color: var(--muted); }
  .pub__authors::before { content: " · "; }
  .pub__title { font-size: 8.4pt; line-height: 1.27; }
  .pub__venue { margin: 0; font-size: 8pt; }
  .pub__venue::before { content: " · "; }
  .pub__venue em { color: inherit; font-style: italic; }
  .pubs li > p:has(> .more) { position: absolute; top: 0; right: 0; margin: 0; }
  .pubs .more::after { content: ""; }
  .entry .project__links { display: block; margin: 0; }
  .entry .project__links .more + .more, .pubs .more + .more { display: none; }
}
