/* Movement is progressive enhancement; the page works without it. */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  height: 3px;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  will-change: transform;
}
html.has-motion .hero-copy > * {
  transition:
    opacity 0.8s ease,
    transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.has-motion:not(.motion-ready) .hero-copy > * {
  opacity: 0;
  transform: translateY(22px);
}
.hero-copy > :nth-child(2) {
  transition-delay: 0.1s !important;
}
.hero-copy > :nth-child(3) {
  transition-delay: 0.2s !important;
}
.hero-copy > :nth-child(4) {
  transition-delay: 0.3s !important;
}
/* Assembly runs once; synchronized geometry then reflows the same interface. */
html.has-motion .device-piece {
  animation: device-assemble 1.25s cubic-bezier(0.16, 1, 0.3, 1)
    var(--piece-delay, 0s) both;
}
.device-frame {
  --piece-x: 0px;
  --piece-y: 65px;
  --piece-turn: -8deg;
}
.device-toolbar {
  --piece-x: -65px;
  --piece-y: -65px;
  --piece-turn: -12deg;
  --piece-delay: 0.15s;
}
.device-screen {
  --piece-x: 75px;
  --piece-y: 20px;
  --piece-turn: 9deg;
  --piece-delay: 0.3s;
}
html.has-motion .device-base {
  animation: none;
}
@keyframes device-assemble {
  from {
    opacity: 0;
    transform: translate(var(--piece-x), var(--piece-y))
      rotate(var(--piece-turn)) scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
html.has-motion .device-morph {
  animation: device-reflow 18s cubic-bezier(0.65, 0, 0.35, 1) 2.4s infinite both;
}
html.has-motion .device-toolbar {
  animation:
    device-assemble 1.25s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both,
    browser-chrome 18s ease-in-out 2.4s infinite;
}
html.has-motion .device-camera,
html.has-motion .device-base {
  animation: device-chrome 18s ease-in-out 2.4s infinite;
}
html.has-motion .interface-story {
  animation: story-reflow 18s cubic-bezier(0.65, 0, 0.35, 1) 2.4s infinite both;
}
html.has-motion .interface-preview {
  animation: preview-reflow 18s cubic-bezier(0.65, 0, 0.35, 1) 2.4s infinite
    both;
}
@keyframes device-reflow {
  0%,
  16%,
  100% {
    width: 84%;
    height: 57%;
  }
  36%,
  49% {
    width: 61%;
    height: 78%;
  }
  69%,
  82% {
    width: 38%;
    height: 71%;
  }
}
@keyframes browser-chrome {
  0%,
  16%,
  100% {
    opacity: 1;
  }
  30%,
  86% {
    opacity: 0;
  }
}
@keyframes device-chrome {
  0%,
  16%,
  100% {
    opacity: 0;
  }
  36%,
  82% {
    opacity: 1;
  }
}
@keyframes story-reflow {
  0%,
  16%,
  100% {
    left: 7%;
    top: 16%;
    width: 48%;
  }
  36%,
  49% {
    left: 9%;
    top: 9%;
    width: 65%;
  }
  69%,
  82% {
    left: 10%;
    top: 9%;
    width: 80%;
  }
}
@keyframes preview-reflow {
  0%,
  16%,
  100% {
    left: 64%;
    top: 12%;
    width: 29%;
    height: 76%;
  }
  36%,
  49% {
    left: 9%;
    top: 59%;
    width: 82%;
    height: 32%;
  }
  69%,
  82% {
    left: 10%;
    top: 64%;
    width: 80%;
    height: 27%;
  }
}
html.has-motion .construction {
  transform-box: view-box;
  transform-origin: center;
  animation: construction-drift 20s ease-in-out infinite;
}
@keyframes construction-drift {
  0%,
  100% {
    transform: rotate(-4deg);
  }
  50% {
    transform: rotate(4deg);
  }
}
html.has-motion [data-reveal] {
  transition:
    opacity 0.75s ease,
    translate 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.has-motion [data-reveal]:not(.is-visible) {
  opacity: 0;
  translate: 0 26px;
}
html.has-motion .project-media {
  transform: perspective(1500px) rotateX(calc((1 - var(--arrival, 1)) * 5deg))
    scale(calc(0.97 + var(--arrival, 1) * 0.03));
  transform-origin: center bottom;
  transition: transform 0.15s ease-out;
}
html.has-motion .project-media img {
  transform: scale(1.035) translateY(var(--media-shift, 0px));
  transition: transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}
@media (hover: hover) {
  html.has-motion .project-card:hover .project-media img {
    transform: scale(1.07) translateY(var(--media-shift, 0px));
  }
}
.project-icon,
.text-link svg,
.button svg,
.contact-aside svg {
  transition:
    transform 0.3s,
    background 0.3s,
    color 0.3s;
}
.project-card:hover .project-icon svg,
.text-link:hover svg,
.button:hover svg,
.contact-aside a:hover svg {
  transform: translate(3px, -3px);
}
.project-dialog[open]:not(.is-closing) {
  transform-origin: center 20%;
  animation: dialog-enter 0.52s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.project-dialog[open]:not(.is-closing)::backdrop {
  animation: dialog-backdrop-in 0.42s ease-out both;
}
.project-dialog[open]::before {
  transform-origin: left;
  animation: dialog-rule-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}
.project-dialog[open] .dialog-close,
.project-dialog[open] .dialog-body > * {
  animation: dialog-content-in 0.42s cubic-bezier(0.16, 1, 0.3, 1)
    var(--dialog-delay, 0.1s) both;
}
.dialog-body > h2 {
  --dialog-delay: 0.13s;
}
.dialog-body > p:not(.dialog-outcome) {
  --dialog-delay: 0.17s;
}
.dialog-body > .dialog-image {
  --dialog-delay: 0.21s;
}
.dialog-body > .dialog-outcome {
  --dialog-delay: 0.25s;
}
.project-dialog[open].is-closing {
  pointer-events: none;
  transform-origin: center 20%;
  animation: dialog-exit 0.3s cubic-bezier(0.55, 0, 0.9, 0.45) both;
}
.project-dialog[open].is-closing::backdrop {
  animation: dialog-backdrop-out 0.3s ease-in both;
}
@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: perspective(1200px) translateY(42px) rotateX(4deg) scale(0.955);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes dialog-exit {
  from {
    opacity: var(--dialog-exit-opacity, 1);
    transform: var(--dialog-exit-transform, none);
  }
  to {
    opacity: 0;
    transform: perspective(1200px) translateY(18px) rotateX(-2deg) scale(0.975);
  }
}
@keyframes dialog-backdrop-in {
  from {
    background: #11151d00;
    backdrop-filter: blur(0);
  }
  to {
    background: #11151dcc;
    backdrop-filter: blur(8px);
  }
}
@keyframes dialog-backdrop-out {
  from {
    background: var(--dialog-backdrop-color, #11151dcc);
    backdrop-filter: var(--dialog-backdrop-blur, blur(8px));
  }
  to {
    background: #11151d00;
    backdrop-filter: blur(0);
  }
}
@keyframes dialog-rule-in {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes dialog-content-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 760px) {
  .menu-toggle span {
    transition:
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      opacity 0.2s;
  }
  .menu-toggle {
    transition:
      background 0.3s,
      color 0.3s;
  }
  .menu-toggle[aria-expanded="true"] {
    background: var(--accent);
    border-color: var(--accent);
  }
  .menu-toggle[aria-expanded="true"] span {
    background: var(--accent-ink);
  }
  .menu-toggle[aria-expanded="true"] span:first-child {
    transform: translateY(6px) rotate(45deg);
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle[aria-expanded="true"] span:last-child {
    transform: translateY(-6px) rotate(-45deg);
  }
  .mobile-menu-panel .sidebar-bottom > * {
    opacity: 0;
    transform: translateY(-12px);
    transition:
      opacity 0.25s,
      transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mobile-menu-panel.open .sidebar-bottom > * {
    opacity: 1;
    transform: none;
    transition-delay: 0.12s;
  }
  .mobile-menu-panel.open .sidebar-bottom > :nth-child(2) {
    transition-delay: 0.18s;
  }
  .mobile-menu-panel.open .sidebar-bottom > :nth-child(3) {
    transition-delay: 0.23s;
  }
}
/* The pointer tracks exactly; its fill and outline swap across light and dark surfaces. */
.custom-cursor {
  --cursor-fill: #181818;
  --cursor-outline: #fff;
  position: fixed;
  z-index: 1001;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}
.custom-cursor.visible {
  opacity: 1;
}
.custom-cursor.on-dark {
  --cursor-fill: #fff;
  --cursor-outline: #111;
}
.cursor-arrow {
  position: absolute;
  top: -2px;
  left: -3px;
  display: block;
  width: 28px;
  height: 34px;
  overflow: visible;
  filter: drop-shadow(0 2px 2px #0007);
}
.cursor-arrow .cursor-body {
  fill: var(--cursor-fill);
  stroke: var(--cursor-outline);
  stroke-width: 2.8;
  stroke-linejoin: round;
  paint-order: stroke fill;
  transition:
    fill 0.18s ease,
    stroke 0.18s ease;
}
.cursor-arrow .cursor-accent-mark {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.cursor-label {
  position: absolute;
  top: 18px;
  left: 26px;
  padding: 6px 9px;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 20%, transparent);
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 3px 10px #0004;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-5px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}
.custom-cursor.is-action .cursor-label {
  opacity: 1;
  transform: translateX(0);
}
.custom-cursor.near-right .cursor-label {
  right: 20px;
  left: auto;
  transform: translateX(5px);
}
.custom-cursor.near-right.is-action .cursor-label {
  transform: translateX(0);
}
.custom-cursor.near-bottom .cursor-label {
  top: auto;
  bottom: 18px;
}
.custom-cursor.is-pressed .cursor-arrow {
  filter: drop-shadow(0 1px 1px #0009);
}
html.has-custom-cursor,
html.has-custom-cursor body,
html.has-custom-cursor body * {
  cursor: none !important;
}

html.motion-paused *,
html.motion-paused *::before,
html.motion-paused *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.motion-paused [data-reveal] {
  opacity: 1 !important;
  translate: none !important;
}
html.motion-paused .architecture,
html.motion-paused .project-media,
html.motion-paused .project-media img {
  transform: none !important;
}
html.motion-paused .device-piece:not(.device-base) {
  opacity: 1 !important;
  transform: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .custom-cursor {
    display: none !important;
  }
  html.has-custom-cursor,
  html.has-custom-cursor body,
  html.has-custom-cursor body * {
    cursor: auto !important;
  }
  [data-reveal] {
    opacity: 1 !important;
    translate: none !important;
  }
  .architecture,
  .project-media,
  .project-media img {
    transform: none !important;
  }
  .device-piece:not(.device-base) {
    opacity: 1 !important;
    transform: none !important;
  }
}
@media (pointer: coarse) {
  .custom-cursor {
    display: none;
  }
  html.has-custom-cursor,
  html.has-custom-cursor body,
  html.has-custom-cursor body * {
    cursor: auto !important;
  }
}
