/* The footer, and only the footer.

   One file because there is one footer. It used to live in theme.css, which
   the twenty-two generated pages load and the six section studies do not, so
   the studies had no footer at all or a hand-built one of their own. Both the
   generated pages and the studies now link this, and build/studies.mjs puts
   the same markup on the studies, so there is a single source for both halves.

   Every value is LITERAL, and deliberately so. The first version of this file
   read the site tokens with fallbacks, on the theory that a generated page
   would supply them and a study would fall back. It does not work: the studies
   define --film and --gold too, with their own meanings, so the footer came out
   with a transparent ground and near-black headings on all six of them. A
   token that exists but means something else never reaches its fallback.

   The footer is the film ground on every page of the site, in both themes,
   which is what makes literals the right answer rather than a shortcut: there
   is nothing here that should ever follow the page it is sitting on. */

.foot {
  --f-film:      #0d0b08;
  --f-bone:      #f6eee1;
  --f-bone-soft: #d6cbb8;
  --f-gold:      #cba64e;
  --f-gold-ink:  #1a1409;
  --f-wrap:      74rem;
  --f-gut:       clamp(1.25rem, 4vw, 3.5rem);
  --f-serif:     Georgia, "Noto Serif", "Droid Serif", "Times New Roman", serif;
  --f-sans:      "Public Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-family: var(--f-sans);
}

.foot { background: var(--f-film); color: var(--f-bone); padding: clamp(3rem, 8vh, 5rem) var(--f-gut) 2rem; }
.foot__wrap { width: min(100%, var(--f-wrap)); margin-inline: auto;
  display: grid; gap: clamp(1.6rem, 4vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  /* Every item sits at the top of its row rather than stretching to the
     tallest one in it. Stretching cost nothing visible in itself, since these
     boxes have no ground of their own, but it is what put 227px of empty box
     under the brand and 220 under the Ecosystem list, and it is why the
     newsletter began a screen below the block it belongs to. At every width,
     not just the wide one. */
  align-items: start; }
/* ── how the footer arranges itself ────────────────────────────────────────

   ONE PRINCIPLE AT EVERY WIDTH ABOVE A SINGLE COLUMN: the tall list owns a
   column, and the short blocks stack beside it.

   The Summit list carries ten links against the Ecosystem's four and Take
   part's six, so it is about twice the height of anything else down here, and
   any row it shares is as tall as it is. That is where the empty space came
   from. Not from stretching, which `align-items: start` already stops, but
   from a short block sitting in a row whose height a ten-link list had decided.

   Measured on /summit/registration/ before this rule: at 900px the footer was
   813px tall with a 203px hole under the brand, and every width from 480 to
   1023 had one. The four-column band below was written first and fixed only
   its own band, which left the hole in the widths most of a phone-and-tablet
   audience is actually in.

   Three explicit bands, ascending, each one COMPLETE: every band restates the
   placement of all five children rather than inheriting half of it from the
   band below. That is deliberate. Written as a min/max pair the bands leave a
   sub-pixel width belonging to neither, and written as ascending min-widths
   that only state what changes, the four-column band silently kept the three
   column band's column numbers. Restating is the only version that cannot
   half-apply.

   Placement is by `nav.foot__col:nth-of-type()`, which is safe here and only
   here: every footer on the site is the same five children in the same order,
   brand, three navs, newsletter, verified across all 28 pages, and the three
   navs are the only <nav> elements in the wrap, so the count cannot drift onto
   the brand or onto the form. Add a fourth list, or reorder them, and these
   three blocks are what has to be re-derived.

   The trade this accepts: visual order and DOM order diverge, because the
   newsletter is fifth in the markup and sits second in the first column. That
   was already true of the four-column layout. It is tolerable because each
   list is a <nav> carrying its own aria-label, so a screen reader arrives by
   landmark rather than by position, and because no single group is ever split
   across two columns.

   There is no `grid-column: span 2` on the brand any more. It used to be the
   base rule, and on a phone, where `auto-fit` has room for ONE 12rem track, a
   span of 2 into a one-track grid does not clamp: it invents an implicit
   `auto` track sized by whatever lands in it. On /summit/ and
   /summit/abstracts/ that came out 51px over, the footer overflowed, and
   Chrome widened the LAYOUT viewport to 406px on a 375px screen. Every fixed
   element then sized itself to 406: the bar, the scrim, the abstracts toolbar,
   and the drawer, whose close control ended up 11px off the side of the
   screen. A footer grid was moving the menu. The bands below place the brand
   in a real column at every width that has more than one, and below 28rem the
   grid is a single track and nothing spans anything, so the case cannot
   return. Do not reintroduce it. */

/* one column below 28rem: the bare `auto-fit` rule above, untouched */

/* two columns · brand and Summit lead, newsletter comes to rest beside Take
   part instead of alone on a row of its own

     brand      | Summit
     Ecosystem  |   "
     Take part  | news

   Reading down the left and then the right keeps the tab order walking
   forward: brand, Summit, Ecosystem, Take part, newsletter is the DOM order
   and no item sits above the one before it. */
@media (min-width: 28rem) {
  .foot__wrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot__brand              { grid-column: 1; grid-row: 1; }
  .foot__col:nth-of-type(1) { grid-column: 2; grid-row: 1 / span 2; }
  .foot__col:nth-of-type(2) { grid-column: 1; grid-row: 2; }
  .foot__col:nth-of-type(3) { grid-column: 1; grid-row: 3; }
  .foot__news               { grid-column: 2; grid-row: 3; }
}

/* three columns · the fourth column's content folds under the third and
   nothing else moves, so it reads the way it did one breakpoint wider

     brand | Summit | Ecosystem
     news  |   "    | Take part

   42rem is where three tracks genuinely fit: three 12rem tracks and two 4vw
   gaps against a viewport less two 4vw gutters leaves about 187px a track at
   672px, and the longest link in the footer, "Travel & Accommodation", sets
   at about 160. */
@media (min-width: 42rem) {
  .foot__wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .foot__brand              { grid-column: 1; grid-row: 1; }
  .foot__news               { grid-column: 1; grid-row: 2; }
  .foot__col:nth-of-type(1) { grid-column: 2; grid-row: 1 / span 2; }
  .foot__col:nth-of-type(2) { grid-column: 3; grid-row: 1; }
  .foot__col:nth-of-type(3) { grid-column: 3; grid-row: 2; }
}

/* four columns · the brand block gets the wide track it was drawn for

     brand | Summit | Ecosystem | Take part
     news  |   "    |     "     |     "

   64rem, not 60: four 12rem tracks plus three 3rem gaps need 912px of content,
   and the footer's own gutter is 4vw either side, so four columns do not
   actually fit until about 991px. */
@media (min-width: 64rem) {
  .foot__wrap { grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); }
  .foot__brand              { grid-column: 1; grid-row: 1; }
  .foot__news               { grid-column: 1; grid-row: 2; }
  .foot__col:nth-of-type(1) { grid-column: 2; grid-row: 1 / span 2; }
  .foot__col:nth-of-type(2) { grid-column: 3; grid-row: 1 / span 2; }
  .foot__col:nth-of-type(3) { grid-column: 4; grid-row: 1 / span 2; }
}

/* The supplied PNG has transparent canvas to the left of the crest. Its image
   box aligns with the copy, but the visible artwork otherwise begins about
   6.75% too far right. Offset it without `transform`: transformed footer
   content destabilises ScrollCraft's mobile scroll geometry. The percentage
   tracks fluid logos, while the fixed cap matches the 20rem maximum width. */
.foot__logo {
  display: block;
  position: relative;
  left: max(-1.35rem, -6.75%);
  width: min(100%, 20rem);
  min-width: 15rem;
  height: auto;
}
.foot__org, .foot__when { font-size: .86rem; color: var(--f-bone-soft); margin-top: .4rem; }
.foot h2 { font-size: .72rem; letter-spacing: .17em; text-transform: uppercase; font-weight: 600; color: var(--f-gold); margin-bottom: .7rem; }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.foot a { font-size: .92rem; color: rgba(246,238,225,.82); text-decoration: none; }
.foot a:hover { color: var(--f-bone); text-decoration: underline; text-underline-offset: .25em; }
.foot__news label { margin-bottom: 0; }
.foot__legal { width: min(100%, var(--f-wrap)); margin: clamp(2rem, 5vh, 3.2rem) auto 0;
  border-top: 1px solid rgba(246,238,225,.16); padding-top: 1.2rem;
  font-size: .8rem; color: var(--f-bone-soft); }
.foot input { background: rgba(246,238,225,.06); border-color: rgba(246,238,225,.28); color: var(--f-bone); }
.foot input::placeholder { color: rgba(214,203,184,.6); }
.foot :focus-visible { outline-color: var(--f-gold); }
.foot__legal-links { display: inline-block; margin-left: .6rem; }
.foot__legal-links a { font-size: inherit; margin-right: .8rem; text-decoration: underline; text-underline-offset: .25em; }

/* The way back to the consent choice, in the legal line under the columns.
   js/consent.js appends this button to .foot__legal-links on every page. It
   was styled in theme.css, which the six studies do not load, so on those six
   it rendered as a grey UA button with an outset border in the middle of a
   sentence. It is a footer element, so it lives with the footer; `inherit`
   reaches .foot__legal above, which this file also sets. */
.foot__cookie {
  appearance: none; -webkit-appearance: none;
  border: 0; padding: 0; background: none; color: inherit;
  font: inherit; text-decoration: underline; text-underline-offset: .25em;
  cursor: pointer;
}

/* The form the footer carries. On a generated page theme.css already styles
   .btn--gold and .field; a study has neither, so both are restated here
   scoped under .foot, where they cannot reach anything else on the page. */
.foot .field { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.foot .field input { flex: 1 1 12rem; min-width: 0; }
/* js/forms.js inserts a validation message immediately after the input it
   belongs to, which in this flex row lands BETWEEN the input and the button and
   pushes the button onto a third line. Giving the message a whole line of its
   own and ordering it last keeps the input and its button together. Seen on
   every page, because this sign-up rides the footer. */
.foot .field .field__msg { flex: 1 0 100%; order: 1; margin-top: 0; }
.foot label { display: block; font-family: var(--f-sans); font-size: .78rem;
  letter-spacing: .14em; text-transform: uppercase; font-weight: 600;
  color: var(--f-bone-soft); margin-bottom: .45rem; }
.foot input {
  font: inherit; font-size: .92rem; padding: .7em .9em; border-radius: .4rem;
  border: 1px solid rgba(246,238,225,.28);
}
.foot .btn--gold {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-sans); font-size: .92rem; font-weight: 600; line-height: 1;
  padding: .8em 1.4em; border-radius: 999px; border: 1px solid transparent;
  background: linear-gradient(180deg, #d8ad52, #b7862f); color: var(--f-gold-ink);
  text-decoration: none; cursor: pointer;
}
.foot .btn--gold:hover { background: linear-gradient(180deg, #e2b95f, #c08f34); }
.foot .field__msg { font-size: .82rem; margin-top: .5rem; color: var(--f-bone-soft); }
.foot .field__msg[data-ok]  { color: var(--f-gold); }
.foot .field__msg[data-bad] { color: #f0b8a0; }
.foot .field__msg a { color: var(--f-gold); }
