/* ══════════════════════════════════════════════════════════════════════════
   MOBILE LAYER — Carlo Schembri portfolio
   ------------------------------------------------------------------------
   Everything in this file is wrapped in `@media (max-width: 768px)`.
   It is loaded AFTER all other stylesheets so it overrides them only for
   phones & small tablets. Desktop behaviour is untouched.

   Breakpoints used:
     · ≤ 768px   — mobile default (all rules)
     · ≤ 480px   — compact phones
     · ≤ 360px   — very narrow phones (iPhone SE 1st gen, old Androids)

   Touch target minimum: 44 × 44 CSS px (WCAG 2.5.5).
   iOS zoom prevention:  form inputs ≥ 16px font-size.
   ══════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {

  /* ─── 0. GLOBAL BASE ──────────────────────────────────────────────────
     Prevents iOS auto-zoom on input focus, removes tap highlights,
     eliminates horizontal scrolling surprises.
  */
  html { -webkit-text-size-adjust: 100%; }
  html, body {
    max-width: 100vw;
    overflow-x: hidden;
  }
  body {
    -webkit-tap-highlight-color: rgba(176, 141, 87, 0.18);
    touch-action: manipulation;
  }
  *, *::before, *::after { -webkit-tap-highlight-color: transparent; }
  body, main, section, article, .hero, .about, .chapters, .altair, .contact, .footer {
    max-width: 100vw;
  }

  /* iOS auto-zoom fix: form controls must be ≥ 16px */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="url"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Respect iOS safe areas */
  body { padding-bottom: env(safe-area-inset-bottom, 0); }

  /* ═══════════════════════════════════════════════════════════════════════
     1. NAVIGATION
     Hamburger & drawer already exist in components.css / main.css. This
     block enlarges touch targets and polishes drawer padding.
  ═══════════════════════════════════════════════════════════════════════ */

  /* ── Nav: force flexbox so brand + burger are always on one row ─────── */
  #site-header .nav-inner,
  header.nav .nav-inner {
    display: flex !important;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding: 0 20px;
    min-height: 56px;
  }
  /* Remove the negative margin trick that can cause overflow on narrow phones */
  .nav-mark {
    margin: 0;
    padding: 10px 0;
    flex-shrink: 0;
  }
  .nav-mark-name {
    font-size: 13px;
    letter-spacing: 0.20em;
  }
  .nav-burger {
    width: 44px; height: 44px;          /* WCAG touch target */
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .nav-drawer {
    width: min(92vw, 420px);
    padding: calc(env(safe-area-inset-top, 0) + 80px) 32px 40px;
  }
  .nav-drawer a,
  .mobile-nav a {
    padding: 14px 0;                    /* 44px+ hit row */
    display: block;
    font-size: clamp(1.6rem, 5.2vw, 2.2rem);
  }
  /* Close button in drawer — if present */
  .nav-drawer .drawer-close,
  .mobile-nav .mobile-nav-close {
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     2. INDEX.HTML — HERO
     Hotspots are hidden on phones (by main.css@640). We leave them hidden
     but add a clearer mobile scroll hint and push the chrome safely into
     the viewport.
  ═══════════════════════════════════════════════════════════════════════ */

  .hero {
    min-height: 100vh;
    min-height: 100svh;                 /* small-viewport unit avoids iOS URL-bar jump */
  }
  .hero-title {
    font-size: clamp(2.4rem, 10vw, 4.2rem);
    line-height: 1.0;                   /* 0.96 clips ascenders on some phones */
  }
  /* Keep kicker and tagline from overflowing narrow screens */
  .ht-kicker {
    font-size: 9px;
    letter-spacing: 0.32em;
    gap: 10px;
    margin-bottom: 20px;
  }
  .ht-kicker .ht-rule { width: 32px; }
  .ht-tagline {
    font-size: 10px;
    letter-spacing: 0.32em;
    margin-top: 18px;
  }
  .hero-sub {
    font-size: 13px;
    letter-spacing: 0.28em;
  }
  .hero-scroll {
    bottom: calc(env(safe-area-inset-bottom, 0) + 24px);
  }
  .hero-video,
  .hero video {
    object-fit: cover;
  }

  /* Preview panel stays hidden on mobile; ensure it cannot leak in */
  .preview, .hotspot-preview { display: none !important; }

  /* Hotspots: 641–768px — hide the scattered desktop pins entirely.
     A clean video hero is better than non-interactive floating dots.
     At ≤640px they become a bottom tap strip (see block below). */
  .hotspots { display: none !important; }

  /* 641–768px: hero chrome collapses to a single centred CTA column */
  .hero-chrome {
    left: 0 !important;
    right: 0 !important;
    bottom: max(40px, calc(env(safe-area-inset-bottom, 0) + 32px)) !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    gap: 20px !important;
  }
  .hero-enter {
    justify-content: center !important;
    min-width: 200px;
    max-width: 320px;
    padding: 15px 28px !important;
  }
  /* Scroll hint visible at 641–768 where there's no bottom strip */
  .hero-scroll {
    display: inline-flex !important;
    justify-self: center;
  }
  .hero-chrome-mark { display: none !important; }

  /* ═══════════════════════════════════════════════════════════════════════
     3. INDEX.HTML — ABOUT
     Stack photo over text with sensible proportions.
  ═══════════════════════════════════════════════════════════════════════ */

  /* About: no extra section padding — grid handles spacing */
  .about-grid {
    grid-template-columns: 1fr !important;
    gap: 0;
  }
  .about-photo-col {
    height: 110vw;                      /* tall enough to show full portrait */
    min-height: 340px !important;
    max-height: 620px;
  }
  /* Show more of the portrait — center 28% reveals face + full figure */
  .about-photo-col img {
    object-position: center 28%;
  }
  .about-text-col {
    padding: 40px 22px 48px !important;
    gap: 22px !important;
  }
  .about-heading {
    font-size: clamp(1.8rem, 7vw, 2.4rem) !important;
  }
  .about-bio {
    font-size: 16px !important;
    line-height: 1.75 !important;
  }
  .about-signoff {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
  .about-cta {
    width: 100%;
    justify-content: center;
    padding: 16px 24px !important;     /* 48px tall tap target */
  }
  .about-signature { text-align: left !important; }

  /* ═══════════════════════════════════════════════════════════════════════
     4. INDEX.HTML — CHAPTERS TEASER
  ═══════════════════════════════════════════════════════════════════════ */

  .chapters, #chapters { padding: 56px 0 64px; }

  /* Header: collapse 2-col grid, trim excessive bottom margin */
  .chapters-header {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-bottom: 36px !important;
  }
  .chapters-heading, .chapters-lede { grid-column: 1 !important; }
  .chapters-heading { font-size: clamp(2rem, 9vw, 3rem) !important; }
  .chapters-lede { font-size: 14px !important; }

  /* Card grid: single column, tighter gap */
  .ch-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 0 20px !important;             /* override clamp gutter with fixed mobile pad */
  }

  /* Hero card: remove 16/9 ratio — let min-height drive the height */
  .ch-card--hero {
    aspect-ratio: unset !important;
    min-height: 56vw !important;            /* ~210px on 375px, never too short */
    max-height: 340px;
  }
  /* Counter cards: remove 4/3 ratio, use a portrait-friendly height */
  .ch-card--counter {
    aspect-ratio: unset !important;
    min-height: 72vw !important;            /* ~270px on 375px — shows image well */
    max-height: 400px;
  }

  /* Card body: absolute positioned — override left/right/bottom, not padding */
  .ch-card-body {
    left: 16px !important;
    right: 16px !important;
    bottom: 16px !important;
    gap: 8px !important;
  }
  /* Card meta top row: tighter inset */
  .ch-card-meta-top {
    left: 16px !important;
    right: 16px !important;
    top: 14px !important;
  }
  .ch-card-title { font-size: clamp(1.3rem, 5.5vw, 1.9rem) !important; }

  /* Footer: stack vertically, hide decorative rules on small screens */
  .chapters-foot {
    flex-direction: column !important;
    align-items: center !important;
    gap: 16px !important;
    margin-top: 40px !important;
  }
  .cf-rule { display: none !important; }
  .chapters-cta {
    width: auto !important;               /* don't try to be 100% in flex row */
    align-self: center;
    padding: 14px 28px !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     5. INDEX.HTML — ALTAIR
  ═══════════════════════════════════════════════════════════════════════ */

  .altair, #altair { padding: 64px 0; }
  .altair-inner,
  .altair-grid {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
    text-align: left;
  }
  .altair-frame {
    max-width: 240px !important;
    margin: 0 auto;
  }
  .altair-cta {
    width: 100%;
    justify-content: center;
    padding: 16px 24px !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     6. INDEX.HTML — CONTACT FORM
  ═══════════════════════════════════════════════════════════════════════ */

  .contact, #contact { padding: 56px 0; }
  .contact-grid,
  .cm-grid {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }
  .cm-form, .contact-form {
    display: flex; flex-direction: column;
    gap: 20px;
  }
  .cm-form label,
  .contact-form label {
    font-size: 10px;
    letter-spacing: 0.36em;
  }
  .cm-form input,
  .cm-form textarea,
  .contact-form input,
  .contact-form textarea {
    padding: 14px 4px !important;      /* ≥ 44px tall */
    font-size: 16px !important;
  }
  .cm-form textarea, .contact-form textarea { min-height: 120px; }
  .cm-form button[type="submit"],
  .contact-form button[type="submit"] {
    width: 100%;
    padding: 16px 24px !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     7. INDEX.HTML — FOOTER
  ═══════════════════════════════════════════════════════════════════════ */

  .footer, footer.footer { padding: 40px 20px 32px; }
  .footer-inner, .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px;
    text-align: left;
  }
  .footer-socials, .social-list {
    display: flex; flex-wrap: wrap; gap: 14px;
    justify-content: flex-start;
  }
  .footer-socials a, .social-list a {
    width: 44px; height: 44px;         /* touch target */
    display: inline-flex; align-items: center; justify-content: center;
  }
  .footer small, .footer-copy {
    font-size: 11px;
    letter-spacing: 0.24em;
  }

  /* Section kickers read smaller on phones */
  .section-kicker {
    font-size: 10px;
    letter-spacing: 0.36em;
  }
  .section-kicker .sk-rule { width: 28px; }

  /* ═══════════════════════════════════════════════════════════════════════
     8. CHAPTERS.HTML — CHOOSER (cinematic vs basic)
  ═══════════════════════════════════════════════════════════════════════ */

  .cho-header { padding: 18px 20px !important; }
  .cho-mark { font-size: 13px; letter-spacing: 0.26em; }
  .cho-intro { padding: 56px 20px 32px !important; }
  .cho-intro h1 { font-size: clamp(1.8rem, 8vw, 2.6rem) !important; }
  .cho-intro p { font-size: 15px !important; line-height: 1.7 !important; }

  .cho-gate {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    padding: 20px !important;
  }
  .cho-door {
    min-height: clamp(380px, 60vh, 520px) !important;
    padding: 28px 20px !important;
  }
  .cho-door-number { font-size: 52px !important; }
  .cho-door-title  { font-size: clamp(1.4rem, 5.5vw, 1.9rem) !important; }
  .cho-door-cta {
    padding: 14px 22px;
    min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .cho-divider { display: none !important; }

  /* ═══════════════════════════════════════════════════════════════════════
     9. CHAPTERS-BASIC.HTML
     Fixed: correct class names, dark theme index strip, accurate sticky top.
  ═══════════════════════════════════════════════════════════════════════ */

  /* Header: force same-line layout, no wrapping */
  .bs-header {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0 20px !important;
    height: 56px !important;
    min-height: 0 !important;
  }
  .bs-mark {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
  }
  /* Page top-padding clears the fixed 56px header */
  .bs { padding-top: 56px !important; }

  /* Hero: left-aligned, tighter on phones */
  .bs-hero { padding: 36px 20px 28px !important; text-align: left !important; }
  .bs-title { font-size: clamp(2rem, 8.5vw, 2.8rem) !important; }
  .bs-hero-meta { margin-top: 20px !important; gap: 14px !important; }

  /* Body: single-column, full-width, no extra padding */
  .bs-body {
    grid-template-columns: 1fr !important;
    gap: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  /* ── Sticky index strip ─────────────────────────────────────────────
     Dark background (page is dark). Sticky just below the 56px header.
     Horizontal pill strip of chapter buttons.
  ── */
  .bs-index,
  aside.bs-index {
    position: sticky !important;
    top: 56px !important;
    z-index: 150 !important;
    width: 100% !important;
    max-height: none !important;
    padding: 0 !important;
    background: rgba(10, 9, 8, 0.97) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(196, 167, 108, 0.10);
    align-self: auto !important;
  }
  .bs-index-inner {
    flex-direction: row !important;
    align-items: center !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-height: none !important;
    padding: 10px 16px !important;
    gap: 6px !important;
  }
  .bs-index-inner::-webkit-scrollbar { display: none; }
  .bs-index-label,
  .bs-index-progress { display: none !important; }
  .bs-index-list {
    flex-direction: row !important;
    gap: 6px !important;
    flex-shrink: 0;
  }
  .bs-ix {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 7px 10px !important;
    min-height: 36px;
    border: 1px solid rgba(196, 167, 108, 0.10) !important;
    border-bottom: 1px solid rgba(196, 167, 108, 0.10) !important;
  }
  .bs-ix:hover { padding-left: 10px !important; }
  .bs-ix-title { font-size: 12px; }
  .bs-ix-count { display: none !important; }
  .bs-index-tools {
    margin-top: 0 !important;
    flex-shrink: 0;
    padding-left: 8px;
    border-left: 1px solid rgba(196, 167, 108, 0.12);
  }
  .bs-tool { width: 36px !important; height: 36px !important; }

  /* ── Chapter stream ─────────────────────────────────────────────────
     Extra bottom padding makes room for the floating Index button.
  ── */
  .bs-stream {
    padding: 32px 20px 110px !important;  /* 110px clears the floating btn */
    gap: 60px !important;
  }
  .bs-ch { scroll-margin-top: 120px; }

  /* ── Chapter header: roman left, title + meta stacked right ──────── */
  .bs-ch-head {
    grid-template-columns: auto 1fr !important;
    grid-template-rows: auto auto !important;
    align-items: start !important;
    gap: 2px 12px !important;
    padding-bottom: 14px !important;
    margin-bottom: 18px !important;
  }
  .bs-ch-roman {
    grid-column: 1 !important;
    grid-row: 1 / 3 !important;
    align-self: center !important;
    font-size: 26px !important;
    padding-right: 6px;
    border-right: 1px solid rgba(196, 167, 108, 0.18);
    margin-right: 2px;
  }
  .bs-ch-title {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: end !important;
    font-size: clamp(16px, 5vw, 24px) !important;
  }
  .bs-ch-meta {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: start !important;
    text-align: left !important;
    white-space: normal !important;
    font-size: 8px !important;
  }

  /* ── Photo grid ─────────────────────────────────────────────────────
     sm + md → 2 columns with breathing room between tiles.
     lg → single column.
  ── */
  .bs-grid { gap: 12px !important; }
  .bs-grid.is-sm,
  .bs-grid.is-md { grid-template-columns: repeat(2, 1fr) !important; }
  .bs-grid.is-lg  { grid-template-columns: 1fr !important; }
  .bs-tile-num { opacity: 1 !important; transform: none !important; }

  /* ── Chapter index floating button ──────────────────────────────── */
  .bs-ch-menu-btn {
    display: flex !important;
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    right: 20px;
    z-index: 300;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(10, 9, 8, 0.88);
    border: 1px solid rgba(196, 167, 108, 0.38);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    font-family: var(--font-sc);
    font-size: 9px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--bronze-pale);
    transition: background 0.2s, border-color 0.2s;
  }
  .bs-ch-menu-btn:active {
    background: rgba(196, 167, 108, 0.14);
    border-color: rgba(196, 167, 108, 0.60);
  }

  /* ── Coda ───────────────────────────────────────────────────────── */
  .bs-coda { padding: 48px 20px 56px !important; text-align: left !important; }
  .bs-coda-actions {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .bs-btn {
    justify-content: center !important;
    min-height: 52px !important;
    padding: 16px 24px !important;
  }

  /* ── Lightbox ────────────────────────────────────────────────────── */
  .bs-lb-figure {
    max-width: 100vw !important;
    padding: 0 16px !important;
    gap: 12px !important;
  }
  .bs-lb-figure img {
    max-height: 70vh !important;
    max-height: 70svh !important;
    max-width: calc(100vw - 32px) !important;
  }
  .bs-lb-close { top: 12px !important; right: 12px !important; width: 48px !important; height: 48px !important; }
  .bs-lb-prev  { left: 8px !important;  width: 48px !important; height: 48px !important; }
  .bs-lb-next  { right: 8px !important; width: 48px !important; height: 48px !important; }
  .bs-lb-caption { font-size: 9px !important; gap: 10px !important; }

  /* ═══════════════════════════════════════════════════════════════════════
     10. CHAPTERS-CINEMATIC.HTML
     The pannable atlas stays, but we:
       · enlarge minimap dots / nav tap targets
       · convert detail-panel to a bottom sheet
       · ensure media carousel arrows are 44px
       · add touch-friendly :active states in place of :hover
  ═══════════════════════════════════════════════════════════════════════ */

  /* Chrome / top nav */
  .chrome, .cin-chrome { padding: 14px 18px !important; }
  .chrome-mark { font-size: 13px !important; }
  .chrome-nav, .cin-nav-links { display: none !important; }

  /* Atlas stage: make it the full screen, readable */
  .atlas-stage, .stage {
    touch-action: pan-x pan-y;         /* allow native two-finger pan */
    overscroll-behavior: contain;
  }
  .atlas-hint, .stage-hint { font-size: 10px !important; }

  /* Node cards on the atlas */
  .node-card {
    min-width: 120px;
    padding: 12px !important;
  }
  .node-card .node-title { font-size: 14px !important; }

  /* Navigator minimap — bump dot targets to 10px (visible) but keep a
     24px transparent hit area around them via padding. */
  .navigator, .atlas-navigator {
    left: 14px !important;
    bottom: calc(env(safe-area-inset-bottom, 0) + 14px) !important;
    padding: 10px !important;
    min-width: 100px !important;
  }
  .navigator-dot, .minimap-dot {
    width: 10px !important; height: 10px !important;
    padding: 7px;
    background-clip: content-box;
  }

  /* Index sidebar collapses behind a button */
  .cin-index,
  .atlas-index {
    right: 12px !important;
    top: calc(env(safe-area-inset-top, 0) + 60px) !important;
    max-width: min(82vw, 300px) !important;
    max-height: 70vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cin-index-toggle, .atlas-index-toggle {
    width: 44px; height: 44px;
  }

  /* Detail panel → bottom sheet */
  .detail, .cin-detail, .detail-panel {
    position: fixed !important;
    left: 0 !important; right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 86vh;
    height: auto !important;
    border-left: 0 !important;
    border-top: 1px solid rgba(107, 101, 92, 0.22);
    border-radius: 12px 12px 0 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform .45s cubic-bezier(.2, .9, .3, 1);
    z-index: 60;
    padding-bottom: calc(env(safe-area-inset-bottom, 0) + 24px) !important;
  }
  .detail.is-open, .cin-detail.is-open, .detail-panel.is-open {
    transform: translateY(0);
  }
  .detail-inner, .cin-detail-inner { padding: 24px 20px !important; }
  .detail-title,
  .cin-detail-title { max-width: none !important; font-size: clamp(1.6rem, 6vw, 2.1rem) !important; }

  /* Bottom-sheet grab handle */
  .detail::before,
  .detail-panel::before,
  .cin-detail::before {
    content: "";
    position: sticky; top: 8px; left: 50%;
    display: block;
    width: 44px; height: 4px;
    margin: 8px auto 12px;
    background: rgba(107, 101, 92, 0.35);
    border-radius: 2px;
  }

  /* Detail close button */
  .detail-close, .cin-detail-close {
    width: 44px !important; height: 44px !important;
    top: 10px !important; right: 10px !important;
  }

  /* Media carousel controls */
  .detail-media-nav,
  .cin-detail-nav,
  .media-nav-btn {
    width: 44px !important; height: 44px !important;
  }
  .strip-thumb, .thumb-strip-item {
    width: 96px !important; height: 68px !important;
  }

  /* Lightbox */
  .lightbox, .cin-lightbox {
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  }
  .lightbox-nav { width: 44px !important; height: 44px !important; }
  .lightbox-close {
    width: 44px !important; height: 44px !important;
    top: calc(env(safe-area-inset-top, 0) + 8px) !important;
    right: 8px !important;
  }

  /* Remove hover-dependent transforms on touch (main.css hover survives
     on desktop; we only neutralize here). */
  .node-card:hover,
  .media-plate:hover,
  .strip-thumb:hover,
  .detail-media-nav:hover { transform: none; }

  /* ═══════════════════════════════════════════════════════════════════════
     11. MODE-SELECTOR bar (used on chapters-cinematic / -basic)
  ═══════════════════════════════════════════════════════════════════════ */
  .mode-selector, .mode-switch {
    bottom: calc(env(safe-area-inset-bottom, 0) + 14px) !important;
    padding: 6px !important;
  }
  .mode-selector a, .mode-switch a,
  .mode-selector button, .mode-switch button {
    min-height: 44px;
    padding: 10px 16px !important;
    font-size: 11px !important;
    letter-spacing: 0.26em !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════
     12. GENERIC — buttons, links, focus ring
  ═══════════════════════════════════════════════════════════════════════ */
  a, button, [role="button"] { min-height: 44px; }
  .nav-cta, .cta-pill, .btn, .about-cta {
    min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  :focus-visible {
    outline: 2px solid var(--bronze, #b08d57);
    outline-offset: 3px;
  }

  /* Improve text selection on dark photography overlays */
  ::selection { background: var(--bronze, #b08d57); color: var(--warm-white, #f6f2ec); }

  /* ═══════════════════════════════════════════════════════════════════════
     13. PERFORMANCE — mobile
     Tone down decorative animation cost on phones.
  ═══════════════════════════════════════════════════════════════════════ */
  #grain { opacity: 0.35; }            /* film grain lighter on mobile */
  .reveal { transition-duration: 0.7s; }

  /* ══════════════════════════════════════════════════════════════════════
     ≤ 480px  — COMPACT PHONES
     ══════════════════════════════════════════════════════════════════════ */
  @media (max-width: 480px) {
    .nav-mark-name { font-size: 13px; }
    .hero-title { font-size: clamp(2.2rem, 12vw, 3.4rem); }
    .hero-chrome { padding: 20px 16px; gap: 14px; }

    .about-text-col { padding: 32px 18px 40px !important; }
    .about-bio { font-size: 15.5px !important; }

    .ch-grid { gap: 16px; }
    .ch-card { min-height: 280px; }
    .ch-card-body { padding: 18px !important; }

    .altair, #altair { padding: 52px 0; }
    .altair-frame { max-width: 200px !important; }

    .contact, #contact { padding: 48px 0; }

    /* Chooser doors tighter */
    .cho-intro { padding: 44px 18px 28px !important; }
    .cho-door { min-height: clamp(340px, 58vh, 460px) !important; padding: 24px 18px !important; }
    .cho-door-number { font-size: 44px !important; }

    /* Basic chapter grid: still 2-col is fine, keep gap tight */
    .bs-chapter-grid, .bs-grid { gap: 6px !important; }

    /* Footer gets single-file links */
    .footer-links { gap: 8px !important; }
  }

  /* ══════════════════════════════════════════════════════════════════════
     ≤ 360px  — NARROW PHONES (iPhone SE 1st gen, small Androids)
     ══════════════════════════════════════════════════════════════════════ */
  @media (max-width: 360px) {
    #site-header .nav-inner, header.nav .nav-inner { padding: 0 14px; }
    .nav-drawer { width: 96vw; padding: 72px 22px 32px; }

    .hero-title { font-size: clamp(2rem, 13vw, 3rem); }
    .hero-sub   { font-size: 11.5px; letter-spacing: 0.24em; }
    .hero-chrome { padding: 16px 12px; }

    .about-text-col { padding: 28px 14px 36px !important; }
    .about-heading  { font-size: clamp(1.6rem, 7.5vw, 2.1rem) !important; }
    .about-bio      { font-size: 15px !important; line-height: 1.7 !important; }

    .ch-card { min-height: 240px; }
    .ch-card-body { padding: 14px !important; }

    .bs-chapter-grid, .bs-grid { grid-template-columns: 1fr !important; }

    .cho-door { min-height: 300px !important; padding: 20px 14px !important; }
    .cho-door-number { font-size: 36px !important; }

    .detail-inner, .cin-detail-inner { padding: 20px 14px !important; }
  }

  /* ══════════════════════════════════════════════════════════════════════
     LANDSCAPE PHONES — compress vertical hero so scroll cue is visible
     ══════════════════════════════════════════════════════════════════════ */
  @media (orientation: landscape) and (max-height: 480px) {
    .hero { min-height: 100vh; }
    .hero-title { font-size: clamp(2rem, 8vh, 3rem); }
    .hero-chrome { padding: 14px 20px; gap: 10px; }
    .hero-scroll { bottom: 12px; }
    .about-photo-col { height: 60vh; max-height: 480px; }
  }

} /* ← end outer @media (max-width: 768px) */


/* ══════════════════════════════════════════════════════════════════════════
   MOBILE HOTSPOT STRIP — ≤ 640px
   Replaces the scattered absolute-positioned chapter pins with a
   horizontally-scrolling pill strip anchored to the bottom of the hero.
   ══════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Hero height: use small-viewport unit so the strip isn't hidden
     below iOS Safari's address bar. Fallback order matters: svh last. ── */
  .hero {
    height: 100vh !important;
    height: 100svh !important;
    min-height: 0 !important;
  }

  /* ── Strip container ─────────────────────────────────────────────────
     Override: main.css sets display:none AND inset:0 (full-hero spread).
     We need to un-spread it and pin it to the bottom only.
  ── */
  .hotspots {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
    /* Reset the full-hero spread from main.css */
    position: absolute !important;
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: max(10px, env(safe-area-inset-bottom, 10px)) !important;
    z-index: 6;
    height: auto !important;
    /* Horizontal scroll */
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: center;
    gap: 6px;
    padding: 24px 20px 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    pointer-events: auto !important;
    /* Dark atmospheric gradient behind strip */
    background: linear-gradient(to top,
      rgba(10,9,8,0.90) 0%,
      rgba(10,9,8,0.60) 50%,
      transparent 100%);
    /* Visibility: match main.css — container is opacity:0 until hero
       reaches ready/fade, then transitions in */
  }
  .hotspots::-webkit-scrollbar { display: none; }

  /* ── Individual chapter pills ────────────────────────────────────── */
  .hotspot {
    /* Remove JS-placed absolute positioning */
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    /* Bypass the JS bloom stagger — always visible once container is */
    opacity: 1 !important;
    scale: 1 !important;
    /* Pill geometry */
    flex: 0 0 auto;
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 3px;
    padding: 9px 13px;
    min-width: 80px;
    max-width: 160px;
    min-height: 52px;
    /* Glass pill */
    background: rgba(10, 9, 8, 0.58);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(196, 167, 108, 0.20);
    transition: background 0.2s, border-color 0.2s;
  }
  .hotspot:active,
  .hotspot:focus-visible {
    background: rgba(176, 141, 87, 0.24);
    border-color: rgba(196, 167, 108, 0.50);
  }
  .hotspot.is-dim {
    opacity: 0.38 !important;
    filter: none;
  }

  /* ── Pin: show only the roman numeral ──────────────────────────── */
  .hs-pin {
    position: static !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    border-radius: 0;
  }
  .hs-pin-num {
    position: static !important;
    z-index: auto;
    opacity: 1 !important;
    transform: none !important;
    font-family: var(--font-sc);
    font-size: 8px;
    letter-spacing: 0.28em;
    color: var(--bronze-pale);
    line-height: 1;
    transition: none;
  }
  .hs-pin-ring,
  .hs-pin-core,
  .hs-pin-pulse { display: none !important; }

  /* ── Label: static, below the numeral ────────────────────────── */
  .hs-label {
    position: static !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;
    display: block !important;
    white-space: nowrap;
    pointer-events: none;
    gap: 0;
  }
  /* Remove the hairline pseudo — it doesn't work in this layout */
  .hs-label::before { display: none !important; content: none !important; }
  .hs-label-rule { display: none !important; }
  .hs-label-text {
    font-family: var(--font-display);
    font-size: 12.5px;
    font-weight: 400;
    font-style: italic;
    color: var(--warm-white);
    opacity: 0.90;
    line-height: 1.15;
    transition: none;
  }

  /* hs-left variant: same on mobile, no reversal */
  .hotspot.hs-left .hs-label {
    flex-direction: row !important;
    left: auto !important;
    right: auto !important;
  }

  /* ── Hero chrome: lift above strip, centre the Folio CTA ─────── */
  .hero-chrome {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 108px !important;           /* clear the ~80px strip + breathing room */
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 20px !important;
    gap: 14px !important;
  }
  /* The chapter-number label hides; scroll cue re-shown as a simpler hint */
  .hero-chrome-mark { display: none !important; }
  /* Scroll hint: stripped back, just the animated line */
  .hero-scroll {
    display: inline-flex !important;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0.55;
  }
  .hero-scroll span:first-child { display: none; } /* hide the SCROLL text */
  /* Folio CTA: centred, comfortable tap target */
  .hero-enter {
    flex: none;
    min-width: 200px;
    max-width: 300px;
    justify-content: center !important;
    padding: 14px 28px !important;
  }

  /* ── Hero title: tighter on very small screens ─────────────────── */
  .ht-name {
    font-size: clamp(3rem, 13vw, 5rem) !important;
  }

  /* ── Chapter overlay ──────────────────────────────────────────── */
  .ovl-head { padding: 12px 16px !important; }
  .ovl-title { font-size: clamp(1.15rem, 4.8vw, 1.6rem) !important; }
  .ovl-close { width: 40px !important; height: 40px !important; }
  .ovl-body { padding: 20px 12px 80px !important; }
  .ovl-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* ── Lightbox ─────────────────────────────────────────────────── */
  .lb-figure {
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100svh - 80px) !important;
  }
  .lb-figure img { max-height: calc(100svh - 120px) !important; }

  /* ── Mobile chapter quick-view bottom sheet ───────────────────── */
  .hs-quick,
  .hs-quick-backdrop { display: block; }

  .hs-quick {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 820;
    background: rgba(12, 10, 9, 0.97);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border-top: 1px solid rgba(196, 167, 108, 0.20);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
    will-change: transform;
  }
  .hs-quick.is-open { transform: translateY(0); }

  .hs-quick-drag {
    width: 38px; height: 4px;
    background: rgba(196, 167, 108, 0.24);
    border-radius: 2px;
    margin: 14px auto 0;
  }
  .hs-quick-body {
    display: grid;
    grid-template-columns: 96px 1fr;
    gap: 16px;
    padding: 16px 20px 6px;
    align-items: start;
  }
  .hs-quick-thumb {
    width: 96px; height: 120px;
    overflow: hidden;
    background: rgba(20, 18, 16, 0.8);
    flex-shrink: 0;
  }
  .hs-quick-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
  }
  .hs-quick-info {
    display: flex;
    flex-direction: column;
    min-height: 120px;
    gap: 3px;
  }
  .hs-quick-num {
    font-family: var(--font-sc, 'Cormorant SC', serif);
    font-size: 8px;
    letter-spacing: 0.44em;
    text-transform: uppercase;
    color: var(--bronze-pale, #c4a76c);
    display: block;
  }
  .hs-quick-name {
    margin: 3px 0 0;
    font-family: var(--font-display, 'Cormorant Garamond', serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.05rem, 4.4vw, 1.35rem);
    color: var(--warm-white, #f6f2ec);
    line-height: 1.2;
  }
  .hs-quick-meta {
    font-family: var(--font-body, 'EB Garamond', serif);
    font-size: 11px;
    color: rgba(232, 226, 214, 0.42);
    display: block;
    margin-top: 3px;
  }
  .hs-quick-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 12px;
  }
  .hs-quick-steppers { display: flex; gap: 6px; }
  .hs-quick-step {
    width: 38px; height: 38px;
    min-height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid rgba(196, 167, 108, 0.24);
    color: rgba(232, 226, 214, 0.65);
    transition: border-color 0.18s, color 0.18s, background 0.18s;
  }
  .hs-quick-step:active {
    border-color: var(--bronze-pale, #c4a76c);
    color: var(--bronze-pale, #c4a76c);
    background: rgba(196, 167, 108, 0.10);
  }
  .hs-quick-open {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    min-height: 38px;
    background: rgba(196, 167, 108, 0.09);
    border: 1px solid rgba(196, 167, 108, 0.38);
    font-family: var(--font-sc, 'Cormorant SC', serif);
    font-size: 8px;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: var(--bronze-pale, #c4a76c);
    transition: background 0.22s, border-color 0.22s, color 0.22s;
  }
  .hs-quick-open:active {
    background: var(--bronze-pale, #c4a76c);
    border-color: var(--bronze-pale, #c4a76c);
    color: var(--ink-deep, #0a0908);
  }
  .hs-quick-backdrop {
    position: fixed; inset: 0;
    z-index: 810;
    background: rgba(10, 9, 8, 0.46);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.36s;
  }
  .hs-quick-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

}
