/* ─────────────────────────────────────────────────────────────
   Mobile layout (< 768px). Loaded only on small screens; the desktop
   stage engine (main.js) never runs here — mobile.js does instead.
   Same DOM, same tokens, same assets: the fixed 1920×1080 frame becomes
   a vertical document that scrolls naturally under a thumb.
   Every rule is scoped to html.is-mobile so nothing leaks upward.
   ───────────────────────────────────────────────────────────── */
html.is-mobile {
  --pad: clamp(18px, 5.2vw, 28px);
  --header-h: 64px;
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-top: calc(var(--header-h) + 8px);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
html.is-mobile body {
  height: auto;
  min-height: 100%;
  overflow: visible;
}
html.is-mobile #viewport {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
}
html.is-mobile #stage {
  position: static;
  width: auto !important;
  height: auto !important;
  transform: none !important;
  overflow: visible;
}
/* Faint construction grid stays as a fixed backdrop, like the desktop paper. */
html.is-mobile #stage > .grid {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
}
html.is-mobile #design {
  position: relative;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  clip-path: none !important;
  display: flex;
  flex-direction: column;
  padding: calc(var(--header-h) + 56px) var(--pad) 0;
  z-index: 1;
}
/* Everything flows; nothing is pinned to stage coordinates any more. */
html.is-mobile #design > * {
  position: static;
  transform: none;
  translate: none;
  will-change: auto;
}
/* …except the blocks whose own children are positioned inside them. */
html.is-mobile #design > .avatar,
html.is-mobile #design > .cross,
html.is-mobile #design > .collage,
html.is-mobile #design > .footer,
html.is-mobile #design > .card {
  position: relative;
}
/* Never let the first-load gate hide content on mobile (there is no counter). */
html.is-mobile #stage.is-loading #design > *,
html.is-mobile #stage.is-loading .chrome > * {
  opacity: 1;
  visibility: visible;
}

/* Desktop-only pieces */
html.is-mobile .hero-title.upper,
html.is-mobile .hero-title.overlay,
html.is-mobile .cross,
html.is-mobile .work-arrows,
html.is-mobile .loader,
html.is-mobile .seal,
html.is-mobile .nav .bullet {
  display: none;
}

/* Scroll reveal: each piece of content loads in as it enters the viewport —
   rises, fades and sharpens — with a short stagger inside its group (--d). */
html.is-mobile #design .m-reveal,
html.is-mobile .chrome .m-reveal {
  opacity: 0;
  transform: translateY(26px);
  filter: blur(6px);
  transition: opacity 0.7s var(--ease-out), transform 0.8s var(--ease-out), filter 0.7s ease;
  transition-delay: var(--d, 0ms);
  will-change: opacity, transform, filter;
}
html.is-mobile #design .m-reveal.in,
html.is-mobile .chrome .m-reveal.in {
  opacity: 1;
  transform: none;
  filter: blur(0);
  will-change: auto;
}
/* Images and cards settle in from a touch smaller */
html.is-mobile #design .m-reveal.m-scale {
  transform: translateY(26px) scale(0.965);
}
html.is-mobile #design .m-reveal.m-scale.in {
  transform: none;
}

/* ── Header ─────────────────────────────────────────────────── */
html.is-mobile .chrome {
  position: static;
  width: auto;
  height: auto;
  transform: none;
}
html.is-mobile .chrome-top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad);
  background: rgba(255, 255, 255, 0.94);
  /* no filter/transform here: they would become the containing block of the fixed menu */
  transform: none;
  filter: none;
  will-change: auto;
  z-index: 60;
}
html.is-mobile .chrome-top .logo {
  position: static;
  width: 56px;
  height: auto;
  transform: none;
  display: block;
}
html.is-mobile .chrome-top .logo img {
  position: static;
  width: 100%;
  height: auto;
}
html.is-mobile .chrome-top .logo .logo-halo {
  display: none;
}
html.is-mobile .menu-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
html.is-mobile .menu-btn i {
  grid-area: 1 / 1;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: translateY(-4px);
  transition: transform 0.28s var(--ease-out);
}
html.is-mobile .menu-btn i + i {
  transform: translateY(4px);
}
html.is-mobile.menu-open .menu-btn i {
  transform: rotate(45deg);
}
html.is-mobile.menu-open .menu-btn i + i {
  transform: rotate(-45deg);
}

/* Full-screen menu under the header */
html.is-mobile .chrome-top .nav {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--header-h);
  bottom: 0;
  width: auto;
  height: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: left;
  gap: 0;
  padding: 0 var(--pad) 12vh;
  background: var(--bg);
  transform: translateY(-10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.32s var(--ease-out);
  z-index: 55;
}
html.is-mobile.menu-open .chrome-top .nav {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
html.is-mobile .nav a {
  display: block;
  justify-items: start;
  text-align: left;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--archivo);
  font-size: clamp(30px, 9vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  text-transform: none;
  -webkit-tap-highlight-color: transparent;
}
html.is-mobile .nav a .lbl {
  display: block;
  transform: none;
}
html.is-mobile .nav a .tag {
  display: none;
}
/* The active item keeps the desktop's graffiti tag — a small identity moment. */
html.is-mobile .nav a.active .lbl {
  display: none;
}
html.is-mobile .nav a.active .tag {
  display: block;
  font-family: "a Another Tag", var(--archivo);
  font-weight: 400;
  font-size: clamp(40px, 12vw, 56px);
  letter-spacing: 0;
  line-height: 1;
  padding: 4px 0;
}
html.is-mobile.menu-open body {
  overflow: hidden;
}

/* ── Hero ───────────────────────────────────────────────────── */
html.is-mobile .avatar {
  order: 1;
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0;
}
html.is-mobile .intro {
  order: 2;
  width: auto;
  max-width: 34em;
  margin: 14px 0 0;
}
html.is-mobile .intro-head,
html.is-mobile .intro .salaam,
html.is-mobile .intro .name {
  width: auto;
  max-width: 100%;
}
html.is-mobile .intro .name {
  font-size: 17px;
}
html.is-mobile .intro .body {
  width: auto;
  font-size: 15.5px;
  line-height: 1.6;
}
/* Bricks: the same Cycles image sequence as desktop. The player expects its
   1067×1000 design box (its 260px headroom is in design px), so the box keeps
   that size and is zoomed down to the column width (--lz, set by mobile.js). */
html.is-mobile .lego {
  order: 3;
  width: 1067px;
  height: 1000px;
  margin: 10px auto 0;
  overflow: visible;
  zoom: var(--lz, 0.32);
  pointer-events: none;
}
html.is-mobile .lego img {
  position: absolute;
  left: 0;
  top: -11.33%;
  width: 100%;
  height: 106.73%;
  filter: none;
}
html.is-mobile .lego img.blurred {
  display: block;
  filter: blur(22px);
}
html.is-mobile #design > .lego {
  position: relative;
}

/* The two small labels share one row: left and right, just above the title. */
html.is-mobile .portfolio-lbl,
html.is-mobile .designer-lbl {
  width: auto;
  font-size: 11px;
  letter-spacing: 1px;
  line-height: 18px;
  color: var(--text-secondary);
}
html.is-mobile .portfolio-lbl {
  order: 4;
  margin: -16% 0 0; /* labels and title ride up over the blurred blue brick */
  align-self: flex-start;
  position: relative;
  z-index: 1;
}
html.is-mobile .designer-lbl {
  order: 5;
  margin: -18px 0 0;
  align-self: flex-end;
  position: relative;
  z-index: 1;
}
html.is-mobile .hero-title.lower {
  order: 6;
  position: relative;
  z-index: 1;
  width: auto;
  margin: 4px 0 0;
  font-size: clamp(52px, 17vw, 100px);
  letter-spacing: -0.04em;
  line-height: 0.92;
  text-transform: uppercase;
  white-space: normal;
  text-align: center;
  filter: none;
}

/* ── Work ───────────────────────────────────────────────────── */
html.is-mobile .cross {
  order: 6;
  width: 231px;
  height: 231px;
  margin: 72px 0 0 calc(var(--pad) * -1);
  zoom: 0.42;
}
html.is-mobile .work-header {
  order: 7;
  width: auto;
  margin: 88px 0 0;
}
html.is-mobile .work-header h2 {
  font-size: clamp(25px, 7vw, 38px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}
html.is-mobile .work-header p {
  width: auto;
  max-width: 34em;
  margin-top: 16px;
  font-size: 15px;
  line-height: 1.55;
}
html.is-mobile .card {
  order: 8;
  display: flex;
  flex-direction: column;
  width: auto;
  height: auto;
  margin-top: 40px;
  text-decoration: none;
  color: inherit;
  cursor: default;
}
html.is-mobile .card + .card {
  margin-top: 44px;
}
/* Beat the desktop's state-based hiding, but leave the scroll reveal in charge
   of anything that carries .m-reveal until it has arrived (.in). */
html.is-mobile #stage .card .card-label:not(.m-reveal),
html.is-mobile #stage .card .card-kind:not(.m-reveal),
html.is-mobile #stage .card .card-meta:not(.m-reveal),
html.is-mobile #stage .card .colorbar,
html.is-mobile #stage .card .m-reveal.in {
  opacity: 1;
  pointer-events: auto;
}
html.is-mobile .card .card-label {
  position: static;
  order: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: auto;
  margin-bottom: 12px;
  opacity: 1;
  pointer-events: auto;
  transition: none;
}
html.is-mobile .card .pjt {
  font-size: 18px;
  line-height: 1;
  gap: 8px;
}
html.is-mobile .card .colorbar {
  position: static;
  width: 92px;
  height: auto;
  opacity: 1;
}
html.is-mobile .card .card-face {
  position: relative;
  order: 2;
  inset: auto;
  width: 100%;
  aspect-ratio: 741 / 529.671;
  border-radius: 14px;
  overflow: hidden;
  filter: none;
  transform: none;
}
html.is-mobile .card .card-kind {
  position: static;
  order: 3;
  width: auto;
  margin: 14px 0 0;
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  text-align: left;
  opacity: 1;
  pointer-events: auto;
}
html.is-mobile .card .card-meta {
  position: static;
  order: 4;
  width: auto;
  margin-top: 8px;
  opacity: 1;
  pointer-events: auto;
}
html.is-mobile .card .card-title {
  font-size: 20px;
  line-height: 1.2 !important;
  width: auto;
}
html.is-mobile .card .card-desc {
  width: auto;
  max-width: 36em;
  margin-top: 6px;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-line-clamp: unset;
  display: block;
}
html.is-mobile .card .view {
  display: none;
}
/* Tap feedback replaces the cursor bubble */
html.is-mobile .card:active .card-face {
  transform: scale(0.985);
}
html.is-mobile .card .soon {
  order: 5;
  display: inline-block;
  margin-top: 12px;
  font-family: var(--ndot);
  font-size: 11px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--blue);
}

/* ── Journey ────────────────────────────────────────────────── */
html.is-mobile .collage {
  order: 9;
  position: relative;
  width: 100%;
  aspect-ratio: 866 / 816;
  height: auto;
  margin: 88px 0 0;
  overflow: visible;
}
html.is-mobile .collage .scene {
  position: absolute;
  left: 0;
  top: 0;
  width: 866px;
  height: 816px;
  transform-origin: 0 0;
  transform: scale(var(--cscale, 0.4)) !important;
}
html.is-mobile .journey {
  order: 10;
  width: 100% !important;
  height: auto;
  margin: 28px 0 0;
}
html.is-mobile .journey-bio,
html.is-mobile .journey-name,
html.is-mobile .journey-text,
html.is-mobile .journey .body,
html.is-mobile .journey .name {
  width: auto;
  max-width: 100%;
}
html.is-mobile .journey-text .body {
  width: auto;
  font-size: 15px;
  line-height: 1.6;
}
html.is-mobile .timeline {
  width: auto;
}

/* ── Contact ────────────────────────────────────────────────── */
html.is-mobile .footer {
  order: 11;
  position: relative;
  width: auto;
  height: auto;
  margin: 96px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
html.is-mobile .footer .connect {
  position: static;
  order: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(120px, 33vw, 200px);
  height: clamp(120px, 33vw, 200px);
  margin: 0 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-family: var(--ndot);
  font-size: clamp(12px, 3.4vw, 16px);
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  transform: none;
  z-index: 2;
  transition: transform 160ms var(--ease-out);
}
html.is-mobile .footer .connect:active {
  transform: scale(0.96);
}
html.is-mobile .footer-title {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  transform: none;
  order: 2;
  width: 100%;
  margin: calc(clamp(120px, 33vw, 200px) * -0.45) 0 0; /* button overlaps the title's top-right */
  font-size: clamp(56px, 19vw, 112px);
  letter-spacing: -0.045em;
  line-height: 0.9;
  white-space: normal;
  text-align: left;
  filter: none;
  z-index: 1;
}
html.is-mobile .footer .f-person {
  position: static;
  order: 3;
  width: min(70vw, 340px);
  height: auto;
  aspect-ratio: 617 / 680;
  margin: 4px auto 0;
  transform: none;
}

/* Copyright: flows at the very end instead of pinning to the viewport */
html.is-mobile .chrome-bottom {
  position: static;
  padding: 0 var(--pad) 28px;
}
html.is-mobile .copyright {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: auto;
  margin-top: 0;
  padding-top: 22px;
  opacity: 1;
  pointer-events: auto;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-align: center;
}
html.is-mobile .copyright .copy-left {
  text-align: center;
}
html.is-mobile .copyright .copy-right {
  margin-left: 0;
  justify-content: center;
  gap: 8px;
}
html.is-mobile .copyright .copy-right a {
  padding: 6px 0;
}

/* ── Fine-tuning per width ──────────────────────────────────── */
@media (max-width: 374px) {
  html.is-mobile .hero-title.lower {
    font-size: 50px;
  }
  html.is-mobile .footer-title {
    font-size: 50px;
  }
  html.is-mobile .card .pjt {
    font-size: 16px;
  }
}
@media (min-width: 480px) {
  html.is-mobile #design {
    padding-left: max(var(--pad), calc((100vw - 640px) / 2));
    padding-right: max(var(--pad), calc((100vw - 640px) / 2));
  }
  html.is-mobile .footer {
    margin-left: 0;
    margin-right: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  html.is-mobile #design .m-reveal,
  html.is-mobile .chrome .m-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  html.is-mobile {
    scroll-behavior: auto;
  }
}
