/* FSartori.com — Week 3 static design-system prototype v3 */

:root {
  --background: #07090d;
  --surface: rgba(15, 19, 27, 0.78);
  --surface-strong: rgba(18, 23, 33, 0.92);
  --secondary-surface: rgba(255, 255, 255, 0.035);
  --text-primary: #f4f6f8;
  --text-secondary: #aab3c0;
  --border: rgba(255, 255, 255, 0.15);
  --accent: #c8dcff;

  --screen-width: 90%;
  --screen-max-width: 1080px;
  --screen-max-height: 780px;

  --safe-margin: 12px;
  --card-padding: 20px;
  --nav-clearance: 72px;

  --identity-size: 15px;
  --label-size: 11px;
  --heading-size: 48px;
  --body-size: 15px;
  --meta-size: 11px;

  --default-gap: 12px;
  --home-gap: 20px;

  --radius-screen: 22px;
  --radius-card: 18px;
  --radius-secondary: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--background);
  color: var(--text-primary);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: var(--body-size);
  line-height: 1.5;
}

a {
  color: inherit;
}

/* Visible keyboard focus everywhere, including links inside cards. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-180%);
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--text-primary);
  color: var(--background);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- Placeholder universe layer ---------- */

.universe-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 20%, rgba(64, 91, 132, 0.18), transparent 28%),
    radial-gradient(circle at 80% 75%, rgba(81, 54, 112, 0.18), transparent 34%),
    linear-gradient(180deg, #080a0f 0%, #05070a 100%);
}

.stars {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.72) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(255,255,255,0.42) 0 1px, transparent 1.2px);
  background-size: 83px 83px, 137px 137px;
  background-position: 10px 20px, 50px 70px;
}

.stars-b {
  opacity: 0.22;
  transform: scale(1.25);
}

.nebula {
  position: absolute;
  width: 38vw;
  height: 38vw;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.08;
}

.nebula-a {
  left: -8vw;
  top: 18vh;
  background: #6f95d6;
}

.nebula-b {
  right: -12vw;
  bottom: 10vh;
  background: #8060a5;
}

/* ---------- Floating navigation ---------- */

.site-header {
  position: fixed;
  right: 0;
  bottom: 18px;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  pointer-events: none;
}

.navigation-banner {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: calc(100vw - 24px);
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(9, 12, 18, 0.84);
  backdrop-filter: blur(12px);
  pointer-events: auto;
}

.navigation-banner a {
  padding: 7px 11px;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 13px;
  text-decoration: none;
}

.navigation-banner a:hover,
.navigation-banner a:focus-visible {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Canonical ScreenSection ---------- */

.screen-section {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding:
    28px
    20px
    calc(var(--nav-clearance) + 74px);
}

.screen-frame {
  position: relative;
  width: min(var(--screen-width), var(--screen-max-width));
  height: min(90svh, var(--screen-max-height));
  min-height: 430px;
  border: 1px solid var(--border);
  border-radius: var(--radius-screen);
  background: rgba(10, 14, 20, 0.28);
  backdrop-filter: blur(3px);
}

.screen-identity {
  position: absolute;
  top: var(--safe-margin);
  left: var(--safe-margin);
  margin: 0;
  font-size: var(--identity-size);
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
}

/* ---------- Canonical InfoCard ---------- */

.info-card {
  position: absolute;
  top: 52px;
  right: var(--safe-margin);
  bottom: var(--safe-margin);
  left: var(--safe-margin);
  padding: var(--card-padding);
  /* Content can now grow past the locked height without being silently clipped. */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  backdrop-filter: blur(10px);
}

.info-card::-webkit-scrollbar {
  width: 8px;
}

.info-card::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}

.info-card__label,
.card-number,
.card-kind {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* Higher specificity than `.info-card p` so eyebrows stay at label size. */
.info-card .card-number,
.info-card .card-kind {
  font-size: var(--label-size);
}

.info-card h1,
.info-card h2 {
  margin: 0;
  font-size: var(--heading-size);
  line-height: 1.03;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.info-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 500;
}

.info-card p {
  font-size: var(--body-size);
  line-height: 1.5;
}

.info-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.meta {
  color: var(--text-secondary);
  font-size: var(--meta-size);
  line-height: 1.4;
}

.meta a {
  color: var(--accent);
  text-decoration-color: rgba(200, 220, 255, 0.4);
  text-underline-offset: 3px;
}

.meta a:hover {
  text-decoration-color: var(--accent);
}

.button-group {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button:hover,
.primary-button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.primary-button--quiet {
  background: transparent;
  color: var(--text-secondary);
}

.primary-button--quiet:hover,
.primary-button--quiet:focus-visible {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* ---------- Lateral cross-links between sections ---------- */

.cross-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-size: var(--meta-size);
  letter-spacing: 0.02em;
  text-decoration: none;
  border-bottom: 1px solid rgba(200, 220, 255, 0.28);
  padding-bottom: 2px;
}

.cross-link::after {
  content: " →";
}

.cross-link:hover,
.cross-link:focus-visible {
  border-bottom-color: var(--accent);
}

.status-note {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: var(--meta-size);
}

.info-card .status-note {
  font-size: var(--meta-size);
}

/* ---------- Home: no secondary card ---------- */

.info-card--home {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--home-gap);
}

.home-content {
  max-width: 850px;
  align-self: flex-start;
}

.home-content .info-card__label {
  margin-bottom: 16px;
}

.home-content h1 {
  max-width: 21ch;
}

.lead {
  max-width: 58ch;
  margin: 24px 0 0;
}

.capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.capability-list li {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: var(--meta-size);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ---------- About / split pattern ---------- */

.info-card--split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
  grid-template-rows: 1fr auto;
  gap: 20px;
  align-items: start;
}

.title-zone {
  align-self: start;
}

.title-zone .info-card__label,
.section-title .info-card__label {
  margin-bottom: 14px;
}

.secondary-stack {
  display: flex;
  flex-direction: column;
  gap: var(--default-gap);
  min-width: 0;
  align-self: center;
}

.secondary-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-secondary);
  background: var(--secondary-surface);
}

.secondary-card .card-kind {
  margin-bottom: 10px;
}

.secondary-card p:first-child {
  margin-top: 0;
}

.secondary-card p:last-child {
  margin-bottom: 0;
}

.secondary-card--body {
  align-self: center;
}

.info-card--split .info-card__footer {
  grid-column: 1 / -1;
  align-self: end;
}

/* ---------- Projects / Research: title + horizontal secondary cards ---------- */

.info-card--rows {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
}

.section-title h2 {
  max-width: 22ch;
}

.horizontal-card-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--default-gap);
  align-items: stretch;
}

.horizontal-card-row .secondary-card {
  display: flex;
  flex-direction: column;
}

.horizontal-card-row .card-number,
.horizontal-card-row .card-kind {
  margin-bottom: 14px;
}

.horizontal-card-row h3 {
  margin-bottom: 10px;
}

/* Pin the lateral cross-link to the bottom of every card in the row. */
.horizontal-card-row .cross-link {
  margin-top: auto;
  padding-top: 14px;
}

.placeholder-card {
  border-style: dashed;
  color: var(--text-secondary);
}

/* ---------- Multi-row card stacks (Projects, Research) ---------- */

.card-rows {
  display: flex;
  flex-direction: column;
  gap: var(--default-gap);
  min-width: 0;
}

.horizontal-card-row--compact .secondary-card p {
  font-size: 14px;
}

/* ---------- Publications ---------- */

.publication-block {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-secondary);
  background: var(--secondary-surface);
}

.publication-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px var(--default-gap);
}

.publication-columns .card-kind {
  margin-bottom: 12px;
}

.publication-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.publication-list li {
  font-size: 14px;
  line-height: 1.35;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.publication-list .meta {
  display: block;
  margin-top: 3px;
}

.publication-list a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.recognition-note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.info-card .recognition-note {
  font-size: 13px;
}

.recognition-note strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ---------- Dense sections: more cards inside the same locked frame ---------- */

.info-card--dense {
  padding: 16px;
}

.info-card--dense .card-rows {
  gap: 10px;
}

.info-card--dense .horizontal-card-row {
  gap: 10px;
}

.info-card--dense .secondary-card {
  padding: 14px;
}

.info-card--dense p,
.info-card--dense .publication-list li {
  font-size: 13.5px;
  line-height: 1.45;
}

.info-card--dense h2 {
  font-size: 38px;
}

.info-card--dense h3 {
  font-size: 17px;
}

.info-card--dense .section-title {
  margin-bottom: -4px;
}

.info-card--dense .secondary-card .card-kind {
  margin-bottom: 8px;
}

.info-card--dense .horizontal-card-row .card-kind {
  margin-bottom: 10px;
}

.info-card--dense .horizontal-card-row h3 {
  margin-bottom: 8px;
}

.info-card--dense .horizontal-card-row .cross-link {
  padding-top: 10px;
}

.info-card--dense .publication-block {
  padding: 14px;
}

.info-card--dense .recognition-note {
  margin-top: 12px;
  padding-top: 10px;
}

/* One-line section headings inside dense cards. */
.info-card--dense .section-title h2 {
  max-width: 36ch;
}

/* The secondary row carries shorter entries at a smaller size. */
.horizontal-card-row--compact .secondary-card {
  padding: 12px;
}

.info-card--dense .horizontal-card-row--compact p {
  font-size: 12.5px;
  line-height: 1.4;
}

.info-card--dense .horizontal-card-row--compact h3 {
  font-size: 15px;
}

/* ---------- Narrative prose (About, Perspective) ---------- */

.narrative {
  margin-top: 18px;
  max-width: 46ch;
}

.narrative p {
  margin: 0 0 12px;
}

.narrative p:last-child {
  margin-bottom: 0;
}

.narrative--wide {
  margin-top: 0;
  max-width: 88ch;
}

.home-note {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--text-secondary);
}

/* ---------- Experience timeline ---------- */

.timeline {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
  gap: 20px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.timeline-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.timeline-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.35;
  padding-top: 2px;
}

.timeline-date {
  color: var(--text-primary);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timeline-body {
  min-width: 0;
}

.timeline-body h3 {
  margin: 0 0 4px;
}

.info-card .timeline-body p {
  margin: 0;
  color: var(--text-secondary);
}

.timeline-body .cross-link {
  display: inline-block;
  margin-top: 4px;
  padding-top: 0;
}

/* ---------- Research themes ---------- */

.theme-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--default-gap);
  align-items: start;
}

.theme-block {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-secondary);
  background: var(--secondary-surface);
}

.theme-block h3 {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.info-card--dense .theme-block {
  padding: 12px;
}

.info-card--dense .publication-list {
  gap: 8px;
}

.info-card--dense .publication-list li {
  font-size: 13px;
  line-height: 1.35;
}

/* ---------- Contact ---------- */

.contact-section {
  min-height: 70svh;
  display: grid;
  place-items: center;
  padding: 40px 20px 140px;
}

.contact-panel {
  width: min(90%, 720px);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface-strong);
}

.contact-panel h2 {
  margin: 10px 0 12px;
  font-size: 36px;
  line-height: 1.1;
  font-weight: 500;
}

.contact-panel p {
  max-width: 56ch;
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
  padding: 0;
  list-style: none;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  text-decoration: none;
}

.contact-links a:hover,
.contact-links a:focus-visible {
  border-color: rgba(200, 220, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 20px 110px;
  color: var(--text-secondary);
  font-size: var(--meta-size);
}

/* ---------- Static/mobile fallback ---------- */

@media (max-width: 1024px) {
  html {
    scroll-behavior: auto;
  }

  .screen-section {
    min-height: auto;
    display: block;
    padding: 20px 12px 110px;
  }

  .screen-frame {
    width: 100%;
    height: auto;
    min-height: 0;
    padding: 52px var(--safe-margin) var(--safe-margin);
  }

  .info-card {
    position: relative;
    inset: auto;
    overflow: visible;
  }

  .info-card--split,
  .info-card--rows {
    grid-template-columns: 1fr;
  }

  .info-card--split {
    grid-template-rows: auto auto auto;
  }

  .info-card--split .info-card__footer {
    grid-column: 1;
  }

  .secondary-stack,
  .secondary-card--body {
    align-self: start;
  }

  .horizontal-card-row {
    grid-template-columns: 1fr;
  }

  .publication-columns,
  .theme-row {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .timeline-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .narrative,
  .narrative--wide,
  .home-note {
    max-width: none;
  }

  .info-card h1,
  .info-card h2 {
    font-size: 34px;
  }

  .home-content h1,
  .section-title h2 {
    max-width: none;
  }

  .info-card__footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .navigation-banner {
    gap: 2px;
  }

  .navigation-banner a {
    padding: 6px 8px;
    font-size: 12px;
  }

  .site-footer {
    flex-direction: column;
  }
}

/* Reduced-motion receives the same static semantic layout, regardless of width. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .screen-section {
    min-height: auto;
    display: block;
    padding: 20px 12px 110px;
  }

  .screen-frame {
    width: min(100%, var(--screen-max-width));
    height: auto;
    min-height: 0;
    padding: 52px var(--safe-margin) var(--safe-margin);
  }

  .info-card {
    position: relative;
    inset: auto;
    overflow: visible;
  }

  .info-card--split {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .info-card--split .info-card__footer {
    grid-column: 1;
  }

  .horizontal-card-row {
    grid-template-columns: 1fr;
  }

  .publication-columns,
  .theme-row {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .timeline-meta {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .narrative,
  .narrative--wide,
  .home-note {
    max-width: none;
  }
}

/* ---------- Deck mode: one InfoCard per wheel gesture ----------
   The ScreenFrame and the identity stay pinned; only the InfoCard rolls
   through. Enabled by index.html, which adds .deck-mode to <body>.
   Below 600px and under reduced motion the page stays a normal scroll. */

@media (min-width: 600px) and (min-height: 560px) and (prefers-reduced-motion: no-preference) {
  body.deck-mode,
  html.deck-mode body {
    overflow: hidden;
  }

  .deck-mode main {
    position: fixed;
    inset: 0;
  }

  .deck-mode .site-footer {
    display: none;
  }

  .deck-mode .deck-slide {
    position: absolute;
    inset: 0;
    min-height: 0;
    display: grid;
    place-items: center;
    padding: 28px 20px calc(var(--nav-clearance) + 74px);
    pointer-events: none;
  }

  .deck-mode .deck-slide.is-active {
    pointer-events: auto;
  }

  /* Frame chrome is drawn only by the active slide, so the frame and the
     name never appear to move between cards. */
  .deck-mode .deck-slide:not(.is-active) .screen-frame {
    border-color: transparent;
    background: transparent;
    backdrop-filter: none;
  }

  .deck-mode .deck-slide:not(.is-active) .screen-identity {
    opacity: 0;
  }

  /* Fade transition. Duration must match DURATION in index.html. */
  .deck-mode .deck-slide .info-card,
  .deck-mode .deck-slide .contact-panel {
    opacity: 0;
    will-change: opacity;
  }

  /* Transitions run only once the deck is settled (index.html adds .deck-anim). */
  .deck-anim .deck-slide .info-card,
  .deck-anim .deck-slide .contact-panel {
    transition: opacity 0.5s ease;
  }

  .deck-mode .deck-slide.is-active .info-card,
  .deck-mode .deck-slide.is-active .contact-panel {
    opacity: 1;
  }
}

/* ==========================================================
   Refinement v4 — content-sized home card, illustrations,
   education badges, recognition block, contact icons
   ========================================================== */

/* Frames marked --fit size to their card: no fixed height, no nested scroll. */
.screen-frame--fit {
  height: auto;
  min-height: 0;
  padding: 52px var(--safe-margin) var(--safe-margin);
}

.screen-frame--fit > .info-card {
  position: relative;
  inset: auto;
  overflow: visible;
}

/* Home: text column + city illustration on the right */
.info-card--home {
  justify-content: flex-start;
  gap: 28px;
  padding: 28px 28px 20px;
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(190px, 22%, 240px);
  gap: 32px;
  align-items: stretch;
}

.home-content {
  max-width: none;
}

.home-content .info-card__label {
  margin-bottom: 20px;
}

.home-content h1 {
  max-width: none;
  text-wrap: balance;
}

.home-content .lead {
  max-width: 64ch;
  margin-top: 26px;
}

.home-content .home-note {
  margin-top: 12px;
}

.home-content .capability-list {
  margin-top: 26px;
}

.home-visual {
  position: relative;
  margin: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-secondary);
  background: var(--secondary-surface);
}

.home-visual img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  opacity: 0.92;
}

/* About: portrait as a quiet byline under the narrative */
.title-zone {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.about-byline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: auto 0 0;
  padding-top: 14px;
}

.about-portrait {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* About: give the three texts room so the card does not need to scroll. */
.info-card--split.info-card--about {
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1.1fr);
  column-gap: 28px;
}

.info-card--about .narrative {
  max-width: 58ch;
}

.info-card--about .secondary-card p {
  margin: 0 0 8px;
}

.info-card--about .secondary-card p:last-child {
  margin-bottom: 0;
}

.about-portrait {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

/* Experience: education with institution badges */
.education-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.education-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.edu-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Swap the text for an <img> of the official mark if brand use is cleared. */
.edu-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid rgba(200, 220, 255, 0.35);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* Research: recognition and training, secondary to the themes */
.recognition-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 6px 24px;
}

.recognition-note p,
.info-card--dense .recognition-note p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.45;
}

.recognition-note strong {
  display: block;
  margin-bottom: 2px;
  color: var(--text-primary);
  font-size: var(--label-size);
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

/* Perspective placeholder */
.post-list {
  min-height: 120px;
}

/* Contact icons */
.contact-links i {
  margin-right: 8px;
  font-size: 15px;
  color: var(--accent);
}

/* Short desktop viewports (e.g. 1366 × 768 with browser chrome):
   trim spacing so the home card fits without scrolling. */
@media (min-width: 1025px) and (max-height: 760px) {
  .deck-mode .deck-slide,
  .screen-section {
    padding-top: 20px;
    padding-bottom: calc(var(--nav-clearance) + 14px);
  }

  .screen-frame--fit {
    padding-top: 46px;
  }

  .screen-identity {
    top: 14px;
  }

  .info-card--home {
    gap: 20px;
    padding: 22px 26px 16px;
  }

  .home-content h1 {
    font-size: 44px;
  }

  .home-content .info-card__label {
    margin-bottom: 16px;
  }

  .home-content .lead {
    margin-top: 20px;
  }

  .home-content .capability-list {
    margin-top: 20px;
  }
}

/* Tablet and mobile keep the existing stacked layout; the illustration is dropped. */
@media (max-width: 1024px) {
  .home-layout {
    grid-template-columns: 1fr;
  }

  .home-visual {
    display: none;
  }

  .info-card--home {
    padding: var(--card-padding);
  }

  .recognition-note {
    grid-template-columns: 1fr;
  }

  .about-portrait {
    width: 72px;
    height: 72px;
  }
}

/* Very short windows fall back to normal document scrolling (see index.html). */
@media (max-height: 559px) {
  .screen-frame {
    height: auto;
    min-height: 0;
    padding: 52px var(--safe-margin) var(--safe-margin);
  }

  .info-card {
    position: relative;
    inset: auto;
    overflow: visible;
  }
}

@media (max-width: 1024px), (prefers-reduced-motion: reduce) {
  .info-card--split.info-card--about {
    grid-template-columns: 1fr;
  }

  .info-card--about .narrative {
    max-width: none;
  }
}

/* Fixed-height frames stop above the floating navigation. */
@media (min-width: 1025px) and (min-height: 560px) and (prefers-reduced-motion: no-preference) {
  .deck-mode .deck-slide {
    padding-bottom: calc(var(--nav-clearance) + 22px);
  }

  .screen-frame {
    height: min(calc(100svh - 28px - var(--nav-clearance) - 22px), var(--screen-max-height));
  }
}

@media (min-width: 1025px) and (max-height: 760px) and (prefers-reduced-motion: no-preference) {
  .screen-frame {
    height: min(calc(100svh - 20px - var(--nav-clearance) - 14px), var(--screen-max-height));
  }
}

.info-card--about .secondary-card {
  padding: 12px 14px;
}

/* Research: the largest theme spans the row with its list in two columns */
.info-card--research .theme-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.info-card--research .theme-block--wide {
  grid-column: 1 / -1;
}

.info-card--research .theme-block--wide .publication-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 20px;
}

.info-card--research {
  grid-template-rows: auto auto auto auto;
  align-content: start;
}

@media (max-width: 1024px), (prefers-reduced-motion: reduce) {
  .info-card--research .theme-row,
  .info-card--research .theme-block--wide .publication-list {
    grid-template-columns: 1fr;
  }
}

.info-card--dense .timeline-item {
  padding: 7px 0;
}

.info-card--research {
  gap: 14px;
}

.info-card--research .recognition-note {
  margin-top: 0;
}

.info-card--dense .section-title {
  margin-bottom: -8px;
}

/* ==========================================================
   v5 — every card fills the same fixed frame; footers pinned
   ========================================================== */

/* Home: content on top, footer at the bottom of the frame */
.info-card--home {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.info-card--home .home-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.info-card--home .home-content {
  align-self: center;
}

.info-card__footer {
  margin-top: auto;
}

/* Footers stay in the same place even when a long card scrolls. */
@media (min-width: 1025px) and (min-height: 560px) and (prefers-reduced-motion: no-preference) {
  .info-card--rows > .info-card__footer,
  .info-card--split > .info-card__footer {
    position: sticky;
    bottom: -16px;
    z-index: 2;
    margin-bottom: -16px;
    padding-bottom: 16px;
    background: rgb(13, 17, 24);
  }
}

/* Perspective: empty body takes the free space */
.info-card--placeholder .post-list {
  min-height: 0;
}

/* Square arrow buttons */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  text-decoration: none;
}

.icon-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover,
.icon-button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.icon-button--off {
  opacity: 0.28;
}

.button-group {
  align-items: center;
}

.contact-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contact-footer .meta {
  margin: 0;
}

/* About: larger portrait, no caption */
.about-byline {
  padding-top: 20px;
}

@media (max-width: 1024px) {
  .about-portrait {
    width: 104px;
    height: 104px;
  }

  .info-card--home {
    overflow: visible;
  }
}

/* Same footer geometry on every card: divider, text and buttons line up. */
@media (min-width: 1025px) and (min-height: 560px) and (prefers-reduced-motion: no-preference) {
  .info-card {
    padding-bottom: 16px;
  }

  .info-card > .info-card__footer {
    box-sizing: border-box;
    height: 64px;
    align-items: center;
    padding-top: 12px;
  }

  .info-card--home > .info-card__footer {
    margin-bottom: 0;
    padding-bottom: 0;
    height: 48px;
  }

  .info-card--rows > .info-card__footer,
  .info-card--split > .info-card__footer {
    height: 64px;
  }

  .education-meta {
    gap: 2px;
  }

  .edu-badge {
    padding: 0 5px;
    font-size: 9.5px;
    line-height: 1.5;
  }
}

@media (min-width: 1025px) and (max-height: 700px) {
  .home-content h1 {
    font-size: 40px;
  }

  .home-content .info-card__label {
    margin-bottom: 12px;
  }

  .home-content .lead {
    margin-top: 14px;
  }

  .home-content .home-note {
    margin-top: 8px;
  }

  .home-content .capability-list {
    margin-top: 14px;
  }

  .info-card--home {
    padding-top: 18px;
  }
}

.info-card--research {
  grid-template-rows: auto auto 1fr auto;
}

.info-card--research .recognition-note {
  align-self: start;
}

.about-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.about-heading .info-card__label {
  margin-bottom: 14px;
}

.info-card--about .narrative {
  margin-top: 14px;
}

.about-heading .about-portrait {
  flex: 0 0 auto;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

@media (max-width: 1024px) {
  .about-heading .about-portrait {
    width: 104px;
    height: 104px;
  }
}

/* ---------- v4: About quote ---------- */
.about-quote {
  margin: 14px 0 0;
  padding: 10px 0 10px 16px;
  border-left: 2px solid var(--accent);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.4;
  font-style: italic;
}

/* ---------- v4: Perspective carousel ---------- */
.post-carousel {
  display: grid;
  grid-template-columns: 40px minmax(0, 640px) 40px;
  justify-content: center;
  align-items: center;
  gap: 14px;
  min-height: 0;
}

.carousel-viewport {
  position: relative;
  display: grid;
  overflow: hidden;
  border-radius: var(--radius-secondary);
}

.carousel-viewport > .post-card {
  grid-area: 1 / 1;
  transition: transform .6s cubic-bezier(.22, .8, .3, 1), opacity .6s ease;
}

.post-card.is-from-right { transform: translateX(100%); opacity: 0; transition: none; }
.post-card.is-from-left  { transform: translateX(-100%); opacity: 0; transition: none; }
.post-card.is-to-left    { transform: translateX(-100%); opacity: 0; }
.post-card.is-to-right   { transform: translateX(100%); opacity: 0; }

.carousel-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  cursor: pointer;
}

.carousel-arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carousel-arrow:hover { background: rgba(255, 255, 255, 0.14); }

.post-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-secondary);
  background: var(--secondary-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color .2s ease, background .2s ease;
}

.post-card:hover,
.post-card:focus-visible {
  border-color: rgba(200, 220, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

.post-card__image {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.post-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-card__title {
  font-size: 26px;
  line-height: 1.15;
  font-weight: 500;
}

.post-card__text {
  color: var(--text-secondary);
}

.post-card__more {
  color: var(--accent);
  font-size: 13px;
}

@media (max-width: 600px) {
  .post-carousel { grid-template-columns: 32px minmax(0, 1fr) 32px; gap: 6px; }
  .carousel-arrow { width: 32px; height: 32px; }
}

/* ---------- v4: Contact form ---------- */
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 22px 0 8px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row--full,
.form-actions {
  grid-column: 1 / -1;
}

.form-row label {
  color: var(--text-secondary);
  font-size: var(--label-size);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font: inherit;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: rgba(200, 220, 255, 0.6);
  background: rgba(255, 255, 255, 0.07);
}

.form-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.contact-form button {
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
}

.contact-form button:disabled {
  opacity: .5;
  cursor: wait;
}

.form-status {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-status--ok { color: #9fe0b5; }
.form-status--error { color: #ffb4a8; }

@media (max-width: 600px) {
  .contact-form { grid-template-columns: 1fr; }
}
