@font-face {
  font-family: "Onest";
  src: url("assets/fonts/Onest-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1b1d21;
  --muted: #5f6672;
  --accent: #2455e0;
  --border: #e4e4df;
  --radius: 14px;
  --max: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101214;
    --surface: #181b1f;
    --text: #eceef1;
    --muted: #9aa1ad;
    --accent: #7ea1ff;
    --border: #2a2e34;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); text-decoration: none; }
html[lang="ru"] body,
html[lang="ru"] .pixel-bubble {
  font-family: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a:hover { text-decoration: underline; }

code {
  background: var(--border);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px max(16px, calc((100vw - var(--max)) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { font-family: "Onest", system-ui, sans-serif; font-weight: 700; color: var(--text); white-space: nowrap; }
.nav nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 15px; }
.nav nav a { color: var(--muted); }
.nav nav a:hover { color: var(--text); text-decoration: none; }

/* ---------- Layout ---------- */
main, footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 16px;
}
section { padding: 56px 0 8px; scroll-margin-top: 60px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.7rem; margin-bottom: 20px; }
h3 { font-size: 1.1rem; }
.muted { color: var(--muted); font-size: 0.92rem; }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 40px; }
.eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.hero h1 { font-size: clamp(2.4rem, 7vw, 4rem); letter-spacing: -0.02em; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

/* Hero: text on the left, portrait on the right */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 56px;
  align-items: center;
}
.portrait {
  width: 280px;
  height: 280px;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 50%;
  border: 1px solid var(--border);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 14%, transparent);
}

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .portrait { order: -1; width: 180px; height: 180px; }
}

/* ---------- Timeline ---------- */
.timeline { border-left: 2px solid var(--border); padding-left: 24px; }
.timeline article { position: relative; margin-bottom: 28px; }
.timeline article::before {
  content: "";
  position: absolute;
  left: -31px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}
.date { font-size: 0.85rem; color: var(--muted); }
.meta { margin: 0 0 6px; color: var(--muted); }
.timeline ul { margin: 8px 0 0; padding-left: 20px; }

/* ---------- Project cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 20px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--border);
}
.gallery { display: grid; grid-auto-flow: column; grid-auto-columns: 100%; overflow-x: auto; scroll-snap-type: x mandatory; }
.gallery img { scroll-snap-align: start; }
.card-body { padding: 18px 20px 20px; }
.card-body p { margin: 0 0 12px; font-size: 0.97rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0 0 12px; }
.tags li {
  font-size: 0.78rem;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.links { margin: 0; font-weight: 600; font-size: 0.95rem; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 24px; }
.skill-category { min-width: 0; }
.skill-category h3 { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-size: 1rem; }
.skill-icon { flex: 0 0 32px; width: 32px; height: 32px; padding: 6px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); color: var(--accent); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 7px; list-style: none; padding: 0; margin: 0; }
.skill-chips li { max-width: 100%; padding: 5px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .88rem; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 900px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .skills { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
footer { padding: 48px 16px; color: var(--muted); font-size: 0.9rem; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .hero { padding-top: 56px; }
}

/* ---------- Achievements ---------- */
.achievements { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.achievements li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.97rem;
}
.card-body .date { margin: 0 0 8px; }

/* ---------- Language switcher ---------- */
.nav nav { margin-left: auto; }
.lang {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  flex-shrink: 0;
}
.lang button {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 11px;
  background: transparent;
  color: var(--muted);
  border: 0;
  cursor: pointer;
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }
.lang button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }


/* ---------- Theme and compact navigation ---------- */
:root { color-scheme: light; --on-accent: #fff; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214; --surface: #181b1f; --text: #eceef1;
  --muted: #a8afba; --accent: #8aabff; --border: #2a2e34; --on-accent: #101214;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; --on-accent: #101214; }
}
.btn, .lang button[aria-pressed="true"] { color: var(--on-accent); }
.btn.ghost { color: var(--text); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
button { font: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.nav { gap: 12px; }
.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; flex-shrink: 0; padding: 10px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 50%; cursor: pointer; }
.icon-button:hover { border-color: var(--accent); }
.icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun, :root[data-theme="dark"] .theme-moon { display: none; }
:root[data-theme="dark"] .theme-sun { display: block; }
.menu-wrap { position: relative; }
.hamburger { display: grid; gap: 4px; width: 18px; }
.hamburger span { height: 2px; border-radius: 2px; background: currentColor; transition: transform 160ms, opacity 160ms; }
[aria-expanded="true"] .hamburger span:first-child { transform: translateY(6px) rotate(45deg); }
[aria-expanded="true"] .hamburger span:nth-child(2) { opacity: 0; }
[aria-expanded="true"] .hamburger span:last-child { transform: translateY(-6px) rotate(-45deg); }
.nav #section-menu { position: absolute; right: 0; top: calc(100% + 14px); margin: 0; display: grid; gap: 2px; width: min(290px, calc(100vw - 32px)); padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 14px 40px #0002; max-height: calc(100dvh - 100px); overflow-y: auto; }
.nav #section-menu a { padding: 10px 14px; border-radius: 8px; }
.nav #section-menu a:hover, .nav #section-menu a:focus-visible { background: var(--bg); color: var(--accent); }
section { scroll-margin-top: 86px; }
.grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
@media (min-width: 821px) {
  #projects > .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.card-body { display: flex; flex-direction: column; flex: 1; }
.card-body .links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: auto; padding-top: 4px; }
.details-button { border: 1px solid var(--border); background: var(--bg); color: var(--text); padding: 8px 14px; border-radius: 999px; font-size: .9rem; font-weight: 600; cursor: pointer; }
.details-button:hover { color: var(--accent); border-color: var(--accent); }
.empty-state { padding: 24px; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.credential-card { padding: 24px; }
.credential-card h3 { margin-top: 12px; }
.credential-card .links { margin-top: auto; }
/* ---------- Project windows ---------- */
.project-dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 28px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 20px; overflow-y: auto; overscroll-behavior: contain; box-shadow: 0 24px 100px #0004; }
.project-dialog::backdrop { background: #080d18aa; backdrop-filter: blur(5px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.dialog-header .eyebrow { margin: 0; }
.dialog-close { font-size: 26px; }
.detail-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 20px; margin: 24px 0; background: var(--bg); border-radius: var(--radius); }
.detail-facts h3 { font-size: .9rem; }
.detail-facts p { color: var(--muted); font-size: .95rem; margin: 0; }
.detail-gallery { display: grid; gap: 16px; }
.project-dialog > .links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; margin-top: 16px; }
.detail-gallery img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; }
body.dialog-open { overflow: hidden; }
.image-zoom-trigger { display: block; width: 100%; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: zoom-in; }
.image-zoom-trigger:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.image-viewer { position: fixed; inset: 0; box-sizing: border-box; width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 64px 16px 16px; border: 0; background: #080d18f2; overflow: hidden; }
.image-viewer[open] { display: flex; align-items: center; justify-content: center; }
.image-viewer::backdrop { background: #080d18; }
.image-viewer > img { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.image-viewer-close { position: absolute; top: 16px; right: 16px; color: #fff; background: #ffffff1a; border-color: #ffffff55; font-size: 26px; }
@media (max-width: 560px) {
  .nav { padding: 10px 16px; }
  .nav-actions { gap: 8px; }
  .lang button { padding: 6px 9px; }
  .project-dialog { padding: 20px; }
  .detail-facts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}

#credentials-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--border);
}

#credentials-list .credential-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 24px;
  padding: 16px 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}


#credentials-list .eyebrow {
  display: none;
}

#credentials-list h3 {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

#credentials-list p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

#credentials-list .meta {
  grid-column: 1;
  grid-row: 2;
}

#credentials-list .date {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  white-space: nowrap;
}

#credentials-list p:not(.eyebrow):not(.meta):not(.date):not(.links) {
  grid-column: 1;
  font-size: 0.8rem;
}

#credentials-list .links {
  grid-column: 1 / -1;
  margin-top: 4px;
}

@media (max-width: 560px) {
  #credentials-list .credential-card {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #credentials-list .date {
    grid-column: 1;
    grid-row: 3;
  }
}

.certificate-dialog {
  width: min(960px, calc(100% - 32px));
}

.certificate-dialog .dialog-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.certificate-content img {
  display: block;
  width: 100%;
  max-height: 72dvh;
  object-fit: contain;
}

.certificate-content iframe {
  display: block;
  width: 100%;
  height: 72dvh;
  border: 0;
  background: var(--bg);
}

/* Pixel companion: the overlay leaves links and page content clickable. */
.pixel-game { position: fixed; inset: auto 0 6px; height: 0; z-index: 12; pointer-events: none; }
.pixel-game[hidden], .pixel-controls[hidden] { display: none; }
.pixel-player { position: absolute; bottom: 0; left: 0; width: 56px; height: 96px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; appearance: none; -webkit-appearance: none; }
.pixel-player canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.pixel-player:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.pixel-player:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.pixel-shadow { position: absolute; bottom: -4px; left: -16px; width: 32px; height: 6px; border-radius: 50%; background: var(--text); opacity: .12; }
.pixel-bubble { position: absolute; bottom: calc(100% + 9px); left: 50%; width: max-content; max-width: min(164px, calc(100vw - 24px)); padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px 10px 10px 3px; background: color-mix(in srgb, var(--surface) 96%, var(--accent)); color: var(--text); font: 11px/1.4 system-ui, sans-serif; text-align: center; box-shadow: 0 3px 10px #0001; transform: translateX(calc(-50% + var(--bubble-shift, 0px))); pointer-events: none; }
.pixel-bubble::after { content: ''; position: absolute; bottom: -5px; left: 50%; width: 8px; height: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: inherit; transform: translateX(calc(-50% - var(--bubble-shift, 0px))) rotate(45deg); }
/* A compact corner control; instructions live in the popover above it. */
.pixel-controls { position: fixed; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); right: 12px; z-index: 11; display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); box-shadow: 0 2px 8px #0001; font-size: 11px; }
.pixel-controls button { border: 0; border-radius: 6px; padding: 5px 8px; background: var(--bg); color: var(--text); font: inherit; cursor: pointer; }
.pixel-controls button:hover { color: var(--accent); }
.pixel-controls button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#pixel-toggle { min-height: 28px; padding: 6px 12px; border-radius: 999px; line-height: 1.4; font-weight: 500; white-space: nowrap; }
#pixel-help-toggle { width: 28px; height: 28px; padding: 0; border-radius: 50%; color: var(--muted); }
.pixel-help { position: absolute; bottom: calc(100% + 8px); right: 0; width: 260px; max-width: calc(100vw - 24px); display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); box-shadow: 0 4px 16px #0001; font-size: 11px; line-height: 1.5; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .15s ease, visibility .15s ease; }
.pixel-help::after { content: ''; position: absolute; top: 100%; right: 0; left: 0; height: 10px; }
#pixel-key-hint { color: var(--text); }
.pixel-help-open .pixel-help { visibility: visible; opacity: 1; pointer-events: auto; }
.pixel-touch { display: none; gap: 4px; }
.pixel-is-hidden .pixel-help, .pixel-is-hidden .pixel-touch { display: none; }
footer { padding-bottom: 70px; }
@media (hover: none), (max-width: 600px) {
  #pixel-help-toggle, .pixel-help { display: none; }
  .pixel-game { bottom: calc(6px + env(safe-area-inset-bottom, 0px)); }
  .pixel-player { width: 42px; height: 72px; }
  .pixel-touch { display: flex; }
  .pixel-controls button { min-height: 44px; }
  #pixel-help-toggle { width: 44px; height: 44px; }
  .pixel-touch button { min-width: 44px; touch-action: none; user-select: none; }
  footer { padding-bottom: 88px; }
}
@media (prefers-reduced-motion: reduce) {
  .pixel-help { transition: none; }
}


/* Images keep their natural ratio when width/height attributes are present */
img { height: auto; }

/* Availability pill in the hero */
.availability { margin: 20px 0 0; }
.availability a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.35;
}
.availability a:hover { text-decoration: none; border-color: var(--accent); }
.availability .dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2e9e5b;
  box-shadow: 0 0 0 0 rgba(46, 158, 91, 0.5);
  animation: availability-pulse 2.4s ease-out infinite;
}
@keyframes availability-pulse {
  70% { box-shadow: 0 0 0 8px rgba(46, 158, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 158, 91, 0); }
}
.availability + .cta { margin-top: 20px; }

/* Contact buttons */
button.btn { border: 0; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; }
button.btn.ghost { border: 1px solid var(--border); }
.contact-actions { margin-top: 20px; }
.copy-label[hidden], .copied-label[hidden] { display: none; }
#copy-email { min-width: 150px; }

/* Scroll reveal (only active when JS adds .js-reveal) */
.js-reveal .reveal { opacity: 0; transform: translateY(14px); }
.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 0.55s ease, transform 0.55s ease;
}
@media (prefers-reduced-motion: reduce) {
  .availability .dot { animation: none; }
  .js-reveal .reveal { opacity: 1; transform: none; }
}
@media print {
  .js-reveal .reveal { opacity: 1 !important; transform: none !important; }
}

/* Multi-ASV project dialog: internship details */
.asv-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:1rem 1.5rem;margin:1.25rem 0 1.75rem}
.asv-facts dt{font-size:.78rem;text-transform:uppercase;letter-spacing:.07em;opacity:.7}
.asv-facts dd{margin:.2rem 0 0;font-weight:600}

.asv-list{margin:.75rem 0 1.5rem;padding-left:1.2rem;display:grid;gap:.4rem}

.asv-bars{margin:1rem 0 1.75rem;padding:1.1rem 1.25rem;border:1px solid var(--border,rgba(128,128,128,.3));border-radius:14px}
.asv-bars-title{font-weight:600;margin:0 0 .9rem}
.asv-bar-group{margin-bottom:1rem}
.asv-bar-group-label{margin:0 0 .35rem;font-size:.85rem;opacity:.75}
.asv-bar-row{display:grid;grid-template-columns:minmax(110px,170px) 1fr 3.2rem;gap:.75rem;align-items:center;margin:.3rem 0}
.asv-bar-track{display:block;height:.9rem;border-radius:999px;background:var(--border,rgba(128,128,128,.2));overflow:hidden}
.asv-bar{display:block;height:100%;border-radius:999px;background:var(--accent,#3b5bdb)}
.asv-bar.is-after{background:#2f9e44}
.asv-bar-row strong{text-align:right;font-variant-numeric:tabular-nums}

.asv-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:1rem;margin:1rem 0}
.asv-stat{border:1px solid var(--border,rgba(128,128,128,.3));border-radius:14px;padding:1rem 1.1rem}
.asv-stat strong{display:block;font-size:1.9rem;line-height:1.1;margin-bottom:.35rem;font-variant-numeric:tabular-nums}
.asv-stat > span{font-size:.92rem;opacity:.85}

.asv-note{font-size:.88rem;opacity:.75;margin:.6rem 0 0}
.asv-outcome-title{margin-top:1.5rem}
.asv-funding{margin:1.5rem 0 0}

.asv-gallery-title{margin:1.75rem 0 .75rem}
.detail-gallery figure{margin:0}
.detail-gallery figcaption{font-size:.85rem;opacity:.75;margin-top:.45rem}
.asv-photos{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem}

@media (max-width:520px){
  .asv-bar-row{grid-template-columns:1fr 3.2rem;}
  .asv-bar-row > span:first-child{grid-column:1 / -1;font-size:.85rem}
}

/* Red Monopoly project details */
.mono-strategies{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;margin:1rem 0 1.75rem}
.mono-strategies article{border:1px solid var(--border);border-radius:14px;padding:1rem 1.1rem}
.mono-strategies h4{margin:0 0 .5rem;color:var(--accent)}
.mono-strategies p{margin:0;font-size:.92rem}
.mono-flow{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem;list-style:none;padding:0;margin:1rem 0 1.75rem}
.mono-flow li{padding:1rem;border-radius:14px;background:var(--bg);border-top:3px solid var(--accent)}
.mono-flow strong,.mono-flow span{display:block}
.mono-flow span{margin-top:.4rem;font-size:.9rem;color:var(--muted)}
.mono-timeline{list-style:none;padding:0 0 0 1.25rem;margin:1rem 0 1.75rem;border-left:2px solid var(--border)}
.mono-timeline li{position:relative;padding:0 0 .75rem .5rem}
.mono-timeline li::before{content:"";position:absolute;left:-1.65rem;top:.4rem;width:.65rem;height:.65rem;border-radius:50%;background:var(--accent)}
.mono-timeline p{margin:.4rem 0 .5rem;font-size:.95rem;color:var(--muted)}

/* Autonomous tram project details */
#project-tram > .asv-stats{margin-bottom:1.75rem}
.tram-controllers{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:1rem;margin:1rem 0 1.75rem}
.tram-controllers article{padding:1rem 1.1rem;border:1px solid var(--border);border-radius:14px;background:var(--bg)}
.tram-controllers h4{margin:0 0 .5rem;color:var(--accent)}
.tram-controllers p{margin:0;font-size:.92rem}
#project-tram .detail-gallery img{max-height:620px;object-fit:contain;background:var(--bg)}

/* Digital twin project details */
#project-twin > .asv-stats{margin-bottom:1.75rem}
.twin-topology{margin:1rem 0 1.75rem}
.twin-research-note{margin-bottom:1.5rem}
#project-twin .cta{display:flex;flex-wrap:wrap;gap:12px}

.asv-highlights-note{margin-bottom:1.75rem}

/* AI visualization in the physical tram project dialog. */
.tram-video { margin: 0 0 1.75rem; }
.tram-video video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; border-radius: var(--radius); background: var(--bg); }
.tram-video-player { position: relative; }
.tram-video-play { position: absolute; left: 12px; bottom: 12px; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 1px solid #ffffff66; border-radius: 50%; background: #101214cc; color: #fff; cursor: pointer; }
.tram-video-play:hover { background: #101214; }
.tram-video-play svg { display: block; }
.tram-video-play:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.tram-video figcaption { margin-top: .65rem; color: var(--muted); font-size: .875rem; line-height: 1.6; }
.tram-video figcaption a { display: block; margin-top: .25rem; }

.asv-simulations video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); }
.asv-simulations figcaption p { margin: .35rem 0 0; }

.asv-simulation-details { width: fit-content; max-width: 100%; box-sizing: border-box; margin: .75rem 0 1.5rem; padding: .45rem .7rem; border: 1px solid var(--border); border-radius: 10px; }
.asv-simulation-details[open] { width: 100%; }
.asv-simulation-details summary { cursor: pointer; font-size: .8rem; font-weight: 600; }
.asv-simulation-details summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.asv-simulation-details h4 { margin: 1rem 0 .35rem; }
.asv-simulation-details p { font-size: .875rem; line-height: 1.6; }

/* Recommendations share the portfolio cards and native project dialogs. */
.recommendations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-top: 20px; }
.recommendation-card { margin: 0; padding: 24px; }
.recommendation-label { margin: 0 0 16px; font-size: .8rem; color: var(--muted); }
.recommendation-card blockquote { margin: 0 0 24px; padding: 0 0 0 18px; border-left: 2px solid var(--border); font-size: 1rem; line-height: 1.65; }
.recommendation-card blockquote p { margin: 0; }
.recommendation-card figcaption { margin-top: auto; }
.recommendation-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.recommendation-card .meta { font-size: .9rem; }
.recommendation-relationship { margin: 6px 0 0; color: var(--muted); font-size: .85rem; }
.recommendation-card .links { margin: 18px 0 0; }
.recommendation-card .details-button { text-align: left; }
.recommendation-dialog .dialog-header { position: sticky; top: 0; z-index: 1; margin: -28px -28px 24px; padding: 16px 28px; background: var(--surface); border-bottom: 1px solid var(--border); }
.recommendation-dialog h2 { margin-top: 0; }
.recommendation-dialog .date { margin: 12px 0 24px; }
.recommendation-full { max-width: 70ch; margin: 0; font-size: 1rem; line-height: 1.85; }
.recommendation-full p { margin: 0 0 1.25em; }
.recommendation-full p:last-child { margin-bottom: 0; }
@media (max-width: 700px) {
  .recommendations-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .recommendation-card { padding: 20px; }
  .recommendation-dialog .dialog-header { top: 0; margin: -20px -20px 20px; padding: 12px 20px; }
}

#project-recommendation-meherrem .recommendation-full p:not(:last-child) { margin-bottom: 0.6em; }

.recommendation-person { display: flex; align-items: center; gap: 12px; }
.recommendation-person > div { min-width: 0; }
.recommendation-portrait { display: block; width: 48px; height: 48px; flex: 0 0 48px; object-fit: cover; border: 1px solid var(--border); border-radius: 50%; }
.recommendation-person .meta { margin-bottom: 0; }
.recommendation-dialog .recommendation-person h2 { margin-bottom: 4px; }

.recommendation-dialog { padding-top: 0; }
.recommendation-dialog .dialog-header { margin-top: 0; margin-bottom: 20px; }
