/* Second Look: the pieces more than one page uses. Layer 3 of 5 (tokens, base, components, shell,
   pages). Moved here unchanged from the old style.css, except the page head and the meter, which
   are new for the redesign's pages. A piece one page alone uses stays in that page's file. */

/* ---------- buttons ---------- */
.primary, .ghost-button, .danger, .dialog-actions button, .upload-actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-3);
  min-height: 36px; padding: 0 var(--space-6); border: 1px solid var(--rule-2); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink); font-size: var(--size-body); font-weight: 500; white-space: nowrap;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.ghost-button { min-height: 32px; padding: 0 var(--space-5); font-size: var(--size-sm); color: var(--ink-2); }
.ghost-button:hover:not(:disabled), .dialog-actions button:hover:not(:disabled):not(.primary),
.upload-actions button:hover:not(:disabled):not(.primary) { background: var(--chrome); border-color: var(--rule-2); color: var(--ink); }
/* Colour is kept for what matters: the answer figure, the status pill, an amber reviewer flag and
   coral failure. Controls are ink and grey: the one filled button is light ink on the dark ground. */
.primary { background: var(--ink); border-color: var(--ink); color: var(--on-accent); font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--sig); border-color: var(--sig); color: var(--on-accent); }
.primary.busy { cursor: progress; }
.danger { color: var(--bad); }
.danger:hover:not(:disabled) { background: var(--bad-surface); border-color: var(--bad-edge); }
.link-button { padding: 0; border: 0; background: none; color: var(--ink-2); font-size: var(--size-sm); font-weight: 500; text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 3px; }
.link-button:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- the wordmark (the sign-in page; the strip carries the monogram) ---------- */
.wordmark { font-size: 18px; font-weight: 650; letter-spacing: -.028em; color: var(--nav-ink-strong); }
.wordmark em { font-style: normal; color: var(--nav-meta); }

/* ---------- status: a dot, a pill ---------- */
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pending-dot); flex: none; }
.dot.ok { background: var(--ok-dot); }
.dot.warn { background: var(--warn-dot); }
.dot.bad { background: var(--bad-dot); }
.pill { display: inline-flex; align-items: center; gap: var(--space-3); padding: 3px var(--space-4) 3px var(--space-3); border: 1px solid var(--rule-2); border-radius: 999px; background: var(--chrome); font-size: var(--size-meta); font-weight: 500; line-height: 1.3; white-space: nowrap; color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pending-dot); flex: none; }
.pill.ok { border-color: var(--ok-edge); background: var(--ok-surface); color: var(--ok); }
.pill.ok::before { background: var(--ok-dot); }
.pill.warn { border-color: var(--warn-edge); background: var(--warn-surface); color: var(--warn); }
.pill.warn::before { background: var(--warn-dot); }
.pill.bad { border-color: var(--bad-edge); background: var(--bad-surface); color: var(--bad); }
.pill.bad::before { background: var(--bad-dot); }

/* ---------- cards ---------- */
.card { margin-bottom: var(--space-8); padding: var(--space-8); border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--sheet); box-shadow: var(--shadow-card); }
/* A card's title is a section key, as the deck labels a panel: spaced mono capitals, flush left. */
.card-title { margin: 0 0 var(--space-6); font: 500 var(--size-meta)/16px var(--font-mono); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-2); }

/* ---------- disclosures: technical detail, closed by default ---------- */
.more > summary, .tech > summary { display: inline-flex; align-items: center; gap: var(--space-3); font-size: var(--size-sm); font-weight: 500; color: var(--dim); transition: color var(--dur) var(--ease); }
.more > summary::before, .tech > summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur) var(--ease); }
.more[open] > summary::before, .tech[open] > summary::before { transform: rotate(45deg); }
.more > summary:hover, .tech > summary:hover { color: var(--ink); }
/* Disclosures open and close by height and opacity where the browser can animate to auto. */
details::details-content { height: 0; opacity: 0; overflow: clip; transition: height var(--dur-slow) var(--ease-out), opacity var(--dur) var(--ease), content-visibility var(--dur-slow) allow-discrete; }
details[open]::details-content { height: auto; opacity: 1; }
.more-body { margin-top: var(--space-3); padding-left: var(--space-5); border-left: 2px solid var(--rule); }
.more-body p { margin: var(--space-2) 0 0; font-size: var(--size-sm); color: var(--dim); overflow-wrap: anywhere; }
.more { margin-top: var(--space-4); }
.tech { padding: var(--space-6) var(--space-8); box-shadow: none; background: transparent; border-style: dashed; }
.tech > summary { font-size: var(--size-body); }

/* ---------- a workbook range laid out as its sheet (core.js workbookSheet): the Memo and Review source views ---------- */
.source-sheet-scroll { overflow-x: auto; }
.source-sheet { width: 100%; border-collapse: collapse; font-size: var(--type-small-size); line-height: var(--type-small-line); }
.source-sheet th, .source-sheet td { padding: var(--space-2) var(--space-4) var(--space-2) 0;
  border-top: 1px solid var(--rule); text-align: left; vertical-align: baseline; font-weight: 400; }
.source-sheet td.fig { text-align: right; white-space: nowrap; }
.source-sheet .source-sheet-head th { color: var(--ink-2); font-weight: 600; }
.source-sheet .source-cited { background: var(--cited); box-shadow: inset 0 0 0 1px var(--cited-edge); font-weight: 600; }
.source-sheet .source-cited.found { animation: cell-found 1.2s ease-out 1; }
@keyframes cell-found { 0% { background: var(--cited-flash); } 100% { background: var(--cited); } }
.source-sheet-more { margin-top: var(--space-3); }
@media (prefers-reduced-motion: reduce) {
  .source-sheet .source-cited.found { animation: none; }
}

/* ---------- dialogs ---------- */
.sheet-dialog { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: var(--space-8); border: 1px solid var(--rule-2); border-radius: var(--radius-lg); background: var(--sheet); color: var(--ink); box-shadow: var(--shadow-pop); }
.sheet-dialog::backdrop { background: var(--backdrop); }
/* Open: the backdrop fades in (150 ms), the panel fades, rises 8 px and scales from .96 (200 ms).
   Close: the reverse, faster (140 ms); core.js closeDialog closes it when this animation ends. */
.sheet-dialog[open] { animation: dialog-in 200ms var(--ease-out); }
.sheet-dialog[open]::backdrop { animation: backdrop-in 150ms var(--ease); }
.sheet-dialog.closing { animation: dialog-out 140ms var(--ease) forwards; }
.sheet-dialog.closing::backdrop { animation: backdrop-out 140ms var(--ease) forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(6px) scale(.97); } }
@keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes backdrop-out { from { opacity: 1; } to { opacity: 0; } }
.sheet-dialog h2 { margin: 0 0 var(--space-5); font-size: var(--size-lg); font-weight: 600; letter-spacing: var(--track-title); }
.sheet-dialog p { margin: 0 0 var(--space-4); font-size: var(--size-body); color: var(--ink-2); line-height: var(--lh-copy); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-4); margin-top: var(--space-7); }
.dialog-actions .ghost-button { min-height: 36px; border-color: transparent; background: transparent; }
.dialog-actions .ghost-button:hover:not(:disabled) { background: var(--chrome); border-color: transparent; }
.dialog-actions .primary[aria-busy="true"] { cursor: progress; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-3); }
.sheet-dialog .dialog-head h2 { margin: 0; }
.dialog-x { display: grid; place-items: center; width: 30px; height: 30px; flex: none; padding: 0; border: 1px solid transparent; border-radius: var(--radius); background: none; color: var(--dim); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.dialog-x:hover:not(:disabled) { background: var(--chrome); border-color: var(--rule); color: var(--ink); }
.sheet-dialog .dialog-lead { margin-bottom: var(--space-6); color: var(--dim); }

/* ---------- loading ---------- */
/* Placeholders while data loads: faint blocks in the shape of what is coming, a moving
   highlight every 1.3 s, a still block under reduced motion. */
.skel { display: block; border-radius: 5px; background: linear-gradient(100deg, var(--chrome) 30%, var(--viewer) 50%, var(--chrome) 70%); background-size: 220% 100%; animation: shimmer 1.3s ease-in-out infinite; }
.skel-lines { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.skel-line { height: 10px; border-radius: 4px; }
.skel-line.w70 { width: 70%; }
.skel-line.w45 { width: 45%; }
@keyframes shimmer { from { background-position: 220% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background: var(--chrome); }
}

/* ---------- a page's head (new for the redesign's pages) ---------- */
.page-head { display: grid; gap: var(--space-4); max-width: 880px; }
.page-lead { color: var(--ink-2); }
.page-link { justify-self: start; font-size: var(--type-small-size); font-weight: 600; }

/* ---------- a meter or a bar (new): its length is --value, 0 to 1 (motion.js setMeter) ----------
   The track is the full length; the fill is --value of it and draws from zero when the page
   enters (mark the fill data-enter="draw-x"). */
.meter { position: relative; height: 6px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.meter-fill { display: block; width: calc(var(--value, 0) * 100%); height: 100%; border-radius: inherit; background: var(--sig); }
