:root {
  color-scheme: dark;
  --background: #15131a;
  --surface: #201d27;
  --line: #393443;
  --text: #f6f3fb;
  --muted: #b9b1c5;
  --accent: #e8f8ac;
  --purple: #bba8f3;
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
section, details { scroll-margin-top: 24px; }
.shell { width: min(1170px, calc(100% - 72px)); margin-inline: auto; }
.skip { position: absolute; z-index: 5; top: 10px; left: 10px; padding: 12px; background: var(--accent); color: var(--background); transform: translateY(-150%); }
.skip:focus { transform: none; }

.header {
  min-height: 83px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}
.wordmark { font-weight: 800; font-size: 27px; letter-spacing: -.06em; }
.wordmark span { color: var(--accent); }
.header nav { display: flex; gap: clamp(14px, 3.5vw, 44px); color: var(--muted); }
.header nav a, .header-contact { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.header nav a:hover, .header-contact:hover, .footer a:hover { color: var(--accent); }
.header-contact { gap: 12px; font-weight: 600; }

.hero {
  display: grid;
  grid-template-columns: 1.16fr minmax(0, 1fr);
  align-items: center;
  gap: clamp(32px, 7vw, 100px);
  padding-block: clamp(48px, 7vw, 98px);
  border-bottom: 1px solid var(--line);
}
.eyebrow { margin: 0 0 18px; color: var(--purple); font-size: 12px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; }
h1, h2, h3, p { overflow-wrap: break-word; }
h1 { margin: 0; font-size: clamp(62px, 9vw, 132px); font-weight: 760; letter-spacing: -.085em; line-height: .91; }
.title-accent { color: var(--accent); }
.title-stage { position: relative; width: fit-content; max-width: 100%; overflow: hidden; }
.title-stage.has-runner h1 { padding-top: max(.45em, 37px); }
.title-line { display: inline-block; white-space: nowrap; }
.title-baseline { display: inline-block; width: 0; height: 0; }
.title-runner, .title-jump { position: absolute; inset: 0; width: 100%; height: 100%; }
.title-runner { pointer-events: none; }
.title-jump { border: 0; padding: 0; background: transparent; }
.title-jump:focus-visible { outline-offset: -3px; }
.hero-actions { display: flex; align-items: center; gap: 10px; }
.runner-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-size: 16px;
}
.runner-toggle:hover { color: var(--accent); }
.intro { color: var(--muted); max-width: 390px; line-height: 1.65; font-size: clamp(16px, 1.8vw, 20px); margin: 27px 0; }
.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 16px;
  border: 0;
  border-radius: 8px;
  padding: 12px 19px;
  color: #1c2414;
  background: var(--accent);
  font-size: 14px;
  font-weight: 750;
  transition: background .18s ease;
}
.button:hover { background: #f3ffd3; }
.portrait { margin: 0; min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.portrait-photo { position: relative; isolation: isolate; }
.portrait-like {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 11px;
  padding: 0;
  background: transparent;
  touch-action: manipulation;
}
.portrait img { width: 100%; height: auto; aspect-ratio: 1.05; object-fit: cover; object-position: center 42%; border-radius: 11px; }
.portrait-heart {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  color: #ff6b9e;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 34px;
  line-height: 1;
  text-shadow: 0 2px 12px #a02256aa;
  animation: portrait-heart-flight 900ms ease-out both;
}

@keyframes portrait-heart-flight {
  0% { transform: translate(-50%, -50%) scale(.45); opacity: .85; }
  30% { transform: translate(-50%, calc(-50% - 18px)) scale(1.35); opacity: 1; }
  100% { transform: translate(-50%, calc(-50% - 125px)) scale(1.6); opacity: 0; }
}

@keyframes portrait-heart-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}
.portrait figcaption { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 7px 5px; font-size: 13px; font-weight: 700; }
.portrait figcaption span { color: var(--muted); font-weight: 400; }
.portrait-likes {
  margin: 8px 7px 4px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.portrait-likes > span { margin-right: 4px; color: #ff6b9e; }
.portrait-likes strong { margin-left: 4px; color: var(--text); font-variant-numeric: tabular-nums; }

.section { padding-block: clamp(40px, 6vw, 78px); border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 12px 24px; margin-bottom: 27px; }
h2 { margin: 0; font-size: clamp(30px, 5vw, 54px); line-height: 1.02; letter-spacing: -.058em; }
.section-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.project { min-width: 0; grid-column: span 4; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.project:first-child, .project:nth-child(2) { grid-column: span 6; }
.project:nth-last-child(-n+2) { grid-column: span 6; }
.project-cover { display: grid; place-items: center; width: 100%; aspect-ratio: 1.68; background: radial-gradient(ellipse at center, #423752, #1b1822 72%); overflow: hidden; }
.project-cover img { width: 100%; height: 100%; min-height: 0; object-fit: contain; transition: transform .24s ease; }
.project-cover:hover img { transform: scale(1.035); }
.project-cover:focus-visible { outline-offset: -5px; }
.project-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 85px; padding: 14px 16px; }
.project-caption h3 { margin: 0 0 4px; font-size: 19px; letter-spacing: -.035em; }
.project-caption p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.project-thumbnails { display: flex; gap: 6px; flex-shrink: 0; }
.project-thumbnail { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #18151e; }
.project-thumbnail:hover { border-color: var(--accent); }
.project-thumbnail img { width: 100%; height: 100%; object-fit: contain; }

.about { display: grid; grid-template-columns: 1fr 1.75fr; gap: 24px; }
.about-copy { max-width: 680px; }
.about-copy p { margin: 0 0 16px; color: var(--muted); font-size: 17px; line-height: 1.7; }
.skills { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0; }
.skills li { background: var(--surface); border: 1px solid var(--line); padding: 7px 11px; border-radius: 6px; font-size: 12px; }
.about-copy .web-project { margin-bottom: 0; font-size: 14px; }
.web-project a { color: var(--purple); text-decoration: underline; text-underline-offset: 3px; }
.experiments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
summary { cursor: pointer; min-height: 55px; padding: 16px; color: var(--text); font-weight: 650; }
summary::marker { color: var(--purple); }
form { display: grid; gap: 12px; padding: 4px 16px 16px; font-size: 14px; }
form label { display: grid; gap: 6px; line-height: 1.45; }
form p { color: var(--muted); margin: 0; line-height: 1.5; }
form p:empty { display: none; }
form input { min-height: 44px; width: 100%; border: 1px solid #554d62; border-radius: 6px; padding: 8px 10px; color: var(--text); background: var(--background); }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.subtle { color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; min-height: 44px; padding-inline: 12px; }
.subtle:hover:enabled { border-color: var(--purple); }
.contact { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.contact-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 20px; }
.contact-email { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); font-size: 14px; }
.contact-email:hover { color: var(--accent); }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding-block: 25px; color: var(--muted); font-size: 13px; }

.viewer { width: min(1160px, calc(100% - 24px)); max-height: 94dvh; padding: 0; border-radius: 15px; border: 1px solid var(--line); background: var(--background); color: var(--text); overflow: auto; }
.viewer::backdrop { background: #0b0910df; }
body:has(.viewer[open]) { overflow: hidden; }
.viewer-bar, .viewer-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }
.viewer-bar h2 { font-size: 21px; }
.viewer-bar p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.viewer-button { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; color: var(--text); font-size: 22px; }
.viewer-button:hover { border-color: var(--purple); }
.viewer-stage { display: grid; place-items: center; background: #100e14; height: min(68dvh, 780px); padding: 8px; }
.viewer-stage img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.viewer-controls a { font-size: 13px; color: var(--purple); text-align: center; padding: 10px 0; }
.viewer-controls a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery .project { grid-column: auto; }
  .gallery .project:last-child { grid-column: 1 / -1; }
  .gallery .project:last-child .project-cover { aspect-ratio: 2.2; }
}

@media (max-width: 630px) {
  .shell { width: calc(100% - 32px); }
  .header { min-height: 0; padding-top: 12px; gap: 0 12px; flex-wrap: wrap; }
  .header nav { order: 2; width: 100%; gap: 0; justify-content: space-between; }
  .header nav a, .header-contact { font-size: 13px; }
  .hero { grid-template-columns: 1fr; gap: 26px; padding-block: 36px; }
  h1 { font-size: clamp(58px, 14vw, 87px); }
  .intro { margin-block: 19px; }
  .portrait img { aspect-ratio: 1.35; object-position: center 36%; }
  .section-heading { align-items: start; flex-direction: column; margin-bottom: 19px; }
  .gallery { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .gallery .project:last-child .project-cover { aspect-ratio: 1.68; }
  .about, .experiments { grid-template-columns: minmax(0, 1fr); }
  .about-copy p { font-size: 15px; }
  .viewer-stage { height: 63dvh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  .portrait-heart {
    transform: translate(-50%, -50%);
    animation: portrait-heart-fade 500ms ease-out both;
  }
}
