/* Minimal academic portfolio (index.html).
   The legacy classes.html continues to use css/styles.css. */

:root {
  --background: #fff;
  --ink: #181818;
  --body: #505050;
  --muted: #777;
  --line: #e5e5e5;
  --soft: #f7f7f7;
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --container: 1480px;
  --header-height: 64px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 0;
  /* One complete panel at a time on larger screens, without wheel-event hijacking. */
  scroll-snap-type: y proximity;
}

@media (min-width: 900px) and (min-height: 700px) {
  html { scroll-snap-type: y mandatory; }
}

/* Expanded repositories can exceed a viewport; allow uninterrupted natural scrolling. */
html.expanded-repositories { scroll-snap-type: none; }

body {
  margin: 0;
  background: var(--background);
  color: var(--body);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid #576f8c;
  outline-offset: 5px;
}

[hidden] { display: none !important; }

.container {
  width: min(var(--container), calc(100% - clamp(40px, 7vw, 140px)));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  top: -100px;
  left: 14px;
  z-index: 1000;
  padding: 10px 15px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus { top: 10px; }

/* Transparent on the image; light once the page moves into the content. */
.site-header {
  --nav-text: #fff;
  --nav-muted: rgba(255,255,255,.80);
  --nav-edge: rgba(255,255,255,.22);
  --nav-menu: rgba(11,17,22,.98);
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  background: rgba(9,15,20,.22);
  border-bottom: 1px solid rgba(255,255,255,.15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background .26s ease, border-color .26s ease, box-shadow .26s ease;
}

.site-header.is-scrolled {
  --nav-text: var(--ink);
  --nav-muted: #666;
  --nav-edge: var(--line);
  --nav-menu: #fff;
  background: rgba(255,255,255,.97);
  border-bottom-color: var(--line);
  box-shadow: 0 3px 16px rgba(0,0,0,.025);
}

.nav-shell {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  color: var(--nav-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.018em;
  white-space: nowrap;
  transition: color .26s ease;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 35px);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  display: inline-block;
  color: var(--nav-muted);
  font-size: 13px;
  transition: color .2s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="location"] { color: var(--nav-text); }

.menu-toggle {
  display: none;
  border: 1px solid var(--nav-edge);
  border-radius: 6px;
  background: transparent;
  padding: 5px 10px;
  color: var(--nav-text);
  font-size: 18px;
  line-height: 1.3;
  cursor: pointer;
}

/* Restrained cinematic hero, using the original starfield photograph. */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-height) + 72px) 0 100px;
  overflow: hidden;
  background: #0b1218;
  color: #fff;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(90deg, rgba(5,9,15,.82) 0%, rgba(6,12,18,.53) 48%, rgba(6,12,18,.18) 100%),
    linear-gradient(0deg, rgba(5,10,15,.44), rgba(5,10,15,.08) 52%, rgba(5,10,15,.16)),
    url("../wallpaper.jpg");
  background-position: center, center, center 50%;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero-inner { position: relative; z-index: 1; }

.hero,
.content-section { scroll-snap-align: start; }

.hero-content { max-width: 670px; }

.hero-eyebrow {
  margin: 0 0 25px;
  color: rgba(255,255,255,.83);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  line-height: 1.65;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1, h2 { color: var(--ink); font-family: var(--font); }

.hero h1 {
  margin: 0;
  color: #fff;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(72px, 8.4vw, 109px);
  font-weight: 500;
  letter-spacing: -.042em;
  line-height: .86;
  text-wrap: balance;
}

.hero h1 span { display: block; }

.hero-description {
  max-width: 430px;
  margin: 30px 0 24px;
  color: rgba(255,255,255,.83);
  font-size: clamp(15px, 1.7vw, 17px);
  line-height: 1.75;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255,255,255,.6);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: border-color .2s ease, gap .2s ease;
}

.hero-cta:hover { gap: 17px; border-color: #fff; }

.hero-scroll {
  position: absolute;
  right: max(28px, calc((100vw - min(var(--container), calc(100vw - clamp(40px, 7vw, 140px)))) / 2));
  bottom: 31px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,.80);
  font-size: 11px;
  letter-spacing: .035em;
  transition: color .2s ease;
}

.hero-scroll:hover { color: #fff; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: #b7b7b7;
  text-underline-offset: 5px;
  transition: text-decoration-color .2s ease;
}

.text-link:hover { text-decoration-color: var(--ink); }

#about { border-top: 0; }

/* Quiet entrance, without parallax, autoplay media or scroll-jacking. */
@media (prefers-reduced-motion: no-preference) {
  .hero-content { animation: hero-appear .85s cubic-bezier(.22, 1, .36, 1) both; }
  @keyframes hero-appear {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* Three clear content sections, with whitespace instead of cards. */
.content-section {
  border-top: 1px solid var(--line);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--header-height) + 55px) 0 72px;
  scroll-margin-top: 0;
}

#about { background: #fff; }
#repositories { background: #f8f8f8; }
#animations { background: #fff; }

.section-layout {
  display: grid;
  grid-template-columns: minmax(180px, .65fr) minmax(0, 1.35fr);
  align-items: center;
  column-gap: clamp(40px, 5vw, 95px);
}

h2 {
  margin-bottom: 0;
  font-size: clamp(30px, 3.4vw, 47px);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: 1.25;
}

.about-copy {
  max-width: 790px;
  margin-bottom: 32px;
  color: var(--body);
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.85;
}

.link-row { display: flex; flex-wrap: wrap; gap: 18px 32px; }

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: clamp(34px, 5vh, 52px);
}

.section-description {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.subtle-link { flex-shrink: 0; margin-top: 10px; }

/* Compact repository rows replace fifteen oversized cards. */
.repo-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(35px, 5vw, 92px);
  border-top: 1px solid var(--line);
}

.repo-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: clamp(22px, 3vh, 30px) 0;
  border-bottom: 1px solid var(--line);
  min-width: 0;
  min-height: 115px;
  transition: color .2s ease;
}

.repo-main { display: flex; flex-direction: column; min-width: 0; }

.repo-main strong {
  font-size: clamp(15px, 1.15vw, 18px);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  letter-spacing: -.012em;
  overflow-wrap: anywhere;
}

.repo-main > span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: clamp(13px, .94vw, 15px);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.repo-arrow {
  color: #929292;
  font-size: 16px;
  line-height: 1.3;
  transition: transform .2s ease, color .2s ease;
}

.repo-item:hover .repo-main strong { text-decoration: underline; text-underline-offset: 3px; }
.repo-item:hover .repo-arrow { color: var(--ink); transform: translate(2px, -2px); }

.repo-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  margin-top: 24px;
}

.text-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-color: #b7b7b7;
}

.text-button:hover { text-decoration-color: var(--ink); }

.repo-status { font-size: 12px; color: var(--muted); }

/* Gentle, seamless simulation slideshow. Images move; media does not autoplay. */
.slideshow-controls {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin: -9px 0 22px;
}

.slideshow-caption {
  color: var(--muted);
  font-size: 12px;
}

.slideshow-toggle {
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid #bdbdbd;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.slideshow-toggle:hover { border-color: var(--ink); }

.simulation-marquee {
  --slide-gap: clamp(18px, 2vw, 30px);
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
}

/* Two identical sets are laid end to end, making -50% an exact loop. */
.simulation-track {
  display: flex;
  width: max-content;
}

.simulation-set {
  display: flex;
  flex: 0 0 auto;
  gap: var(--slide-gap);
  padding-right: var(--slide-gap);
  width: max-content;
}

.simulation-item {
  display: block;
  flex: 0 0 clamp(255px, 29vw, 450px);
  min-width: 0;
  scroll-snap-align: start;
}

.simulation-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: border-color .2s ease;
}

.simulation-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.simulation-caption {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-top: 14px;
  color: var(--ink);
}

.simulation-caption strong {
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 600;
  line-height: 1.5;
}

.simulation-caption > span { color: #878787; }

.simulation-item:hover .simulation-preview { border-color: #aaa; }
.simulation-item:hover .simulation-caption strong { text-decoration: underline; text-underline-offset: 3px; }

/* Activated only when JavaScript has cloned the first set successfully. */
@media (prefers-reduced-motion: no-preference) {
  .simulation-marquee.is-playing {
    overflow-x: hidden;
    scroll-snap-type: none;
    scrollbar-width: none;
  }

  .simulation-marquee.is-playing .simulation-track {
    animation: simulation-drift 55s linear infinite;
    will-change: transform;
  }

  .simulation-marquee.is-playing:hover .simulation-track,
  .simulation-marquee.is-playing:focus-within .simulation-track,
  .simulation-marquee.is-playing.is-paused .simulation-track {
    animation-play-state: paused;
  }

  @keyframes simulation-drift {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(-50%, 0, 0); }
  }
}

/* The footer belongs to the final full-viewport section, not a separate half-screen. */
#animations { padding: 0; }

#animations > .container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: calc(var(--header-height) + 54px);
  padding-bottom: 48px;
}

#animations .site-footer {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
}

/* One distinct section per screen. The sections fill the viewport horizontally
   and vertically; min-height lets long repository lists grow without clipping. */
main > section.screen-section {
  width: 100%;
  min-height: 100vh;  /* older browsers */
  min-height: 100svh; /* stable viewport with browser chrome */
  min-height: 100dvh; /* visible viewport, including Safari changes */
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

/* Do not prevent shorter displays, large text, or expanded content from scrolling. */
@media (max-width: 899px), (max-height: 849px) {
  main > section.screen-section { scroll-snap-stop: normal; }
}

/* Quiet footer. */
.site-footer { padding: 24px 0 36px; border-top: 1px solid var(--line); }

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 12px;
}

.footer-inner a { color: var(--ink); }
.footer-inner a:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 900px) {
  html { scroll-snap-type: y proximity; }
  .section-layout { grid-template-columns: minmax(140px, .6fr) minmax(0, 1.4fr); column-gap: 28px; }
  .repo-list { column-gap: 24px; }
}

@media (max-width: 670px) {
  :root { --header-height: 60px; }
  html { scroll-snap-type: none; }
  .container { width: calc(100% - 36px); }
  .nav-shell { position: relative; }
  .menu-toggle { display: inline-block; }
  .nav-links {
    display: none;
    position: absolute;
    top: calc(var(--header-height) - 1px);
    right: -18px;
    left: -18px;
    padding: 9px 18px 17px;
    background: var(--nav-menu);
    border-bottom: 1px solid var(--nav-edge);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  .nav-links.is-open { display: flex; }
  .nav-links a { display: block; padding: 11px 0; font-size: 14px; }
  .hero {
    min-height: 100vh;
    min-height: 100svh;
    padding: calc(var(--header-height) + 60px) 0 88px;
  }
  .hero h1 { font-size: clamp(68px, 12vw, 91px); }
  .hero-description { max-width: 390px; }
  .hero-scroll { right: 18px; bottom: 26px; }
  .content-section { padding: calc(var(--header-height) + 30px) 0 54px; }
  .section-layout { grid-template-columns: 1fr; gap: 23px; }
  .about-copy { font-size: 16px; line-height: 1.85; }
  .section-heading { align-items: flex-start; }
  .repo-list { grid-template-columns: 1fr; }
  .repo-item { min-height: 0; padding: 18px 0; }
  .simulation-item { flex-basis: min(82vw, 360px); }
  .slideshow-controls { margin-top: 0; }
  #animations { padding: 0; }
  #animations > .container { padding-top: calc(var(--header-height) + 30px); padding-bottom: 48px; }
}

@media (max-width: 460px) {
  .hero { min-height: 100vh; min-height: 100svh; padding-top: calc(var(--header-height) + 60px); }
  .hero h1 { font-size: clamp(58px, 14.2vw, 76px); }
  .hero-media { background-position: center, center, 54% 50%; }
  .hero-eyebrow { font-size: 10px; letter-spacing: .15em; }
  .section-heading { display: block; }
  .subtle-link { margin-top: 13px; }
  .simulation-item { flex-basis: min(84vw, 360px); }
  .simulation-preview { aspect-ratio: 16 / 10; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-height: 699px) {
  /* Short/landscape screens must never be forced to skip overflowed content. */
  html { scroll-snap-type: none; }
  .content-section { padding-top: calc(var(--header-height) + 32px); padding-bottom: 36px; }
  #animations > .container { padding-top: calc(var(--header-height) + 32px); padding-bottom: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .simulation-marquee { overflow-x: auto; scroll-snap-type: x proximity; }
  .simulation-track { animation: none !important; transform: none !important; }
  html { scroll-behavior: auto; scroll-snap-type: none; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
