:root {
  --bg: #ececef;
  --bg-start: #f8f8fa;
  --bg-end: #e7e7ea;
  --surface: #f4f4f6;
  --text: #2f2f36;
  --muted: #616173;
  --blue: #2048b2;
  --line-blue: rgba(32, 72, 178, 0.35);
  --on-accent: #ffffff;
  --banner-divider: rgba(0, 0, 0, 0.08);
  --about-copy: #383843;
  --hero-gradient: linear-gradient(135deg, #f5f7ff 0%, #eaedf8 100%);
  --chip-bg: rgba(255, 255, 255, 0.9);
  --card-radius: 8px;
}

:root[data-theme="dark"] {
  --bg: #111827;
  --bg-start: #1a2336;
  --bg-end: #090d16;
  --surface: #1e2636;
  --text: #f3f6ff;
  --muted: #b3bbcc;
  --blue: #ffffff;
  --line-blue: rgba(191, 198, 212, 0.42);
  --on-accent: #111827;
  --banner-divider: rgba(255, 255, 255, 0.16);
  --about-copy: #d5ddef;
  --hero-gradient: linear-gradient(135deg, #1d273a 0%, #111827 100%);
  --chip-bg: rgba(18, 26, 41, 0.92);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 12% -8%, var(--bg-start) 2%, var(--bg) 42%, var(--bg-end) 100%);
  color: var(--text);
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  font-family: "Cormorant Garamond", serif;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

.shell {
  width: min(1200px, 92vw);
  margin: 0 auto;
}

.site-header {
  padding-top: 1.2rem;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.top-nav-meta {
  margin: 0;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.top-nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.top-nav-link {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  text-decoration: none;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: border-color 180ms ease, color 180ms ease;
}

.top-nav-link:hover,
.top-nav-link.active {
  border-color: var(--line-blue);
  color: var(--blue);
}

.theme-toggle {
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.theme-toggle[aria-pressed="true"] {
  background: var(--line-blue);
  color: var(--blue);
}

.profile-banner {
  border-top: 1px solid var(--line-blue);
  border-bottom: 1px solid var(--banner-divider);
  padding: clamp(1.2rem, 3vw, 1.8rem) 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
}

.profile-banner.compact {
  border-bottom: none;
}

.profile-photo {
  width: clamp(72px, 9vw, 108px);
  aspect-ratio: 1;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(32, 72, 178, 0.25);
}

.profile-kicker {
  margin: 0;
  color: var(--blue);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "Space Mono", monospace;
}

.profile-name {
  margin: 1rem 0 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.95;
  font-weight: 500;
}

.profile-tagline {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 60ch;
}

.home-main {
  padding-bottom: 4rem;
}

.projects-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  padding: 0.85rem 0 0.35rem;
}

.projects-filter-label {
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.projects-filter-select {
  appearance: none;
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  background: var(--surface);
  color: var(--blue);
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.42rem 2rem 0.42rem 0.85rem;
  min-width: 170px;
  cursor: pointer;
}

.projects-filter-select:focus {
  outline: 2px solid var(--line-blue);
  outline-offset: 2px;
}

.project-empty-state {
  margin: 1.2rem 0 0;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.home-hero {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.home-hero-banner {
  border-bottom: none;
  margin-top: 0.2rem;
  min-height: clamp(520px, 78vh, 780px);
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 0.9fr);
  gap: clamp(1.4rem, 4vw, 3.8rem);
  align-items: center;
}

.home-hero-copy .profile-name {
  font-size: clamp(2.6rem, 8vw, 5.6rem);
}

.home-hero-copy .profile-tagline {
  font-size: clamp(1.1rem, 2.25vw, 1.45rem);
}

.hero-scroll-link {
  margin-top: 1.2rem;
  display: inline-flex;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--blue);
  color: var(--blue);
  text-decoration: none;
  font-family: "Space Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.45rem 0.72rem;
  box-shadow: 0 0 0 rgba(32, 72, 178, 0);
  transform: translateY(0);
  transition:
    background-color 260ms ease,
    color 260ms ease,
    transform 260ms ease,
    box-shadow 300ms ease;
  will-change: transform, box-shadow;
}

.hero-scroll-link::after {
  content: "";
  position: absolute;
  top: 0;
  left: -130%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.45) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-18deg);
  transition: left 460ms ease;
}

.hero-scroll-link:hover,
.hero-scroll-link:focus-visible {
  background: var(--blue);
  color: var(--on-accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(32, 72, 178, 0.28);
}

.hero-scroll-link:hover::after,
.hero-scroll-link:focus-visible::after {
  left: 140%;
}

.hero-scroll-link:active {
  transform: translateY(-1px);
}

.hero-work-visual {
  position: relative;
  width: min(540px, 100%);
  margin-inline: auto;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 15%, rgba(32, 72, 178, 0.16), transparent 46%),
    radial-gradient(circle at 85% 85%, rgba(32, 72, 178, 0.11), transparent 38%),
    var(--hero-gradient);
  box-shadow: 0 16px 36px rgba(18, 28, 60, 0.14);
}

.hero-work-visual::before {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 20px;
  border: 1px dashed rgba(32, 72, 178, 0.28);
  animation: dashboardPulse 4.8s ease-in-out infinite;
}

.hero-profile-photo {
  width: clamp(130px, 22vw, 186px);
  border-width: 2px;
  z-index: 2;
}

.hero-orbit-ring {
  position: absolute;
  width: 72%;
  height: 72%;
  border-radius: 999px;
  border: 1px solid rgba(32, 72, 178, 0.34);
  animation: orbitRotate 16s linear infinite;
}

.work-chip {
  position: absolute;
  border: 1px solid rgba(32, 72, 178, 0.5);
  background: var(--chip-bg);
  color: var(--blue);
  font-family: "Space Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.35rem 0.56rem;
  border-radius: 999px;
  z-index: 3;
}

.chip-robotics {
  top: 17%;
  left: 16%;
  animation: chipFloat 4.6s ease-in-out infinite;
}

.chip-apps {
  top: 22%;
  right: 15%;
  animation: chipFloat 4.2s ease-in-out infinite 0.7s;
}

.chip-finance {
  bottom: 18%;
  right: 30%;
  animation: chipFloat 4.9s ease-in-out infinite 1.1s;
}

@keyframes orbitRotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes chipFloat {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes dashboardPulse {
  0%,
  100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.02);
  }
}

.project-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(380px, 1.15fr);
  align-items: center;
  gap: clamp(1.5rem, 6vw, 4.2rem);
  padding: clamp(2rem, 6vw, 3.2rem) 0;
  border-top: 1px solid var(--line-blue);
}

.project-content {
  padding-top: 0.3rem;
}

.project-category {
  margin: 0;
  text-transform: capitalize;
  color: var(--accent, var(--blue));
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-decoration: underline;
  font-family: "Space Mono", monospace;
}

.project-title {
  margin: 0.55rem 0 0;
  color: var(--accent, var(--blue));
  font-size: clamp(2.3rem, 5.2vw, 4rem);
  font-weight: 500;
  line-height: 0.9;
}

.project-date {
  margin: 0.8rem 0 1.1rem;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-link {
  display: inline-flex;
  border: 1px solid var(--accent, var(--blue));
  color: var(--accent, var(--blue));
  text-decoration: none;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.3rem 0.62rem;
  transition: background-color 180ms ease, color 180ms ease;
}

.project-link:hover {
  background: var(--accent, var(--blue));
  color: var(--on-accent);
}

.project-image-link {
  text-decoration: none;
}

.project-image {
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(10, 10, 12, 0.12);
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-overlay-dots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
}

.image-overlay-dots span {
  width: clamp(48px, 7vw, 76px);
  height: clamp(48px, 7vw, 76px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  position: absolute;
}

.image-overlay-dots span:nth-child(1) {
  transform: translate(-70px, -58px);
}

.image-overlay-dots span:nth-child(2) {
  transform: translate(0, -58px);
}

.image-overlay-dots span:nth-child(3) {
  transform: translate(-70px, 0);
}

.image-overlay-dots span:nth-child(4) {
  transform: translate(0, 0);
}

.image-overlay-dots span:nth-child(5) {
  transform: translate(-35px, 58px);
}

.project-main {
  padding: 1.4rem 0 3.6rem;
}

.project-detail {
  border-top: 1px solid var(--line-blue);
  padding-top: 1.8rem;
}

.project-detail-title {
  text-align: center;
  margin: 0 0 clamp(1.3rem, 3vw, 2.1rem);
}

.project-detail-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(1.5rem, 5vw, 3.5rem);
}

.project-detail-copy {
  min-width: 0;
}

.project-description {
  font-size: clamp(1.12rem, 2vw, 1.34rem);
  line-height: 1.5;
  margin: 0.85rem 0 1.2rem;
}

.project-highlights {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.45rem;
  font-size: 1.05rem;
}

.project-highlights li {
  line-height: 1.35;
}

.project-back-link {
  margin-top: 1.4rem;
  display: inline-flex;
  text-decoration: none;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 0.73rem;
  color: var(--accent, var(--blue));
  border-bottom: 1px solid currentColor;
}

.project-image-large {
  border-radius: var(--card-radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 12px 28px rgba(8, 10, 16, 0.16);
}

.project-image-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-fallback {
  margin: 0 0 1rem;
  color: #8b2f2f;
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.about-main {
  padding: 1.5rem 0 3.6rem;
}

.about-grid {
  border-top: 1px solid var(--line-blue);
  padding-top: 1.8rem;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1fr);
  gap: clamp(1.5rem, 5vw, 3.6rem);
  align-items: start;
}

.about-title {
  margin: 0;
  font-size: clamp(2rem, 4.7vw, 3.2rem);
  line-height: 0.92;
  color: var(--blue);
}

.about-copy p {
  font-size: clamp(1.1rem, 2vw, 1.32rem);
  line-height: 1.5;
  color: var(--about-copy);
}

.about-links {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.about-links a {
  border: 1px solid rgba(32, 141, 195, 0.45);
  padding: 0.4rem 0.7rem;
  text-decoration: none;
  color: var(--blue);
  font-family: "Space Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.72rem;
}

.about-links a:hover {
  background: var(--blue);
  color: var(--on-accent);
}

.about-figure {
  margin: 0;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(8, 10, 16, 0.14);
}

.about-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 5;
}

.page {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 260ms ease, transform 260ms ease;
}

.page.is-entering {
  opacity: 0;
  transform: translateY(12px);
}

.page.is-leaving {
  opacity: 0;
  transform: translateY(-10px);
}

.site-footer {
  border-top: 1px solid var(--line-blue);
  margin-top: 1.8rem;
  padding: 1.1rem 0 1.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer-copy {
  margin: 0;
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.footer-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.footer-links a,
.footer-links span {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.58rem;
  border: 1px solid var(--line-blue);
  border-radius: 999px;
  color: var(--blue);
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  text-transform: uppercase;
}

.footer-links a:hover {
  background: var(--blue);
  color: var(--on-accent);
}

@media (max-width: 900px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .top-nav-meta {
    font-size: 0.63rem;
    letter-spacing: 0.06em;
  }

  .top-nav-links {
    gap: 0.7rem;
    flex-wrap: wrap;
  }

  .project-row,
  .project-detail-body,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .home-hero {
    min-height: auto;
  }

  .home-hero-banner {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .home-hero-copy .profile-name {
    font-size: clamp(2.3rem, 12vw, 3.8rem);
  }

  .projects-toolbar {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .hero-work-visual {
    width: min(460px, 100%);
    aspect-ratio: 1 / 0.92;
  }

  .project-content {
    order: 1;
  }

  .project-image-link {
    order: 2;
  }

  .project-image,
  .project-image-large,
  .about-figure img {
    aspect-ratio: 16 / 11;
  }

  .image-overlay-dots span {
    width: clamp(40px, 11vw, 56px);
    height: clamp(40px, 11vw, 56px);
  }

  .image-overlay-dots span:nth-child(1) {
    transform: translate(-50px, -38px);
  }

  .image-overlay-dots span:nth-child(2) {
    transform: translate(0, -38px);
  }

  .image-overlay-dots span:nth-child(3) {
    transform: translate(-50px, 0);
  }

  .image-overlay-dots span:nth-child(4) {
    transform: translate(0, 0);
  }

  .image-overlay-dots span:nth-child(5) {
    transform: translate(-25px, 38px);
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 600px) {
  .top-nav {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.7rem;
  }

  .top-nav-meta {
    display: flex;
    width: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.16rem;
    white-space: normal;
  }

  .top-nav-meta span[aria-hidden="true"] {
    display: none;
  }

  .top-nav-links {
    width: auto;
    justify-content: flex-end;
    gap: 0.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
