@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --canvas: #0b0d0e;
  --surface: #171b1d;
  --elevated: #22282b;
  --text: #f1f4f4;
  --muted: #a6afb2;
  --accent: #75e0e7;
  --line: rgba(241, 244, 244, 0.12);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --sans: "Space Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

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

html {
  background: var(--canvas);
  color: var(--text);
  scroll-padding-top: 5.5rem;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.55;
}

h1,
h2,
h3,
p,
ul,
figure {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

button,
a {
  color: inherit;
  font: inherit;
}

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

::selection {
  background: var(--accent);
  color: #0b0d0e;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  transform: translateY(-160%);
  background: var(--text);
  color: var(--canvas);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  z-index: 40;
}

.skip:focus {
  transform: none;
}

.rail {
  position: fixed;
  z-index: 20;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  transition: width 420ms var(--ease), left 420ms var(--ease), transform 420ms var(--ease);
  display: flex;
  align-items: stretch;
  gap: 0;
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171b1d;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.rail.is-scrolled {
  background: rgba(23, 27, 29, 0.97);
}

@supports (backdrop-filter: blur(12px)) {
  .rail.is-scrolled {
    background: rgba(23, 27, 29, 0.84);
    backdrop-filter: blur(12px);
  }
}

.rail a {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.9rem;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.rail a:active {
  transform: translateY(1px);
}

.rail-mark {
  position: absolute;
  left: 4px;
  bottom: 6px;
  height: 2px;
  width: 0;
  background: var(--accent);
  transform: translateX(0);
  transition: transform 480ms var(--ease), width 480ms var(--ease);
  pointer-events: none;
}

main {
  width: 100%;
  margin-inline: 0;
}

.hero,
#about,
#contact,
.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.hero {
  min-height: 0;
  padding: 16vh 0 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.name-spacer {
  display: none;
  height: 0;
}

.name-plane {
  position: relative;
  transform: none;
}

h1 {
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.84;
}

.name-lines {
  position: relative;
  display: block;
  height: clamp(250px, 36vw, 470px);
  text-transform: uppercase;
}

.name-line {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  font-size: clamp(84px, 18vw, 232px);
  line-height: 0.84;
  white-space: nowrap;
}

.name-plane.is-docked {
  box-sizing: border-box;
  padding: 0.35rem 0.7rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #171b1d;
}

.name-plane.is-docked .name-lines {
  height: auto;
}

.name-plane.is-docked .name-line,
.name-plane.is-docked .name-line-2 {
  position: relative;
  top: auto;
  left: auto;
  display: block;
  width: auto;
  margin: 0;
  text-align: left;
}

.name-line-2 {
  top: 1.28em;
  font-size: clamp(64px, 13vw, 168px);
  margin-left: calc((1 - var(--dock, 0)) * clamp(0.4rem, 7vw, 5.5rem));
}

.role {
  margin-top: 2.5rem;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

#work,
#about,
#contact {
  scroll-margin-top: 6rem;
}

#work {
  position: relative;
  padding: 0 0 2rem;
}

#work-heading {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 0.5rem;
}

#work-heading,
#about-heading,
#contact-heading {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  background: transparent;
}

main,
.site-footer {
  position: relative;
  z-index: 1;
}

.scenes {
  position: relative;
  z-index: 1;
}

.scene-slot {
  min-width: 0;
}

.scene {
  display: grid;
  width: 100%;
  align-items: end;
  gap: clamp(1.25rem, 4vw, 4rem);
  padding: 3vh max(20px, calc((100% - 1240px) / 2)) 7vh;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: visible;
}

.scene-tomi {
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  min-height: min(78vh, 760px);
}

@media (min-width: 861px) {
  .scene-tomi .scene-copy {
    order: 1;
  }

  .scene-tomi .scene-media {
    order: 2;
  }
}

.scene-orza {
  grid-template-columns: minmax(0, 1.28fr) minmax(220px, 0.72fr);
  align-items: center;
  min-height: min(82vh, 820px);
  padding-top: 8vh;
}

.scene-orza .scene-copy {
  order: 2;
}

.scene-media,
.card-frame {
  display: block;
  position: relative;
  min-width: 0;
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translate3d(var(--sx, 0px), var(--sy, 0px), 0) scale(var(--ss, 1));
  transform-origin: center center;
}

.scene-tomi .card-frame {
  aspect-ratio: 16 / 10;
}

.card-art,
.morph-media.is-card-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0);
  transition: transform 640ms cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-orza .card-frame {
  height: min(68vh, 640px);
}

.mode-stack {
  position: absolute;
  inset: 0;
}

.scene-orza .mode {
  position: absolute;
  width: 68%;
  height: 72%;
  object-fit: contain;
  object-position: center;
  background: transparent;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
  transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0);
}

.scene-orza .mode[data-mode="0"] {
  left: 16%;
  top: 0;
  width: 76%;
  z-index: 3;
  transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0) scale(calc(1.08 - var(--scrub, 0) * 0.22));
}

.scene-orza .mode[data-mode="1"] {
  left: 0;
  top: 46%;
  width: 48%;
  height: 52%;
  z-index: 2;
  transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0) scale(calc(0.82 + (1 - max(var(--scrub, 0) - 0.5, 0.5 - var(--scrub, 0)) * 2) * 0.18));
}

.scene-orza .mode[data-mode="2"] {
  left: 50%;
  top: 42%;
  width: 48%;
  height: 54%;
  z-index: 1;
  transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0) scale(calc(0.78 + var(--scrub, 0) * 0.28));
}

.scene-copy {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: end;
  justify-items: start;
  gap: 0.35rem;
  min-width: 0;
}

.scene-mark {
  width: 28px;
  height: 28px;
  margin-bottom: 0.65rem;
}

.scene-kicker,
.mode-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scene-title {
  display: block;
  overflow: hidden;
  max-width: 100%;
  font-size: clamp(72px, 12vw, 176px);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 0.82;
  text-transform: uppercase;
  background: none;
  padding: 0;
}

.scene-title > span {
  display: block;
}

.scene-line {
  max-width: 28ch;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 20px);
  transform: none;
}

.scene-open {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 44px;
  margin-top: 0.45rem;
  color: var(--accent);
  font-size: 16px;
  font-weight: 500;
}

.scene-open::after {
  content: "";
  width: 36px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(1);
  transform-origin: left center;
  transition: transform 520ms cubic-bezier(0.16, 1, 0.3, 1);
}

.scene-media {
  overflow: visible;
}

.card-icon,
.peek-icon,
.morph-icon {
  width: 36px;
  height: 36px;
  flex: none;
}

.peek-icon {
  width: 44px;
  height: 44px;
}

.card-copy {
  display: grid;
  min-width: 0;
}

@media (hover: hover) and (pointer: fine) {
  .scene:hover .scene-open::after,
  .scene:focus-visible .scene-open::after {
    transform: scaleX(2.2);
  }

  .scene:hover .card-art,
  .scene:focus-visible .card-art,
  .scene:hover .mode,
  .scene:focus-visible .mode {
    transform: translate3d(var(--ix, 0px), var(--iy, 0px), 0) scale(1.025);
  }
}

#about,
#contact {
  padding: 7rem 0 2rem;
  max-width: 60ch;
}

#about p {
  font-size: 20px;
  line-height: 1.45;
}

#contact {
  min-height: 70vh;
  padding-bottom: 6rem;
}

.contact-mail {
  margin-top: 0.85rem;
  font-size: 20px;
}

.contact-mail a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(117, 224, 231, 0.55);
}

.site-footer {
  margin: 0 auto;
  padding: 1rem 0 2rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.peek {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.peek[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.peek::backdrop {
  background: rgba(5, 6, 7, 0.78);
  opacity: 0;
}

.peek.is-shown::backdrop {
  opacity: 1;
  transition: opacity 480ms linear;
}

.peek-panel {
  width: min(960px, calc(100% - 3rem));
  max-height: calc(100dvh - 2.5rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
}

.peek-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0.7rem 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.peek-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--elevated);
  cursor: pointer;
}

.peek-hero {
  margin: 0.35rem 1rem 0;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background: #050607;
  padding: 0.75rem;
}

.peek-hero img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  object-position: center;
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
}

.peek-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1rem 0.15rem;
}

.peek-head h2 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.92;
}

.peek-body {
  padding: 0.35rem 1rem 1.5rem;
  opacity: 0;
  transform: translateY(18px);
}

.peek.is-ready .peek-body {
  opacity: 1;
  transform: none;
  transition: opacity 280ms var(--ease), transform 420ms var(--ease);
}

.summary {
  max-width: 60ch;
  font-size: 20px;
  line-height: 1.45;
}

.platform {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.visit {
  margin-top: 0.85rem;
}

.visit a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid rgba(117, 224, 231, 0.55);
}

.points {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.1rem;
  max-width: 60ch;
}

.points li {
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.gallery {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.stage {
  position: relative;
  aspect-ratio: 3 / 4;
  max-height: min(72vh, 760px);
  overflow: hidden;
  border-radius: 12px;
  background: #050607;
}

.screen-panel {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translate3d(36px, 12px, 0) scale(0.96);
  transition: opacity 420ms var(--ease), transform 520ms var(--ease);
}

.screen-panel.is-shown {
  opacity: 1;
  transform: none;
}

.screen-panel.is-shown img {
  opacity: 1;
  filter: none;
  mix-blend-mode: normal;
}

.screen-panel img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.stage-caption {
  color: var(--muted);
  font-size: 13px;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.thumb {
  width: 6.5rem;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--elevated);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.thumb img {
  width: 100%;
  height: 4.6rem;
  object-fit: contain;
  object-position: center;
  background: #050607;
}

.thumb span {
  display: block;
  padding: 0.3rem 0.4rem 0.45rem;
  font-size: 13px;
}

.thumb[aria-selected="true"] {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.morph {
  position: fixed;
  margin: 0;
  pointer-events: none;
}

.morph-frame {
  z-index: 4;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.morph-media {
  z-index: 5;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 12px 12px 0 0;
  background: #050607;
}

.morph-icon {
  z-index: 6;
}

.morph-title {
  z-index: 7;
  display: flex;
  align-items: center;
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--text);
  white-space: nowrap;
}

.peek.is-morphing .peek-hero,
.peek.is-morphing .peek-head,
.peek.is-morphing .peek-body {
  visibility: hidden;
}

@media (max-width: 860px) {
  .scene-tomi,
  .scene-orza {
    grid-template-columns: 1fr;
    min-height: 0;
    align-items: start;
    padding-top: 2.5rem;
    padding-bottom: 3rem;
  }

  .scene-orza .scene-copy {
    order: 2;
  }

  .scene-orza .card-frame {
    height: 68vw;
    min-height: 240px;
  }

  .scene-title {
    font-size: clamp(64px, 18vw, 112px);
  }
}

@media (max-width: 720px) {
  .hero,
  #about,
  #contact,
  .site-footer {
    width: min(1120px, calc(100% - 40px));
  }

  .hero {
    padding-top: 18vh;
  }

  .rail {
    width: calc(100% - 24px);
    justify-content: space-between;
  }

  html.is-named .rail {
    left: 112px;
    right: 12px;
    width: auto;
    transform: none;
  }

  .rail a {
    flex: 1;
    padding-inline: 0.35rem;
  }

  .peek[open] {
    align-items: stretch;
  }

  .peek-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .peek-hero {
    height: auto;
    margin-inline: 0.75rem;
  }

  .peek-hero img {
    max-height: 58vh;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .name-spacer {
    display: block;
    height: clamp(250px, 36vw, 470px);
  }

  .name-plane {
    position: fixed;
    z-index: 18;
    top: 18vh;
    left: max(20px, calc((100vw - min(1120px, calc(100vw - 40px))) / 2));
    width: max-content;
    max-width: calc(100vw - 32px);
    pointer-events: none;
  }

  html.is-motion .name-line {
    animation: stage-in 640ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  html.is-motion .name-line-2 {
    animation-delay: 90ms;
  }
}

@keyframes stage-in {
  from {
    opacity: 0;
    transform: translate3d(0, 140px, 0);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-card,
  .project-card:hover,
  .project-card:active,
  .card-slot,
  .name-line,
  .role,
  .field,
  .card-art,
  .mode-stack,
  .card-line,
  .scene-media,
  .scene-title > span {
    transform: none !important;
    transition: none;
    animation: none;
  }

  .card-frame::after {
    content: none;
  }

  .name-plane {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    text-align: center;
    pointer-events: none;
  }

  .name-lines {
    height: auto;
  }

  .name-line,
  .name-line-2 {
    position: relative;
    top: auto;
    left: auto;
    width: auto;
    margin-left: 0;
    text-align: center;
  }

  .card-slot {
    opacity: 1 !important;
  }

  .peek.is-shown::backdrop {
    opacity: 1;
    transition: opacity 120ms linear;
  }

  .peek-body,
  .peek.is-ready .peek-body {
    opacity: 1;
    transform: none;
    transition: opacity 120ms linear;
  }

  .screen-panel,
  .screen-panel.is-shown,
  .rail-mark,
  .mode {
    transition: none;
  }

  .screen-panel {
    transform: none;
  }
}
