/* ===================================================================
   Lens + Linen — the site footer (template-parts/ll-footer.php)
   ===================================================================
   ONE stylesheet for the one footer partial, loaded wherever that partial
   renders: the standalone templates (homepage, content, downloads) and the
   pages rendered inside Astra (My Account, the support portal, the shop,
   404s, the privacy policy, SMS terms). See functions.php for the enqueue.

   These rules used to live in css/homepage.css under `.ll-homepage`, which
   is a body class only the standalone templates carry, so nothing here
   could reach an Astra page. They moved here unchanged in VALUE except for
   two colours (note 4); what changed is the scoping, and these additions:

   1. NO `.ll-homepage` PREFIX. Selectors are scoped by the footer's own
      class instead. The base rule is `footer.ll-footer` rather than a bare
      `.ll-footer` so that it keeps a type selector's weight against Astra's
      element rules; every descendant rule has the same specificity it had
      under `.ll-homepage` (two classes, plus an element where it had one).

   2. RESETS THE HOMEPAGE NEVER NEEDED, because homepage.css's own base
      block supplied them to every element on those pages. On an Astra page
      nothing does, and three things from other stylesheets reach the
      footer there (checked by reading the cascade, not by rendering it):
        - style.css's global `ul { list-style: disc; margin-left: 20px; }`,
          which would indent the link list and add bullets;
        - Astra's and account.css's link colours (`a`, and
          `body.woocommerce-account a` / `a:hover` / `a:focus`, which turn
          links navy, then gold), which is why the link colours below keep
          the `!important` they always had;
        - Astra's body font (Inter) and its line-height, where the footer
          wants Outfit at weight 300.
      On the homepage each reset restates what `.ll-homepage` already set,
      so it changes nothing there.

   3. A KEYBOARD FOCUS RING (`:focus-visible`), new on every page. The links
      are faint on navy, and without it a keyboard user's position was
      shown only by whatever outline the browser or Astra happened to draw.
      Mouse and touch users never see it.

   4. BRIGHTER LINKS AND COPYRIGHT, on every page, homepage included: white
      at 55% on the navy, 5.76:1, where the homepage had links at 35%
      (3.15:1) and the copyright line at 40% (3.69:1). WCAG AA for text this
      size is 4.5:1. This footer replaced the compliance strip on the Astra
      pages, whose Privacy Policy and SMS Terms links were bright on purpose
      (82%) because they are what A2P 10DLC reviewers look for, so keeping
      35% would have made those links fail AA where they used to pass. Hover
      and focus stay gold, 6.69:1. Gate's ruling on Bill's behalf
      LINK-CONTRAST B, 2026-11-16. Ratios computed with the WCAG relative-
      luminance formula over the alpha-blended colour; a lower alpha than
      0.5 (4.96:1) fails, so do not "match the old homepage" here.

   Colours and fonts read the --ll-* tokens where a page defines them
   (homepage.css and account.css both do, with the same values) and fall
   back to the same literal values where none does: the support portal,
   the shop and 404s load neither file.

   template-landing.php also has a <footer class="ll-footer">, with its own
   inline styles and a different design. This file is NOT loaded there
   (gate's ruling LANDING-FOOTER A, 2026-11-16), and it must not be: the
   base rule below would turn that cream footer navy.
=================================================================== */

footer.ll-footer {
  background: var(--ll-navy, #1A2236);
  /* 55%, not the 40% it had on the homepage: see note 4 above. */
  color: rgba(255,255,255,0.55);
  padding: 4rem 6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* Resets for Astra pages; see note 2 above. */
  margin: 0;
  font-family: var(--ll-sans, 'Outfit', sans-serif);
  font-weight: 300;
  line-height: 1.7;
  text-align: left;
}

.ll-footer *,
.ll-footer *::before,
.ll-footer *::after {
  box-sizing: border-box;
}

.ll-footer .footer-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.ll-footer .footer-logo-img {
  height: 24px;
  width: auto;
}

.ll-footer .footer-links {
  display: flex;
  /* NINE LINKS. Measured, because the earlier estimate here was wrong and it
     is what made the footer look jumbled: the row needs roughly 1020px on its
     own, and with the logo and the copyright beside it the three-column layout
     needs about 1560px of viewport before it stops overflowing. It was
     therefore wrapping on ordinary laptops, not just "between 768px and
     ~1200px" as this comment used to claim — and a wrapped row inside a
     space-between parent breaks ragged-left in the middle of the footer, which
     is the jumble. Above 1560px it fits and the classic row is kept; below it
     the footer stacks (see the 1560px block).

     TEN LINKS since the FAQ link was added after Pricing (2026-11-25), so the
     stacking query below moved to 1640px. That number is an ESTIMATE, not a
     measurement: "FAQ" at this size and tracking is roughly 30px, plus one
     1.75rem gap, so about 60px more than the measured 1560px, rounded up.
     Erring wide only stacks the footer in a slightly wider band, which is the
     safe direction. Re-measure on staging and correct it here. */
  flex-wrap: wrap;
  justify-content: center;
  /* Row gap first: a wrapped second line needs breathing room, and 2rem
     between columns was also part of why it did not fit. */
  gap: 0.85rem 1.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ll-footer .footer-links li { margin: 0; padding: 0; }
.ll-footer .footer-links li::before { display: none; }

.ll-footer .footer-links a {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  /* 55%, not the 35% it had on the homepage: see note 4 above. */
  color: rgba(255,255,255,0.55) !important;
  text-decoration: none !important;
  transition: color 0.3s;
}

.ll-footer .footer-links a:hover { color: var(--ll-gold, #C4A46C) !important; }

/* See note 3 above. */
.ll-footer a:focus-visible {
  outline: 1px solid var(--ll-gold, #C4A46C);
  outline-offset: 4px;
}
.ll-footer .footer-links a:focus-visible { color: var(--ll-gold, #C4A46C) !important; }

.ll-footer .footer-copy { font-size: 0.75rem; letter-spacing: 0.05em; }

/* Legal entity attribution — brighter again than the footer's 55% text,
   at 82% (11:1), so the Kalium LLC line that A2P 10DLC reviewers look for
   stands out on the navy footer as well as clearing WCAG AA. */
.ll-footer .footer-entity { color: rgba(255, 255, 255, 0.82); }

/* The footer's three groups stop fitting on one line well before 1200px --
   see the measurement on .footer-links. Stack them into centred rows rather
   than letting the link list wrap ragged between the logo and the copyright.

   1560px, NOT 1500px, and the difference is not cosmetic: the measurement it
   comes from says the row needs about 1560px, so a 1500px query left
   1501-1560px still in row mode and still wrapping. That band contains 1536px
   -- a 1920px screen at 125% scaling, which is an ordinary Windows laptop, not
   an edge case. The query and the number it is derived from have to be the
   same number.

   1640px since the tenth link (FAQ): an estimate, see .footer-links. */
@media (max-width: 1640px) {
  footer.ll-footer {
    flex-direction: column;
    gap: 1.75rem;
    text-align: center;
  }
}

@media (max-width: 1200px) {
  footer.ll-footer { padding: 3rem; }
}

/* ===================================================================
   THE FOOTER STAYS AT THE BOTTOM OF A SHORT PAGE
   ===================================================================
   Bill, 2026-11-16: "The footer should be stuck to the bottom even when the
   page content is not tall enough." Gate's ruling: a flex column on the page
   wrapper with a viewport-high minimum, never fixed positioning, so a long
   page scrolls exactly as before and only a short one changes. The content
   area takes the spare height (flex: 1 0 auto), which pushes the footer down.

   The minimum subtracts WordPress's admin bar where it shows (WordPress sets
   --wp-admin--admin-bar--height on <html> and pushes the page down by it), so
   a signed-in administrator does not get a needless scrollbar. 100dvh, the
   height a phone shows with its address bar, where the browser supports it,
   and 100vh elsewhere. The dvh line MUST stay inside @supports: a declaration
   containing var() is only validated at computed-value time, so a bare
   `min-height: calc(100dvh - var(...))` after the 100vh line would win the
   cascade in a browser without dvh, turn invalid there, and leave NO minimum
   at all rather than falling back to 100vh.

   Astra pages (body.ll-site-footer, added in functions.php): <body> holds the
   skip link and #page, and #page holds the header, #content and the footer.

   The standalone templates have no wrapper: the nav, <main> and the footer
   sit straight in <body>. Matched by the body classes they already print:
     - content (body.ll-content-page) and downloads (body.ll-downloads-body).
       Their nav, mobile drawer and the grain overlay are position: fixed, so
       they are not flex items. .ll-content-main's `margin: 0 auto` would let a
       flex item shrink to its content, so it gets width: 100%, which with its
       border-box sizing and max-width is the width it already had.
     - NOT the homepage: it is a long page of full-width sections (its hero
       alone is min-height: 100vh above 1024px), always taller than the
       screen, so the footer is never short of the bottom. Leaving it out
       keeps those sections out of a layout change that could buy it nothing.
     - NOT /welcome/ (template-landing.php): this file is not loaded there
       (LANDING-FOOTER A, above).
   What a flex column changes on a LONG page, and why it is nothing visible:
   a flex item keeps its children's top and bottom margins inside itself,
   where a block let them collapse through its edge. The standalone <main>s
   have vertical padding (or are flex already), so nothing collapsed through
   them. #content has no padding, but the neighbours a margin could collapse
   into — the header, and this footer (margin: 0, above) — add no margin of
   their own (none in Astra's CSS or this theme's, read 2026-11-16), so the
   gap is the same size either way. The only difference is that the gap is
   painted with #content's background instead of the body's: the same colour
   on the account pages (account.css) and the legal pages (legal.css), and
   this theme gives #content no background anywhere else. */
body.ll-site-footer #page,
body.ll-content-page,
body.ll-downloads-body {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--wp-admin--admin-bar--height, 0px));
}
@supports (height: 100dvh) {
  body.ll-site-footer #page,
  body.ll-content-page,
  body.ll-downloads-body {
    min-height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
  }
}
body.ll-site-footer #page > #content { flex: 1 0 auto; }
body.ll-content-page > .ll-content-main { flex: 1 0 auto; width: 100%; }
body.ll-downloads-body > .ll-downloads-main { flex: 1 0 auto; }

/* ===================================================================
   AT LEAST 60PX BETWEEN THE CONTENT AND THE FOOTER (Astra pages)
   ===================================================================
   Bill, 2026-11-16: "there needs to be more spacing between the footer and
   the content above. It looks like maybe 20px or so, I think we should bump
   it up to 60". Gate's ruling: on every Astra page that shows this footer,
   at least 60px, desktop and phone; exactly 60px on a long page; and on a
   short page the footer still sits at the bottom of the screen (the block
   above), with at least 60px above it. The standalone templates keep their
   spacing.

   WHERE THE ~20PX CAME FROM (read 2026-11-16 from the stylesheets and pages
   staging serves, worked through the cascade, not rendered). The gap is
   whatever the page content ends with:
     - My Account, signed in (every section): the page's content is one
       full-width Spectra/UAGB container, and its generated stylesheet
       (uploads/uag-plugin/assets/0/uag-css-11.css) gives that block
       `padding-bottom: 20px` at every width. After it comes an empty
       <p class="wp-block-paragraph">, the last element in .entry-content,
       so Astra's `.entry-content>:last-child { margin-bottom: 0 }` (0,2,0)
       beats both `.entry-content p` margins (0,1,1): it adds nothing.
       Astra's plain, no-sidebar layout gives #primary no margin here. So
       20px: Bill's figure.
     - the standalone support portal (signed out): about 26px, the last
       paragraph's `.entry-content p` margin (1.6em).
     - a 404: Astra's `.ast-404-layout-1` margin (4em) PLUS #primary's own:
       the 404 does not get the plain-layout override, so #primary keeps
       `margin: 4em 0` at 977px and up and `padding: 1.5em 0` below.
     - the shop: about 56px (49px on a phone), WooCommerce's last-row
       product margin (2.5em, kept inside the product grid) plus the list's
       own 1em.
     - already well over 60px, and left alone: the legal pages (about 114px,
       82px on a phone: .ll-legal-doc's 6rem/4rem of padding plus the last
       paragraph's 1.1rem) and the signed-out sign-in and password screens
       (.ll-signin's 72px, 128px on desktop, plus the 20px).

   So the rules below RAISE each short gap to exactly 60px rather than adding
   60px to every page, which would have doubled the space under the legal
   pages. Everything sits inside #content, the flex item that grows on a
   short page, so the sticky footer's push adds to it rather than replacing
   it: never less than 60px on a short page.

   1. My Account, signed in: the container's 20px becomes 60px. Beats the
      generated (0,2,0) rule, which has no !important. Not the password
      page, which draws .ll-signin and already has more, nor the signed-out
      pages. The trailing empty paragraph's margin is also zeroed here,
      although Astra's :last-child rule already does it, so that an edit
      to the page that puts something after it cannot quietly add 16px. */
body.ll-site-footer.woocommerce-account.logged-in:not(.woocommerce-lost-password) .entry-content > .wp-block-uagb-container.uagb-is-root-container {
  padding-bottom: 60px;
}
body.ll-site-footer.woocommerce-account.logged-in:not(.woocommerce-lost-password) .entry-content > p.wp-block-paragraph:empty {
  margin-bottom: 0;
}

/* 2. Every other Astra page with .entry-content, except the legal pages
      and My Account: a 60px top margin on Astra's own
      `.entry-content::after` (display: table; clear: both), which closes
      the content. A table box's margins never collapse THROUGH it (it
      starts a new formatting context), so a minimum placed anywhere below
      it would add to the content's trailing margin. Its OWN top margin
      does collapse with the bottom margin of the content before it, to the
      larger of the two: a minimum, not an extra. So the support portal's
      26px becomes exactly 60px, and so does any page that ends in a margin
      smaller than 60. A page that ends in more keeps its own.
      (Only margin-top is added; Astra's display, clear and content stand.) */
body.ll-site-footer:not(.woocommerce-account):not(.page-template-template-privacy-policy):not(.page-template-template-sms-terms) .entry-content::after {
  margin-top: 60px;
}

/* 3. The 404, which has no .entry-content: the layout's own bottom margin
      becomes 60px, and #primary's bottom margin (977px and up) and bottom
      padding (below) go, so nothing adds to it. Exactly 60px at every
      width: the layout's trailing children end at 0 (`.page-content >
      :last-child`), and #content contains the margin either way (#primary
      is a flex item at 977px and up, a plain block below). Beats Astra's
      `.ast-404-layout-1` (0,1,0), `#primary` (1,0,0) and the inline
      `#primary,#secondary` padding (1,0,0). */
body.ll-site-footer.error404 .ast-404-layout-1 {
  margin-bottom: 60px;
}
body.ll-site-footer.error404 #primary {
  margin-bottom: 0;
  padding-bottom: 0;
}

/* 4. The shop and the product category and tag archives, which also have
      no .entry-content and end with the product list. The last row's
      2.5em margin sits inside the list (a CSS grid, whose items' margins
      never collapse out), so the list's own bottom margin tops it up to
      60px: calc(60px - 2.5em). No rule sets a font size on the list or
      its items, so the two ems are the same. The last product's button
      keeps its own 0.5em below it inside the item, so the space under the
      button is about 60px plus that half-em (about 7px): close to 60 on
      a page none of the site's journeys use. Beats Astra's WooCommerce
      `.woocommerce-js ul.products` (0,2,1). */
body.ll-site-footer.woocommerce-shop ul.products,
body.ll-site-footer.tax-product_cat ul.products,
body.ll-site-footer.tax-product_tag ul.products {
  margin-bottom: calc(60px - 2.5em);
}

body.ll-site-footer #page > footer.ll-footer,
body.ll-content-page > footer.ll-footer,
body.ll-downloads-body > footer.ll-footer { flex-shrink: 0; }

/* Phones: one link per row. */
@media (max-width: 768px) {
  footer.ll-footer { flex-direction: column; gap: 1.5rem; text-align: center; }
  .ll-footer .footer-links {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: center;
  }
  .ll-footer .footer-links li { display: block; }
}
