:root {
  --home-bg: #000000;
  --home-surface: rgba(255, 255, 255, 0.055);
  --home-border: rgba(255, 255, 255, 0.1);
  --home-text: #fff;
  --home-muted: #aaa4b5;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--home-bg);
  touch-action: manipulation;
}

body {
  color: var(--home-text);
  font-family: "K2D", sans-serif;
  overflow: hidden;
}

.ambient-light {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site-controls {
  position: fixed;
  z-index: 1000;
  left: 50%;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 46px;
  transform: translateX(-50%);
  pointer-events: none;
}

body.controls-at-top .site-controls {
  top: 20px;
  bottom: auto;
}

body.no-ambient-spores .site-controls {
  width: clamp(437px, calc(48vmin + 67px), 577px);
  justify-content: space-between;
  gap: 0;
  transform: translateX(calc(-50% - 4px));
}

.project-card.site-fps,
.project-card.site-home {
  position: relative;
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
  width: 76px;
  height: 58px;
  min-height: 0;
  aspect-ratio: auto;
  gap: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.65);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.13), transparent 18%),
    radial-gradient(circle at 72% 78%, rgba(193, 53, 132, 0.12), transparent 48%),
    rgba(10, 10, 12, 0.84);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1px;
  text-align: center;
  pointer-events: none;
}

.project-card.site-home {
  width: 58px;
  color: rgba(255, 255, 255, 0.78);
  pointer-events: auto;
  cursor: pointer;
}

.project-card.site-home svg {
  position: relative;
  z-index: 3;
  width: 20px;
  height: 20px;
}

.site-fps-value {
  position: relative;
  z-index: 3;
  white-space: nowrap;
  text-shadow: 0 0 12px rgba(193, 53, 132, 0.2);
}

@media (max-width: 680px) {
  .site-controls {
    bottom: 6px;
    gap: 34px;
  }

  body.controls-at-top .site-controls {
    top: 16px;
    bottom: auto;
  }

  body.no-ambient-spores .site-controls {
    width: min(calc(66vw + 57px), 321px);
  }

  .project-card.site-fps {
    width: 66px;
    height: 48px;
    padding: 0;
    font-size: 9px;
  }

  .project-card.site-home {
    width: 48px;
    height: 48px;
    padding: 0;
  }

  .project-card.site-home svg {
    width: 17px;
    height: 17px;
  }
}



.home {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(0.75rem, 2vh, 1.25rem);
  padding: clamp(1rem, 2.5vh, 2rem) clamp(1rem, 4vw, 4rem);
  background: transparent;
}

.inner-page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: clamp(1rem, 3vh, 2rem);
  padding: clamp(1rem, 2.5vh, 2rem) clamp(1rem, 4vw, 4rem);
  background: transparent;
}

.inner-content {
  min-height: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.inner-placeholder {
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.inner-placeholder h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2.4rem);
  font-weight: 700;
  background: linear-gradient(90deg, #833ab4, #c13584, #e1306c, #fd1d1d, #f56040);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.product-page {
  height: 100vh;
  height: 100svh;
  min-height: 0;
  padding-top: clamp(5rem, 10vh, 6rem);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.product-content {
  flex: 0 0 auto;
  margin: auto 0;
  min-height: 0;
  display: block;
  overflow: visible;
  padding: 0 0 clamp(0.75rem, 2vh, 1.5rem);
  text-align: left;
}

.product-page .home-footer {
  flex: 0 0 auto;
}

.product-shell {
  width: min(1120px, 100%);
  height: auto;
  margin: 0 auto;
  padding: 0 clamp(0.35rem, 2.2vw, 1.5rem);
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(320px, 1.28fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: clamp(1.25rem, 4vw, 4rem);
  row-gap: clamp(0.45rem, 1.5vh, 0.9rem);
}

.product-visual {
  min-width: 0;
  display: grid;
  place-items: center;
}

.product-cover {
  display: block;
  width: min(100%, 350px, 38vh);
  height: auto;
  filter: drop-shadow(0 24px 42px rgba(0, 0, 0, 0.62));
}

.product-copy {
  position: relative;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 30px 38px 28px 42px / 34px 27px 43px 31px;
  background:
    radial-gradient(circle at 88% 12%, rgba(193, 53, 132, 0.12), transparent 33%),
    rgba(10, 10, 12, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 24px 60px rgba(0, 0, 0, 0.34);
}

.product-kicker {
  display: block;
  margin-bottom: 0.65rem;
  color: rgba(252, 175, 69, 0.78);
  font-size: clamp(0.64rem, 1vw, 0.76rem);
  font-weight: 700;
  letter-spacing: 0.18em;
}

.product-copy h1 {
  margin: 0;
  width: fit-content;
  font-size: clamp(2rem, 5vw, 4.3rem);
  font-weight: 800;
  line-height: 0.95;
  background: linear-gradient(90deg, #833ab4, #c13584, #e1306c, #f56040, #fcaf45);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.product-lead {
  margin: clamp(1rem, 2.5vh, 1.5rem) 0 0;
  max-width: 700px;
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1rem, 1.75vw, 1.25rem);
  font-weight: 500;
  line-height: 1.55;
}

.product-description {
  margin: 0.85rem 0 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.62);
  font-size: clamp(0.86rem, 1.25vw, 1rem);
  line-height: 1.62;
}

.product-meta {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.product-meta span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.66);
  background: rgba(255, 255, 255, 0.035);
  font-size: 0.77rem;
  letter-spacing: 0.03em;
}

.product-download {
  width: fit-content;
  min-height: 48px;
  margin-top: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 1.05rem;
  border: 1px solid rgba(193, 53, 132, 0.48);
  border-radius: 18px 22px 17px 25px / 21px 17px 24px 18px;
  color: #fff;
  background: linear-gradient(110deg, rgba(131, 58, 180, 0.36), rgba(193, 53, 132, 0.31), rgba(225, 48, 108, 0.24));
  box-shadow: 0 12px 30px rgba(193, 53, 132, 0.14);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, filter 160ms ease;
}

.product-download:hover {
  color: #fff;
  border-color: rgba(252, 175, 69, 0.7);
  filter: brightness(1.14);
  text-decoration: none;
  transform: translateY(-2px);
}

.product-download svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-gallery {
  grid-column: 1 / -1;
  min-height: 68px;
  margin-top: clamp(0.9rem, 2.5vh, 1.6rem);
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(0.5rem, 1.4vw, 0.85rem);
  transform: none;
}

.product-gallery-label {
  background-image: linear-gradient(90deg, #833ab4, #c13584, #e1306c, #fd1d1d);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.product-thumb {
  width: clamp(100px, min(16vh, 12vw), 150px);
  aspect-ratio: 16 / 10;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 11px 15px 12px 17px / 14px 11px 16px 12px;
  background: rgba(8, 8, 10, 0.82);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.32);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease;
}

.product-thumb:hover,
.product-thumb:focus-visible {
  border-color: rgba(225, 48, 108, 0.72);
  outline: none;
  transform: translateY(-3px);
}

.product-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(1.24) saturate(1.07);
  transition: filter 150ms ease;
}

.product-thumb:hover img,
.product-thumb:focus-visible img {
  filter: brightness(1.34) saturate(1.1);
}

.product-gallery-single {
  justify-content: center;
}

.product-gallery-single .product-thumb {
  width: clamp(130px, min(24vh, 26vw), 220px);
}

.lightbox-open {
  overflow: hidden;
}

.media-lightbox {
  position: fixed;
  z-index: 1100;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  padding: max(4rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(1.25rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  opacity: 0;
  transition: opacity 180ms ease;
}

.media-lightbox[hidden] {
  display: none;
}

.media-lightbox.is-open {
  opacity: 1;
}

.media-lightbox-figure {
  width: min(100%, 1500px);
  min-width: 0;
  max-width: none;
  margin: 0 auto;
  display: grid;
  justify-items: center;
  gap: 0.7rem;
}

.media-lightbox-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100svh - 7rem);
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.68);
}

.media-lightbox-caption {
  color: rgba(255, 255, 255, 0.64);
  font-size: clamp(0.72rem, 1.5vw, 0.9rem);
  text-align: center;
}

.media-lightbox-close,
.media-lightbox-nav {
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  background: rgba(15, 15, 18, 0.78);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
  cursor: pointer;
}

.media-lightbox-close {
  position: absolute;
  top: max(0.8rem, env(safe-area-inset-top));
  right: max(0.8rem, env(safe-area-inset-right));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font: 300 2rem/1 K2D, sans-serif;
}

.media-lightbox-nav {
  position: absolute;
  z-index: 1;
  top: 50%;
  width: clamp(42px, 5vw, 58px);
  height: clamp(58px, 8vw, 78px);
  border-radius: 999px;
  font: 300 clamp(2.2rem, 5vw, 3.5rem)/1 K2D, sans-serif;
  transform: translateY(-50%);
}

.media-lightbox-prev {
  left: max(0.65rem, env(safe-area-inset-left));
}

.media-lightbox-next {
  right: max(0.65rem, env(safe-area-inset-right));
}

.media-lightbox-close:hover,
.media-lightbox-nav:hover,
.media-lightbox-close:focus-visible,
.media-lightbox-nav:focus-visible {
  border-color: rgba(225, 48, 108, 0.75);
  outline: none;
  background: rgba(193, 53, 132, 0.2);
}

.home-header,
.home-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-header {
  padding-bottom: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--home-text);
  font-size: clamp(1.25rem, 2.2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-name {
  background: linear-gradient(90deg, #833ab4, #c13584, #e1306c, #fd1d1d, #f56040);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.socials {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--home-text);
  text-decoration: none;
  border: 1px solid var(--home-border);
  background: var(--home-surface);
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  font-size: 0.9rem;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.social-link {
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.social-link svg {
  width: 21px;
  height: 21px;
  stroke-width: 1.8;
}

.social-link:hover {
  color: var(--home-text);
  text-decoration: none;
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.09);
}

.home-main {
  min-height: 0;
  width: 100%;
  margin: 0;
  display: block;
  position: relative;
  align-self: stretch;
  overflow: hidden;
}

.project-grid {
  position: absolute;
  inset: 0;
}

/* Cards are positioned by home-effects.js flight physics; hide them until
   the first positions are applied so they never flash stacked at 0,0. */
.project-grid .project-card {
  visibility: hidden;
}

.project-grid .project-card.is-positioned {
  visibility: visible;
}

.project-card {
  position: absolute;
  left: 0;
  top: 0;
  width: clamp(160px, 16vw, 195px);
  min-height: 0;
  aspect-ratio: 1.08 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  text-align: center;
  color: var(--home-text);
  text-decoration: none;
  border: 1px solid var(--home-border);
  border-radius: 44% 56% 48% 52% / 55% 43% 57% 45%;
  padding: clamp(0.9rem, 2vw, 1.35rem);
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.13), transparent 18%),
    radial-gradient(circle at 72% 78%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 48%),
    rgba(10, 10, 12, 0.9);
  box-shadow:
    inset 8px 10px 20px rgba(255, 255, 255, 0.025),
    inset -12px -14px 24px rgba(0, 0, 0, 0.45),
    0 12px 28px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  animation: blob-float 6s ease-in-out infinite;
  --morph-duration: 9s;
  --morph-delay: 0s;
  translate:
    calc(var(--flight-x, 0px) + var(--push-x, 0px))
    calc(var(--flight-y, 0px) + var(--push-y, 0px));
  transition: border-color 180ms ease, background 180ms ease, filter 180ms ease;
  will-change: transform, translate, border-radius;
}

.project-card::after {
  content: none;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 30% 17%, rgba(255, 255, 255, 0.16), transparent 12%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), transparent 45%);
  pointer-events: none;
}

.project-card:hover {
  color: var(--home-text);
  text-decoration: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.085);
  filter: brightness(1.16);
}

.project-card svg {
  color: var(--accent);
  width: 24px;
  height: 24px;
  position: relative;
  z-index: 2;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-title {
  position: relative;
  z-index: 1;
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  font-weight: 700;
  line-height: 1.1;
}

.project-card:nth-child(2) {
  border-radius: 55% 45% 43% 57% / 47% 56% 44% 53%;
  animation-delay: -1.1s;
  animation-duration: 5.4s;
  --morph-delay: -2.4s;
  --morph-duration: 7.5s;
}

.project-card:nth-child(3) {
  border-radius: 47% 53% 57% 43% / 56% 45% 55% 44%;
  animation-delay: -3.4s;
  animation-duration: 4.8s;
  --morph-delay: -5.2s;
  --morph-duration: 8.5s;
}

.project-card:nth-child(4) {
  border-radius: 57% 43% 52% 48% / 43% 54% 46% 57%;
  animation-delay: -4.7s;
  animation-duration: 5.8s;
  --morph-delay: -7.6s;
  --morph-duration: 7.2s;
}

.project-card:nth-child(5) {
  border-radius: 49% 51% 42% 58% / 58% 46% 54% 42%;
  animation-delay: -2.8s;
  animation-duration: 5.1s;
  --morph-delay: -4.1s;
  --morph-duration: 8s;
}

/* Morph keyframes are applied by home-effects.js at 30 Hz (updateMorphs)
   instead of a CSS animation: animating border-radius at the display
   refresh rate repaints every card every frame and is the main FPS cost.
   Keep these values in sync — JS parses this rule as the source of truth. */
@keyframes blob-morph {
  0%,
  100% {
    border-radius: 38% 62% 43% 57% / 61% 36% 64% 39%;
  }

  24% {
    border-radius: 63% 37% 35% 65% / 39% 68% 32% 61%;
  }

  49% {
    border-radius: 44% 56% 67% 33% / 66% 35% 65% 34%;
  }

  74% {
    border-radius: 59% 41% 52% 48% / 35% 57% 43% 65%;
  }
}

@keyframes blob-float {
  0%,
  100% {
    transform: translate3d(-3px, 2px, 0) rotate(-1.2deg) scale(0.985, 1.015);
  }

  50% {
    transform: translate3d(4px, -13px, 0) rotate(1.35deg) scale(1.025, 0.975);
  }
}

.home-footer {
  color: var(--home-muted);
  font-size: 0.9rem;
  justify-content: space-between;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.footer-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.82rem;
  border: 0.5px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008));
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.04),
    0 6px 18px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(7px) saturate(115%);
  -webkit-backdrop-filter: blur(7px) saturate(115%);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  animation: footer-drift 6.8s ease-in-out infinite alternate;
  will-change: translate;
}

.footer-button:nth-child(2) {
  animation-delay: -2.1s;
  animation-duration: 7.6s;
}

.footer-button:nth-child(3) {
  animation-delay: -4.4s;
  animation-duration: 6.2s;
}

.footer-button::before {
  content: "";
  position: absolute;
  inset: 1px 12% auto;
  height: 0.5px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  pointer-events: none;
}

.footer-button:hover {
  border-color: rgba(255, 255, 255, 0.17);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.014));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 22px rgba(131, 58, 180, 0.08);
  text-decoration: none;
  transform: translateY(-2px);
}

.footer-gradient {
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
}

.footer-actions .footer-button:nth-child(1) .footer-gradient {
  background-image: linear-gradient(90deg, #833ab4, #c13584);
}

.footer-actions .footer-button:nth-child(2) .footer-gradient {
  background-image: linear-gradient(90deg, #c13584, #e1306c);
}

.footer-actions .footer-button:nth-child(3) .footer-gradient {
  background-image: linear-gradient(90deg, #e1306c, #fd1d1d);
}

.footer-author .footer-gradient {
  background-image: linear-gradient(90deg, #fd1d1d, #f56040);
}

.footer-button .footer-gradient {
  font-size: clamp(0.86rem, 1.15vw, 1rem);
  font-weight: 600;
  white-space: nowrap;
}

.footer-author {
  flex: 0 0 auto;
  font-weight: 600;
  white-space: nowrap;
}

.footer-author .footer-gradient {
  font-size: clamp(0.92rem, 1.3vw, 1.08rem);
}

.footer-author {
  animation-delay: -3.2s;
  animation-duration: 7.2s;
}

@keyframes footer-drift {
  0% {
    translate: -2px 1px;
  }

  50% {
    translate: 2px -3px;
  }

  100% {
    translate: 3px 1px;
  }
}

/* Short desktop windows (height 800px or less): compress the product card so
   pages with long text (Dexi Notes) still fit one screen without scrolling. */
@media (min-width: 681px) and (max-height: 800px) {
  .product-page {
    padding-top: clamp(3.9rem, 9vh, 5rem);
  }

  .product-cover {
    width: min(100%, 260px, 34vh);
  }

  .product-copy {
    padding: clamp(0.85rem, 2.2vh, 1.35rem) clamp(1.1rem, 2.6vw, 1.6rem);
  }

  .product-kicker {
    margin-bottom: 0.45rem;
    font-size: clamp(0.56rem, 1.4vh, 0.68rem);
  }

  .product-copy h1 {
    font-size: clamp(1.7rem, 6.5vh, 3.1rem);
  }

  .product-lead {
    margin-top: clamp(0.55rem, 1.6vh, 0.9rem);
    font-size: clamp(0.86rem, 2.2vh, 1.05rem);
    line-height: 1.42;
  }

  .product-description {
    margin-top: 0.55rem;
    font-size: clamp(0.74rem, 1.9vh, 0.88rem);
    line-height: 1.45;
  }

  .product-meta {
    margin-top: 0.75rem;
    gap: 0.4rem;
  }

  .product-meta span {
    min-height: 26px;
    padding: 0.26rem 0.55rem;
    font-size: 0.68rem;
  }

  .product-download {
    min-height: 40px;
    margin-top: 0.75rem;
    padding: 0.5rem 0.8rem;
    font-size: clamp(0.74rem, 2vh, 0.88rem);
  }

  .product-gallery {
    min-height: 0;
    margin-top: clamp(0.4rem, 1.2vh, 0.8rem);
  }

  .product-thumb {
    width: clamp(88px, min(13vh, 11vw), 130px);
  }

  .product-gallery-single .product-thumb {
    width: clamp(110px, min(16vh, 22vw), 170px);
  }
}

@media (max-width: 680px) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .home {
    height: 100vh;
    height: 100svh;
    min-height: 0;
    grid-template-rows: auto 1fr auto;
    gap: 0.55rem;
    padding:
      max(0.7rem, env(safe-area-inset-top))
      0.75rem
      max(0.65rem, env(safe-area-inset-bottom));
    overflow: hidden;
  }

  .home-header {
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
    padding-bottom: 0.5rem;
  }

  .brand {
    gap: 0.5rem;
    font-size: 1rem;
  }

  .brand img {
    width: 34px;
    height: 34px;
    border-radius: 9px;
  }

  .socials {
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  .social-link {
    width: 36px;
    height: 36px;
    padding: 0;
  }

  .social-link svg {
    width: 14px;
    height: 14px;
  }

  .home-main {
    width: 100%;
    display: block;
  }

  .project-grid {
    width: 100%;
  }

  .project-card {
    width: clamp(124px, 36vw, 145px);
    height: clamp(96px, 15svh, 116px);
    min-height: 0;
    aspect-ratio: auto;
    gap: 0.4rem;
    padding: 0.65rem;
    animation-name: blob-float-mobile;
  }

  .project-card svg {
    width: 19px;
    height: 19px;
  }

  .project-title {
    font-size: clamp(0.95rem, 4.2vw, 1.2rem);
  }

  .product-page {
    gap: 0.55rem;
    padding:
      max(4.05rem, calc(env(safe-area-inset-top) + 0.55rem))
      0.75rem
      max(0.55rem, env(safe-area-inset-bottom));
  }

  .product-content {
    padding: 0 0 0.5rem;
  }

  .product-shell {
    height: auto;
    padding: 0 0.15rem;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    align-content: normal;
    justify-items: center;
    column-gap: 0;
    row-gap: clamp(0.5rem, 1.2vh, 0.8rem);
  }

  .product-cover {
    width: min(26vw, 104px, 12vh);
  }

  .product-copy {
    width: 100%;
    padding: clamp(0.85rem, 4vw, 1.25rem);
    border-radius: 22px 26px 21px 29px / 25px 21px 28px 22px;
    text-align: left;
  }

  .product-kicker {
    margin-bottom: 0.4rem;
    font-size: clamp(0.54rem, 2.2vw, 0.66rem);
    letter-spacing: 0.14em;
  }

  .product-copy h1 {
    font-size: clamp(1.75rem, 8.2vw, 2.4rem);
  }

  .product-lead {
    margin-top: 0.6rem;
    font-size: clamp(0.86rem, 3.7vw, 1rem);
    line-height: 1.42;
  }

  .product-description {
    margin-top: 0.5rem;
    font-size: clamp(0.76rem, 3.2vw, 0.88rem);
    line-height: 1.42;
  }

  .product-meta {
    margin-top: 0.7rem;
    gap: 0.35rem;
  }

  .product-meta span {
    min-height: 26px;
    padding: 0.3rem 0.55rem;
    font-size: 0.68rem;
  }

  .product-download {
    min-height: 44px;
    margin-top: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 15px 18px 14px 20px;
    font-size: clamp(0.78rem, 3.4vw, 0.9rem);
  }

  .product-download svg {
    width: 17px;
    height: 17px;
  }

  .product-gallery {
    min-height: 0;
    margin-top: clamp(0.5rem, 1.6vh, 0.9rem);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-evenly;
    align-items: center;
    gap: 0.35rem 0.5rem;
    transform: none;
  }

  .product-gallery-label {
    flex: 0 0 100%;
    text-align: center;
    font-size: 0.6rem;
  }

  .product-thumb {
    width: clamp(64px, min(24vw, 16vh), 104px);
  }

  .product-gallery-single .product-thumb {
    width: clamp(120px, min(44vw, 18vh), 180px);
  }

  .media-lightbox {
    grid-template-columns: minmax(0, 1fr);
    padding: max(4rem, env(safe-area-inset-top)) max(0.55rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.55rem, env(safe-area-inset-left));
  }

  .media-lightbox-nav {
    position: absolute;
    z-index: 1;
    top: 50%;
    width: 40px;
    height: 58px;
    transform: translateY(-50%);
    background: rgba(12, 12, 14, 0.72);
  }

  .media-lightbox-prev {
    left: max(0.35rem, env(safe-area-inset-left));
  }

  .media-lightbox-next {
    right: max(0.35rem, env(safe-area-inset-right));
  }

  .media-lightbox-image {
    max-height: calc(100svh - 6rem);
  }

  .home-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
  }

  .footer-actions {
    width: 100%;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .footer-button {
    min-height: 28px;
    padding: 0.26rem 0.4rem;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .footer-button .footer-gradient {
    font-size: clamp(0.6rem, 2.5vw, 0.74rem);
  }

  .footer-author {
    min-height: 28px;
    padding: 0.26rem 0.5rem;
  }

  .footer-author .footer-gradient {
    font-size: clamp(0.66rem, 2.7vw, 0.8rem);
  }
}

/* Extra-compact tier for short phone screens: everything must fit on one
   screen without scrolling (320x568, 360x640, iPhone SE 375x667 and similar). */
@media (max-width: 680px) and (max-height: 700px) {
  .product-content {
    padding: 0 0 0.3rem;
  }

  .product-shell {
    row-gap: 0.5rem;
  }

  .product-cover {
    width: min(22vw, 76px, 10vh);
  }

  .product-copy {
    padding: 0.7rem 0.85rem;
  }

  .product-kicker {
    margin-bottom: 0.3rem;
    font-size: 0.5rem;
    letter-spacing: 0.12em;
  }

  .product-copy h1 {
    font-size: clamp(1.45rem, 7.5vw, 1.9rem);
  }

  .product-lead {
    margin-top: 0.45rem;
    font-size: clamp(0.76rem, 3.4vw, 0.88rem);
    line-height: 1.35;
  }

  .product-description {
    margin-top: 0.4rem;
    font-size: clamp(0.68rem, 3vw, 0.78rem);
    line-height: 1.4;
  }

  .product-meta {
    margin-top: 0.5rem;
    gap: 0.25rem;
  }

  .product-meta span {
    min-height: 22px;
    padding: 0.22rem 0.42rem;
    font-size: 0.6rem;
  }

  .product-download {
    min-height: 34px;
    margin-top: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: clamp(0.7rem, 3.1vw, 0.8rem);
  }

  .product-download svg {
    width: 15px;
    height: 15px;
  }

  .product-gallery {
    gap: 0.3rem 0.4rem;
  }

  .product-gallery-label {
    font-size: 0.54rem;
  }

  .product-thumb {
    width: clamp(56px, 20vw, 88px);
  }

  .product-gallery-single .product-thumb {
    width: clamp(56px, min(20vw, 18vh), 88px);
  }

  .home-footer {
    gap: 0.3rem;
  }

  .footer-button {
    min-height: 26px;
    padding: 0.22rem 0.36rem;
  }

  .footer-button .footer-gradient {
    font-size: clamp(0.56rem, 2.3vw, 0.68rem);
  }

  .footer-author {
    min-height: 26px;
    padding: 0.22rem 0.45rem;
  }

  .footer-author .footer-gradient {
    font-size: clamp(0.6rem, 2.5vw, 0.74rem);
  }
}

@keyframes blob-float-mobile {
  0%,
  100% {
    transform: translate3d(-1px, 1px, 0) rotate(-0.55deg);
  }

  50% {
    transform: translate3d(2px, -5px, 0) rotate(0.65deg);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  body.no-ambient-spores .site-controls {
    width: min(calc(44vw + 57px), 413px);
  }

  .product-page {
    padding-top: 4.05rem;
  }

  .product-content {
    padding: 0 0 0.3rem;
  }

  .product-shell {
    grid-template-columns: minmax(84px, 0.3fr) minmax(0, 1fr) auto;
    column-gap: clamp(0.7rem, 2.5vw, 1.6rem);
    row-gap: 0.4rem;
    align-items: center;
  }

  .product-visual {
    grid-column: 1;
    grid-row: 1;
  }

  .product-cover {
    width: min(100%, 120px, 34vh);
  }

  .product-copy {
    grid-column: 2;
    grid-row: 1;
    padding: clamp(0.55rem, 1.8vh, 0.9rem) clamp(0.8rem, 2.2vw, 1.2rem);
  }

  .product-kicker {
    margin-bottom: 0.25rem;
    font-size: clamp(0.48rem, 1.5vh, 0.58rem);
  }

  .product-copy h1 {
    font-size: clamp(1.3rem, 6vh, 2rem);
  }

  .product-lead {
    margin-top: 0.3rem;
    font-size: clamp(0.66rem, 2.2vh, 0.84rem);
    line-height: 1.32;
  }

  .product-description {
    margin-top: 0.3rem;
    font-size: clamp(0.58rem, 2vh, 0.72rem);
    line-height: 1.34;
  }

  .product-meta {
    margin-top: 0.35rem;
    gap: 0.25rem;
  }

  .product-meta span {
    min-height: 22px;
    padding: 0.2rem 0.42rem;
    font-size: 0.58rem;
  }

  .product-download {
    min-height: 34px;
    margin-top: 0.35rem;
    padding: 0.38rem 0.6rem;
    font-size: clamp(0.62rem, 2.3vh, 0.76rem);
  }

  .product-gallery {
    grid-column: 3;
    grid-row: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transform: none;
  }

  .product-gallery-label {
    font-size: 0.52rem;
    text-align: center;
  }

  .product-thumb {
    width: clamp(56px, 13vh, 84px);
  }

  .product-gallery-single .product-thumb {
    width: clamp(56px, 13vh, 84px);
  }

  .home {
    gap: 0.5rem;
    padding: 0.6rem clamp(0.75rem, 3vw, 2rem);
  }

  .home-header {
    padding-bottom: 0.45rem;
  }

  .project-card {
    width: clamp(108px, 16vw, 148px);
    height: clamp(80px, 23vh, 108px);
    min-height: 0;
    aspect-ratio: auto;
    gap: 0.3rem;
  }

  .project-card svg {
    width: 18px;
    height: 18px;
  }

  .project-title {
    font-size: clamp(0.9rem, 2.6vh, 1.1rem);
  }

  .home-footer .footer-button {
    min-height: 32px;
    padding: 0.3rem 0.5rem;
  }

  .home-footer .footer-button .footer-gradient {
    font-size: clamp(0.64rem, 2.2vh, 0.78rem);
  }

  .home-footer .footer-author .footer-gradient {
    font-size: clamp(0.68rem, 2.4vh, 0.84rem);
  }
}

/* Ultra-short landscape (old phones, 320-360px height): drop the long
   description and shrink further so everything still fits one screen. */
@media (max-height: 360px) and (orientation: landscape) {
  .product-page {
    padding-top: 4.1rem;
  }

  .product-content {
    padding: 0 0 0.3rem;
  }

  .product-cover {
    width: min(100%, 84px, 26vh);
  }

  .product-copy {
    padding: 0.55rem 0.8rem;
  }

  .product-kicker {
    margin-bottom: 0.2rem;
    font-size: 0.46rem;
  }

  .product-copy h1 {
    font-size: clamp(1.2rem, 6vh, 1.6rem);
  }

  .product-lead {
    margin-top: 0.3rem;
    font-size: clamp(0.62rem, 2.3vh, 0.76rem);
    line-height: 1.3;
  }

  .product-description {
    display: none;
  }

  .product-meta {
    margin-top: 0.35rem;
  }

  .product-meta span {
    min-height: 20px;
    padding: 0.16rem 0.38rem;
    font-size: 0.55rem;
  }

  .product-download {
    min-height: 30px;
    margin-top: 0.4rem;
    padding: 0.3rem 0.55rem;
    font-size: clamp(0.58rem, 2.2vh, 0.7rem);
  }

  .product-download svg {
    width: 14px;
    height: 14px;
  }

  .product-gallery {
    gap: 0.24rem;
  }

  .product-gallery-label {
    font-size: 0.48rem;
  }

  .product-thumb {
    width: clamp(48px, 12vh, 68px);
  }

  .product-gallery-single .product-thumb {
    width: clamp(48px, 12vh, 68px);
  }

  .home-footer .footer-button {
    min-height: 26px;
    padding: 0.22rem 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ambient-light {
    display: none;
  }

  /* No flight physics without JS motion: lay the cards out statically. */
  .home-main {
    position: static;
    height: 100%;
    overflow: hidden;
    display: grid;
    place-items: center;
    padding: clamp(0.75rem, 3vmin, 2rem);
  }

  .project-grid {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    align-content: center;
    gap: clamp(0.5rem, 2vmin, 1.1rem);
    max-width: min(94vw, 1150px);
    max-height: 100%;
    margin: 0 auto;
  }

  .project-grid .project-card {
    position: static;
    translate: none;
  }

  .project-card,
  .social-link,
  .footer-button {
    transition: none;
  }

  .project-card {
    animation: none;
  }

  .footer-button {
    animation: none;
  }

}
