/* Full portrait is the page background. Cards sit on top; section bands stay clear. */

body:has(.site-face),
:root[data-theme="light"] body:has(.site-face),
:root[data-theme="dark"] body:has(.site-face) {
  background-color: var(--paper);
  background-image: none;
}

.site-face {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.face-stage__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.06;
  transition: opacity 0.55s ease;
}

.site-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--paper);
}

/* Home fallback layer must stay clear so the canvas (or ::after) can read through. */
.site-face .site-bg {
  background: transparent;
}

body > .site-bg {
  position: fixed;
  inset: 0;
  height: auto;
  z-index: -1;
}

.site-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("../assets/photos/site-bg-illustration.png");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: 0.06;
  transition: opacity 0.55s ease, transform 0.55s ease;
}

html.has-face-gl .site-face .site-bg::after {
  opacity: 0;
}

/* Dark theme keeps the real drawing. A charcoal veil sits over it
   so light type still reads — no invert, no negative. */
:root:not([data-theme="light"]) .site-face::after,
:root:not([data-theme="light"]) body > .site-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      180deg,
      rgb(5 5 5 / 0.38) 0%,
      rgb(5 5 5 / 0.58) 45%,
      rgb(5 5 5 / 0.7) 100%
    );
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.55s ease;
  z-index: 2;
}

:root:not([data-theme="light"]) .hero-editorial__name,
:root:not([data-theme="light"]) .hero-editorial__solid,
:root:not([data-theme="light"]) .hero-editorial__pitch,
:root:not([data-theme="light"]) .section__title,
:root:not([data-theme="light"]) .how-build__lede,
:root:not([data-theme="light"]) .work-invite__lede {
  text-shadow: 0 1px 16px rgb(0 0 0 / 0.55);
}

@media (hover: hover) and (pointer: fine) {
  body:hover .face-stage__canvas {
    opacity: 1;
  }

  body:hover > .site-bg::after {
    opacity: 1;
    transform: scale(1.035);
  }

  html.has-face-gl body:hover .site-face .site-bg::after {
    opacity: 0;
  }

  :root:not([data-theme="light"]) body:hover .site-face::after,
  :root:not([data-theme="light"]) body:hover > .site-bg::before {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .face-stage__canvas,
  .site-bg::after {
    transition: none;
  }

  body:hover > .site-bg::after {
    transform: none;
  }
}

/* Do not reset .nav position — it stays sticky. */
body:has(.site-face) .nav {
  z-index: 20;
}

body:has(.site-face) main,
body:has(.site-face) .footer {
  position: relative;
  z-index: 1;
}

body:has(.site-face) .section,
body:has(.site-face) .section--warm,
body:has(.site-face) .section--dark,
body:has(.site-face) .hero--editorial,
body:has(.site-face) .how-build__shell,
body:has(.site-face) .how-build__main,
body:has(.site-face) .contact__intro,
body:has(.site-face) .footer {
  background: transparent;
}

body:has(.site-face) .why-card,
body:has(.site-face) .ai-process__step,
body:has(.site-face) .contact-action:not(.contact-action--wa),
body:has(.site-face) .contact-brief,
body:has(.site-face) .work-card {
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.hero--editorial {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-height) + 1.5rem) clamp(1.15rem, 4vw, 3rem) 2rem;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}

.hero--editorial::before {
  display: none;
}

.hero-editorial__inner {
  position: relative;
  z-index: 2;
  width: min(920px, 100%);
  margin: 0 auto;
  text-align: center;
}

.hero-editorial__eyebrow {
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-editorial__stage {
  position: relative;
  margin: 0 0 1.35rem;
}

.hero-editorial__type {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  line-height: 0.95;
}

.hero-editorial__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 11vw, 6.2rem);
  letter-spacing: -0.045em;
  line-height: 0.92;
  color: var(--ink);
}

/* Nickname flap — hover / focus / tap flips Kunal Varshney → Little */
.hero-editorial__type,
.hero-editorial__name.name-flip {
  transform-style: preserve-3d;
}

.name-flip {
  display: inline-block;
  max-width: 100%;
  perspective: 1200px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.name-flip:focus {
  outline: none;
}

.name-flip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0.12em;
  border-radius: 4px;
}

.name-flip__inner {
  display: grid;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  animation: name-flip-hint 1.35s var(--ease) 2.45s 1;
}

.name-flip__face {
  grid-area: 1 / 1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.name-flip__face--back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: rotateX(180deg);
  color: var(--accent);
  /* Hide until 3D flip is ready — otherwise "Little" paints over the name on first load */
  visibility: hidden;
}

.name-flip__aka {
  display: block;
  margin-bottom: 0.12em;
  font-family: var(--font-mono);
  font-size: 0.14em;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.hero-editorial__name.name-flip:is(:hover, :focus-visible, .is-flipped) .name-flip__inner,
.nav__brand:is(:hover, :focus-visible) .name-flip--nav .name-flip__inner {
  animation: none;
  transform: rotateX(180deg);
}

.hero-editorial__name.name-flip:is(:hover, :focus-visible, .is-flipped) .name-flip__face--back,
.nav__brand:is(:hover, :focus-visible) .name-flip--nav .name-flip__face--back {
  visibility: visible;
}

@keyframes name-flip-hint {
  0%, 100% { transform: rotateX(0); }
  35% { transform: rotateX(-16deg); }
  62% { transform: rotateX(7deg); }
}

.name-flip--nav {
  perspective: 640px;
  cursor: inherit;
}

.name-flip--nav .name-flip__inner {
  animation: none;
}

.name-flip--nav .name-flip__face--back {
  flex-direction: row;
  justify-content: flex-start;
  font-size: 0.92em;
  letter-spacing: -0.03em;
}

.hero-editorial__roles {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.2em 0.35em;
}

.hero-editorial__solid {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 6.5vw, 3.75rem);
  letter-spacing: -0.035em;
  text-transform: lowercase;
  color: var(--ink);
}

.hero-editorial__outline {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 6.5vw, 3.75rem);
  letter-spacing: -0.035em;
  text-transform: lowercase;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--ink) 90%, transparent);
  paint-order: stroke fill;
}

.hero-editorial__pitch {
  margin: 0 auto 1rem;
  max-width: 42ch;
  font-size: clamp(1rem, 2.2vw, 1.12rem);
  line-height: 1.55;
  font-weight: 500;
  color: var(--ink-soft);
}

.hero-editorial__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem 1.5rem;
}

.hero-editorial__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
}

.hero-editorial__proof {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin: 0 auto 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.hero-editorial__proof li:not(:last-child)::after {
  content: "·";
  margin-left: 1.25rem;
  color: var(--ink-faint);
  font-weight: 400;
}

.hero-editorial__proof a {
  color: inherit;
  text-underline-offset: 0.15em;
}

.hero-editorial__proof a:hover {
  color: var(--accent-strong);
}

.hero-editorial__scroll {
  position: absolute;
  right: clamp(1rem, 3vw, 2rem);
  bottom: 1.5rem;
  z-index: 2;
  font-size: 1.25rem;
  color: var(--ink-faint);
  text-decoration: none;
  animation: hero-editorial-bob 2.4s ease-in-out infinite;
}

@keyframes hero-editorial-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.hero-editorial__type,
.hero-editorial__pitch,
.hero-editorial__foot {
  will-change: transform, opacity;
}

.section__title--scroll {
  will-change: transform, opacity;
  transform-origin: left center;
}

@media (prefers-reduced-motion: reduce) {
  .hero-editorial__type,
  .hero-editorial__pitch,
  .hero-editorial__foot,
  .section__title--scroll,
  [data-scroll-reveal] {
    will-change: auto;
    transform: none !important;
    opacity: 1 !important;
  }

  .hero-editorial__scroll {
    animation: none;
  }

  .name-flip__inner {
    animation: none;
    transition: none;
    transform: none !important;
  }

  .name-flip__face--back {
    transform: none;
    visibility: hidden;
    opacity: 0;
  }

  .hero-editorial__name.name-flip:is(:hover, :focus-visible, .is-flipped) .name-flip__face--front,
  .nav__brand:is(:hover, :focus-visible) .name-flip--nav .name-flip__face--front {
    opacity: 0;
  }

  .hero-editorial__name.name-flip:is(:hover, :focus-visible, .is-flipped) .name-flip__face--back,
  .nav__brand:is(:hover, :focus-visible) .name-flip--nav .name-flip__face--back {
    visibility: visible;
    opacity: 1;
  }
}

.nav--on-editorial {
  --nav-bg: color-mix(in srgb, var(--paper) 82%, transparent);
  color: var(--ink);
}

.nav--on-editorial .nav__brand-name,
.nav--on-editorial .nav__links a {
  color: var(--ink);
}

@media (max-width: 640px) {
  .hero--editorial {
    min-height: auto;
    padding-top: calc(var(--nav-height) + 1.1rem);
    padding-bottom: 3.25rem;
    padding-inline: max(1rem, env(safe-area-inset-left, 0px)) max(1rem, env(safe-area-inset-right, 0px));
  }

  .hero-editorial__name {
    font-size: clamp(2.15rem, 11vw, 3.2rem);
    overflow-wrap: anywhere;
  }

  .hero-editorial__roles {
    flex-direction: column;
    align-items: center;
    gap: 0;
    line-height: 1.05;
  }

  .hero-editorial__solid,
  .hero-editorial__outline {
    font-size: clamp(1.35rem, 7vw, 1.85rem);
  }

  .hero-editorial__outline {
    -webkit-text-stroke-width: 1px;
  }

  .hero-editorial__pitch {
    max-width: none;
    font-size: 1rem;
  }

  .hero-editorial__proof {
    gap: 0.35rem 0.85rem;
  }

  .hero-editorial__proof li:not(:last-child)::after {
    margin-left: 0.85rem;
  }

  .hero-editorial__actions {
    width: 100%;
  }

  .hero-editorial__actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .hero-editorial__scroll {
    display: none;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hero--editorial {
    min-height: auto;
    padding-top: calc(var(--nav-height) + 0.6rem);
    padding-bottom: 1.5rem;
    justify-content: flex-start;
  }

  .hero-editorial__scroll {
    display: none;
  }
}
