/* Phone and tablet layer: DESIGN_SYSTEM.md rule 8 exception and section 12.
   build.page() links it with media="(max-width: 899.98px)", so it never applies at 900px and wider.
   Whole file: phones and tablets. @media (max-width: 639.98px): the phone layouts.
   Tokens: --ph-* in the first :root of css/site.css. Colours from tokens or rgba(), font sizes from var().
   Photos keep the inline focal point from slot_images.py; a crop override needs !important and an
   entry, with a reason, in the allowlist below. */

/* Focal-point allowlist (!important overrides of inline object-position): none yet */

/* --- Touch and safe areas (phones and tablets) */

html { -webkit-tap-highlight-color: transparent; }

a, button, label, summary, input, select, textarea { touch-action: manipulation; }

/* Tablets and landscape phones keep desktop layouts but are touch screens: 12px labels, 44px stand-alone links */
:root { --fs-eyebrow: var(--ph-fs-eyebrow); }

.footer a { display: flex; align-items: center; min-height: 44px; padding-block: 0; }
.projects-head a, .shelf-head a, .shelf-tools a, .connect-routes li > a,
.continue a, details > summary { display: inline-flex; align-items: center; min-height: 44px; }
.continue a { white-space: normal; overflow-wrap: anywhere; }
details > summary { display: flex; cursor: pointer; }
.subnav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.filters button { min-width: 44px; }

/* --- Top bar (phones and tablets): glass on ::before, never on .mast (a filter or transform there would trap the fixed menu) */

:root { --header-height: calc(var(--ph-bar-h) + env(safe-area-inset-top)); }

.mast { background: transparent; border-bottom: 0; isolation: isolate; }

.mast::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ph-glass); -webkit-backdrop-filter: var(--ph-glass-filter); backdrop-filter: var(--ph-glass-filter); border-bottom: 1px solid var(--ph-glass-line); transition: background-color var(--ph-dur-fade) var(--ph-ease-out), border-color var(--ph-dur-fade) var(--ph-ease-out); }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .mast::before { background: var(--ph-glass-strong); }
}

/* viewport-fit=cover lets the page run under the status bar and the home indicator */
.mast-inner { min-height: var(--ph-bar-h); padding-top: env(safe-area-inset-top); box-sizing: content-box; gap: .375rem; }

/* Header controls (Menu, globe, Join, logo) keep a 44px target at every phone width. They never shrink: the
   wordmark is the one part that gives way (smaller below 420px, on two lines below 360px). */
.brand { min-height: 44px; min-width: 44px; gap: .5rem; font-size: var(--fs-nav); margin-right: auto; justify-content: center; }
.mast-cta, .mast .mast-globe, .nav-toggle { flex: none; }
.mast .mast-inner:has(.mast-globe) .brand { min-inline-size: 44px; }

.brand-logo { width: 2.25rem; height: 2.25rem; }

.mast nav { display: none; }

/* Join: a yellow pill inside a full 44px tap area */
.mast-cta { position: relative; z-index: 0; min-height: 44px; min-width: 44px; padding: 0 .95rem; background: none; font-size: var(--fs-small); }

.mast-cta::before { content: ""; position: absolute; inset: 5px 0; z-index: -1; border-radius: var(--ph-radius-pill); background: var(--accent); transition: transform var(--ph-dur-press) var(--ph-ease-out); }

.mast-cta:hover { background: none; }
.mast-cta:active::before { transform: scale(.96); }

/* Menu button: two bars that turn into a cross */
.nav-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; margin: 0 -.65rem 0 0; padding: 0; }

.nav-toggle-icon { position: relative; width: 1.25rem; height: .75rem; display: block; }

.nav-toggle-icon i { position: absolute; left: 0; width: 100%; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform var(--ph-dur-fade) var(--ph-ease-out), top var(--ph-dur-fade) var(--ph-ease-out); }

.nav-toggle-icon i:first-child { top: 0; }
.nav-toggle-icon i:last-child { top: calc(100% - 1.5px); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon i:first-child { top: calc(50% - .75px); transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon i:last-child { top: calc(50% - .75px); transform: rotate(-45deg); }

.nav-toggle-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 419.98px) {
  /* the wordmark takes what the three controls leave: one line while it fits, two when it does not */
  .brand > span { font-size: calc(var(--fs-nav) * .94); max-inline-size: calc(100vw - 242px); line-height: 1.05; white-space: normal; }
}

@media (max-width: 359.98px) {
  .brand > span { font-size: calc(var(--fs-nav) * .72); }
}

/* --- Menu sheet: six photo cards on cream; display:none when closed (Safari tints its toolbars from it) */

.mast.is-open { position: fixed; top: 0; left: 0; right: 0; z-index: 80; }
.mast.is-open::before { background: var(--home-paper); border-color: transparent; }

.mast #site-nav {
  position: fixed;
  inset: 0;
  z-index: -2;
  display: none;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: .75rem;
  margin: 0;
  padding: calc(var(--header-height) + 1rem) max(var(--gutter), env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--home-paper);
  opacity: 0;
  transform: translateY(-.5rem);
  transition: opacity var(--ph-dur-sheet) var(--ph-ease-out), transform var(--ph-dur-sheet) var(--ph-ease-out), display var(--ph-dur-sheet) allow-discrete;
}

.mast.is-open #site-nav { display: grid; opacity: 1; transform: none; }

@starting-style {
  .mast.is-open #site-nav { opacity: 0; transform: translateY(-.5rem); }
}

.mast #site-nav .nav-intro { display: block; grid-column: 1 / -1; margin: .25rem 0 0; font-size: var(--ph-fs-eyebrow); font-weight: 600; letter-spacing: var(--track-eyebrow); text-transform: uppercase; color: var(--clay); }

.mast #site-nav a {
  position: relative;
  z-index: 0;
  isolation: isolate;
  display: flex;
  align-items: flex-end;
  min-height: 8.25rem;
  padding: 1rem;
  border-radius: var(--ph-radius-card);
  overflow: hidden;
  background: var(--forest);
  box-shadow: var(--ph-shadow-card);
  color: var(--cream);
  text-decoration: none;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: var(--ph-fs-h3);
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: var(--track-heading);
  transition: transform var(--ph-dur-press) var(--ph-ease-out);
}

.mast #site-nav a:first-of-type { grid-column: 1 / -1; min-height: 11rem; font-size: var(--ph-fs-h2); }
.mast #site-nav a:active { transform: scale(.98); }
.mast #site-nav a:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }
.mast #site-nav a[aria-current="page"] { text-decoration: none; color: var(--cream); box-shadow: inset 0 0 0 2px var(--accent), var(--ph-shadow-card); }

.mast #site-nav .nav-photo { display: block; position: absolute; inset: 0; z-index: -1; background-size: cover; }

/* The same bottom shade as the home hero, so the label always reads on the photo */
.mast #site-nav a::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(20, 36, 28, .78), rgba(20, 36, 28, .12) 62%, rgba(20, 36, 28, 0)); }

.mast #site-nav .nav-label { display: block; }

.mast.is-open #site-nav a { animation: ph-rise var(--ph-dur-sheet) var(--ph-ease-out) both; }
.mast.is-open #site-nav a:nth-of-type(2) { animation-delay: 40ms; }
.mast.is-open #site-nav a:nth-of-type(3) { animation-delay: 70ms; }
.mast.is-open #site-nav a:nth-of-type(4) { animation-delay: 100ms; }
.mast.is-open #site-nav a:nth-of-type(5) { animation-delay: 130ms; }

@keyframes ph-rise {
  from { opacity: 0; transform: translateY(.75rem); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 640px) {
  .mast #site-nav { gap: 1rem; }
  .mast #site-nav a { min-height: 12rem; font-size: var(--ph-fs-h2); }
  .mast #site-nav a:first-of-type { min-height: 16rem; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .mast #site-nav { grid-template-columns: repeat(3, 1fr); }
  .mast #site-nav a, .mast #site-nav a:first-of-type { grid-column: span 1; min-height: 6.5rem; font-size: var(--ph-fs-h3); }
}

/* Touch screens keep :hover after a tap; these hovers would stick */
@media (hover: none) {
  a:hover { color: inherit; }
  .btn:hover, .ng-btn:hover, .mast-cta:hover { background: var(--accent); }
}

/* == Phone layer (below 640px): components shared by every page family == */

@media (max-width: 639.98px) {
  :root { --gutter: var(--ph-gutter); --section-space: var(--ph-section); --fs-h1: var(--ph-fs-h1); --fs-h2: var(--ph-fs-h2); --fs-h3: var(--ph-fs-h3); }

  /* Buttons: rounded, taller, a press state */
  .btn, .ng-btn, .btn-secondary, .btn-quiet { min-height: 3.25rem; padding-inline: 1.35rem; border-radius: var(--ph-radius-control); transition: transform var(--ph-dur-press) var(--ph-ease-out), filter var(--ph-dur-press) var(--ph-ease-out), background-color var(--ph-dur-fade) var(--ph-ease-out); }
  .btn:active, .ng-btn:active, .btn-secondary:active, .btn-quiet:active { transform: scale(.98); filter: brightness(.96); }
  .action-card .btn, .form-stage .btn, .apply-panel .btn, .form-actions .btn { width: 100%; }
  .step-nav .btn { width: auto; flex: 1; }

  /* Chip scroller: section links and Lab filters as one swipeable row of pills; the current one is filled */
  .subnav, .filters {
    display: flex;
    flex-wrap: nowrap;
    gap: .5rem;
    margin: .25rem calc(-1 * var(--gutter)) 1.25rem;
    padding: .25rem var(--gutter) .5rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: var(--gutter);
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, black var(--gutter), black calc(100% - var(--gutter)), transparent);
    mask-image: linear-gradient(to right, transparent, black var(--gutter), black calc(100% - var(--gutter)), transparent);
  }
  .subnav::-webkit-scrollbar, .filters::-webkit-scrollbar { display: none; }
  .subnav a, .filters button {
    flex: none;
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
    padding: 0 1.05rem;
    border: 1px solid var(--line);
    border-radius: var(--ph-radius-pill);
    background: var(--home-paper);
    color: var(--ink);
    font-size: var(--fs-small);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    scroll-snap-align: start;
    transition: background-color var(--ph-dur-fade) var(--ph-ease-out), color var(--ph-dur-fade) var(--ph-ease-out), transform var(--ph-dur-press) var(--ph-ease-out);
  }
  .subnav a:active, .filters button:active { transform: scale(.97); }
  .subnav a[aria-current="page"], .filters button.is-on { background: var(--forest); border-color: var(--forest); color: var(--cream); text-decoration: none; }

  /* Facts card: commitment, where, the work, costs */
  .sheet { margin: 1.25rem 0 1.75rem; padding: .25rem var(--ph-pad); border: 0; border-radius: var(--ph-radius-card); background: var(--cream); box-shadow: var(--ph-shadow-card); }
  .sheet div { padding: .9rem 0; border-bottom: 1px solid var(--line); }
  .sheet div:last-child { border-bottom: 0; }
  .sheet dd { font-size: var(--fs-body); }
  .sheet-grid { column-gap: var(--ph-pad); }
  .sheet-grid div { border-top: 0; border-bottom: 1px solid var(--line); }

  /* Cards: rounded, soft shadow, press state */
  .card { border-radius: var(--ph-radius-card); overflow: hidden; background: var(--cream); box-shadow: var(--ph-shadow-card); transition: transform var(--ph-dur-press) var(--ph-ease-out); }
  .card:active { transform: scale(.985); }
  .card-copy { padding: .9rem var(--ph-pad) 1.1rem; }

  .map { gap: .75rem; }
  .map a { padding: 1rem var(--ph-pad); border: 0; border-radius: var(--ph-radius-card); background: var(--cream); box-shadow: var(--ph-shadow-card); transition: transform var(--ph-dur-press) var(--ph-ease-out); }
  .map a:active { transform: scale(.985); }

  .story img, .project-card img { border-radius: calc(var(--ph-radius-card) - 4px); }

  .enter-tile, .hero-choice { border-radius: var(--ph-radius-card); overflow: hidden; }
  .enter-tile:active, .hero-choice:active { transform: scale(.985); }

  .action-card, .stage-form { border: 0; border-radius: var(--ph-radius-card); background: var(--cream); box-shadow: var(--ph-shadow-card); padding: var(--ph-pad); }
  .form-stage { border-top: 0; padding-top: 0; }

  /* Forms: rounded fields (still 18px, so iOS does not zoom), pill choices, a rounded progress bar */
  .fields input, .fields textarea, .fields select { min-height: 3.25rem; border-radius: 12px; background: var(--home-paper); font-size: var(--fs-body); transition: border-color var(--ph-dur-fade) var(--ph-ease-out), box-shadow var(--ph-dur-fade) var(--ph-ease-out); }
  .fields input:focus, .fields textarea:focus, .fields select:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(28, 107, 56, .18); outline: 0; }
  .chip span { min-height: 44px; border-radius: var(--ph-radius-pill); background: var(--home-paper); }
  .form-progress-bar { height: 4px; border-radius: var(--ph-radius-pill); overflow: hidden; }
  .form-progress-bar i { border-radius: inherit; }
  .form-review { border-radius: var(--ph-radius-card); }

  /* Footer: a flat document footer, tighter */
  .footer { padding-top: var(--space-4); margin-top: var(--space-5); }
}

/* == Story pages (explore/*, experiments/*, why, about, the space pages, lab/schools) == */

@media (max-width: 639.98px) {
  /* The photo comes first, edge to edge, with its caption; then the eyebrow, title and intro.
     Desktop places the photo beside the title, which on a phone left an empty band between them. */
  .story-head { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding-block: 0 var(--ph-gap); }
  .story-head-text { padding-top: var(--ph-section); }
  .story-head-media { order: -1; width: auto; max-width: none; margin: 0 calc(-1 * var(--gutter)); }
  .story-head-media img { display: block; width: 100%; aspect-ratio: 4 / 3; }
  .story-head-media figcaption { margin: .6rem var(--gutter) 0; font-size: var(--ph-fs-caption); line-height: 1.45; }
  .story-head-copy { padding-top: 1.75rem; }
  .story-head-text .story-head-copy { padding-top: 0; }
  .story-head .kicker { margin-bottom: .6rem; }
  .story-head h1 { margin: 0 0 .9rem; line-height: 1.08; text-wrap: balance; }
  .story-head .dek { margin: 0; }

  /* Prose rhythm */
  .story-body { gap: var(--ph-section); padding-block: 1.5rem 0; }
  .story-body > * { min-width: 0; }  /* a chip row inside the prose must scroll, not widen the column */
  .story-body .prose > :first-child { margin-top: 0; }
  .story-body .prose h2 { margin: 2.5rem 0 .75rem; text-wrap: balance; }
  .story-body .prose img { border-radius: var(--ph-radius-card); }
  .story-body .prose figure { margin-block: 2rem; }
  .story-body .prose figcaption { margin-top: .6rem; font-size: var(--ph-fs-caption); }
  .story-body blockquote.pull { margin-block: 2rem; }

  /* Key facts and the apply status: one card */
  .story-body .rail-facts { margin: 0; padding: 1.1rem var(--ph-pad) 1.25rem; border-radius: var(--ph-radius-card); background: var(--cream); box-shadow: var(--ph-shadow-card); }
  .story-body .rail-facts > .kicker { margin: 0 0 .5rem; }
  .story-body .rail-facts .sheet { margin: 0 0 .75rem; padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .story-body .rail-facts .meta { margin: 0 0 .9rem; }
  .story-body .rail p { line-height: 1.55; }
  .story-body .rail-facts .apply-panel > div > :last-child { margin-bottom: 0; }
  .badge { padding: .35rem .75rem; border-radius: var(--ph-radius-pill); }
  .story-body .rail > .rail-facts + .continue { margin-top: 1rem; }

  /* Continue: the next read is one large card */
  .story-body .rail .next-read { margin: 0; padding: 0; border-top: 0; max-width: none; }
  .story-body .rail > * + .next-read { margin-top: 2rem; }
  .story-body .rail .next-read .kicker { margin: 0 0 .6rem; }
  .story-body .rail .next-read a { position: relative; display: block; padding: 1.15rem 3.25rem 1.25rem var(--ph-pad); border-radius: var(--ph-radius-card); background: var(--forest); color: var(--cream); font-size: var(--fs-small); box-shadow: var(--ph-shadow-card); transition: transform var(--ph-dur-press) var(--ph-ease-out); }
  .story-body .rail .next-read a:active { transform: scale(.985); }
  .story-body .rail .next-read a::after { content: "→"; position: absolute; right: var(--ph-pad); bottom: 1.15rem; font-size: var(--ph-fs-h3); line-height: 1; }
  .story-body .rail .next-read strong { margin-top: .35rem; font-size: var(--ph-fs-h3); line-height: 1.2; text-wrap: balance; }

}

/* == Index pages (explore, experiments, verticals and their sections) == */

@media (max-width: 639.98px) {
  /* Compact lists for Explore and the Lab. Experiments keeps a featured first card. */
  .explore-index-grid .card-grid, .experiment-index-grid .card-grid, .card-grid.lab-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
  .experiment-index-grid .card:first-child .card-copy { padding: 1rem var(--ph-pad) 1.25rem; }
  .experiment-index-grid .card:first-child strong { font-size: var(--ph-fs-h2); line-height: 1.12; }
  :is(.explore-index-grid .card, .experiment-index-grid .card:not(:first-child), .lab-grid .card) { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: center; gap: .9rem; padding: .5rem; }
  :is(.explore-index-grid .card, .experiment-index-grid .card:not(:first-child), .lab-grid .card) .card-media { aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden; }
  :is(.explore-index-grid .card, .experiment-index-grid .card:not(:first-child), .lab-grid .card) .card-copy { padding: .25rem .5rem .25rem 0; }
  :is(.explore-index-grid .card, .experiment-index-grid .card:not(:first-child), .lab-grid .card) strong { font-size: var(--ph-fs-h3); line-height: 1.2; }
  :is(.experiment-index-grid .card:not(:first-child), .lab-grid .card) strong { font-size: var(--fs-body); }
  :is(.experiment-index-grid .card:not(:first-child), .lab-grid .card) em { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

  /* Swipe rows (spaces, reels, shelves): arrows give way to swiping and dots from js/site.js */
  .shelf .arrow { display: none; }
  .production-reels .card-grid { display: flex; gap: .75rem; margin-inline: calc(-1 * var(--gutter)); padding: .25rem var(--gutter) .75rem; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
  .production-reels .card-grid::-webkit-scrollbar { display: none; }
  .production-reels .shelf-head { width: auto; }
  .production-reels .vcard { flex: 0 0 72%; scroll-snap-align: start; }
  .production-reels .vcard video { border-radius: var(--ph-radius-card); }

  .ph-dots { display: flex; justify-content: center; gap: 6px; margin: .5rem 0 0; color: var(--forest); }
  .ph-dots[hidden] { display: none; }
  .ph-dots i { width: 6px; height: 6px; border-radius: var(--ph-radius-pill); background: currentColor; opacity: .25; transition: width var(--ph-dur-fade) var(--ph-ease-out), opacity var(--ph-dur-fade) var(--ph-ease-out); }
  .ph-dots i.is-on { width: 18px; opacity: 1; }

  /* Verticals: the other four as list cards */
}

/* == Join pages: the Apply bar and stepped forms == */

@media (max-width: 639.98px) {
  /* Apply bar (built by js/site.js). Glass on ::before like the top bar; closed means display:none */
  .phone-cta { position: fixed; inset: auto 0 0; z-index: 60; isolation: isolate; padding: .65rem var(--gutter) calc(.65rem + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 0; transition: transform var(--ph-dur-sheet) var(--ph-ease-sheet), opacity var(--ph-dur-fade) var(--ph-ease-out), display var(--ph-dur-sheet) allow-discrete; }
  .phone-cta::before { content: ""; position: absolute; inset: 0; z-index: -1; border-top: 1px solid var(--ph-glass-line); background: var(--ph-glass-strong); -webkit-backdrop-filter: var(--ph-glass-filter); backdrop-filter: var(--ph-glass-filter); box-shadow: var(--ph-shadow-sheet); }
  @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .phone-cta::before { background: var(--paper); }
  }
  .phone-cta.is-shown { display: block; transform: none; opacity: 1; }
  @starting-style { .phone-cta.is-shown { transform: translateY(100%); opacity: 0; } }
  .phone-cta-inner { display: flex; align-items: center; gap: .9rem; }
  .phone-cta-title {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: var(--fs-body);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .phone-cta .btn { flex: none; max-width: 75%; min-height: 3rem; padding-inline: 1.1rem; font-size: var(--fs-small); white-space: nowrap; }

  /* Stepped forms: the progress sticks under the top bar, Back and Next stick to the bottom.
     The announcement pill is compact while a form is being filled and has its own slot at the right end of the
     progress row (css/announcement.css reads the --fp-* sizes), so no two sticky layers share a position. */
  :root { --fp-pad-top: .5rem; --fp-bar: 4px; --fp-gap: .375rem; --fp-slot: 44px; --fp-pad-bottom: .25rem; }
  .form-progress { position: sticky; top: var(--header-height); z-index: 5; margin: 0 calc(-1 * var(--ph-pad)) 1rem; padding: var(--fp-pad-top) var(--ph-pad) var(--fp-pad-bottom); gap: var(--fp-gap); background: var(--ph-glass-strong); -webkit-backdrop-filter: var(--ph-glass-filter); backdrop-filter: var(--ph-glass-filter); }
  .form-progress-count { display: flex; align-items: center; min-height: var(--fp-slot); padding-inline-end: calc(var(--fp-slot) + .5rem); }
  /* the step or the review lands just under the sticky progress, never beneath it */
  fieldset.step, .form-review { scroll-margin-top: calc(var(--fp-pad-top) + var(--fp-bar) + var(--fp-gap) + var(--fp-slot) + var(--fp-pad-bottom) - 1rem + .5rem); }
  .step-nav { position: sticky; bottom: 0; z-index: 5; margin: 1.25rem calc(-1 * var(--ph-pad)) 0; padding: .75rem var(--ph-pad) calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--ph-glass-line); background: var(--ph-glass-strong); -webkit-backdrop-filter: var(--ph-glass-filter); backdrop-filter: var(--ph-glass-filter); }
}

/* == Home (same blocks, order and copy as desktop; layout only) == */

@media (max-width: 639.98px) {
  /* Hero: the photo fills the first screen; title and Join sit on a shade in the thumb zone */
  .ng-hero-media { position: relative; display: block; height: calc(100svh - var(--header-height)); min-height: 34rem; max-height: 58rem; overflow: hidden; }
  .ng-mobile-still { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; }
  .ng-hero-media::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(10, 22, 16, 0) 22%, rgba(10, 22, 16, .62) 50%, rgba(10, 22, 16, .92) 100%); pointer-events: none; }
  .ng-hero-copy { position: absolute; inset: auto 0 0; z-index: 2; min-height: 0; padding: 0 var(--gutter) calc(1.5rem + env(safe-area-inset-bottom)); background: none; }
  .ng-hero-copy h1 { margin-bottom: 1.5rem; text-shadow: 0 1px 24px rgba(0, 0, 0, .3); }
  .ng-hero-copy .ng-btn { width: 100%; justify-content: center; }

  /* What we are, How we work: photos inset and rounded */
  .ng-split { padding-top: var(--ph-section); }
  .ng-split > img, .ng-flip > img, .ng-split > picture > img, .ng-flip > picture > img { align-self: stretch; width: auto; margin: 0 var(--gutter); border-radius: var(--ph-radius-card); box-shadow: var(--ph-shadow-card); }
  .ng-split > div { padding-top: 1.75rem; }
  .ng-flip { padding-top: 0; padding-bottom: var(--ph-section); }
  .ng-flip > div { padding-top: var(--ph-section); }

  /* Reels and Verticals swipe, with dots */
  .reel-fill { padding-bottom: .25rem; }
  .reel-frame { border-radius: var(--ph-radius-card); overflow: hidden; }
  .projects-band .ph-dots { color: var(--cream); }
  .project-card img { border-radius: var(--ph-radius-card); }

  .hero-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; padding-bottom: .5rem; }
  .hero-choice { min-height: 8.75rem; }
  .hero-choice strong { font-size: var(--ph-fs-h3); line-height: 1.15; }
  [data-panel="who"] .hero-choices { grid-template-columns: 1fr; }
  [data-panel="who"] .hero-choice { min-height: 7.5rem; }
}

@media (max-width: 639.98px) and (hover: none) {
  .card:hover .card-media img { transform: none; }

  .btn-quiet:hover { background: transparent; }
  .chip span:hover { border-color: var(--line); }
}

/* --- Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mast #site-nav { transform: none; transition: opacity 120ms linear, display 120ms allow-discrete; }
  @starting-style { .mast.is-open #site-nav { transform: none; } }
  .mast.is-open #site-nav a { animation: none; }
  .nav-toggle-icon i, .mast-cta::before, .mast #site-nav a { transition: none; }
  .phone-cta { transform: none; transition: opacity 120ms linear, display 120ms allow-discrete; }
  @starting-style { .phone-cta.is-shown { transform: none; } }
  .btn, .ng-btn, .btn-secondary, .btn-quiet, .subnav a, .filters button, .card, .map a, .enter-tile, .hero-choice, .story-body .rail .next-read a, .ph-dots i { transition: none; }
  .btn:active, .ng-btn:active, .btn-secondary:active, .btn-quiet:active, .subnav a:active, .filters button:active,
  .card:active, .map a:active, .enter-tile:active, .hero-choice:active, .story-body .rail .next-read a:active { transform: none; }
}

/* == Premium pass: motion and type on phones (classes from js/site.js, below 640px, with motion) == */

@media (max-width: 639.98px) {
  .ph-rise { opacity: 0; transform: translateY(24px); transition: opacity 550ms var(--ph-ease-out) var(--ph-delay, 0ms), transform 700ms cubic-bezier(.16, 1, .3, 1) var(--ph-delay, 0ms); }
  .ph-rise.is-in { opacity: 1; transform: none; }
  .ph-progress { display: block; position: fixed; z-index: 55; left: 0; right: 0; top: var(--header-height); height: 2px; background: var(--forest); transform-origin: 0 50%; transform: scaleX(0); opacity: 0; transition: opacity var(--ph-dur-fade) var(--ph-ease-out); pointer-events: none; }
  .ph-progress.is-shown { opacity: 1; }
  .mast.is-open ~ .ph-progress { opacity: 0; }

  /* type: balanced headings, hanging punctuation where the browser has it, figures that line up */
  h1, h2, h3, .card-copy strong, .next-read strong { text-wrap: balance; }
  .prose p, .prose li, blockquote.pull, .dek { hanging-punctuation: first last; }
  .sheet dd, .facts b, .form-progress-count { font-variant-numeric: tabular-nums; }
}

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

/* Consulting menu card: full width, forest */
.mast #site-nav a.nav-consult { grid-column: 1 / -1; min-height: 8rem; background-color: var(--forest); }

/* == Page families (phones). One reference page per family first, then its related routes. ==
   Layout and order only: the copy, the facts and every link stay as authored. */

@media (max-width: 639.98px) {
  /* Application routes (the volunteer types): a decision view. The commitment facts are one compact block and the
     Start button follows them at once, inside the first screen on a 390x844 phone. The DOM order is kept, so
     the keyboard meets the types, the facts and then Start in the order they appear. */
  .action:has(> .action-main > nav.subnav + dl.sheet) { row-gap: 0; }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-main > dl.sheet { margin-bottom: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--ph-pad); }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-main > dl.sheet > div { grid-column: 1 / -1; padding-block: .7rem; }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-main > dl.sheet > div:nth-child(-n+2) { grid-column: auto; }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-main > dl.sheet dd { font-size: var(--fs-small); line-height: 1.5; }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-card { margin-top: .75rem; }
  .action:has(> .action-main > nav.subnav + dl.sheet) > .action-card .form-summary p:last-child { margin-bottom: 0; }

  /* Consulting: the application and the process are two adjacent paths inside the first screen. The photo keeps its
     crop focus and loses height; Apply stays the one primary action and the stages link is a full-width second route. */
  .consult-hero-media img { aspect-ratio: 3 / 2; }
  .consult-ctas { gap: 0; margin-top: 1.25rem; }
  .consult-ctas .consult-link { width: 100%; justify-content: center; }

  /* Field notes and place pages: the key facts (place and people, or the availability of a stay) open the body, ahead
     of the long text. The rail is only re-ordered visually; it holds no links before the article, so the keyboard
     order is unchanged. Explore stories have no key facts and keep their order. */
  .story-body:has(> .rail > .rail-facts) { display: flex; flex-direction: column; }
  .story-body:has(> .rail > .rail-facts) > .rail { display: contents; }
  .story-body:has(> .rail > .rail-facts) > .rail > .rail-facts { order: 1; margin-bottom: var(--ph-pad); }
  .story-body:has(> .rail > .rail-facts) > article { order: 2; }
  .story-body:has(> .rail > .rail-facts) > .rail > :not(.rail-facts) { order: 3; }
  /* a place's next actions (follow, work with us) sit with its facts: its article has no links, so nothing is out of order */
  .ed-place .story-body > .rail > .rail-facts + .continue { order: 1; margin: calc(-1 * var(--ph-pad) + .25rem) 0 var(--ph-pad); }
}
