/* punto-final — the closing, the pill and the ink band that ends the page.
   Base rules here apply with or without JS (the band, the pill's one-line fit,
   its press and focus shape). Rules that only make sense while the script runs are
   gated by html.fx-final. The rolling clock digits are sistema's odometer (sistema.css). */

/* ---------- Closing: the band sits flush with the page's last pixel ---------- */
.closing { padding-bottom: 0; }

/* ---------- Pill ---------- */
.closing .magnetic {
  max-width: 100%;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--t-micro) var(--ease-react),
    color var(--t-micro) var(--ease-react),
    scale var(--t-micro) var(--ease-react);
}

/* Never truncated: the address wraps only when it cannot fit (WCAG 1.4.10 / 1.4.12). */
.closing .magnetic span {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The global a:focus-visible radius would square the pill: keep it round. */
.closing .magnetic:focus-visible {
  border-radius: 999px;
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

.closing .magnetic:active { scale: 0.98; }

@media (max-width: 719px) {
  /* One line at 17px from 375px up; narrower screens scale down instead of clipping. */
  .closing .magnetic {
    font-size: min(17px, 4.5vw);
    gap: 10px;
    padding-inline: clamp(18px, 5.6vw, 22px);
  }
}

/* ---------- Ink band ---------- */
.closing-bar[data-surface="ink"] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: baseline;
  gap: 12px 24px;
  margin-inline: calc(var(--gutter) * -1);
  margin-bottom: 0;
  padding: 20px var(--gutter);
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: #0C1821;
  color: var(--band-fg);
  font-size: 15px;
  line-height: 1.2;
}

.closing-bar .sign {
  justify-self: start;
  white-space: nowrap;
}

.closing-bar .clock {
  justify-self: center;
  white-space: nowrap;
  font-weight: 500;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.closing-bar .links {
  justify-self: end;
  display: flex;
  gap: 24px;
}

/* White links; a 26px tall hit area without changing the row's rhythm. */
.closing-bar a {
  color: var(--white);
  padding-block: 4px;
  margin-block: -4px;
}

@media (max-width: 719px) {
  /* Two deliberate lines: the sign and the live clock (both short, fixed width), then the
     links, which have the whole line and may wrap (three links no longer fit beside the
     sign on a phone). --band-h in styles.css counts these two rows. */
  .closing-bar[data-surface="ink"] {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "sign clock"
      "links links";
    gap: 10px 16px;
  }
  .closing-bar .sign { grid-area: sign; }
  .closing-bar .clock { grid-area: clock; justify-self: end; }
  .closing-bar .links {
    grid-area: links;
    justify-self: start;
    flex-wrap: wrap;
    gap: 8px 20px;
  }
}

/* ---------- Releases ---------- */
@media (prefers-reduced-motion: reduce) {
  .closing .magnetic:active { scale: none; }
  html.fx-final .closing .magnetic { transform: none !important; }
  html.fx-final .closing h2 .dot-scrub,
  html.fx-final .closing h2 .dot-turn { transform: none !important; }
}

@media (forced-colors: active) {
  .closing-bar[data-surface="ink"] { border-top: 1px solid CanvasText; }
}

@media print {
  html.fx-final .closing .magnetic { transform: none !important; }
}
