/* =========================================================================
   Krondel — main stylesheet
   ========================================================================= */

/* ------------------------------ tokens --------------------------------- */
:root {
  --color-cream: #f5e7df;
  --color-dark: #1f1d1d;
  --color-brand: #5cc2d6;
  --color-brand-deep: #0e7490;
  --color-violet: #7c5cff;

  --font-display: 'Cabinet Grotesk', 'Cabinet Grotesk Variable', Arial, Helvetica, sans-serif;
  --font-ui: 'Satoshi', Arial, Helvetica, sans-serif;

  --radius-block: 40px;
  --radius-card: 15px;
  --letter-spacing-display: -0.025em;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  scrollbar-gutter: stable;
  background-color: var(--color-dark);
}

body {
  margin: 0;
  background-color: var(--color-cream);
  color: var(--color-dark);
  font-family: var(--font-display);
  font-weight: 700;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  --current-interface-color: var(--color-cream);
  --header-capsule-color: #646464;
}

body[data-interface-color='cream'] {
  --current-interface-color: var(--color-cream);
  --header-capsule-color: #646464;
}

body[data-interface-color='dark'] {
  --current-interface-color: var(--color-dark);
  --header-capsule-color: #ffffff;
}

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

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

canvas {
  display: block;
}

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

/* underline-on-hover links */
:where(.site-header__link, .text-link, .next-footer__meta-link) {
  position: relative;
  display: inline-block;
  width: fit-content;
  color: inherit;
  text-decoration: none;
}

:where(.site-header__link, .text-link, .next-footer__meta-link)::after {
  content: '';
  position: absolute;
  bottom: -0.2em;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.35s var(--ease-out);
  pointer-events: none;
}

:where(.site-header__link, .text-link, .next-footer__meta-link):hover::after,
:where(.site-header__link, .text-link, .next-footer__meta-link):focus-visible::after {
  transform: scaleX(1);
}

/* ------------------------------ header --------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 26px 32px;
  color: var(--current-interface-color, var(--color-dark));
  pointer-events: none;
  will-change: transform;
  transition: color 0.4s var(--ease-out);
}

.site-header__logo,
.site-header__nav,
.site-header__link {
  pointer-events: auto;
}

.site-header__logo {
  display: block;
  width: clamp(38px, 4vw, 52px);
  height: clamp(32px, 3.4vw, 44px);
  color: inherit;
}

.site-header__logo:focus-visible {
  outline: 2px solid;
  outline-offset: 4px;
}

.site-header__logo-mark {
  display: block;
  width: 100%;
  height: 100%;
  background-color: currentColor;
  -webkit-mask-image: url('../brand/krondel-mark.svg');
  mask-image: url('../brand/krondel-mark.svg');
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.8vw, 40px);
  height: clamp(56px, 5vw, 72px);
  padding-inline: clamp(10px, 2.5vw, 36px);
  border: 1px solid color-mix(in srgb, var(--header-capsule-color, #fff) 10%, transparent);
  background-color: color-mix(in srgb, var(--header-capsule-color, #fff) 20%, transparent);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition: background-color 0.35s var(--ease-out);
}

.site-header__link {
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 500;
  line-height: 1;
  color: inherit;
  text-decoration: none;
}

.site-header__link:focus-visible {
  outline: 2px solid;
  outline-offset: 4px;
}

.site-header__language-switch {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.3em;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  pointer-events: auto;
  white-space: nowrap;
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.1vw, 18px);
  font-weight: 500;
  line-height: 1;
}

.site-header__language-switch span {
  position: relative;
  opacity: 0.45;
  transition: opacity 0.25s;
}

.site-header__language-switch span.is-active {
  opacity: 1;
}

.site-header__language-switch span[data-lang-option]::after {
  content: '';
  position: absolute;
  bottom: -0.3em;
  left: 0;
  width: 100%;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.35s;
}

.site-header__language-switch:hover span[data-lang-option]:not(.is-active) {
  opacity: 1;
}

.site-header__language-switch:hover span[data-lang-option]:not(.is-active)::after {
  transform: scaleX(1);
}

@media (min-width: 700px) {
  .site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .site-header__logo {
    grid-column: 1;
    justify-self: start;
  }

  .site-header__nav {
    grid-column: 2;
  }
}

@media (max-width: 600px) {
  .site-header {
    padding: 24px clamp(12px, 4vw, 24px);
  }

  .site-header__nav {
    gap: clamp(8px, 2.4vw, 14px);
    height: 52px;
    padding-inline: clamp(12px, 3vw, 18px);
  }

  .site-header__link--secondary {
    display: none;
  }
}

/* -------------------------- scroll indicator --------------------------- */
.scroll-indicator {
  --bar-short: 12px;
  --bar-neighbor: 28px;
  --bar-active: 48px;
  position: fixed;
  bottom: clamp(24px, 4vh, 40px);
  left: clamp(20px, 2vw, 32px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: var(--current-interface-color, var(--color-dark));
  transition: color 0.4s var(--ease-out), opacity 0.3s;
}

.scroll-indicator.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.scroll-indicator__item {
  position: relative;
  display: flex;
  align-items: center;
  width: 62px;
  height: 18px;
  color: inherit;
}

.scroll-indicator__item::after {
  content: attr(aria-label);
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transform: translate(-4px, -50%);
  transition: opacity 0.25s, transform 0.25s;
}

.scroll-indicator__item:hover::after,
.scroll-indicator__item:focus-visible::after {
  opacity: 0.8;
  transform: translateY(-50%);
}

.scroll-indicator__bar {
  position: relative;
  display: block;
  width: var(--bar-short);
  height: 2px;
  overflow: hidden;
  transform-origin: 0 50%;
  transition: width 0.45s var(--ease-out);
}

.scroll-indicator__bar::before,
.scroll-indicator__bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background-color: currentColor;
}

.scroll-indicator__bar::before {
  opacity: 0.28;
  transition: opacity 0.35s;
}

.scroll-indicator__bar::after {
  opacity: 0;
  transform: scaleX(var(--progress, 0));
  transform-origin: 0 50%;
  transition: opacity 0.35s;
}

.scroll-indicator__item.is-neighbor .scroll-indicator__bar {
  width: var(--bar-neighbor);
}

.scroll-indicator__item.is-neighbor .scroll-indicator__bar::before {
  opacity: 0.55;
}

.scroll-indicator__item.is-active .scroll-indicator__bar {
  width: var(--bar-active);
}

.scroll-indicator__item.is-active .scroll-indicator__bar::before {
  opacity: 0.45;
}

.scroll-indicator__item.is-active .scroll-indicator__bar::after {
  opacity: 1;
}

@media (max-width: 600px) {
  .scroll-indicator {
    display: none;
  }
}

/* -------------------------------- hero --------------------------------- */
.hero {
  position: relative;
  background-color: var(--color-cream);
}

.hero__pin-height {
  height: 560vh;
}

.hero__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

.hero__frame {
  --hero-frame-inset: clamp(8px, calc(2.5vw - 8px), 16px);
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 18px;
  overflow: hidden;
  transform-origin: top center;
  will-change: transform;
  -webkit-clip-path: inset(var(--hero-frame-inset) round 18px);
  clip-path: inset(var(--hero-frame-inset) round 18px);
}

.webgl {
  width: 100%;
  height: 100%;
}

.hero__fallback {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8vw;
  text-align: center;
  color: var(--color-cream);
  font-size: clamp(32px, 7vw, 92px);
  line-height: 0.95;
  background: linear-gradient(120deg, #0aa6c8, #1e5bd6 45%, #7c2fe0);
}

html[data-webgl='off'] .hero__fallback {
  display: flex;
}

html[data-webgl='off'] .webgl {
  display: none;
}

.hero__content {
  position: relative;
  z-index: 2;
  height: 100%;
  pointer-events: none;
}

.hero__scroll-hint {
  position: absolute;
  right: clamp(24px, 3vw, 48px);
  bottom: clamp(24px, 3vw, 48px);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-cream);
  font-family: var(--font-ui);
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.hero__scroll-arrow {
  display: block;
  flex: none;
  animation: hero-arrow 1.8s ease-in-out infinite;
}

@keyframes hero-arrow {
  0%, 100% { transform: translateY(-4px); }
  50% { transform: translateY(4px); }
}

@media (max-width: 600px) {
  .hero__scroll-hint {
    bottom: 92px;
  }
}

/* ------------------------------ manifesto ------------------------------ */
.manifesto {
  position: relative;
  z-index: 2;
  margin-top: clamp(-500px, -55vh, -450px);
  background-color: var(--color-cream);
}

.manifesto__pin-height {
  height: 420vh;
}

.manifesto .container {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  border-radius: 0;
  transform-origin: top center;
  will-change: transform, border-radius;
}

.manifesto.is-exiting {
  background-color: var(--color-dark);
}

.manifesto.is-exiting .container {
  background-color: var(--color-cream);
}

.manifesto .text {
  display: flex;
  width: max-content;
  padding: 0 101vw;
  color: var(--color-dark);
  font-size: 12vw;
  white-space: nowrap;
  letter-spacing: var(--letter-spacing-display);
  cursor: default;
}

.manifesto .letter {
  display: inline-block;
  will-change: transform;
}

@media (max-width: 600px) {
  .manifesto .text {
    font-size: clamp(52px, 15vw, 72px);
  }
}

/* --------------------------- approach / journey ------------------------ */
.trajectory {
  position: relative;
  z-index: 3;
  padding: 0 2vw;
  background-color: var(--color-dark);
}

.trajectory .entry .container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.trajectory .title {
  color: var(--color-cream);
  font-family: var(--font-display);
  font-size: 12vw;
  font-weight: 700;
  text-align: center;
  letter-spacing: var(--letter-spacing-display);
}

.trajectory .title span {
  display: inline-block;
  will-change: transform;
}

.trajectory-sentences {
  width: calc(100% + 4vw);
  margin-left: -2vw;
  margin-right: -2vw;
  background-color: var(--color-dark);
  transition: background-color 0.6s linear;
}

.trajectory-sentences__pin-height {
  height: 1000vh;
}

.trajectory-sentences__container {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  overflow: hidden;
}

.trajectory-sentences__visuals {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.trajectory-sentences__visual {
  position: absolute;
  top: 50%;
  width: 0;
  height: 0;
  background-image: url('../assets/gradient-journey.jpg');
  background-repeat: no-repeat;
  background-size: 100vw 100vh;
  will-change: transform, width, height, border-radius;
}

.trajectory-sentences__visual--left {
  left: 0;
  background-position: left center;
  border-radius: 0 24px 24px 0;
}

.trajectory-sentences__visual--right {
  right: 0;
  background-position: right center;
  border-radius: 24px 0 0 24px;
}

.trajectory-sentences__center {
  position: relative;
  z-index: 2;
  width: 100%;
}

.trajectory-sentences__sentence {
  width: 100%;
  color: var(--color-cream);
  font-size: 10vw;
  line-height: 0.9;
  text-align: center;
  letter-spacing: var(--letter-spacing-display);
}

.trajectory-sentences__sentence.is-two-lines {
  margin-top: -0.45em;
}

.trajectory-sentences__sentence span {
  display: inline-block;
  will-change: transform;
}

.trajectory-sentences__sentence:not(:first-child) {
  position: absolute;
  top: 0;
  left: 0;
}

@media (hover: hover) and (pointer: fine) {
  .trajectory-sentences__sentence.is-both.is-pointer-play {
    pointer-events: none;
  }

  .trajectory-sentences__sentence.is-both.is-pointer-play > span {
    color: transparent;
    pointer-events: auto;
    -webkit-text-stroke: 2px var(--stroke-color, #1f1d1d);
    transition: color 0.3s, -webkit-text-stroke-width 0.3s;
  }

  .trajectory-sentences__sentence.is-both.is-pointer-play:hover > span {
    color: var(--stroke-color, #1f1d1d);
    -webkit-text-stroke-width: 0;
  }
}

@media (max-width: 600px) {
  .trajectory .title {
    font-size: clamp(52px, 15vw, 72px);
  }

  .trajectory-sentences__sentence {
    font-size: clamp(42px, 12vw, 60px);
  }
}

/* ------------------------------- toolkit ------------------------------- */
.toolkit {
  position: relative;
  z-index: 4;
  background-color: var(--color-dark);
  color: var(--color-cream);
}

.toolkit__pin-height {
  height: 620vh;
}

.toolkit__container {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 100vh;
  background-color: var(--color-dark);
  overflow: hidden;
}

.toolkit__header {
  position: absolute;
  top: 18vh;
  left: 0;
  z-index: 3;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.toolkit__title {
  font-family: var(--font-display);
  font-size: max(48px, 6vw);
  font-weight: 700;
  letter-spacing: var(--letter-spacing-display);
}

.toolkit__subtitle-wrap {
  position: relative;
  height: 3.2em;
  margin-top: 2vh;
  overflow: hidden;
}

.toolkit__subtitle {
  position: absolute;
  inset: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: max(20px, 2vw);
  font-weight: 300;
  text-align: center;
}

.toolkit__wheel {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.toolkit__wheel--b {
  z-index: 2;
  opacity: 0;
  pointer-events: none;
}

.toolkit__slot {
  --wheel-top: 58vh;
  position: absolute;
  top: var(--wheel-top);
  left: 50%;
  visibility: hidden;
  will-change: transform;
}

.toolkit__slot.is-visible {
  visibility: visible;
}

.toolkit-card {
  position: relative;
  width: clamp(180px, 18vw, 295px);
  aspect-ratio: 295 / 417;
  border-radius: 20px;
  overflow: hidden;
  cursor: default;
  transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.toolkit__wheel.is-interactive .toolkit-card {
  pointer-events: auto;
  cursor: pointer;
}

@media (any-hover: hover) and (any-pointer: fine) {
  .toolkit__wheel.is-interactive .toolkit-card:hover {
    transform: translateY(-3%) scale(1.04);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  }
}

.toolkit-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
  padding: clamp(16px, 1.4vw, 26px);
  background-color: var(--card-bg, #111);
  color: var(--card-fg, #fff);
}

.toolkit-card__index {
  position: absolute;
  top: clamp(14px, 1.2vw, 22px);
  right: clamp(14px, 1.2vw, 22px);
  font-family: var(--font-ui);
  font-size: clamp(11px, 0.85vw, 14px);
  font-weight: 500;
  opacity: 0.55;
}

.toolkit-card__glow {
  position: absolute;
  top: -28%;
  left: -20%;
  width: 140%;
  height: 90%;
  background: radial-gradient(circle at 50% 50%, currentColor, transparent 62%);
  opacity: 0.22;
  pointer-events: none;
}

.toolkit-card__name {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.5vw, 44px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
}

.toolkit-card__tag {
  position: relative;
  align-self: flex-start;
  padding: 0.5em 0.95em;
  border-radius: 999px;
  background-color: color-mix(in srgb, currentColor 16%, transparent);
  font-family: var(--font-ui);
  font-size: clamp(10px, 0.78vw, 13px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.toolkit-card__mark {
  position: absolute;
  top: clamp(16px, 1.4vw, 26px);
  left: clamp(16px, 1.4vw, 26px);
  width: 30%;
  height: auto;
  opacity: 0.9;
}

/* flip card (deck hand-off) */
.toolkit-card--flip {
  perspective: 2000px;
  background: none;
  box-shadow: none;
  overflow: visible;
}

.toolkit-card__flipper {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
}

.toolkit-card--flip .toolkit-card__face {
  border-radius: 20px;
  overflow: hidden;
  backface-visibility: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.toolkit-card__face--back {
  transform: rotateY(180deg);
}

@media (min-width: 1025px) {
  .toolkit__header {
    top: 12vh;
  }

  .toolkit__slot {
    --wheel-top: 51vh;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  .toolkit-card {
    width: min(clamp(150px, 48vw, 180px), 26svh);
  }
}

/* ------------------------------- projects ------------------------------ */
.projects {
  position: relative;
  z-index: 5;
  background-color: var(--color-dark);
}

.projects__pin-height {
  height: 380vh;
}

.projects__container {
  position: sticky;
  top: 0;
  height: 100vh;
  color: var(--color-dark);
  background-color: var(--color-cream);
  border-radius: 0;
  overflow: hidden;
  transform-origin: top center;
  will-change: transform, border-radius;
}

.projects__title {
  position: absolute;
  top: 11vh;
  left: 0;
  width: 100%;
  font-family: var(--font-display);
  font-size: max(48px, 6vw);
  font-weight: 700;
  text-align: center;
  letter-spacing: var(--letter-spacing-display);
  transition: color 0.4s var(--ease-out);
}

/* the open preview may float over the title; it steps back with the other rows */
.projects__container.is-previewing .projects__title {
  color: rgba(31, 29, 29, 0.35);
}

.projects__list {
  position: absolute;
  top: 26vh;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 5vh, 44px);
  width: 100%;
}

.projects__link {
  position: relative;
  display: flex;
  justify-content: center;
  width: fit-content;
  color: inherit;
  font-family: var(--font-ui);
  font-size: min(clamp(44px, 6.6vw, 84px), 8.4vh);
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
}

.projects__link:focus-visible {
  outline: 2px solid;
  outline-offset: 4px;
}

.project-letter {
  position: relative;
  display: inline-block;
  transform-origin: 50% 50%;
  pointer-events: none;
  will-change: transform;
}

/* the name opens at its seam; the preview grows out of the gap */
.projects__half,
.projects__seam {
  display: flex;
  transition: transform 0.85s var(--ease-out);
}

.projects__seam {
  position: relative;
}

.projects__link.is-hovered .projects__half--start {
  transform: translate3d(calc(var(--project-shift, 0px) - var(--project-push, 0px)), 0, 0);
}

.projects__link.is-hovered .projects__half--end {
  transform: translate3d(calc(var(--project-shift, 0px) + var(--project-push, 0px)), 0, 0);
}

.projects__link.is-hovered .projects__seam {
  transform: translate3d(var(--project-shift, 0px), 0, 0);
}

.project-preview {
  --preview-radius: clamp(10px, 0.9vw, 16px);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: min(clamp(220px, 19vw, 360px), 44vh);
  aspect-ratio: 16 / 10;
  transform: translate(-50%, -50%);
  pointer-events: none;
  filter: drop-shadow(0 24px 40px rgba(31, 29, 29, 0.28));
}

.project-preview__frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: var(--preview-radius);
  background: linear-gradient(125deg, #0b9ec9, #1a4fd0 55%, #6b2fd6);
  clip-path: inset(0 50% 0 50% round var(--preview-radius));
  transform: scale(0.92);
  transition:
    clip-path 0.55s cubic-bezier(0.55, 0, 0.1, 1),
    transform 0.55s cubic-bezier(0.55, 0, 0.1, 1);
}

.projects__link.is-hovered .project-preview__frame {
  clip-path: inset(0 0 0 0 round var(--preview-radius));
  transform: scale(1);
  transition-duration: 0.85s;
  transition-timing-function: var(--ease-out);
}

.project-preview__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transform: scale(1.18);
  transition: transform 1.2s var(--ease-out), opacity 0.35s ease;
}

.projects__link.is-hovered .project-preview__media {
  transform: scale(1);
}

/* the still frame stays underneath until the video actually has pixels */
.project-preview__video {
  opacity: 0;
}

.project-preview.is-playing .project-preview__video {
  opacity: 1;
}

/* no preview and no poster yet: the brand mark holds the slot */
.project-preview.is-empty .project-preview__frame::after {
  content: '';
  position: absolute;
  inset: 34% 38%;
  background-color: var(--color-cream);
  -webkit-mask: url('../brand/krondel-mark.svg') center / contain no-repeat;
  mask: url('../brand/krondel-mark.svg') center / contain no-repeat;
  opacity: 0.85;
}

@media (max-width: 600px) {
  .projects__list {
    top: 31vh;
    padding-inline: 24px;
  }

  .projects__title {
    top: 17vh;
  }

  .projects__link {
    font-size: min(clamp(30px, 9.5vw, 50px), 9vh);
  }
}

/* ------------------------------ next + footer -------------------------- */
.next-section {
  position: relative;
  z-index: 6;
  background-color: var(--color-dark);
  color: var(--color-cream);
}

.next-section__pin-height {
  height: 520vh;
}

.next-section__container {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.next-section__intro {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(48px, 7vw, 120px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: var(--letter-spacing-display);
  text-align: center;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  will-change: opacity, transform;
}

.next-section__playground-link {
  position: absolute;
  top: calc(115% + clamp(12px, 1.5vw, 24px));
  left: 50%;
  width: max-content;
  color: var(--color-cream);
  font-family: var(--font-ui);
  font-size: clamp(16px, 1.5vw, 24px);
  line-height: 1.2;
  text-decoration: none;
  transform: translateX(-50%);
}

.playground-link {
  display: inline-block;
  width: fit-content;
  font-weight: 400;
  letter-spacing: 0;
}

.playground-link__letter,
.playground-link__word {
  display: inline-block;
}

.next-section__playground-arrow {
  display: inline-block;
  margin-left: 0.35em;
  will-change: transform;
}

.next-section__svg {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: block;
  max-width: none;
  overflow: visible;
  pointer-events: none;
  will-change: transform, opacity;
}
.next-section__text {
  fill: var(--color-cream);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.04em;
}
.next-section__text #nextTextGradientPart { fill: url(#nextTextGradient); }
.next-section__orb {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  border-radius: 50%;
  background: #5cc2d6;
  pointer-events: none;
  opacity: 0;
  will-change: transform, opacity;
}

.next-footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 1;
  height: calc(50vh - 18px);
  border-radius: 18px;
  overflow: hidden;
  pointer-events: none;
  -webkit-clip-path: circle(0);
  clip-path: circle(0);
  will-change: clip-path;
}

.next-footer__background {
  position: absolute;
  inset: 0;
  background-image: url('../assets/gradient-footer.jpg');
  background-position: center;
  background-size: cover;
}

.next-footer__content {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
  padding: clamp(40px, 6vw, 100px);
  color: var(--color-cream);
}

.next-footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: clamp(64px, 10vw, 180px);
  width: 100%;
}

.next-footer__main {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: clamp(24px, 4vh, 50px);
  min-width: 0;
}

.next-footer__headline {
  max-width: 950px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.3vw, 72px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: var(--letter-spacing-display);
}

.next-footer__meta {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.1vw, 20px);
  font-weight: 400;
}

.next-footer__nav {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: flex-start;
  gap: clamp(24px, 4vw, 56px);
  padding-top: clamp(4px, 1vh, 16px);
}

.next-footer__group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(8px, 1.3vh, 18px);
  min-width: clamp(110px, 8vw, 160px);
}

.next-footer__group-title {
  margin-bottom: clamp(8px, 1.4vh, 18px);
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 500;
  line-height: 1;
}

.next-footer__group a {
  color: inherit;
  font-family: var(--font-ui);
  font-size: clamp(17px, 1.2vw, 24px);
  font-weight: 400;
  line-height: 1.2;
  text-decoration: none;
}

.next-footer.is-open {
  pointer-events: auto;
}

@media (max-width: 1024px) and (orientation: portrait) {
  .next-section__intro {
    font-size: clamp(36px, 9vw, 72px);
  }

  .next-footer {
    --inset: max(8px, 1vw);
    right: var(--inset);
    bottom: var(--inset);
    left: var(--inset);
    height: calc(min(66vh, 720px) - var(--inset));
  }

  .next-footer__content {
    align-items: stretch;
    padding: clamp(28px, 7vw, 40px);
  }

  .next-footer__inner {
    flex-direction: column;
    gap: clamp(16px, 2.5vh, 32px);
  }

  .next-footer__headline {
    font-size: clamp(26px, 6vw, 48px);
  }

  .next-footer__nav {
    justify-content: space-between;
    width: 100%;
    padding-top: 0;
  }

  .next-footer__group {
    min-width: 0;
  }
}

/* ------------------------------ legal page ----------------------------- */
.legal {
  min-height: 100vh;
  padding: clamp(96px, 14vh, 200px) clamp(24px, 8vw, 140px) clamp(64px, 10vh, 120px);
  background-color: var(--color-cream);
  color: var(--color-dark);
}

.legal h1 {
  font-size: clamp(44px, 8vw, 120px);
  line-height: 0.92;
  letter-spacing: var(--letter-spacing-display);
}

.legal h2 {
  margin-top: clamp(32px, 5vh, 64px);
  font-size: clamp(22px, 2.2vw, 34px);
  letter-spacing: var(--letter-spacing-display);
}

.legal p,
.legal li {
  max-width: 68ch;
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: clamp(16px, 1.1vw, 19px);
  font-weight: 400;
  line-height: 1.6;
}

.legal a {
  color: inherit;
}

.legal__back {
  display: inline-block;
  margin-bottom: clamp(24px, 4vh, 48px);
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
  color: inherit;
  text-decoration: none;
}

/* ----------------------------- reduced motion -------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero__scroll-arrow {
    animation: none;
  }

  .projects__half,
  .projects__seam,
  .project-preview__frame,
  .project-preview__media {
    transition-duration: 0.01ms !important;
  }

  * {
    scroll-behavior: auto !important;
  }
}

/* Let short screens scroll the revealed contact panel rather than clip its links. */
.next-footer.is-open { overflow-y: auto; overscroll-behavior: contain; }
.next-footer__content { min-height: 100%; height: auto; }
.next-section__intro { pointer-events: none; }
.next-section__intro.is-visible { pointer-events: auto; }
.next-footer__content { padding: clamp(24px, 4vh, 64px) clamp(24px, 6vw, 100px); }
@media (max-width: 600px) {
  .next-footer__content { padding: 24px; }
  .next-footer__meta { flex-wrap: wrap; gap: 12px 24px; }
}

/* Keep the page branded and readable even after a GPU context loss. */
.hero__fallback-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(80px, 23vw, 440px);
  letter-spacing: -0.07em;
}
.hero__fallback-mark {
  position: absolute;
  width: min(42vw, 320px);
  height: auto;
  transform: rotate(-12deg);
  filter: drop-shadow(12px 18px 20px rgba(0, 30, 60, 0.3));
}
.next-footer__content { flex-direction: column; justify-content: center; gap: 24px; }
.back-to-top {
  display: inline-flex;
  flex: none;
  align-self: center;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 18px;
  color: inherit;
  border: 1px solid rgba(245, 231, 223, 0.45);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 14px;
  text-decoration: none;
  background: rgba(0, 20, 40, 0.12);
}
.back-to-top:hover { background: rgba(0, 20, 40, 0.25); }
.back-to-top:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
