/* =====================================================================
   RESPONSIVE — gutters and overflow containment.
   Shared by every page; load LAST, after surfaces.css.

   What was wrong
   --------------
   Content looked misaligned at the screen edges on phones. The gutters
   themselves were fine; the cause was horizontal overflow pushing the page
   wider than the viewport, so scrolling sideways left text out of line with
   the sticky header:

     - Three data tables (5, 3 and 4 columns) sat directly in the flow with
       no scroll container. width:100% does not stop a table from exceeding
       the viewport, since column content sets its minimum width.
     - Only index.html guarded overflow-x; the six project pages did not.
     - Only index.html had a global img{max-width:100%}.
     - Grid and flex children default to min-width:auto, so one long
       unbreakable string (a DOI, a URL) forces its track wider than the
       container.
     - The nav coordinate readout never collapsed, so back-link + coords +
       theme toggle competed for space on a 360px screen.

   Gutters were also inconsistent: 22px on index, 26px on project pages,
   fixed at every size. They now scale from one token.

   Specificity: each page's inline <style> loads after this file, so every
   rule here is one step higher (html .wrap beats .wrap, and so on).
   ===================================================================== */

:root{
  /* 24px on a small phone, easing out to 32px by ~580px wide */
  --gutter:clamp(24px,5.5vw,32px);
}

/* ---------- GUTTERS ---------------------------------------------------
   Only the horizontal padding is set, so each page keeps its own vertical
   rhythm (the hero and findings bands have bespoke top/bottom values).   */
html .wrap{
  padding-left:var(--gutter);
  padding-right:var(--gutter);
  width:100%;
}
html .hero .wrap,
html .findings .wrap{
  padding-left:var(--gutter);
  padding-right:var(--gutter);
}
/* index.html's mobile drop-down menu */
html .navlinks{
  padding-left:var(--gutter);
  padding-right:var(--gutter);
}

/* ---------- OVERFLOW CONTAINMENT --------------------------------------
   clip is preferred over hidden: it contains the overflow without making
   the body a scroll container, so the sticky header keeps working. Older
   engines fall back to hidden.                                           */
html body{
  overflow-x:hidden;
  overflow-x:clip;
}

/* Long strings wrap instead of widening their container. */
html body{overflow-wrap:break-word}

/* Media can never exceed its column. */
html img,
html svg,
html video,
html iframe{max-width:100%}

/* Grid and flex children shrink below their content width instead of
   forcing the track open. */
html .grid > *,
html .stats > *,
html .figures > *,
html .obj-grid > *,
html .find-grid > *,
html .spec-grid > *,
html .contact-grid > *,
html .pub{min-width:0}

/* ---------- WIDE TABLES ----------------------------------------------
   The table scrolls inside its own box rather than the page. */
.table-scroll{
  overflow-x:auto;
  -webkit-overflow-scrolling:touch;
  margin-top:26px;
  /* hint that there is more to the right */
  scrollbar-width:thin;
}
.table-scroll > .rtable{margin-top:0}
html .rtable{min-width:520px}
@media (min-width:760px){
  html .rtable{min-width:0}
}

/* ---------- SMALL SCREENS --------------------------------------------- */
@media (max-width:560px){
  /* Decorative readout; first thing to go when the bar gets tight. */
  html nav .coord{display:none}
  html .hero h1{overflow-wrap:break-word}
}
@media (max-width:400px){
  html .socials a,
  html .btn{font-size:12px}
}
