/* Ace Countertops Design Studio — application styles.
 *
 * Tokens come from the shared theme kit (brand/ace.css). Nothing here invents a
 * color, a spacing step or a duration.
 *
 * RESPONSIVE CONTRACT — every component below declares its behaviour at all six
 * breakpoints. The primary targets are md (tablet portrait) and lg (tablet
 * landscape): a rep standing in someone's kitchen holding an iPad.
 *
 *   xs   320   phone portrait      single column, bottom bar, tray collapses to a strip
 *   sm   480   phone landscape     2-up grid
 *   md   768   tablet portrait     3-up grid, bottom bar, tray as a sheet
 *   lg  1024   tablet landscape    rail appears, 4-up grid, tray docks right
 *   xl  1280   laptop              5-up grid
 *   2xl 1600   showroom display    6-up grid, wider reading measure
 *
 * Components size themselves off their CONTAINER, not the viewport, wherever a
 * component appears in more than one slot — that is what lets a surface card
 * work in a 6-up grid, a 10-up compare wall and a full-bleed detail pane
 * without a second implementation.
 */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--ace-color-ink-900);
  color: var(--ace-color-paper-100);
  font-family: var(--ace-font-sans);
  font-size: var(--ace-font-size-base);
  line-height: var(--ace-line-height-body);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  line-height: var(--ace-line-height-tight);
  letter-spacing: var(--ace-letter-spacing-heading);
  font-weight: var(--ace-font-weight-bold);
  margin: 0 0 var(--ace-space-3);
}

a { color: var(--ace-color-gold-200); text-decoration: none; }
a:hover { color: var(--ace-color-gold-100); }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--ace-color-gold-200);
  outline-offset: 2px;
  border-radius: var(--ace-radius-sm);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: var(--ace-z-skip);
  background: var(--ace-color-ink-700); padding: var(--ace-space-3) var(--ace-space-4);
  border-radius: var(--ace-radius-md);
}
.skip:focus { left: var(--ace-space-3); top: var(--ace-space-3); }

/* ── app frame ─────────────────────────────────────────────────────────────
   Grid areas rather than absolute positioning so the rail can appear at lg
   without any component knowing it happened. */

.app {
  display: grid;
  min-height: 100dvh;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "topbar"
    "main"
    "rail";
}

/* lg+: the rail moves to the side and becomes permanent. */
@media (min-width: 1024px) {
  .app {
    grid-template-columns: var(--ace-layout-rail) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "rail topbar"
      "rail main";
  }
}

/* ── topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  grid-area: topbar;
  position: sticky; top: 0; z-index: var(--ace-z-sticky);
  display: flex; align-items: center; gap: var(--ace-space-3);
  padding: var(--ace-space-3) var(--ace-space-4);
  padding-top: max(var(--ace-space-3), env(safe-area-inset-top));
  background: color-mix(in srgb, var(--ace-color-ink-800) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--ace-color-ink-400);
}

/* The wordmark is a link home, so it is a touch target like any other and gets
   the same 44px minimum — at xs the sublabel is hidden and it was collapsing to
   28×20, which is a miss-tap waiting to happen on a tablet held one-handed. */
.wordmark {
  display: flex; align-items: center; gap: var(--ace-space-2); min-width: 0;
  min-height: var(--ace-layout-touch-min);
  padding-inline: var(--ace-space-2);
  margin-inline-start: calc(var(--ace-space-2) * -1);
  border-radius: var(--ace-radius-md);
}
.wordmark img { height: 20px; width: auto; }
.wordmark-sub {
  color: var(--ace-color-paper-300);
  font-size: var(--ace-font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--ace-letter-spacing-caps);
  white-space: nowrap;
}
/* xs/sm: the wordmark alone; the sublabel would push search off screen. */
@media (max-width: 767px) { .wordmark-sub { display: none; } }

.topbar-search { margin-left: auto; flex: 0 1 clamp(9rem, 30vw, 22rem); }
.topbar-search input {
  width: 100%;
  min-height: var(--ace-layout-touch-min);
  padding: 0 var(--ace-space-4);
  background: var(--ace-color-ink-600);
  border: 1px solid var(--ace-color-ink-400);
  border-radius: var(--ace-radius-full);
  color: var(--ace-color-paper-100);
  font-size: var(--ace-font-size-sm);
}
.topbar-search input::placeholder { color: var(--ace-color-paper-300); }
/* xs: search collapses to an icon-width field so the wordmark survives. */
@media (max-width: 479px) { .topbar-search { flex-basis: 7.5rem; } }

.iconbtn {
  display: grid; place-items: center;
  width: var(--ace-layout-touch-min); height: var(--ace-layout-touch-min);
  flex: none;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--ace-radius-md); cursor: pointer;
}
.iconbtn:hover { background: var(--ace-color-ink-600); }
.iconbtn svg { width: 22px; height: 22px; }
/* display:grid above wins over [hidden]'s display:none — same trap as the badge.
   Without this the back arrow shows on the home screen where it does nothing. */
.iconbtn[hidden] { display: none; }

/* ── rail / bottom bar ──────────────────────────────────────────────────── */

.rail {
  grid-area: rail;
  display: flex;
  background: var(--ace-color-ink-800);
  border-top: 1px solid var(--ace-color-ink-400);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: var(--ace-z-sticky);
}
.rail a {
  position: relative;
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px;
  min-height: 56px;
  color: var(--ace-color-paper-200);
  font-size: var(--ace-font-size-xs);
  text-decoration: none;
}
.rail a[aria-current="page"] { color: var(--ace-color-gold-100); }
.rail-ico { font-size: 1.1rem; line-height: 1; }

.rail-badge {
  position: absolute; top: 6px; right: 50%; transform: translateX(1.35rem);
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center;
  background: var(--ace-color-gold-200); color: var(--ace-color-gold-contrast);
  border-radius: var(--ace-radius-full);
  font-size: 11px; font-weight: var(--ace-font-weight-bold);
}
/* `display:grid` above wins over the `[hidden]` attribute's low-specificity
   display:none, so the badge showed a "0" even when the code set hidden=true.
   This makes hidden actually hide it. */
.rail-badge[hidden] { display: none; }

@media (min-width: 1024px) {
  .rail {
    flex-direction: column;
    border-top: 0;
    border-right: 1px solid var(--ace-color-ink-400);
    padding: var(--ace-space-4) 0;
    gap: var(--ace-space-2);
  }
  .rail a { flex: none; min-height: 64px; }
  .rail-badge { top: 8px; right: 14px; transform: none; }
}

/* ── main ───────────────────────────────────────────────────────────────── */

.main {
  grid-area: main;
  min-width: 0;                    /* without this the canvas forces the page wide */
  width: 100%;
  max-width: var(--ace-layout-maxw);  /* content does not stretch across a showroom display */
  margin-inline: auto;
  padding: var(--ace-space-5) var(--ace-layout-gutter);
  padding-bottom: var(--ace-space-16);
}
.main:focus { outline: none; }

.view-head { margin-bottom: var(--ace-space-6); }
.view-head h1 { font-size: var(--ace-font-size-3xl); margin-bottom: var(--ace-space-2); }
.view-head p { color: var(--ace-color-paper-200); margin: 0; max-width: 62ch; }

.eyebrow {
  color: var(--ace-color-gold-200);
  font-size: var(--ace-font-size-xs);
  text-transform: uppercase;
  letter-spacing: var(--ace-letter-spacing-caps);
  font-weight: var(--ace-font-weight-semibold);
  margin-bottom: var(--ace-space-2);
}

/* ── buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ace-space-2);
  min-height: var(--ace-layout-touch-min);
  padding: 0 var(--ace-space-5);
  border: 1px solid transparent;
  border-radius: var(--ace-radius-md);
  font-weight: var(--ace-font-weight-semibold);
  font-size: var(--ace-font-size-sm);
  cursor: pointer;
  transition: transform var(--ace-motion-fast) var(--ace-motion-ease),
              background var(--ace-motion-base) var(--ace-motion-ease);
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--ace-color-gold-100), var(--ace-color-gold-200));
  /* Never paper-100 on gold: that pairing measured ~1.5:1 on the main site. */
  color: var(--ace-color-gold-contrast);
}
.btn-ghost {
  background: transparent;
  border-color: var(--ace-color-ink-300);
  color: var(--ace-color-paper-100);
}
.btn-ghost:hover { border-color: var(--ace-color-gold-200); color: var(--ace-color-gold-100); }
.btn-sm { min-height: 36px; padding: 0 var(--ace-space-3); font-size: var(--ace-font-size-xs); }

/* ── color family grid ─────────────────────────────────────────────────── */

.family-grid {
  display: grid;
  gap: var(--ace-space-4);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 480px)  { .family-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px)  { .family-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .family-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .family-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .family-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

.family-card {
  display: block;
  border-radius: var(--ace-radius-lg);
  overflow: hidden;
  background: var(--ace-color-ink-700);
  border: 1px solid var(--ace-color-ink-400);
  text-decoration: none;
  color: inherit;
  transition: transform var(--ace-motion-base) var(--ace-motion-ease-spring),
              border-color var(--ace-motion-base) var(--ace-motion-ease);
}
.family-card:hover { transform: translateY(-3px); border-color: var(--ace-color-gold-300); }
/* An inset border so a near-white family swatch (White, Cream) is still a
   visible shape against the light card in light theme, where it would otherwise
   disappear. */
.family-swatch { aspect-ratio: 3 / 2; width: 100%; box-shadow: inset 0 0 0 1px var(--ace-color-ink-400); }
.family-meta { padding: var(--ace-space-3); }
.family-meta strong { display: block; font-size: var(--ace-font-size-sm); }
.family-meta span { color: var(--ace-color-paper-300); font-size: var(--ace-font-size-xs); }

/* ── surface grid (canvas + DOM twin) ───────────────────────────────────── */

.grid-wrap {
  position: relative;
  border-radius: var(--ace-radius-lg);
  overflow: hidden;
  background: var(--ace-color-ink-800);
  border: 1px solid var(--ace-color-ink-400);
  container-type: inline-size;
  container-name: grid;
}
.grid-canvas { display: block; width: 100%; touch-action: pan-y; }

/* The accessible twin: real links over the canvas, invisible but focusable, so
   the grid is keyboard- and screen-reader-navigable. Never display:none — that
   would remove it from the accessibility tree, which is the whole point. */
.grid-twin { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.grid-twin a {
  position: absolute;
  display: block;
  overflow: hidden;
  border-radius: var(--ace-radius-md);
  text-decoration: none;
}
.grid-twin a:focus-visible { outline: 3px solid var(--ace-color-gold-100); outline-offset: -3px; }

/* The surface name, sitting in the label strip the canvas leaves empty below
   each tile. This is the only legible name in the grid — the WebGL backend
   draws no text — so it is styled for reading at arm's length, not decoration. */
.tile-name {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0 2px;
  font-size: var(--ace-font-size-xs);
  line-height: 1.25;
  color: var(--ace-color-paper-200);
  /* Two lines maximum, then ellipsis — surface names run long and a third line
     would push the grid rows out of alignment with the canvas. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.grid-twin a:hover .tile-name { color: var(--ace-color-gold-100); }

.grid-empty { padding: var(--ace-space-12); text-align: center; color: var(--ace-color-paper-300); }

/* ── filter bar ─────────────────────────────────────────────────────────── */

.filters {
  display: flex; flex-wrap: wrap; gap: var(--ace-space-2);
  margin-bottom: var(--ace-space-4);
}
.chip {
  /* 44px is the brand kit's own touch minimum; the filter chips were 38px and
     miss-tap on a tablet held one-handed. */
  min-height: var(--ace-layout-touch-min);
  padding: 0 var(--ace-space-4);
  display: inline-flex; align-items: center; gap: var(--ace-space-2);
  background: var(--ace-color-ink-600);
  border: 1px solid var(--ace-color-ink-400);
  border-radius: var(--ace-radius-full);
  color: var(--ace-color-paper-200);
  font-size: var(--ace-font-size-xs);
  cursor: pointer;
  white-space: nowrap;
}
.chip[aria-pressed="true"] {
  background: var(--ace-color-alpha-gold-wash-strong);
  border-color: var(--ace-color-gold-300);
  color: var(--ace-color-gold-100);
}
.chip-dot { width: 12px; height: 12px; border-radius: var(--ace-radius-full); flex: none; }

/* xs: filters scroll horizontally instead of wrapping to four rows. */
@media (max-width: 479px) {
  .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: calc(var(--ace-layout-gutter) * -1);
    padding-inline: var(--ace-layout-gutter);
    scroll-snap-type: x proximity;
  }
  .filters::-webkit-scrollbar { display: none; }
  .chip { scroll-snap-align: start; }
}

/* ── surface detail ─────────────────────────────────────────────────────── */

.detail {
  display: grid;
  gap: var(--ace-space-6);
  grid-template-columns: 1fr;
}
@media (min-width: 1024px) { .detail { grid-template-columns: 1.35fr 1fr; align-items: start; } }
@media (min-width: 1600px) { .detail { grid-template-columns: 1.6fr 1fr; gap: var(--ace-space-10); } }

.detail-hero {
  border-radius: var(--ace-radius-lg);
  overflow: hidden;
  background: var(--ace-color-ink-700);
  aspect-ratio: 4 / 3;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }

.gallery {
  display: grid;
  gap: var(--ace-space-2);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: var(--ace-space-3);
}
@media (min-width: 768px)  { .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.gallery button {
  padding: 0; border: 2px solid transparent; background: none; cursor: pointer;
  border-radius: var(--ace-radius-md); overflow: hidden; aspect-ratio: 1;
}
.gallery button[aria-current="true"] { border-color: var(--ace-color-gold-200); }
.gallery img { width: 100%; height: 100%; object-fit: cover; }

.spec-table { width: 100%; border-collapse: collapse; font-size: var(--ace-font-size-sm); }
.spec-table th, .spec-table td {
  text-align: left; padding: var(--ace-space-3) 0;
  border-bottom: 1px solid var(--ace-color-ink-400);
  vertical-align: top;
}
.spec-table th { color: var(--ace-color-paper-300); font-weight: var(--ace-font-weight-medium); width: 40%; }

.panel {
  background: var(--ace-color-ink-700);
  border: 1px solid var(--ace-color-ink-400);
  border-radius: var(--ace-radius-lg);
  padding: var(--ace-space-5);
}
.panel + .panel { margin-top: var(--ace-space-4); }
.panel h2 { font-size: var(--ace-font-size-lg); }

.chip-swatch {
  width: 100%; aspect-ratio: 5 / 2;
  border-radius: var(--ace-radius-md);
  border: 1px solid var(--ace-color-ink-400);
}

/* ── compare wall ───────────────────────────────────────────────────────── */

.compare-wall {
  display: grid;
  gap: var(--ace-space-3);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 480px)  { .compare-wall { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px)  { .compare-wall { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .compare-wall { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .compare-wall { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--ace-space-4); } }

.compare-card {
  container-type: inline-size;
  background: var(--ace-color-ink-700);
  border: 1px solid var(--ace-color-ink-400);
  border-radius: var(--ace-radius-lg);
  overflow: hidden;
}
.compare-card img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.compare-card .cc-body { padding: var(--ace-space-3); }
.compare-card .cc-name { font-weight: var(--ace-font-weight-semibold); font-size: var(--ace-font-size-sm); }
.compare-card .cc-meta { color: var(--ace-color-paper-300); font-size: var(--ace-font-size-xs); }
.compare-card .cc-remove { margin-top: var(--ace-space-2); width: 100%; }

/* Container query: in a narrow slot the card drops its secondary text rather
   than truncating it into noise. */
@container (max-width: 150px) {
  .compare-card .cc-meta { display: none; }
  .compare-card .cc-body { padding: var(--ace-space-2); }
}

/* Side-by-side mode: full-bleed rows for judging color against color. */
.compare-wall.mode-strip { display: flex; gap: 2px; height: min(60vh, 520px); }
.compare-wall.mode-strip .compare-card {
  flex: 1; border-radius: 0; border: 0; display: flex; flex-direction: column;
}
.compare-wall.mode-strip .compare-card img { flex: 1; aspect-ratio: auto; height: auto; }
.compare-wall.mode-strip .cc-body { flex: none; }
@media (max-width: 767px) {
  .compare-wall.mode-strip { flex-direction: column; height: auto; }
  .compare-wall.mode-strip .compare-card { flex-direction: row; align-items: center; }
  .compare-wall.mode-strip .compare-card img { width: 96px; height: 96px; flex: none; }
}

/* ── compare tray ───────────────────────────────────────────────────────── */

.tray {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: var(--ace-z-tray);
  background: color-mix(in srgb, var(--ace-color-ink-700) 96%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--ace-color-ink-300);
  padding: var(--ace-space-3) var(--ace-layout-gutter);
  padding-bottom: calc(var(--ace-space-3) + env(safe-area-inset-bottom));
  transform: translateY(0);
  transition: transform var(--ace-motion-slow) var(--ace-motion-ease-out);
}
/* `visibility: hidden` alongside the slide, not instead of it.
   translateY(110%) alone was not enough: the tray is offset by `bottom: 56px`
   above the bottom bar at small sizes, so 110% of its own height still left a
   strip of an EMPTY comparison tray on screen. */
.tray[hidden] {
  display: block;
  transform: translateY(calc(100% + var(--ace-space-16)));
  visibility: hidden;
  pointer-events: none;
}

/* Bottom bar sits at the bottom below lg, so lift the tray above it. */
@media (max-width: 1023px) { .tray { bottom: 56px; } }

.tray-head { display: flex; align-items: center; gap: var(--ace-space-3); margin-bottom: var(--ace-space-2); }
.tray-title { font-size: var(--ace-font-size-sm); }
.tray-actions { margin-left: auto; display: flex; gap: var(--ace-space-2); }

.tray-items {
  display: flex; gap: var(--ace-space-2); list-style: none; margin: 0; padding: 0;
  overflow-x: auto; scrollbar-width: thin;
}
.tray-items li { flex: none; }
.tray-items button {
  position: relative; padding: 0; border: 1px solid var(--ace-color-ink-300);
  border-radius: var(--ace-radius-md); overflow: hidden; cursor: pointer;
  width: 56px; height: 56px; background: var(--ace-color-ink-600);
}
.tray-items img { width: 100%; height: 100%; object-fit: cover; }

/* xs: the tray shrinks to a single strip — 10 thumbnails at 56px would eat the
   screen on a 320px phone. */
@media (max-width: 479px) {
  .tray-items button { width: 44px; height: 44px; }
  .tray-title { font-size: var(--ace-font-size-xs); }
}
/* lg+: the tray docks to the right of the rail rather than covering content. */
@media (min-width: 1024px) {
  .tray { left: var(--ace-layout-rail); }
}

/* ── guided flow ────────────────────────────────────────────────────────── */

.guide-step { max-width: 64rem; margin-inline: auto; }
.guide-progress {
  display: flex; gap: var(--ace-space-2); margin-bottom: var(--ace-space-6);
}
.guide-progress span {
  flex: 1; height: 4px; border-radius: var(--ace-radius-full);
  background: var(--ace-color-ink-500);
}
.guide-progress span[data-done="true"] { background: var(--ace-color-gold-200); }

.guide-options {
  display: grid; gap: var(--ace-space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}
.guide-option {
  display: flex; flex-direction: column; gap: var(--ace-space-2);
  padding: var(--ace-space-5);
  min-height: 7rem;
  text-align: left;
  background: var(--ace-color-ink-700);
  border: 1px solid var(--ace-color-ink-400);
  border-radius: var(--ace-radius-lg);
  cursor: pointer;
  transition: border-color var(--ace-motion-base) var(--ace-motion-ease),
              transform var(--ace-motion-base) var(--ace-motion-ease-spring);
}
.guide-option:hover { border-color: var(--ace-color-gold-300); transform: translateY(-2px); }
.guide-option[aria-pressed="true"] {
  border-color: var(--ace-color-gold-200);
  background: var(--ace-color-alpha-gold-wash);
}
.guide-option strong { font-size: var(--ace-font-size-lg); }
.guide-option span { color: var(--ace-color-paper-300); font-size: var(--ace-font-size-xs); }

.guide-nav { display: flex; gap: var(--ace-space-3); margin-top: var(--ace-space-6); }
.guide-count { margin-left: auto; align-self: center; color: var(--ace-color-paper-200); font-size: var(--ace-font-size-sm); }
@media (max-width: 479px) {
  .guide-nav { flex-wrap: wrap; }
  .guide-count { width: 100%; margin: 0 0 var(--ace-space-2); order: -1; }
}

/* ── boot + toast ───────────────────────────────────────────────────────── */

.boot { display: grid; place-items: center; gap: var(--ace-space-4); padding: var(--ace-space-20) 0; }
.boot-mark {
  width: 40px; height: 40px; border-radius: var(--ace-radius-full);
  border: 3px solid var(--ace-color-ink-400);
  border-top-color: var(--ace-color-gold-200);
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot-msg { color: var(--ace-color-paper-300); font-size: var(--ace-font-size-sm); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--ace-layout-tray) + var(--ace-space-6));
  transform: translate(-50%, 1rem);
  z-index: var(--ace-z-toast);
  padding: var(--ace-space-3) var(--ace-space-5);
  background: var(--ace-color-ink-600);
  border: 1px solid var(--ace-color-ink-300);
  border-radius: var(--ace-radius-full);
  font-size: var(--ace-font-size-sm);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ace-motion-base) var(--ace-motion-ease),
              transform var(--ace-motion-base) var(--ace-motion-ease-out);
}
.toast[data-show="true"] { opacity: 1; transform: translate(-50%, 0); }

.offline-pill {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + var(--ace-space-3));
  transform: translateX(-50%);
  z-index: var(--ace-z-toast);
  padding: var(--ace-space-2) var(--ace-space-4);
  background: var(--ace-color-ink-600); border: 1px solid var(--ace-color-border-strong, var(--ace-color-ink-300));
  border-radius: var(--ace-radius-full);
  font-size: var(--ace-font-size-xs); color: var(--ace-color-paper-200);
  box-shadow: var(--ace-elevation-menu);
}
.offline-pill::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px;
  border-radius: 50%; background: var(--ace-color-state-warn); vertical-align: middle;
}

.noscript { padding: var(--ace-space-8); text-align: center; }

/* ── view transitions ───────────────────────────────────────────────────────
   Progressive enhancement: Safari 18+, Chrome 111+, Firefox 144+. Everything
   works without it; this only removes the hard cut between views. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: var(--ace-motion-base);
}

/* ── no-JS fallback ─────────────────────────────────────────────────────── */
.nojs .boot-mark { animation: none; }
