/* ============================================================
   responsive.css — mobile & tablet layout and typography.
   Loads LAST (after sections.css) so it can override the
   inline grid / padding styles used throughout index.html.
   `!important` appears only where it must beat an inline style.
   ============================================================ */

/* ---- fluid page gutters ------------------------------------ */
@media (max-width: 1024px){
  .wrap{ padding-left:40px; padding-right:40px; }
}
@media (max-width: 640px){
  .wrap{ padding-left:20px; padding-right:20px; }
}

/* ---- mobile navigation (pure-CSS toggle) ------------------- */
@media (max-width: 820px){
  .nav-wrap{ position:relative; padding-top:16px; padding-bottom:12px; }
  .brand-name{ font-size:18px; }

  .nav-burger{
    display:inline-flex; flex-direction:column; justify-content:center; gap:5px;
    width:44px; height:44px; padding:11px; cursor:pointer;
    border-radius:12px; background:rgba(255,255,255,.72); border:1px solid var(--line);
    -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px);
  }
  .nav-burger span{
    display:block; width:22px; height:2px; border-radius:2px; background:#24211c;
    transition:transform .3s ease, opacity .2s ease;
  }

  .site-nav{
    position:absolute; top:calc(100% + 8px); right:0; left:auto;
    width:min(250px, 74vw);
    flex-direction:column; align-items:stretch; gap:2px;
    background:#fff; border:1px solid var(--line); border-radius:16px; padding:10px;
    box-shadow:0 24px 48px -20px rgba(30,26,20,.45);
    opacity:0; transform:translateY(-8px) scale(.98); transform-origin:top right;
    pointer-events:none; transition:opacity .22s ease, transform .22s ease;
  }
  .nav-toggle:checked ~ .site-nav{ opacity:1; transform:none; pointer-events:auto; }
  .site-nav a{ padding:12px 14px; border-radius:10px; font-size:15px; }
  .site-nav a:hover{ background:var(--teal-t); }
  .nav-cta{ justify-content:center; margin-top:6px; }

  .nav-toggle:checked ~ .nav-burger span:nth-child(1){ transform:translateY(7px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2){ opacity:0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3){ transform:translateY(-7px) rotate(-45deg); }
}

/* ---- hero -------------------------------------------------- */
/* Rebuilt 2026-10-22. The grid used to collapse to ONE column, which pushed
   the portrait underneath the text: the hero ran 939px against an 812px
   screen (1.16 screens) and the portrait was the part that fell off. It is
   now one screen, composed like the desktop — text left, portrait anchored
   bottom-right — with the CTA pinned to the bottom edge.

   The text column is a flex column of its own so `margin-top:auto` on the CTA
   row does the pinning; nothing is positioned by hand-tuned offsets. */
@media (max-width: 860px){
  /* `min-height` MUST carry !important: index.html sets min-height:660px as an
     inline style on .hero-wrap, which otherwise beats anything declared here.
     (The rule this replaced used `min-height:0 !important` for the same
     reason.) Dropping it silently left the hero 660px tall on a 568px screen
     and detached the portrait's bottom anchor from the CTA. */
  .hero-wrap{
    display:block !important;
    position:relative;
    min-height:0 !important;
    gap:0 !important;
    padding-top:94px !important;
    padding-bottom:26px !important;
  }

  /* NO z-index here. HANDOVER: the hero sets no z-index on any of its layers
     on purpose, so they stack by DOM order and the name clip's
     mix-blend-mode:multiply can blend into the hero backdrop. Adding one
     makes this div a stacking context, which isolates the blend and leaves
     the clip sitting in a visible grey rectangle. position:relative alone is
     safe — it is z-index that forms the context. */
  .hero-wrap > div:first-child{
    position:relative;
    display:flex; flex-direction:column;
    padding-bottom:0 !important;
  }

  /* eyebrow */
  .hero-wrap > div:first-child > div:nth-of-type(1){
    margin-bottom:10px !important; gap:9px !important;
  }
  .hero-wrap .ht{ font-size:clamp(34px, 11vw, 52px) !important; }

  /* The written-name clip: 196px instead of 319px. It is the element that was
     eating the most vertical room, and at 40/18 its height follows its width. */
  .name-media{
    width:196px !important; max-width:54% !important; margin-top:10px !important;
  }

  /* credentials — kept clear of the portrait column.
     margin-top clears the stamp clip's border ornament and ink splatter, which
     hang ~9% of the headline's width below its letters (115 of 1278 source px,
     HANDOVER §6.21). A % margin resolves against the column width, which is
     the headline's width here, so the gap scales with the ornament. */
  .hero-wrap > div:first-child > div:nth-of-type(2){
    font-size:11px !important; line-height:1.5 !important;
    max-width:56% !important; margin-top:9% !important;
  }

  /* CTA: one column, stacked, pinned to the bottom by auto margin.
     Each button is full width of the column, so the labels have room to sit on
     one line without the icon-shedding this needed when they shared a row. */
  .hero-wrap > div:first-child > div:nth-of-type(3){
    margin-top:auto !important; padding-top:20px;
    flex-direction:column !important; align-items:stretch !important;
    gap:10px !important; flex-wrap:nowrap !important;
  }
  .hero-wrap > div:first-child > div:nth-of-type(3) .btn{
    width:100%; justify-content:center;
    padding:14px 16px; font-size:14px; white-space:nowrap;
  }

  /* Portrait: out of the flow, bottom-right, sitting directly ABOVE the CTA.
     bottom:150px = 26px hero padding + ~110px stacked button column + 14px
     clearance. It is a measured offset, so if the button padding, font or
     count above changes, re-check it. pointer-events:none so the figure can
     never swallow a tap — it is the topmost layer and overlaps live text.
     It is topmost by DOM order alone: it is the last child and positioned, so
     it paints over the text column without needing a z-index (which would
     break the name clip's blend — see the note above). */
  .hero-wrap > div:last-child{
    position:absolute !important; right:-14px; bottom:150px;
    width:62% !important;
    justify-content:flex-end !important; align-items:flex-end !important;
    pointer-events:none;
  }
  /* NO mask-image here, and none on the wrapper either.
     A bottom fade was added on 2026-10-22 to soften the PNG's straight cut at
     his waist, and it drew a visible rectangle around the whole portrait: the
     mask promotes the element to its own composited layer, and the hero video
     behind it (opacity .22) rasterises differently inside those layer bounds,
     so the backdrop looks hazier within the image's box than outside it. The
     edge sits exactly on the img's border box.
     Isolated by elimination — the rectangle survived hiding both glow layers
     and removing the drop-shadow filter, and disappeared the moment the mask
     came off. Moving the mask to the parent div reproduces it. The straight
     bottom edge is the lesser problem; leave it alone. */
  .hero-wrap > div:last-child img{
    width:100% !important; max-width:100% !important;
  }
}

/* The one-screen hero, gated on there actually being a screen's worth of room.
   Below 620px tall (iPhone SE and friends) the hero's own content already
   fills the viewport, so forcing 100svh would only pin the portrait to a box
   taller than the text and drive it up through the credentials. Those screens
   get the same composition at natural height instead. */
@media (max-width: 860px) and (min-height: 620px){
  .hero-wrap{
    min-height:100vh !important;     /* fallback first */
    min-height:100svh !important;    /* svh: no jump when the URL bar hides */
  }
  .hero-wrap > div:first-child{
    min-height:calc(100vh - 120px);
    min-height:calc(100svh - 120px); /* 94px top + 26px bottom padding */
  }
}

/* The portrait's size is a HEIGHT problem, not a width one. Given enough
   vertical room it sits entirely BELOW the credentials and can be large
   (375x812: portrait top 448, credentials bottom 396 — clear). As the screen
   gets shorter the two slide alongside each other, and from then on the only
   thing keeping them apart is horizontal: the portrait has to be narrow
   enough that its box never reaches the credentials column.
   Three bands, measured rather than guessed — 620px was tried as a single
   threshold first and 375x667, one of the most common phones there is, still
   overlapped. */

/* 760px+ tall: room for the full composition — a large portrait sitting over
   the text, with the written-name clip pinned alongside his head.

   The portrait PNG is 460x538 (ratio 0.855) and its alpha was measured per
   tenth of its height: the top 40% (head and shoulders) is opaque only from
   31% of its width rightward, while the bottom 40% fills essentially the whole
   frame. That is what makes this layout possible at all — text may sit beside
   his head, but nothing may sit beside his crossed arms.

   So the name clip is anchored from the BOTTOM in vw, exactly as the portrait
   is, instead of flowing above it. Both then scale and move together and the
   clip stays level with his head at every screen size, which a flow margin
   could not do: portrait height is 0.8vw/0.855 = 0.936vw, and 62% down that
   from its own bottom is 0.58vw — hence `calc(120px + 58vw)`.
   (120px = the portrait's 150px bottom offset minus the text column's own 26px
   of hero padding, since the clip is positioned inside the text column.) */
@media (max-width: 860px) and (min-height: 760px){
  /* Capped at 340px. A bare percentage becomes 602px wide and 704px tall on a
     768px tablet, where the portrait's top edge climbs above the credentials
     and runs them behind his shoulder. The cap holds the tablet to the same
     physical size as a phone.
     78%, not 80%: the headline went up to 11vw on 2026-10-22 and pushed the
     credentials 7px into the portrait's crown at 360x800. The 2% buys ~17px
     of clearance there and is not perceptible in the composition. */
  .hero-wrap > div:last-child{ width:min(78%, 340px) !important; right:-18px; }

  .name-media{
    position:absolute; left:0;
    /* min() mirrors the portrait's own width cap above, so the clip tracks his
       head on a tablet exactly as it does on a phone: 0.62 x 340/0.855 = 247. */
    bottom:calc(120px + min(57vw, 247px));
    /* Sized against the measured alpha edge, not by eye, and deliberately run
       right up to it. The portrait is 80vw wide and opaque from 31% of that at
       head height, so his shoulder starts at 0.448vw + 18px from the left of
       the screen. The clip's INK occupies 4.7%-91% of its own box (measured
       from the source frame), so the box may run past his edge by that last
       9% without the strokes touching him.
       At 48vw the ink lands 2-3px short of his shoulder at 360, 375 and 390 —
       as close as it goes without collision. */
    width:min(49vw, 215px) !important;
    max-width:none !important;
    margin:0 !important;
  }

  /* The credentials now sit ABOVE the portrait's top edge rather than beside
     it, so they are free to run wider than the 56% the side-by-side bands need. */
  .hero-wrap > div:first-child > div:nth-of-type(2){ max-width:74% !important; }
}

/* Tablets: the portrait is capped at 340px and therefore sits much further
   right than on a phone, which would leave the clip stranded at the gutter
   ~315px away from him. Anchor it from the right instead so it stays beside
   his head there too. */
@media (min-width: 700px) and (max-width: 860px) and (min-height: 760px){
  .name-media{ left:auto; right:190px; width:215px !important; }
}

/* 620-759px tall: side by side. At 375x667 this puts the credentials' right
   edge at 187 and the portrait's left edge at 202. */
@media (max-width: 860px) and (min-height: 620px) and (max-height: 759px){
  .hero-wrap > div:last-child{ width:50% !important; right:-10px; }
  .hero-wrap > div:first-child > div:nth-of-type(2){ max-width:50% !important; }
  /* The name clip stays in flow in this band (there is no room to float it at
     head height), so it has to clear the portrait column too: at 54% it ran to
     201 against a portrait starting at 197. */
  .name-media{ max-width:48% !important; }
}

/* Under 620px tall. At 320x568: credentials right edge 166, portrait left 192. */
@media (max-width: 860px) and (max-height: 619px){
  .hero-wrap > div:last-child{ width:42% !important; right:-6px; }
  .hero-wrap > div:first-child > div:nth-of-type(2){
    max-width:52% !important; font-size:11.5px !important;
  }
  .hero-wrap .ht{ font-size:26px !important; }
  .name-media{ width:150px !important; max-width:48% !important; }
}
@media (max-width: 860px){
  /* Same intent as desktop — nothing behind the text, faint graphs only
     around the portrait. The headline runs the full phone width, so a plain
     left→right ramp would still put graphs behind its right end; anchor the
     fade on the portrait (bottom-right) instead. */
  #top .hero-video{
    opacity:.28;
    -webkit-mask-image:radial-gradient(85% 55% at 100% 72%, #000 0%, rgba(0,0,0,.35) 55%, transparent 100%);
            mask-image:radial-gradient(85% 55% at 100% 72%, #000 0%, rgba(0,0,0,.35) 55%, transparent 100%);
  }
}
@media (max-width: 480px){
  .hero-wrap{ padding-top:88px !important; }
}

/* ---- trust strip ------------------------------------------- */
/* Measured: the longest label ("Structured syllabus coverage") is 192px at
   13.5px, so one cell needs 192 + 36 padding + 22 icon + 11 gap = 261px, and
   four of them need 1044px of content — a 1124px viewport once .wrap's 40px
   gutters come off. Below that the row goes two-up instead of wrapping all
   four labels onto two cramped lines, which is what made it read as broken.
   The switch is at 1140px, four pixels of slack past the measurement. */
@media (min-width: 441px) and (max-width: 1140px){
  .featrow{ grid-template-columns:1fr 1fr !important; }
  .featrow > div{
    border-right:none !important;
    border-bottom:1px solid var(--line);
  }
  .featrow > div:nth-child(odd){ border-right:1px solid var(--line) !important; }
  .featrow > div:nth-last-child(-n+2){ border-bottom:none; }
}
/* Phones: ONE line. The four labels come to ~911px laid end to end at 13px,
   so they cannot all fit 375px of screen — keeping them on a single line means
   the line scrolls. A horizontal snap-scroller does that, and the right-edge
   mask is what tells the reader there is more to swipe to.
   This beats the 441-1140px two-up block below it on width, so phones get the
   scroller and tablets keep the two-column grid. */
@media (max-width: 720px){
  .featrow{
    display:flex !important;
    grid-template-columns:none !important;
    overflow-x:auto;
    scroll-snap-type:x proximity;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    -webkit-mask-image:linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
            mask-image:linear-gradient(90deg, #000 0, #000 88%, transparent 100%);
  }
  .featrow::-webkit-scrollbar{ display:none; }

  .featrow > div{
    flex:0 0 auto;
    scroll-snap-align:start;
    padding:15px 16px !important;
    border-bottom:none !important;
    border-right:1px solid var(--line) !important;
  }
  .featrow > div:last-child{ border-right:none !important; padding-right:28px !important; }
  .featrow > div span{ font-size:13px !important; white-space:nowrap; }
}
/* Single column. The two-up block above is bounded at min-width:441px on
   purpose: its :nth-last-child(-n+2) rule has a higher specificity than the
   plain `.featrow > div` below, so left unbounded it stripped the divider from
   the third item once the row was stacked. */
@media (max-width: 440px){
  .featrow{ grid-template-columns:1fr !important; }
  .featrow > div{
    border-right:none !important;
    border-bottom:1px solid var(--line);
  }
  .featrow > div:last-child{ border-bottom:none; }
}

/* ---- contact / CTA band ------------------------------------ */
@media (max-width: 820px){
  .cta-grid{
    grid-template-columns:1fr !important;
    gap:30px !important;
    padding:38px 26px !important;
  }
}
@media (max-width: 460px){
  .cta-grid{ padding:30px 18px !important; }
}

/* ---- footer ------------------------------------------------ */
@media (max-width: 820px){
  .footer-grid{ grid-template-columns:1fr 1fr !important; gap:30px !important; }
}
/* Phones. Stacking all four blocks in one column ran the footer to 872px —
   1.07 screens of pure footer. It keeps TWO columns instead: the brand and
   the sign-up block span the full width, and the two short link lists sit
   side by side, which is where most of the height was going. With the
   tightened spacing below this comes to ~590px.
   !important throughout: every padding and margin here is an inline style in
   index.html. */
@media (max-width: 520px){
  footer{ padding-top:36px !important; padding-bottom:22px !important; }

  .footer-grid{
    grid-template-columns:1fr 1fr !important;
    gap:24px 18px !important;
  }
  .footer-grid > div:nth-child(1),
  .footer-grid > div:nth-child(4){ grid-column:1 / -1; }

  /* brand block */
  .footer-grid > div:nth-child(1) p{
    font-size:12.5px !important; margin-top:12px !important; max-width:none !important;
  }
  .footer-grid > div:nth-child(1) > div:last-child{ margin-top:14px !important; }

  /* the two link lists */
  .footer-grid > div:nth-child(2) > div:first-child,
  .footer-grid > div:nth-child(3) > div:first-child,
  .footer-grid > div:nth-child(4) > div:first-child{ margin-bottom:10px !important; }
  .footer-grid > div:nth-child(2) > div:last-child,
  .footer-grid > div:nth-child(3) > div:last-child{ gap:7px !important; font-size:13px !important; }

  /* sign-up block: the button says "Register now", so the helper line above it
     is the one thing here that earns no height on a phone. */
  .footer-grid > div:nth-child(4) p{ display:none !important; }

  .footer-bar{
    flex-direction:column; align-items:flex-start; gap:4px;
    margin-top:22px !important; padding-top:16px !important; font-size:11.5px !important;
  }
}

/* ---- heading sizes on phones ------------------------------- */
@media (max-width: 640px){
  #register h2{ font-size:27px !important; }
  #videos h2{ font-size:25px !important; }
}

/* ---- tighter vertical rhythm on phones --------------------- */
/* The old `#gallery h2` and `#gallery{padding}` rules were removed on
   2026-10-22: #gallery is no longer a section, it is a block inside #videos
   with an h3, so the first rule matched nothing and the second would have
   padded the inner div. Its phone sizing now lives on .vid-gallery-title. */
@media (max-width: 640px){
  .vid-gallery-title{ font-size:22px !important; }
}

