/*
 * Empty, error, working and loading states (js/states.js).
 *
 * One composition for all of them: a small still piece of halftone, a title,
 * one sentence, one action. It sits on whatever surface it is dropped on and
 * draws none of its own: no panel, no border, no icon in a circle.
 * Three sizes: page (a whole route), card (inside a card), row (one line).
 * Tokens only; both looks.
 */

/* ---------- Halftone motifs (js/halftone.js motif()) ---------- */
.ht-motif { display: block; width: 100%; height: auto; }
.ht-motif .ht-dot { fill: var(--ht-dot); }
.ht-motif .ht-hi { fill: var(--ht-hi); }

/* ---------- emptyState / errorState ---------- */
.estate {
  display: grid; justify-items: center; align-content: center; text-align: center;
  gap: var(--s4); min-width: 0;
}
.estate-art { display: block; flex: none; width: 10.5rem; margin-bottom: calc(-1 * var(--s2)); }
.estate-text { display: grid; gap: var(--s2); justify-items: inherit; min-width: 0; }
.estate-title { font: var(--type-section); letter-spacing: var(--track-title); color: var(--ink-strong); text-wrap: balance; max-width: 28ch; }
.estate-body { font: var(--type-body); color: var(--ink); max-width: min(52ch, 100%); text-wrap: pretty; }
.estate-eyebrow { margin-bottom: var(--s1); }
.estate-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s3) var(--s4); margin-top: var(--s2); }
.estate-note { font: var(--type-meta); color: var(--muted); max-width: min(52ch, 100%); }

/* page: a whole route with nothing on it yet */
.estate--page { padding: var(--s9) var(--s4) var(--s10); }
.estate--page .estate-art { width: 9.5rem; }
/* card: inside a card, under its title */
.estate--card { gap: var(--s3); padding: var(--s4) var(--s2) var(--s5); min-height: 0; }
.estate--card .estate-art { width: 9.5rem; }
.estate--card .estate-text { gap: var(--s1); }
.estate--card .estate-title { font: var(--type-body-strong); letter-spacing: 0; max-width: 36ch; }
.estate--card .estate-body { font: var(--type-body); max-width: 40ch; }
.estate--card .estate-actions { margin-top: 0; }
/* row: one line in a list, a menu or a panel */
.estate--row {
  grid-template-columns: auto minmax(0, 1fr) auto; justify-items: start; align-items: center; text-align: left;
  gap: var(--s3); padding: var(--s3) var(--s2);
}
.estate--row .estate-art { width: 4.5rem; margin: 0; }
.estate--row .estate-text { gap: 0; }
.estate--row .estate-title { font: var(--type-body-strong); letter-spacing: 0; max-width: none; }
.estate--row .estate-body { font: var(--type-body); max-width: var(--measure); }
.estate--row .estate-actions { margin-top: 0; justify-content: flex-end; }
.estate--row .estate-note { grid-column: 2 / -1; }
/* left-aligned variant of page and card */
/* (Left-aligned page and card states are centred with their picture, the way Insights is: the picture is never pushed to an edge.) */
.estate--left:not(.estate--row) { justify-items: center; text-align: center; }
.estate--left:not(.estate--row) .estate-actions { justify-content: center; }
.estate--row.estate--left .estate-actions { justify-content: flex-start; }
.estate--left.estate--page { padding-left: 0; padding-right: 0; }
.estate--left:not(.estate--row) .estate-art { margin-left: 0; }

/* error: the same block; the one dot that carries the point is the fail colour */
.estate--error .ht-motif .ht-hi { fill: var(--st-fail-dot); }

@media (max-width: 680px) {
  .estate--page { padding: var(--s7) 0 var(--s8); }
  .estate--page .estate-art { width: 9.5rem; }
  .estate--page .estate-actions .btn { width: 100%; justify-content: center; }
  .estate--row { grid-template-columns: auto minmax(0, 1fr); }
  .estate--row .estate-actions { grid-column: 2; justify-content: flex-start; }
}

/* The old wrappers keep working and stop drawing surfaces of their own. */
.empty-art { display: block; }
.vgrid > .estate { grid-column: 1 / -1; }
.estate.empty-wrap--404 { align-self: start; }
.card-empty.estate { min-height: 0; }

/* ---------- workingState ---------- */
.wstate { display: grid; justify-items: center; text-align: center; gap: var(--s3); min-width: 0; padding: var(--s5) var(--s3); }
.wstate-field { display: block; width: min(100%, 22rem); height: 5rem; }
.wstate-text { display: grid; gap: var(--s1); justify-items: center; min-width: 0; }
.wstate-title { font: var(--type-body-strong); color: var(--ink-strong); }
.wstate-pct { margin-left: var(--s1); font: var(--type-body); color: var(--muted); font-variant-numeric: var(--nums-tabular); }
.wstate-detail { font: var(--type-meta); color: var(--muted); max-width: 52ch; font-variant-numeric: var(--nums-tabular); }
.wstate--page { padding: var(--s9) var(--s4) var(--s10); gap: var(--s4); }
.wstate--page .wstate-field { width: min(100%, 30rem); height: 7rem; }
.wstate--page .wstate-title { font: var(--type-section); letter-spacing: var(--track-title); }
.wstate--page .wstate-detail { font: var(--type-body); }
.wstate--row { grid-template-columns: 6rem minmax(0, 1fr); justify-items: start; align-items: center; text-align: left; gap: var(--s3); padding: var(--s2) 0; }
.wstate--row .wstate-field { width: 6rem; height: 2rem; }
.wstate--row .wstate-text { justify-items: start; gap: 0; }

/* ---------- Loading: page-shaped skeletons ----------
   .skel (styles.css) is the grey; these give it the page's shape. A skeleton
   waits 200ms before it shows, so a fast answer never flashes one, and its
   shimmer is slow and slight. */
.skel-page { display: grid; gap: var(--gap-card); align-content: start; opacity: 0; animation: skel-appear 0s linear .2s forwards; }
.skel-page .skel--line + .skel--line { margin-top: 0; }
.skel-head { display: grid; gap: var(--s3); padding-bottom: calc(var(--rhythm-head) - var(--gap-card)); }
.skel--title { height: 2.5rem; width: 14rem; border-radius: var(--r-sm); }
.skel--h { height: 1.25rem; }
.skel--flat { border-radius: 0; }
.skel--control { height: var(--control); border-radius: var(--r-sm); }
.skel--player { aspect-ratio: 16 / 9; border-radius: var(--r); }
.skel--poster { width: 15rem; max-width: 100%; aspect-ratio: 16 / 9; border-radius: var(--r-sm); }
.skel--thumb { width: 4.5rem; aspect-ratio: 16 / 9; border-radius: var(--r-xs); flex: none; }
.skel--figure { height: 2.25rem; width: 6rem; border-radius: var(--r-xs); }
.skel--chart { height: 14rem; border-radius: var(--r-sm); }
.skel-card, html[data-look] .skel-card { display: grid; gap: var(--s3); align-content: start; box-shadow: inset 0 0 0 1px var(--line); border-color: transparent; }
.skel-card.vcard { gap: 0; }
.skel-card .vbody { gap: var(--s3); min-height: 7.5rem; }
.skel-card--tall { min-height: 24rem; }
.skel-card--form { padding: var(--pad-card); gap: var(--s4); }
.skel-row { display: flex; gap: var(--s3); }
.skel-row .skel { flex: none; height: var(--control); border-radius: var(--r-sm); }
.skel-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5); }
.skel-figs > div { display: grid; gap: var(--s2); }
.skel-tr { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s5); align-items: center; min-height: 2.5rem; }
.skel-tr + .skel-tr { border-top: 1px solid var(--line); }
.skel-list { display: grid; gap: 0; }
.skel-li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s3); align-items: center; min-height: var(--row-h); }
.skel-li > div { display: grid; gap: var(--s2); }
.skel-li + .skel-li { border-top: 1px solid var(--line); }
.skel-current { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--s5); }
.skel-current > div { display: grid; gap: var(--s3); align-content: start; }
@media (max-width: 680px) {
  .skel-current { grid-template-columns: 1fr; }
  .skel--poster { width: 100%; }
  .skel-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- The shell's first load (index.html) ----------
   What is in the page before any script has run: the mark, the navigation's
   shape and the page's skeleton. No spinner. The router replaces all of it. */
.boot-side { display: grid; gap: var(--s2); align-content: start; }
.boot-logo { display: flex; align-items: center; gap: var(--s3); height: var(--control); margin-bottom: var(--s5); padding-left: var(--s2); color: var(--ink-strong); font: var(--fw-strong) var(--fs-section)/1 var(--font-title); letter-spacing: var(--track-title); }
.boot-mark { width: 1.875rem; height: 1.875rem; flex: none; background: currentColor;
  -webkit-mask: url(../assets/volare-mark.svg) center / 150% no-repeat; mask: url(../assets/volare-mark.svg) center / 150% no-repeat; }
.boot-side .skel { height: var(--control); border-radius: var(--r-sm); opacity: 0; animation: skel-appear 0s linear .2s forwards, skel-shimmer 2.6s ease-in-out .2s infinite; }
.boot-side .skel:nth-child(n+3) { width: 70%; background: none; position: relative; }
.boot-side .skel:nth-child(n+3)::after { content: ''; position: absolute; left: var(--s3); right: 0; top: 50%; height: 0.75rem; margin-top: -0.375rem; border-radius: var(--r-xs); background: var(--line-2); }
@media (max-width: 1019px) { .boot-logo span, .boot-side .skel:nth-child(n+3) { display: none; } }

@media (prefers-reduced-motion: reduce) { .boot-side .skel { animation: skel-appear 0s linear .2s forwards; } }

/* Q2 polish. An empty page centres its block both ways in the space under the header. */
.estate--page.estate--center, .estate--page { align-self: center; }
.outlet > .estate--page { min-height: calc(100vh - 17rem); align-content: center; }
.estate-actions .pill { background: none; box-shadow: none; padding: 0; height: auto; border-radius: 0; font: var(--type-meta); color: var(--muted); }
.estate-actions .pill > i { display: none; }
@media (max-width: 680px) { .estate--card .estate-art { width: 8rem; } }
