/* ==========================================================================
   PJC Website - phone mode (screens under 768px)

   Desktop is for exploring; a phone is for finding out. Under 768px every
   page becomes a shorter, information-first version of the same HTML: the
   facts move up, decorative sections hide, long prose folds away behind a
   native <details>, and a Book a call bar sticks to the bottom once the
   hero's button has scrolled off. Nothing is removed from the HTML, so
   search engines and visitors without JavaScript see everything.

   Two hooks:
   - @media (max-width: 767px)  layout, works with JavaScript off
   - .x-lite on <html>          the same breakpoint, set before first paint
                                by base.njk; animated sections treat it as
                                prefers-reduced-motion and show their
                                finished state

   Markup hooks (see CLAUDE.md, "Phone mode"):
   - .p-hide   hidden on phones          - .p-only   shown only on phones
   - .p-fold   a <details> that is open on desktop and folded on phones
   - .p-first  in a split, each column keeps only its first paragraph
   - .p-terse  in a split, the columns drop their intro paragraphs
   - .p-titles an index list keeps its titles and tags, not its prose
   - .p-cta    the sticky Book a call bar (base.njk)
   - .p-land   also hidden on phones turned landscape (wider than 767px)
   ========================================================================== */

/* ---------- Motion off ----------
   The same still versions prefers-reduced-motion gets in site.css; keep the
   two lists in step. Looping decorative animation stops too. One exception:
   the home hero stack plays its intro once on phones (Peter, 03/11/2026);
   site.js skips its repeating glow there. */

.x-lite.x-motion [data-x-in] { opacity: 1; transform: none; transition: none; }
.x-lite.x-motion .x-hero *, .x-lite.x-motion .x-page-hero * { animation: none !important; }
.x-lite .btn--primary, .x-lite .btn--primary::after { transition: none; }
.x-lite .x-progress { display: none; }
.x-lite .e-order { height: auto; }
.x-lite .e-order__sticky { position: relative; height: 90vh; }
.x-lite .e-order__a { display: none; }
.x-lite .e-order__b { opacity: 1; transform: none; }
.x-lite .nav.is-hidden { transform: none; }
.x-lite .x-nav-pill { transition: none; }
.x-lite .s3__more { animation: none; }
.x-lite .s3--intro.is-done .s3__plane::before { animation: none; }
.x-lite .x-art__plane { animation: none; }
.x-lite .e-tile:hover .x-art { transform: none; }
.x-lite .x-apps__track { scroll-behavior: auto; }
.x-lite .btn::before { display: none; }
.x-lite .ar__rec, .x-lite .ar__notes li { transition: none; }
.x-lite .ds .node, .x-lite .ds .link, .x-lite .ds__stats, .x-lite .ds__step, .x-lite .ds__bar i, .x-lite .ds .dupe { transition: none; }
.x-lite .x-th__tile, .x-lite .x-th__shadow { transition: none; }
.x-lite .x-th__card.is-up .x-th__tile, .x-lite .x-th__card:focus-visible .x-th__tile { transform: translateY(-8px); }
.x-lite *, .x-lite *::before, .x-lite *::after { animation-iteration-count: 1 !important; }

/* ---------- Layout ---------- */
@media (min-width: 768px) {
  .p-only { display: none !important; }
  .p-fold > summary { display: none; }
  .p-cta { display: none; }
}

/* Phones turned landscape are wider than the phone tier, so the tablet tier
   plus a short landscape screen catches them (Peter, 07/11/2026). */
@media (max-width: 1023px) and (orientation: landscape) and (max-height: 500px) {
  .p-land { display: none !important; }

  /* Real builds: wide, short art so each tile fits the screen. */
  /* A set height, not aspect-ratio: Safari sizes an aspect-ratio box wrongly
     inside the subgrid below and draws it over the headline. */
  .e-work .x-art { aspect-ratio: auto; height: clamp(130px, calc(21vw - 20px), 200px); }
  .e-work .x-art__plane { width: 28%; }
  /* Art, headline and paragraph share rows, so the paragraphs line up. */
  .e-work .e-tile { grid-row: span 3; grid-template-rows: subgrid; row-gap: 14px; }

  /* The two reasons side by side, smaller, so both are seen at once. */
  .e-split { grid-template-columns: 1fr 1fr; }
  .e-split__col { padding: 24px 24px 0 0; gap: 12px; }
  .e-split__col + .e-split__col { padding: 24px 0 0 24px; margin-top: 0; border-top: 0; border-left: 1px solid var(--color-line); }
  .e-split__col .e-h3 { font-size: 21px; }
  .e-split__col p { font-size: 15px; }

  /* Photo beside the text, and the three steps as label and line. */
  .e-person { grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: start; }
  .e-person__photo { max-width: none; }
  .e-person .e-h2 { font-size: 34px; }
  .e-person .e-lede { margin-top: 16px; }
  .e-defs > div { grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.6fr); gap: 16px; padding: 12px 0; }
  .e-defs dt { font-size: 18px; }

  /* Footer: the four desktop columns, tighter links and a smaller badge. */
  .footer { padding-top: 36px; }
  .x-footer { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 28px; padding-bottom: 28px; }
  .footer__grid > :first-child { grid-column: auto; }
  .footer__links { gap: 0; }
  .footer__links .footer__link { padding: 4px 0; }
  .footer__col-label { margin-bottom: 8px; }
  .footer .footer__logo { width: 140px; }
  .x-footer__cred { margin-top: 16px; }
  .x-footer__cred .x-footer__badge { width: 56px; }
  .footer__links a[href^="mailto"] { font-size: 13px; }
  .footer__bar, .footer__bar .footer__link { font-size: 13px; }
}

@media (max-width: 767px) {
  .p-hide { display: none !important; }

  /* Rhythm: tighter sections. */
  .e-section, .x-section { padding-top: 48px; padding-bottom: 48px; }
  .e-section + .e-section:not(.e-section--ink):not(.e-section--canvas):not(.e-section--paper) { padding-top: 0; }

  /* Buttons: the same 16px label, less padding. A phone has no room to give
     a button desktop's air; the sticky bar keeps its own full width. */
  .btn, .btn--primary, .btn--primary:hover { padding: 11px 20px; }

  /* ----- Home ----- */
  /* Hero, built for the first screen: the headline full width with room under
     the nav, then Book a call over the review link, with a small stack beside
     them. The stack is a signature, not the content; its words are left to
     the five layers list further down. */
  .e-hero--feature { padding-top: calc(var(--nav-h, 84px) + 52px); padding-bottom: 28px; }
  .e-hero--feature .e-display { font-size: clamp(40px, 12vw, 46px); }
  .e-hero--feature .e-hero__grid { grid-template-columns: auto 1fr; column-gap: 16px; align-items: center; }
  .e-hero__copy > .e-display { grid-column: 1 / -1; grid-row: 1; }
  .e-hero .e-hero__copy > .e-actions { grid-column: 1; grid-row: 2; flex-direction: column; align-items: flex-start; gap: 14px; margin: 28px 0 0; }
  .e-hero__stack { grid-column: 2; grid-row: 2; justify-self: center; padding: 0; margin-top: 28px; }
  .e-hero__stack .s3 { width: clamp(104px, 34vw, 140px); max-width: none; }
  .e-hero__stack .s3__panel, .e-hero__copy > .s3__panel { display: none; }
  .e-hero .e-hero__stack .s3__labels { display: none; }

  /* Trusted by: one row on the page's left edge, equal weight, no paragraph. */
  .e-clients__row { flex-direction: column; align-items: flex-start; gap: 14px; padding-block: 26px; }
  .e-clients__row .e-clients__label { margin: 0; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-muted); }
  /* Logos: one row you swipe sideways (Peter, 11/11/2026). It runs to the screen's right edge
     and fades there, so the cut-off logo shows there is more to see. */
  .e-clients__row .e-clients__logos { display: flex; flex-wrap: nowrap; align-items: center; gap: 0; width: calc(100% + (100vw - 100%) / 2); margin-right: calc((100% - 100vw) / 2); padding: 4px 48px 4px 0; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-mask-image: linear-gradient(to right, black calc(100% - 56px), transparent); mask-image: linear-gradient(to right, black calc(100% - 56px), transparent); }
  .e-clients__row .e-clients__logos::-webkit-scrollbar { display: none; }
  /* Endless (site.js): no snapping, so the jump back by one set can't fight it; both edges fade, as there are logos either side. */
  .e-clients__row .e-clients__logos.is-endless { scroll-snap-type: none; width: 100vw; margin-left: calc((100% - 100vw) / 2); padding: 4px 0; -webkit-mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 48px), transparent); mask-image: linear-gradient(to right, transparent, black 14px, black calc(100% - 48px), transparent); }
  .e-clients__row img { flex: none; width: auto; height: 20px; margin-right: 32px; scroll-snap-align: start; }
  .e-clients__row .e-clients__zing { height: 32px; }
  .e-clients__row .e-clients__keyless, .e-clients__row .e-clients__noco { height: 16px; }
  .e-clients__row p:not(.e-clients__label) { display: none; }

  /* ----- Shared hooks ----- */
  /* Page headers: the stack is the home page's signature, not decoration
     for every page. */
  .x-page-hero .s3, .x-page-hero .s3__panel, .x-page-hero__grid > :has(> .s3) { display: none; }
  .x-page-hero__grid { grid-template-columns: 1fr; }
  .p-first .e-split__col p + p { display: none; }
  .p-terse .e-split__col > p { display: none; }
  :is(.p-first, .p-terse).e-split { gap: 32px; }
  .p-titles .e-index__row > p { display: none; }
  .p-titles .e-index__row { padding-top: 14px; padding-bottom: 14px; }
  .p-titles .e-index__row h3 { font-size: 21px; }
  .e-index__row > span { font-size: 13px; }

  /* ----- About ----- */
  .e-hero__portrait, .e-hero__portrait--about { max-width: 240px; margin-left: 0; }
  .p-beliefs .e-index__row > span { display: none; }

  /* ----- Services hub ----- */
  .e-build > :not(.e-build__copy) { display: none; }

  /* The five layers as a list, phones only. */
  .p-layers { list-style: none; margin: 32px 0 0; padding: 0; border-top: 1px solid var(--color-line); }
  .p-layers li { border-bottom: 1px solid var(--color-line); }
  .p-layers a { display: flex; align-items: baseline; gap: 12px; padding: 14px 0; color: var(--color-ink); text-decoration: none; }
  .p-layers b { flex: 0 0 5.2em; font-weight: 500; }
  .p-layers span { color: var(--color-muted); font-size: 15px; }

  /* Proof: stats as a 2 x 2 grid. */
  .x-facts { grid-template-columns: 1fr 1fr; gap: 20px 16px; }
  .x-facts b { font-size: 30px; }
  .x-facts span { font-size: 13px; }

  /* Real builds: one plain card per live case study, its line kept, no
     illustration; All work sits under the cards. Draft case studies are left
     out of the build, so this may be a single card. */
  #work .e-intro--row { display: block; margin-bottom: 24px; }
  #work .e-intro--row .e-link { display: none; }
  .e-work, .e-work > .e-tile { display: block; }
  .e-work .x-art { display: none; }
  .e-work .e-tile { padding: 20px; margin-bottom: 12px; background: var(--color-white); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
  .e-work .e-tile h3 { font-size: 18px; margin: 0 0 8px; }
  .e-work .e-tile p { font-size: 15px; margin: 0; }
  .p-work-all { display: inline-block; margin-top: 12px; }

  /* ----- Footer ----- */
  /* Two columns: the brand block across the top, Services beside Explore,
     Connect across the bottom for the long email address. Smaller badge and
     tighter links, so it is a page of links, not three screens of them. */
  .x-footer { grid-template-columns: 1fr 1fr; gap: 36px 16px; }
  .x-footer > :first-child, .x-footer > :last-child { grid-column: 1 / -1; }
  .x-footer__cred { margin-top: 18px; }
  .x-footer__cred .x-footer__badge { width: 72px; }
  .footer__links .footer__link { padding: 6px 0; font-size: 14px; line-height: 1.3; }
  .footer__col-label { margin-bottom: 6px; }

  /* ----- Service pages ----- */
  /* Page header: the button says Book a call and sits beside the secondary
     link when both fit; the crumbs share one baseline. */
  .x-crumbs { align-items: baseline; }
  .x-page-hero .e-actions { gap: 12px 20px; margin: 28px 0 0; }
  .x-page-hero .e-actions .e-link { padding: 8px 0; background-position: left 100%; }
  /* The facts first: price and timing, what you get, then the prose. */
  .x-body { display: flex; flex-direction: column; align-items: stretch; gap: 24px; }
  .x-body > * { min-width: 0; max-width: 100%; }
  .x-aside { order: -1; position: static; gap: 12px; }
  .x-aside__box--facts { order: -1; }
  .x-aside__box--who { display: none; }
  .x-aside__box { padding: 18px; }
  .x-aside__box h3 { font-size: 15px; }
  .x-checks li { font-size: 15px; }

  /* Long prose folds away; the visitor opens it if they want it. */
  .p-fold > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line); font-weight: 500; color: var(--color-ink); }
  .p-fold > summary::-webkit-details-marker { display: none; }
  .p-fold > summary::after { content: "+"; font-size: 22px; line-height: 1; color: var(--color-muted); }
  .p-fold[open] > summary::after { content: "\2013"; }
  .p-fold > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
  .p-fold[open] > summary { margin-bottom: 20px; }

  /* ----- Motion library pieces ----- */
  .x-hero-tile { display: none; }
  .x-th__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* ----- Sticky Book a call ----- */
  body { padding-bottom: 76px; }
  .p-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--color-canvas) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--color-line); transform: translateY(110%); transition: transform 0.3s ease; }
  .p-cta.is-on { transform: none; }
  .p-cta .btn { width: 100%; justify-content: center; padding: 13px 20px; }
  .x-lite .p-cta { transition: none; }

  /* ----- Data story on phones: one finished diagram that pans sideways ----- */
  .ds__hint { display: none; }
  .ds__stage { position: relative; height: auto; box-shadow: none; padding-top: 8px; }
  .ds__pan { overflow-x: auto; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .ds__pan::-webkit-scrollbar { display: none; }
  .ds__map { width: 760px; max-height: none; }
  .ds__steps { padding-bottom: 0; }
  .ds__step > div { padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .x-js .ds__step { min-height: 0; padding: 18px 0; border-top: 1px solid var(--ds-line); opacity: 1; }
  .ds__step h3 { font-size: 21px; }
  .ds__step p { margin-top: 8px; font-size: 15.5px; }
}
