:root {
  --bg: #0a0d0f;
  --bg-soft: #11161a;
  --panel: #141a1f;
  --text: #eef2f3;
  --muted: #9aa5aa;
  --line: rgba(255,255,255,.12);
  --accent: #8df0c7;
  --accent-soft: rgba(141, 240, 199, .12);
  --max: 1240px;
}

/* Prevent accidental double-tap zoom, including inside scrollable dialogs.
   Native scrolling and deliberate pinch-to-zoom remain available. */
* { box-sizing: border-box; touch-action: manipulation; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  overflow-x: hidden;
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; }

/* A soft light behind the page content; the native cursor stays visible. */
main,
footer {
  position: relative;
  z-index: 1;
}

.cursor-spotlight {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.cursor-spotlight.is-visible { opacity: 1; }

.cursor-glow {
  position: absolute;
  top: -500px;
  left: -500px;
  width: 1000px;
  height: 1000px;
  background: radial-gradient(circle,
    rgba(141, 240, 199, .115) 0%,
    rgba(141, 240, 199, .045) 35%,
    rgba(141, 240, 199, 0) 70%);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .cursor-spotlight { display: block; }
}

.page-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .035;
  z-index: 1000;
  background-image:
    radial-gradient(circle at 20% 20%, white 0 1px, transparent 1px),
    radial-gradient(circle at 80% 60%, white 0 1px, transparent 1px);
  background-size: 34px 34px, 52px 52px;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 22px 4vw;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  background: linear-gradient(to bottom, rgba(10,13,15,.96), rgba(10,13,15,.58), transparent);
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.04em;
}
.brand span { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: .92rem;
  color: var(--muted);
}
.nav-links a { transition: color .2s ease; }
.nav-links a:hover { color: var(--text); }
.nav-cv {
  border: 1px solid var(--line);
  padding: 9px 14px;
  border-radius: 100px;
}
.menu-toggle {
  display: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 26px;
  height: 2px;
  background: white;
  margin: 5px 0;
}

.section {
  width: min(var(--max), 92vw);
  margin: 0 auto;
  padding: 120px 0;
}

.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 48px;
  align-items: center;
  position: relative;
  padding-top: 130px;
}

.eyebrow,
.section-label {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(4.2rem, 10vw, 9rem);
  line-height: .82;
  margin: 20px 0 36px;
  letter-spacing: -.065em;
}
.hero h1 span { color: var(--muted); }

.hero-intro {
  max-width: 690px;
  color: #c1c9cd;
  font-size: clamp(1.1rem, 2vw, 1.42rem);
}

.hero-actions,
.contact-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 100px;
  border: 1px solid var(--line);
  font-size: .92rem;
  font-weight: 600;
  transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.button:hover { transform: translateY(-2px); }
.button.primary {
  background: var(--accent);
  color: #06110c;
  border-color: transparent;
}
.button.ghost:hover { background: rgba(255,255,255,.05); }

.hero-visual {
  display: flex;
  justify-content: flex-end;
}

.engineering-card {
  width: min(460px, 100%);
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 15%, rgba(141,240,199,.2), transparent 25%),
    linear-gradient(145deg, #11171b, #0c1013);
}

.engineering-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 34px 34px;
}

.cad-mark {
  position: absolute;
  left: 10%;
  top: 23%;
  width: 72%;
  aspect-ratio: 1.15;
  border: 1px solid rgba(141,240,199,.55);
  transform: rotate(-8deg);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(141,240,199,.045);
  box-shadow: inset 0 0 80px rgba(141,240,199,.05);
}
.cad-mark::before,
.cad-mark::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 12px;
  inset: 12%;
}
.cad-mark::after {
  inset: 25%;
  border-color: rgba(141,240,199,.3);
}
.cad-mark span {
  font-family: "Space Grotesk", sans-serif;
  font-size: 4rem;
  line-height: 1;
  font-weight: 700;
}
.cad-mark strong {
  font-size: .75rem;
  letter-spacing: .22em;
  color: var(--accent);
}
.spec-row {
  position: absolute;
  bottom: 6%;
  left: 7%;
  right: 7%;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .1em;
}

.scroll-cue {
  position: absolute;
  bottom: 24px;
  left: 0;
  color: var(--muted);
  font-size: .78rem;
}

.split-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 80px;
  border-top: 1px solid var(--line);
}

.section-content h2,
.section-heading h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.4rem, 5vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -.05em;
  margin: 0 0 36px;
  max-width: 900px;
}
.section-content > p,
.section-heading > p {
  max-width: 790px;
  color: var(--muted);
  font-size: 1.05rem;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 54px;
}

.skills-grid > div {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.skill-number {
  font-size: .72rem;
  color: var(--accent);
}
.skills-grid h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 10px 0 8px;
}
.skills-grid p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
}

.experience-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 38px;
  padding: 0 0 50px;
  margin-bottom: 50px;
  border-bottom: 1px solid var(--line);
}
.experience-item:last-child { border-bottom: 0; }
.experience-meta {
  display: flex;
  flex-direction: column;
  color: var(--muted);
  font-size: .8rem;
}
.experience-body h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  margin: 0;
}
.experience-body h3 {
  color: var(--accent);
  margin: 2px 0 18px;
  font-size: 1rem;
}
.experience-body p {
  color: var(--muted);
  max-width: 720px;
}
.tags,
.project-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}
.tags span,
.project-details span {
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 7px 11px;
  font-size: .72rem;
  color: #bac3c7;
}

.projects-section { border-top: 1px solid var(--line); }
.section-heading { margin-bottom: 70px; }
.section-heading .section-label { margin-bottom: 20px; }

.project-card {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  gap: 54px;
  align-items: center;
  padding: 62px 0;
  border-top: 1px solid var(--line);
}
.project-card.reverse {
  grid-template-columns: .75fr 1.25fr;
}
.project-card.reverse .project-image { order: 2; }
.project-card.reverse .project-info { order: 1; }

.project-image {
  min-height: 480px;
  border-radius: 22px;
  border: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.project-image-one {
  background: linear-gradient(145deg, #16231f, #0d1113 65%);
}
.project-image-two {
  background: linear-gradient(145deg, #181b27, #0d1113 65%);
}
.project-image-three {
  background: linear-gradient(145deg, #241c16, #0d1113 65%);
}
.project-image-four {
  background: linear-gradient(145deg, #23202b, #0d1113 65%);
}
.project-image-five {
  background: linear-gradient(145deg, #13242c, #0d1113 65%);
}
.project-card .project-image > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}
.project-placeholder {
  position: absolute;
  inset: 8%;
  border: 1px dashed rgba(255,255,255,.2);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}
.project-placeholder span {
  font-size: .68rem;
  letter-spacing: .16em;
}
.project-placeholder strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.4rem, 3vw, 2.4rem);
  color: rgba(255,255,255,.7);
}
.project-index {
  color: var(--accent);
  font-size: .78rem;
  margin-bottom: 18px;
}
.project-info h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1;
  letter-spacing: -.04em;
  margin: 0 0 20px;
}
.project-info p { color: var(--muted); }
.text-link {
  display: inline-block;
  margin-top: 25px;
  border: 0;
  border-bottom: 1px solid rgba(141,240,199,.4);
  padding: 0 0 3px;
  background: none;
  color: var(--accent);
  cursor: pointer;
}

.education-row {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 25px 0;
  border-bottom: 1px solid var(--line);
}
.education-row span { color: var(--muted); }

.contact-section {
  min-height: 80vh;
  display: grid;
  align-items: center;
}
.contact-inner {
  max-width: 920px;
}
.contact-inner h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(4rem, 9vw, 8rem);
  line-height: .9;
  letter-spacing: -.065em;
  margin: 20px 0 30px;
}
.contact-inner h2 span { color: var(--accent); }
.contact-inner > p:not(.eyebrow):not(.contact-note) {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.08rem;
}
.contact-note {
  color: #748086;
  font-size: .75rem;
  margin-top: 22px;
}

footer {
  width: min(var(--max), 92vw);
  margin: 0 auto;
  padding: 30px 0 46px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .78rem;
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .2s ease, transform .2s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
}
.modal.open { display: block; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(10px);
}
.modal-dialog {
  position: absolute;
  top: 4vh;
  left: 50%;
  bottom: 4vh;
  width: min(1600px, 94vw);
  transform: translateX(-50%);
}
.modal-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px;
  height: 100%;
  min-height: 0;
}
.modal-media,
.modal-panel {
  min-width: 0;
  min-height: 0;
}
.modal-media {
  display: grid;
  grid-auto-rows: minmax(200px, var(--gallery-row-height, 100%));
  gap: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-media > .project-image {
  width: 100%;
  height: 100%;
  min-height: 0;
  background-color: #11161a;
  border-radius: 24px;
}
.modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  padding: clamp(12px, 2vw, 32px);
  object-fit: contain;
}
.modal-media img.model-image {
  padding: 8px;
}
.modal-media .project-placeholder {
  padding: 20px;
}
.modal-media .project-placeholder strong {
  font-size: clamp(1.3rem, 2.4vw, 2.3rem);
  overflow-wrap: anywhere;
}
.modal-panel {
  background: #11161a;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 78px clamp(28px, 3vw, 50px) 42px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #11161a;
  color: var(--text);
  line-height: 1;
  cursor: pointer;
}
.modal-close svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .modal-close:hover {
    color: var(--accent);
    border-color: var(--accent);
  }
}
.modal-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.modal-panel h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2.2rem, 3.8vw, 4rem);
  line-height: 1.03;
  letter-spacing: -.05em;
  overflow-wrap: break-word;
  margin: 12px 0 30px;
}
.modal-panel h3 {
  color: var(--accent);
  font-size: .8rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-top: 36px;
}
.modal-panel p,
.modal-panel li {
  color: var(--muted);
}
.modal-panel ul { padding-left: 20px; }

@media (max-width: 900px) {
  .site-header { padding: 18px 5vw; }
  .menu-toggle { display: block; }
  .nav-links {
    position: fixed;
    inset: 0;
    background: rgba(10,13,15,.98);
    display: none;
    flex-direction: column;
    justify-content: center;
    font-size: 1.35rem;
    z-index: -1;
  }
  .nav-links.open { display: flex; }
  .hero {
    grid-template-columns: 1fr;
    padding-top: 150px;
  }
  .hero-visual { justify-content: flex-start; }
  .engineering-card { max-width: 520px; }
  .scroll-cue { display: none; }
  .split-section {
    grid-template-columns: 1fr;
    gap: 35px;
  }
  .skills-grid { grid-template-columns: 1fr; }
  .experience-item {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .project-card,
  .project-card.reverse {
    grid-template-columns: 1fr;
  }
  .project-card.reverse .project-image,
  .project-card.reverse .project-info {
    order: initial;
  }
  .project-image { min-height: 340px; }
  .modal-dialog {
    top: 2vh;
    bottom: 2vh;
  }
  .modal-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content max-content;
    align-content: start;
    gap: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .modal-media {
    grid-template-rows: none;
    grid-auto-rows: auto;
    overflow: visible;
  }
  .modal-media > .project-image {
    height: auto;
    aspect-ratio: 8 / 5;
  }
  .modal-panel {
    overflow: visible;
    padding: 34px 30px 40px;
  }
}

@media (max-width: 600px) {
  .section { padding: 90px 0; }
  .hero { padding-top: 125px; }
  .hero h1 { font-size: 4.2rem; }
  .hero-actions .button,
  .contact-actions .button { width: 100%; }
  .engineering-card { aspect-ratio: 1 / 1.18; }
  .education-row {
    flex-direction: column;
    gap: 5px;
  }
  footer {
    flex-direction: column;
    gap: 6px;
  }
  .modal-dialog { width: 96vw; }
  .modal-layout { gap: 12px; }
  .modal-panel { padding: 28px 22px 34px; }
  .modal-close { top: 12px; right: 12px; }
}

/* Keep the gallery panels full size as more views are added. */
.image-expand { padding: 0; appearance: none; font: inherit; color: inherit; cursor: zoom-in; }
.image-expand:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.image-expand-label { position: absolute; right: 14px; bottom: 12px; padding: 5px 9px; border-radius: 20px; background: rgba(10,13,15,.78); color: #d5dedc; font-size: 11px; }
.gallery-scroll-hint { position: absolute; left: 14px; bottom: 12px; z-index: 2; margin: 0; padding: 7px 11px; border-radius: 20px; background: rgba(10,13,15,.86); color: #d5dedc; font-size: 11px; pointer-events: none; }
.gallery-scroll-hint[hidden] { display: none; }
.image-viewer { border: 0; padding: 0; background: transparent; color: var(--text); max-width: none; max-height: none; width: 96vw; overflow: visible; }
.image-viewer::backdrop { background: rgba(0,0,0,.88); backdrop-filter: blur(12px); }
.image-viewer-panel { position: relative; border: 1px solid var(--line); border-radius: 24px; background: #11161a; padding: 66px 16px 16px; }
.image-viewer img { display: block; width: 100%; height: 74vh; height: 74dvh; object-fit: contain; }
.image-viewer p { margin: 12px auto 0; max-width: 850px; text-align: center; color: #a7b5b1; font-size: 13px; }
@media (max-width: 900px) { .gallery-scroll-hint { display: none; } }
@media (max-width: 600px) { .image-viewer-panel { padding: 60px 8px 12px; border-radius: 18px; } .image-viewer img { height: 65vh; height: 65dvh; } }

/* Use the same drawn arrow on every platform, without emoji substitution. */
.arrow-icon { display: inline-block; width: 1em; height: 1em; vertical-align: -.1em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
/* Dialog focus is retained, but taps do not leave a selection ring behind. */
.modal-close, .image-expand, .project-open { -webkit-tap-highlight-color: transparent; }
html[data-input-mode="pointer"] .modal-close:focus,
html[data-input-mode="pointer"] .image-expand:focus,
html[data-input-mode="pointer"] .project-open:focus { outline: none; }

/* Fixed isometric mechanical assembly. */
#mechanical-system-3d { width: 100%; min-width: 0; }
#mechanical-system-3d .ms-product { background: #0c1214; border: 1px solid #2d3836; border-radius: 25px; overflow: hidden; }
#mechanical-system-3d canvas { display: block; width: 100%; height: auto; aspect-ratio: 6 / 5; }

/* Hover feedback is restricted to a mouse or trackpad, avoiding sticky touch states. */
@media (hover: hover) and (pointer: fine) {
  .project-card > .project-image::after,
  .modal-media > .image-expand::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid rgba(142, 234, 201, .7);
    box-shadow: inset 0 0 32px rgba(142, 234, 201, .16);
    background: radial-gradient(ellipse at center, rgba(142, 234, 201, .06), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: none;
  }
  .project-card:has(> .project-image:hover, > .project-info h3:hover, > .project-info > p:hover) > .project-image::after,
  .modal-media > .image-expand:hover::after {
    opacity: 1;
  }
}
