/* Phone + tablet fixes. Loaded last on every page. */
html { background: #1c4aea !important; -webkit-text-size-adjust: 100%; }
img, video { max-width: 100%; }
/* One base colour behind every page, matching the average of the blue streak background,
   so nothing lighter flashes through while a page loads or when scrolling past the edges */
html:has(.home.home.home.home.home) { background-color: #1c4aea !important; }
html:has(.home.home.home.home.home.pg-contact) { background-color: #0a1d86 !important; }

/* ---------- Mid-size windows & tablets (701–1180px): home About block ---------- */
@media (min-width: 701px) and (max-width: 1180px) {
  html body .home.main .bio-col,
  html body .home.main.pol-big .bio-col {
    grid-template-columns: minmax(0, .85fr) minmax(0, 1fr) !important;
    gap: clamp(28px, 4vw, 48px) !important;
    align-items: center !important;
  }
  html body .home .bio-photo { width: 100% !important; max-width: 440px !important; transform: none !important; justify-self: center; }
  html body .home .bio-photo img { width: 100% !important; height: auto !important; max-width: 100% !important; }
  html body .home .bio-text { min-width: 0; width: auto !important; max-width: none !important; }
}

/* ---------- Tablet portrait (701–1024px) ---------- */
@media (min-width: 701px) and (max-width: 1024px) {
  /* Work overview cards: text left, thumbnails right (like desktop) */
  html body .pg .wc { grid-template-columns: minmax(0, 1fr) minmax(0, .72fr) !important; }
  html body .pg .wc .wc-media { order: 0 !important; }
  html body .pg .wc .wc-txt { order: 0 !important; }
}
@media (min-width: 701px) and (max-width: 1024px) and (orientation: portrait) {
  /* Hero doesn't need to fill the whole tall screen */
  html body .hero.fyp { min-height: 0 !important; padding-bottom: 24px !important; }
  html body .q3 { margin-top: 64px !important; }
}

/* Stacked hero (phones, incl. landscape): centre the rotating brand name and the button */
@media (max-width: 790px) {
  html body .fyp-wrap .fp-cur .fp-l { justify-content: center !important; }
  html body .fyp-wrap .cta-line { justify-content: center !important; }
  html body .fyp-wrap .fp-pill { justify-self: center; }
  html body .fyp-wrap .fp-h, html body .fyp-wrap .fp-ans { margin-inline: auto !important; justify-self: center; }
}

/* ---------- Phone (≤ 700px) ---------- */
@media (max-width: 700px) {
  html, body { overflow-x: hidden; }

  /* Header: name on one line, nav underneath */
  html body header.masthead.mh-bar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 9px !important;
    padding: 8px 20px 10px !important; justify-content: center !important;
    height: 74px; box-sizing: border-box;
  }
  html body .mh-bar .mast-name { font-size: 17px !important; white-space: nowrap; }
  html body .mh-bar .mh-id { width: 100%; }
  html body .mh-bar .mast-nav { gap: 20px !important; font-size: 14px !important; width: 100%; }
  html body .mh-bar .mast-nav .icon { display: inline-flex !important; margin-left: auto; }
  html body .mh-bar .mast-nav .icon svg { width: 15px; height: 15px; }

  /* Hero: keep everything inside the screen */
  html body .fyp-wrap,
  html body .fyp-wrap .fp-side { grid-template-columns: minmax(0, 1fr) !important; width: 100%; min-width: 0; }
  html body .fyp-wrap .fp-side > * { min-width: 0; max-width: 100%; }
  html body .fyp-wrap .fp-h,
  html body .fyp-wrap .fp-ans { font-size: 36px !important; }
  html body .fyp-wrap .fp-cur { font-size: 48px !important; }
  html body .fyp-wrap .fp-pill { justify-self: center; }
  html body .fyp-wrap .fp-cur .fp-l { justify-content: center !important; }
  html body .fyp-wrap .fp-ans { margin-top: 28px !important; }
  html body .fyp-wrap .cta-line { justify-content: center; margin-top: 28px; }
  html body .fyp-wrap .fp-phonebox { width: 240px !important; margin: 8px auto 0; }
  html body .fyp-wrap .fp-phone { width: 100% !important; }
  html body .hero.fyp { min-height: 0 !important; padding-top: 48px !important; }
  html body .q3 { margin-top: 56px !important; }

  /* Home "About" block: stack photo over text */
  html body .home .bio-col,
  html body .home.main .bio-col,
  html body .home.main.pol-big .bio-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 32px !important;
  }
  html body .home .bio-photo { width: min(78%, 300px) !important; margin: 0 auto !important; order: 0; }
  html body .home .bio-text { width: 100% !important; max-width: none !important; order: 1; }
  html body .home .bio-text > * { width: auto !important; max-width: none !important; }

  /* About page intro: photo above, text full width */
  html body .ab-top { display: flex !important; flex-direction: column !important; gap: 28px !important; }
  html body .ab-top .ab-photo { width: min(62%, 240px) !important; }
  html body .ab-top > div:not(.ab-photo) { width: 100% !important; }
  html body .ab-top h1, html body .ab-top h2 { font-size: clamp(40px, 12vw, 52px) !important; overflow-wrap: anywhere; }

  /* "Next case" footer: label above title */
  html body a.next { flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
  html body a.next > span { white-space: nowrap; }
  html body a.next > b { text-align: left !important; }

  /* Buttons never wrap mid-label */
  html body .cta-link { white-space: nowrap; }
  html body .see-more-l { font-size: 18px !important; }
}

/* Preview-only version switcher: keep it off touch screens so it never covers content */
@media (max-width: 1024px), (hover: none) { #pv-bar { display: none !important; } }

/* ---------- Intro → home handover (all sizes) ----------
   1. The name fades out quickly and is fully gone before the page appears (no ghosting over the hero).
   2. The hero then fades up in a short stagger instead of popping in. */
@keyframes azs-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes azs-fade { from { opacity: 0; } to { opacity: 1; } }
html[data-intro=fading] body .splash :is(.splash-name, .splash-role, .splash-lock, .splash-loader, .splash-ripple) {
  opacity: 0 !important; transition: opacity .32s ease, transform .6s ease !important;
}
html[data-intro=revealing] body .splash :is(.splash-name, .splash-role, .splash-lock, .splash-loader, .splash-ripple) {
  opacity: 0 !important; transition: none !important;
}
html[data-intro=revealing] body .splash { pointer-events: none !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-side > *,
html[data-intro=revealing] body main .hero .fyp-wrap .cta-line { animation: azs-up .9s cubic-bezier(.22,1,.36,1) both !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-side > :nth-child(1) { animation-delay: .2s !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-side > :nth-child(2) { animation-delay: .3s !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-side > :nth-child(3) { animation-delay: .4s !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-side > :nth-child(n+4),
html[data-intro=revealing] body main .hero .fyp-wrap .cta-line { animation-delay: .55s !important; }
html[data-intro=revealing] body main .hero .fyp-wrap .fp-phonebox { animation: azs-up 1.1s cubic-bezier(.22,1,.36,1) .4s both !important; }
html[data-intro=revealing] body .masthead { animation: azs-fade .9s ease .3s both !important; }
html[data-intro=revealing] body main .hero .q3,
html[data-intro=revealing] body main > .home > :not(.hero):not(.shapes):not(.grainx) { animation: azs-fade .8s ease 1s both !important; }
@media (prefers-reduced-motion: reduce) {
  html[data-intro=revealing] body main *, html[data-intro=revealing] body .masthead { animation-duration: .01s !important; animation-delay: 0s !important; }
}

/* Shorter home statement (Trim): slightly smaller, "3 billion views" never splits */
html body .q3 blockquote.qs-tight u { white-space: nowrap; }
@media (min-width: 701px) { html body .q3 blockquote.qs-tight { font-size: clamp(26px, 2.75vw, 40px) !important; } }

/* Service cards: titles reserve two lines so every card's body text starts at the same height */
@media (min-width: 701px) { html body .services .svc-grid li h3 { min-height: 2lh; } }

/* Polaroid fades in once its image has loaded (no hard pop-in on slow connections) */
html body .pl-fade > * { transition: opacity .8s ease !important; }
html body .pl-wait > * { opacity: 0 !important; }

/* ---------- iPhone review fixes (Dec 3) ---------- */
html body .nw { white-space: nowrap; }
@media (max-width: 700px) {
  /* Header: everything centred — name on top, nav + LinkedIn on one centred row */
  html body header.masthead.mh-bar { align-items: center !important; text-align: center; }
  html body .mh-bar .mh-id { width: auto !important; justify-content: center; }
  html body .mh-bar .mast-nav { width: auto !important; justify-content: center !important; gap: 22px !important; }
  html body .mh-bar .mast-nav .icon { margin-left: 0 !important; }

  /* Hero: the two framing lines on one line each, more air above the brand name */
  html body .fyp-wrap .fp-h,
  html body .fyp-wrap .fp-ans { font-size: min(36px, 5.9vw) !important; white-space: nowrap; line-height: 1.2 !important; }
  html body .fyp-wrap .fp-ans .br-d { display: none; }
  html body .fyp-wrap .fp-cur { margin-top: 26px !important; }
  html body .fyp-wrap .fp-ans { margin-top: 18px !important; }

  /* Phone mockup back to true iPhone proportions */
  html body .fyp-wrap .fp-phonebox { width: 250px !important; height: auto !important; }
  html body .fyp-wrap .fp-phone { width: 100% !important; height: auto !important; aspect-ratio: 224 / 505 !important; }
  html body .fyp-wrap .fp-screen { width: auto !important; height: auto !important; position: absolute !important; inset: 7px !important; }

  /* "Since 2018…" statement: calmer size, balanced lines, no hyphen breaks */
  html body .q3 blockquote { font-size: 24px !important; line-height: 1.3 !important; text-wrap: pretty; hyphens: none; -webkit-hyphens: none; }

  /* Home polaroid centred */
  html body .home.main .bio-col .bio-photo, html body .home.main.pol-big .bio-col .bio-photo { transform: none !important; translate: none !important; margin: 0 auto !important; width: min(80%, 300px) !important; align-self: center !important; }
  html body .home.main .bio-col .bio-photo img { width: 100% !important; height: auto !important; }

  /* Services footer: the link gets its own line */
  html body .services .sv-foot a { display: block !important; width: fit-content; margin: 6px auto 0 !important; }
  html body .services .sv-foot { text-align: center; }
}
@media (max-width: 700px) {
  /* About page: polaroid centred, and its shadow clears the heading */
  html body .ab-top .ab-photo { align-self: center !important; margin: 0 auto 26px !important; }
  html body .pg .ab-photo img { filter: drop-shadow(0 18px 22px rgba(10,20,60,.4)) !important; }
  html body .ab-top > div:not(.ab-photo) { position: relative; z-index: 1; }
}
@media (max-width: 700px) {
  /* About: less empty space after the traits cards */
  html body .pg-about section.cases { padding-bottom: 44px !important; }
}

/* Large images (phones mockup, work thumbnails) fade in once loaded instead of popping in */
html body img.img-fade { transition: opacity .8s ease; }
html body img.img-wait { opacity: 0 !important; }
@media (max-width: 700px) {
  /* Home bio: card sits a bit lower under the polaroid, less dead space after it */
  html body .home.main .bio-col, html body .home.main.pol-big .bio-col { gap: 84px !important; }
  html body .home.main > section.bio.deal[class] { padding-bottom: 48px !important; }
}
/* About: tighter gap between the stats row and section 01 */
html body .pg-about section.bio.pg-top[class] { padding-bottom: 12px !important; }
@media (max-width: 700px) { html body .pg-about section.bio.pg-top[class] { padding-bottom: 4px !important; } }
/* About: section 01 line matches the other section lines; numbers centred between the two lines */
html body .pg-about section.cases::before { border-top: 2px solid rgba(255,255,255,.42) !important; }
html body .pg-about .ab-stats[class] { padding-top: var(--abst, 52px) !important; }
html body .pg-about .ab-stats[class] { --abst: 52px; }
@media (max-width: 1280px) { html body .pg-about .ab-stats[class] { --abst: 42px; } }
@media (max-width: 1024px) { html body .pg-about .ab-stats[class] { --abst: 32px; } }
@media (max-width: 700px)  { html body .pg-about .ab-stats[class] { --abst: 24px; } }

/* About › How do I work: text sits directly under the title, no box, a touch larger */
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two { display: block !important; }
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .sec-title { margin-bottom: 28px !important; }
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .prose {
  background: none !important; padding: 0 !important; border-radius: 0 !important; box-shadow: none !important;
  backdrop-filter: none !important; -webkit-backdrop-filter: none !important; border: 0 !important; max-width: 46em;
}
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .prose::before, html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .prose::after { display: none !important; }
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .prose p { font-size: clamp(18px, 1.6vw, 23px) !important; line-height: 1.55 !important; color: rgba(255,255,255,.9) !important; }
html body .pg-about section:is(.cases,.bio:not(.pg-top)) .two .prose[class] { margin-top: 0 !important; }
/* About › Who I work with: more breathing room after the Let's talk button */
html body .home.pg-about.main > section.bio.deal:not(.pg-top)[class] { padding-bottom: 220px !important; }
@media (max-width: 700px) { html body .home.pg-about.main > section.bio.deal:not(.pg-top)[class] { padding-bottom: 140px !important; } }
html body .pg-about section.bio:not(.pg-top) a.btn[href="#contact"] { margin-top: 48px !important; }
html body .pg-about section.bio:not(.pg-top) a.btn[href="#contact"] { font-size: 20px !important; padding: 14px 28px !important; gap: 10px; }

/* Contact page: same electric-blue streak background as the other pages (contact sections at the bottom of other pages stay dark) */
html:has(.home.home.home.home.home.home.pg-contact) { background: #1c4aea !important; background-color: #1c4aea !important; }
html body .home.home.pg-contact.r11[class] { background: #2f6bf0 !important; }
html body .home.home.pg-contact.r11[class]::before { background: url("../textures/grain-xs.png"), radial-gradient(40% 9% at 80% 5%, rgba(255, 255, 255, 0.13), rgba(0, 0, 0, 0) 70%), linear-gradient(rgba(0, 0, 0, 0) 18%, rgba(255, 255, 255, 0.05) 26%, rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 46%, rgba(255, 255, 255, 0.05) 54%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, 0) 70%, rgba(255, 255, 255, 0.05) 78%, rgba(0, 0, 0, 0) 86%), radial-gradient(38% 8% at 15% 30%, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0) 70%), radial-gradient(40% 8% at 85% 62%, rgba(255, 255, 255, 0.07), rgba(0, 0, 0, 0) 70%), none !important; background-color: #2f6bf0 !important; background-blend-mode: overlay, normal, normal, overlay, normal, normal !important; }
html body .home.home.pg-contact[class] > section.contact[class] { background: transparent !important; }
html body .pg-thanks .thx { min-height: calc(100svh - 330px); display: flex; flex-direction: column; justify-content: center; gap: 22px; align-items: flex-start; }
html body .pg-thanks .thx .btn { font-size: 18px !important; padding: 12px 26px !important; margin-top: 10px; }
