/* The skeleton's own styles. Prompt 9 replaces most of this with the real
 * day page; the reset and the shell wrapper survive. */

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

/* The `hidden` attribute has to keep meaning hidden.
 *
 * The browser hides it with a UA rule, `[hidden] { display: none }`, and ANY
 * author `display` declaration outranks a UA one. So the moment a component's
 * class sets a display — `.sheet { display: flex }` is exactly such a class —
 * `el.hidden = true` quietly stops hiding it, and a full-screen overlay sits on
 * top of the app with nothing in the JavaScript to blame. Every module here
 * hides things by setting `.hidden`, so the guarantee belongs in one place. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: var(--space-6) var(--space-4) var(--space-12);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.55;
}

.shell {
  max-width: 42rem;
  margin: 0 auto;
}

.shell__eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.shell__title {
  margin: var(--space-1) 0 0;
  font-size: clamp(1.35rem, 4.5vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.shell__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 3px solid var(--accent);
}

.shell__titles {
  min-width: 0;
}

/* The shell lede, the shell note and the dev facts table were swept from
 * here in day-page A: the app stopped using all three when the facts table
 * came off Settings (step 10). The spike pages still draw the note and the
 * facts table, so those rules MOVED to spike.css, which both pages link;
 * the lede was used by nothing anywhere and is simply gone. */

/* ---------------------------------------------------------------- auth panel */

.panel {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-4) var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.panel__status {
  margin: 0 0 var(--space-2);
  color: var(--ink-faint);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.panel__status[data-state="ok"] { color: var(--ok); }
.panel__status[data-state="error"] { color: var(--danger); }

.panel__title {
  margin: 0 0 var(--space-2);
  font-size: 1.15rem;
  line-height: 1.25;
}

.panel__lede {
  margin: 0 0 var(--space-4);
  color: var(--ink-muted);
  font-size: var(--text-base);
}

.panel__error {
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  border-left: 3px solid var(--danger);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-sunken);
  color: var(--danger);
  font-size: var(--text-base);
}

.field { display: block; margin-bottom: var(--space-4); }

.field__label {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--ink-muted);
  font-size: var(--text-sm);
  font-weight: 600;
}

.field__input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
}

.field__input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.btn {
  min-height: var(--touch);
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.btn--primary {
  width: 100%;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.btn--quiet { color: var(--ink-muted); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ─────────────────────────────────────────────────────── the sync pill
 *
 * syncpill.js sets the text and exactly one `is-*` class; every rule below is
 * driven by that class and nothing else. It writes no inline style, because the
 * CSP has no 'unsafe-inline' — so if these rules are missing, the pill still
 * says the right words, unstyled, rather than disappearing.
 *
 * The states are ranked by how much they should interrupt: `synced` is almost
 * invisible, `n pending` and `update available` are worth a glance, and the
 * three that mean "your writing is not leaving this device" are red.
 */

.sync-pill {
  flex: 0 0 auto;
  /* 44 px is the touch target on a phone; the text is smaller than the box. */
  min-height: 44px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-muted);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
}

.sync-pill:empty {
  /* Before a session starts there is nothing true to say, so it says nothing. */
  display: none;
}

.sync-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sync-pill.is-synced {
  border-color: transparent;
  background: var(--ps-green-tint);
  color: var(--ok);
}

.sync-pill.is-syncing {
  border-color: var(--accent);
  color: var(--accent);
}

.sync-pill.is-pending,
.sync-pill.is-update {
  border-color: var(--emphasis);
  color: var(--warn);
}

.sync-pill.is-offline {
  color: var(--ink-faint);
}

.sync-pill.is-error,
.sync-pill.is-clock-wrong {
  border-color: var(--danger);
  color: var(--danger);
}

/* Only while a pass is actually in flight, and only for eyes that want it.
 * A pill that pulses all day is a pill nobody reads. */
@media (prefers-reduced-motion: no-preference) {
  .sync-pill.is-syncing {
    animation: sync-pulse 1.4s ease-in-out infinite;
  }
}

@keyframes sync-pulse {
  50% {
    opacity: 0.55;
  }
}
