/* ==========================================================================
   Mobile layout — the header with its hamburger menu, and the work section
   as a feed: a vertical run of cards, media first and copy under it, in place
   of the WebGL arc. Type and colour come from the reel's own tokens
   (reel.css), so the two layouts read as one design.

   The layout in use is chosen once by js/mobile.js, which writes
   data-layout="mobile" | "desktop" on <html> — a media query alone would leave
   a dead section behind if a phone were rotated past the breakpoint after the
   JS had already picked a side.
   ========================================================================== */

/* --- Which face of the section is on ------------------------------------- */
[data-layout="mobile"] #work.reel {
  height: auto;
  min-height: 0;
  overflow: visible;
  cursor: auto;
  touch-action: auto;
  user-select: auto;
  -webkit-user-select: auto;
}

[data-layout="mobile"] #work :is(.reel__canvas, .reel__copy, .reel__nav, .reel__scrim, .reel__cta) {
  display: none;
}

[data-layout="desktop"] .feed {
  display: none;
}

/* --- Hero ----------------------------------------------------------------- */
/* Twice the type of the wide layout. It wraps past the <br> at this size, which
   is what a phone wants: a big headline that fills the top of the screen. */
[data-layout="mobile"] .intro-heading {
  font-size: clamp(4.2rem, min(18vw, 19.6cqi), 145px);
}

[data-layout="mobile"] .intro .content {
  padding-top: 5em;
  padding-bottom: 22vh;
}

/* In a column the flex basis sets the height, so the desktop's fixed width was
   padding dead space under the last line. */
[data-layout="mobile"] .intro-lines {
  flex: 0 0 auto;
}

/* Half the star shows above the fold on the first screen: it starts one
   half-height short of the bottom. */
[data-layout="mobile"] .hero-star-img {
  margin-top: calc(100vh - var(--star-size) / 2);
}

/* --- Bio: the sentence starts near the top instead of floating centred ---- */
[data-layout="mobile"] .bio .content {
  justify-content: flex-start;
  padding-top: 7.5em;
}

/* --- WORK band: bigger type on the small screen --------------------------- */
[data-layout="mobile"] .marquee__word {
  font-size: clamp(4.68rem, 20.3vw, 150px);
}

/* --- Header: logo in the middle, hamburger on the right ------------------- */
[data-layout="mobile"] header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

[data-layout="mobile"] .header-left {
  grid-column: 2;
  justify-self: center;
}

.menu-toggle {
  display: none;
}

[data-layout="mobile"] .menu-toggle {
  position: relative;
  z-index: 1; /* over the panel, so it can close it again */
  grid-column: 3;
  display: grid;
  place-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  justify-self: end;
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-surface-white);
  cursor: pointer;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}

/* the two bars cross into an X while the menu is open */
[data-menu="open"] .menu-toggle span:first-child {
  transform: translateY(3.75px) rotate(45deg);
}

[data-menu="open"] .menu-toggle span:last-child {
  transform: translateY(-3.75px) rotate(-45deg);
}

/* --- The menu itself ------------------------------------------------------ */
[data-layout="mobile"] header nav {
  position: fixed;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 4vh, 28px);
  background: #151515; /* the same flat dark as the work and services fields */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.32s ease, visibility 0.32s;
}

[data-layout="mobile"][data-menu="open"] header nav {
  opacity: 1;
  visibility: visible;
}

[data-layout="mobile"] header nav a {
  opacity: 1;
  font-family: "Futura XB", "Jost", system-ui, sans-serif;
  font-weight: 800;
  font-size: clamp(34px, 11vw, 56px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--color-surface-white);
}

/* In the overlay the section you are in is marked by colour alone — the rule
   the wide header draws would be a dark line on the dark panel. */
[data-layout="mobile"] header nav a.current {
  color: var(--accent);
  background-image: none;
}

/* nothing behind the menu should move while it is up */
[data-menu="open"] body {
  overflow: hidden;
}

/* The feed runs continuously under the fixed header — the full-height panels
   never had to — so the bar needs something behind it to stay legible. */
[data-layout="mobile"] header::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 10, 0.92),
    rgba(10, 10, 10, 0.74) 55%,
    rgba(10, 10, 10, 0)
  );
  pointer-events: none;
}

/* --- The feed ------------------------------------------------------------- */
.feed {
  display: flex;
  flex-direction: column;
  gap: clamp(44px, 11vw, 72px);
  margin: 0;
  padding: clamp(96px, 24vw, 130px) 20px clamp(56px, 14vw, 90px);
  list-style: none;
}

.feed__head {
  margin: 0 0 clamp(6px, 2vw, 12px);
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(34px, 11vw, 56px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.feed__card {
  display: block;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.feed__card.is-in {
  opacity: 1;
  transform: none;
}

/* --- Media ---------------------------------------------------------------- */
.feed__media {
  position: relative;
  overflow: hidden;
  border-radius: 14px; /* the same corner the arc cards are cut with */
  background: #222;
  aspect-ratio: 4 / 5;
}

.feed__media video,
.feed__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Opens the same overlay the desktop card's hover link does. */
.feed__gallery {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.62em 1.15em;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--color-surface-white, #fffce1);
  font-family: var(--body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transform: translateX(-50%);
}

.feed__gallery svg {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- Copy ----------------------------------------------------------------- */
/* .copy__* comes straight from reel.css; only the sizes that were tuned for a
   wide screen are re-stated for the column. */
.feed__text {
  padding-top: clamp(14px, 4vw, 22px);
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.feed__text .copy__client {
  font-size: 15px;
}

.feed__text .copy__title {
  margin-top: 8px;
  font-size: clamp(32px, 9.4vw, 48px);
}

.feed__text .copy__desc {
  max-width: none;
  margin-top: 14px;
  font-size: 15px;
}

.feed__text .copy__meta {
  max-width: none;
  margin-top: 18px;
  grid-template-columns: minmax(70px, 28%) 1fr;
  gap: 8px 18px;
  font-size: 12px;
}

.feed__text .copy__meta dd span {
  display: block;
}

/* --- Services: a shorter pile with smaller pills -------------------------- */
/* Both at once: the pills have to come down further than the box, or the same
   mass of them in a shorter stage would stack up over the title. */
[data-layout="mobile"] .wp {
  --wp-height: max(21rem, 70svh);
  --wp-pill-size: 0.64rem;
  /* Sized so "Strategic thinking" — the longer of the two lines — still holds
     one line between the walls across phone widths; above that it wraps to
     four and runs into the header. */
  --wp-title-size: 7.6vw;
  /* Lower than the wide layout's: the eyebrow has to clear the fixed header. */
  --wp-title-anchor: 26%;
  --wp-smiley-size: 3.9rem;
  --wp-star-size: 3rem;
}

[data-layout="mobile"] .wp__stage {
  min-height: 0;
  padding-top: clamp(2.6rem, 9vh, 3.6rem);
}

/* Two lines at line-height .9, so half the title's box is .9em. */
[data-layout="mobile"] #services .wp__shake {
  top: calc(var(--wp-title-anchor) + 0.9 * var(--wp-title-size) + 1rem);
}

/* --- Gallery overlay ------------------------------------------------------
   The media runs nearly the full width of the screen (gallery.js drops the
   side columns to 16px), so the arrows ride over it rather than beside it. */
[data-layout="mobile"] .gal__arrow {
  width: 40px;
  height: 40px;
  background: rgba(10, 10, 10, 0.55);
  border-color: rgba(255, 252, 225, 0.3);
  backdrop-filter: blur(6px);
}

[data-layout="mobile"] .gal__arrow--prev {
  left: 10px;
}

[data-layout="mobile"] .gal__arrow--next {
  right: 10px;
}

[data-layout="mobile"] .gal__close {
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(6px);
}

[data-layout="mobile"] .gal__foot {
  width: calc(100% - 32px);
  bottom: 16px;
  gap: 10px;
}

[data-layout="mobile"] .gal__caption {
  font-size: 12px;
}

/* --- Contact: as tall as it needs to be, not a whole screen --------------- */
[data-layout="mobile"] #contact.panel {
  height: auto;
  min-height: 0;
}

[data-layout="mobile"] .contact-inner {
  height: auto;
  padding: 4.5em 5% 3em;
  /* the gap is what sets the air above and below the closing line */
  gap: clamp(2.2rem, 5.5vh, 3.2rem);
}

@media (prefers-reduced-motion: reduce) {
  .feed__card {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
