/* ==========================================================================
   Site footer (src/partials/footer.html). Two tiers, the calm end of every page:
   1. the sheet   a full-bleed aqua field (a clear change of tone after whatever the page ends on: canvas, a ruled
                  grid, a photo band or a night band) with rounded bottom corners over the night: a closing statement
                  in the display serif, the appointment row, then the brand and four link columns.
   2. the night   the MDC mark at the full container width, uncovered by the scan line, its dot lit; the
                  disclaimer and copyright under it.
   Column lines follow the card grids above (one container, --grid-gap):
     >= 1101   12 tracks. Brand 1-4; Visit 5, Services 7, Outside 9, Account 11 (2 tracks each), so Visit starts on
               column 2 of any 3-column grid, Services on column 2 of any 2-column grid, Outside on column 3.
     641-1100  4 tracks under the brand: Services starts on column 2 of the 2-column grids used there.
     <= 640    2 columns: Visit | Services, Outside | Account.
   ========================================================================== */
.site-footer {
  --footer-field: var(--mist);
  background: var(--night);   /* the night tucks under the sheet's rounded bottom corners */
}

/* ---------- 1. The sheet ---------- */
.footer-sheet {
  --card-bg: var(--surface);
  --card-badge: var(--tint);
  position: relative; z-index: var(--z-base);
  padding: var(--section-y) var(--gutter) var(--space-12);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  background: var(--footer-field);
  color: var(--ink);
}

.footer-lead {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--grid-gap);
  align-items: end;
}
.footer-statement {
  grid-column: 1 / span 8;
  max-width: 17ch;
  font-family: var(--font-display);
  font-weight: var(--fw-display);
  font-size: var(--fs-display-2);
  line-height: 1.04;
  letter-spacing: var(--tracking-display-2);
  text-wrap: balance;
}
.footer-statement em { font-style: italic; color: var(--accent-em); }
.footer-visit { grid-column: 9 / -1; }
.footer-visit .thumb { --thumb-pos: 62% 30%; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-9) var(--grid-gap);
  margin-top: var(--space-12);
  padding-top: var(--space-9);
  border-top: 1px solid var(--line-2);
}
.footer-brand { grid-column: 1 / span 4; }
.footer-col:nth-of-type(1) { grid-column: 5 / span 2; }
.footer-col:nth-of-type(2) { grid-column: 7 / span 2; }
.footer-col:nth-of-type(3) { grid-column: 9 / span 2; }
.footer-col:nth-of-type(4) { grid-column: 11 / span 2; }

.footer-logo { display: inline-flex; min-height: 44px; align-items: center; }
.footer-logo img { width: 76px; height: 40px; }
.footer-brand p {
  margin-top: var(--space-4);
  font-size: var(--fs-card);
  line-height: 1.5;
  color: var(--ink);
}
.footer-brand p span { display: block; color: var(--ink-3); }

.footer-label {
  font-family: var(--font-sans);
  font-size: var(--fs-small);
  font-weight: var(--fw-ui);
  line-height: 1.3;
  letter-spacing: 0;
  color: var(--ink);
  margin-bottom: var(--space-2);
}
.footer-col ul { list-style: none; }
/* each link is a 44px target (its 1.5 line plus equal padding above and below); a link that has to wrap keeps its arrow
   on the last word */
.footer-col a {
  position: relative;
  display: inline-block;
  padding-block: calc((44px - 1.5em) / 2);
  font-size: var(--fs-card);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: balance;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  text-decoration-color: transparent;
  transition: color var(--dur-2) var(--ease-out), text-decoration-color var(--dur-2) var(--ease-out);
}
/* external: the same drawn arrow as .link, glued to the last word with a word joiner */
.footer-col a.is-ext::after {
  content: "\2060";
  padding-left: 0.72em;
  margin-left: 0.2em;
  background-color: var(--ink-3);
  -webkit-mask: var(--icon-external) no-repeat 100% 58% / 0.66em 0.66em;
  mask: var(--icon-external) no-repeat 100% 58% / 0.66em 0.66em;
  transition: -webkit-mask-position var(--dur-2) var(--ease-spring), mask-position var(--dur-2) var(--ease-spring), background-color var(--dur-2) var(--ease-out);
}
@media (hover: hover) {
  .footer-col a:hover { color: var(--teal-700); text-decoration-color: currentColor; }
  .footer-col a.is-ext:hover::after { background-color: currentColor; -webkit-mask-position: 100% 30%; mask-position: 100% 30%; }
}
.footer-col a:focus-visible { color: var(--teal-700); }

/* the page you are on: teal, with a lit lens dot in the gutter before it (the text keeps the column edge) */
:is([data-page="index"] .footer-col a[href="index.html"],
    [data-page="scan"] .footer-col a[href="scan.html"],
    [data-page="services"] .footer-col a[href="services.html"],
    [data-page="products"] .footer-col a[href="products.html"],
    [data-page="patients"] .footer-col a[href="patients.html"],
    [data-page="wellness"] .footer-col a[href="wellness.html"]) { color: var(--teal-700); }
:is([data-page="index"] .footer-col a[href="index.html"],
    [data-page="scan"] .footer-col a[href="scan.html"],
    [data-page="services"] .footer-col a[href="services.html"],
    [data-page="products"] .footer-col a[href="products.html"],
    [data-page="patients"] .footer-col a[href="patients.html"],
    [data-page="wellness"] .footer-col a[href="wellness.html"])::after {
  content: "";
  position: absolute; left: calc(var(--space-3) * -1); top: 50%;
  width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: var(--teal-500);
  box-shadow: var(--halo);
}

/* ---------- 2. The night ---------- */
.footer-night {
  padding: var(--space-12) var(--gutter) var(--space-7);
  color: var(--on-night-2);
}
.footer-mark {
  position: relative;
  isolation: isolate;
}
.footer-mark svg { position: relative; display: block; width: 100%; height: auto; overflow: visible; }
.footer-mark .ft-stop-a { stop-color: color-mix(in srgb, var(--on-night) 11%, transparent); }
.footer-mark .ft-stop-b { stop-color: color-mix(in srgb, var(--on-night) 0%, transparent); }
.footer-mark-letters {   /* fill: the #ft-mark-fill gradient, set on the path itself so it never resolves against this file's URL */
  stroke: color-mix(in srgb, var(--on-night) 30%, transparent);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
/* the dot of the mark becomes the lens (the eyebrow's scan target): a lit ring round a point */
.footer-mark-ring { fill: color-mix(in srgb, var(--teal-400) 10%, transparent); stroke: var(--teal-400); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.footer-mark-dot { fill: var(--teal-400); }
/* the scan runs a little quicker here than on a photo: it is a 30px-tall line on a quiet mark */
html.js .footer-mark[data-reveal="scan"]:not(.is-done) { --reveal-dur: 900ms; }
/* the dot's light: centred on the dot (55.3, 9 in the 78.4 x 31.8 box that starts at 2, 4) */
.footer-mark-glow {
  position: absolute; z-index: -1;
  left: 68.24%; top: 15.72%;
  width: 34%; aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--glow-teal);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .footer-mark-glow { animation: footer-breathe 5.6s var(--ease-in-out) infinite alternate; }
}
@keyframes footer-breathe {
  from { opacity: 0.55; scale: 0.86; }
  to { opacity: 1; scale: 1.06; }
}

.footer-legal {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--space-3) var(--space-8);
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line-night);
  font-size: var(--fs-small);
  line-height: 1.55;
}
.footer-note { max-width: 70ch; }
.footer-copy { display: flex; align-items: center; gap: var(--space-2) var(--space-7); flex-wrap: wrap; color: var(--on-night); }
.footer-top {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px;
  color: var(--on-night-2);
  transition: color var(--dur-2) var(--ease-out);
}
.footer-top .icon-arrow { transition: transform var(--dur-3) var(--ease-spring); }
@media (hover: hover) {
  .footer-top:hover { color: var(--on-night); }
  .footer-top:hover .icon-arrow { transform: translateY(-3px); }
}
.footer-top:focus-visible .icon-arrow { transform: translateY(-3px); }

/* ---------- Responsive ---------- */
/* 1101-1279: the same 12 tracks, narrower. The appointment row takes one more track and the links step down to 14px,
   so "SA Nursing Council" and "Book an appointment" still sit on one line in a 2-track column */
@media (min-width: 1101px) and (max-width: 1279px) {
  .footer-statement { grid-column: 1 / span 7; }
  .footer-visit { grid-column: 8 / -1; }
  .footer-col a { font-size: var(--fs-small); }
}
@media (max-width: 1100px) {
  .footer-lead { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-8); }
  .footer-statement { grid-column: 1 / -1; }
  .footer-visit { grid-column: 1; }
  .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-brand { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--space-5); }
  .footer-brand p { margin-top: 0; }
  .footer-col:nth-of-type(n) { grid-column: auto / span 1; }
}
@media (max-width: 980px) {
  .footer-sheet { padding-bottom: var(--space-10); }
  .footer-visit { grid-column: 1 / -1; justify-self: start; width: min(100%, 24rem); }
  .footer-grid { margin-top: var(--space-10); padding-top: var(--space-8); }
}
@media (max-width: 640px) {
  /* no gutter room for the lens dot on a phone: it follows the word instead */
  :is([data-page="index"] .footer-col a[href="index.html"],
      [data-page="scan"] .footer-col a[href="scan.html"],
      [data-page="services"] .footer-col a[href="services.html"],
      [data-page="products"] .footer-col a[href="products.html"],
      [data-page="patients"] .footer-col a[href="patients.html"],
      [data-page="wellness"] .footer-col a[href="wellness.html"])::after { position: static; display: inline-block; vertical-align: middle; margin: -3px 0 0 var(--space-3); }
  .footer-lead { grid-template-columns: minmax(0, 1fr); row-gap: var(--space-7); }
  .footer-visit { width: 100%; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: var(--space-8); }
  .footer-col:nth-of-type(n) { grid-column: auto; }
  .footer-night { padding-top: var(--space-10); }
  .footer-legal { margin-top: var(--space-8); }
}
