/* ==========================================================================
   Base — reset, document, typography primitives, focus, header, gate
   ========================================================================== */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}

button { background: none; border: 0; cursor: pointer; }

img { display: block; max-width: 100%; }

/* Numerals line up in every table, price, and counter. */
.num, td, .price, .stat-value { font-variant-numeric: tabular-nums; }

/* ---- Focus: gold ring, never removed ---------------------------------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--c-gold);
  outline-offset: 2px;
  border-radius: var(--r-btn);
}

/* <main> is focused programmatically after a client-side navigation so
   screen readers land in the new screen. That is a announcement target, not
   an interactive control, so it must not paint a focus ring. */
#main[tabindex="-1"]:focus,
#main[tabindex="-1"]:focus-visible { outline: none; }

/* ---- Screen-reader only ----------------------------------------------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4); top: -6rem;
  z-index: 200;
  padding: var(--s-3) var(--s-5);
  background: var(--c-red);
  color: var(--c-text-on-red);
  border-radius: var(--r-btn);
  font-weight: 700;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus-visible { top: var(--s-4); }

/* ==========================================================================
   Header — logo left, red hairline under, agent identity right
   ========================================================================== */

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  background: var(--c-header);
  border-bottom: 3px solid var(--c-red);   /* THE red hairline */
  display: flex;
  align-items: center;
  gap: var(--s-6);
  padding: 0 var(--page-x);
}

.app-header__home {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  border-radius: var(--r-btn);
  padding: var(--s-2);
  margin-left: calc(var(--s-2) * -1);
  text-decoration: none;
  color: inherit;
  transition: opacity var(--dur) var(--ease);
}
.app-header__home:hover { opacity: 0.82; }

.app-header__spacer { flex: 1; }

/* Home wears the wordmark centred and large, with nothing beside it. */
.app-header--home {
  position: relative;
  height: 21rem;
  justify-content: center;
}
.app-header__corner {
  position: absolute;
  right: var(--page-x);
  top: var(--s-5);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

/* ---- Brand wordmark — Bobby's real signage logo -----------------------
   assets/brand/logo.png is his actual mark: white script/bold lettering with
   the red swoosh, transparent background, reading premium on the near-black
   header. Used exactly as delivered — never recoloured or restyled. The
   image carries its intrinsic 1200×481 as width/height, so the box is
   reserved at the right ratio before the file loads; these rules set the
   drawn height and let the width follow.

   Workspace slot: smaller, left. Home: larger, centred (.brand-img--lg,
   centred by .app-header--home's justify-content). -------------------- */
.brand-img {
  display: block;
  height: 6.5rem;
  width: auto;
  user-select: none;
}
.brand-img--lg { height: 13.5rem; }

/* ---- Preview badge — this build shows invented data, and says so ------ */
.preview-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.35rem var(--s-3);
  border: 1px solid var(--c-line);
  border-radius: var(--r-pill);
  font-size: var(--t-micro);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-3);
  white-space: nowrap;
}
.preview-badge__dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--c-amber);
}

/* ---- Agent identity block (right of header) --------------------------- */
.agent-id {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}
/* Same treatment as the Home cards, and the same reason the fade is not a
   mask on the image — see .avatar-feather in components.css. The colour
   behind this one is the header bar. */
.agent-id__portrait {
  width: 8.25rem;
  height: 8.25rem;
  flex: none;
  --feather-rgb: var(--c-header-rgb);
}
.agent-id__text { display: flex; flex-direction: column; gap: 0.15rem; }
.agent-id__name {
  font-size: var(--t-display);
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.agent-id__role {
  font-size: var(--t-body);
  color: var(--c-text-2);
}
.agent-id__status {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-sm);
  color: var(--c-green);
  font-weight: 600;
}
.agent-id__status::before {
  content: "";
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--c-green);
  box-shadow: 0 0 0 3px rgba(53, 201, 90, 0.18);
}

/* ---- Header pill controls: back to home, log out -----------------------
   One shape, two uses. Both sit in the header's right-hand cluster beside
   the icon-only gear and refresh, and both say what they do in words —
   which is why they are pills and not glyphs. -------------------------- */
.back-home,
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-4);
  border: 1px solid var(--c-line);
  border-radius: var(--r-btn);
  color: var(--c-text-2);
  font-size: var(--t-sm);
  font-weight: 600;
  background: transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.back-home:hover,
.logout-btn:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
  border-color: var(--c-surface-4);
}
/* Leaving the demo is not a destructive act — no red. The whitespace before
   it is what separates it from the controls that stay inside the app. */
.logout-btn { margin-left: var(--s-2); }

/* ==========================================================================
   Page shell
   ========================================================================== */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  /* Extra bottom room so the fixed build credit (bottom-right) never sits
     over the last row of content when a long screen is scrolled to its end. */
  padding: var(--s-6) var(--page-x) 7.5rem;
}

.screen-enter { animation: screen-in var(--dur-slow) var(--ease) both; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  /* Reduced motion still gets a designed arrival: the screen fades in
     place rather than sliding, so the change of context stays legible. */
  .screen-enter { animation: screen-in-reduced 1ms both; }
  @keyframes screen-in-reduced { from { opacity: 1; } to { opacity: 1; } }
}

/* ==========================================================================
   Access gate  — see src/screens/gate.js. NOT A SECURITY BOUNDARY.
   ========================================================================== */

.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background:
    radial-gradient(120% 80% at 50% 0%, #202327 0%, var(--c-bg) 60%);
}
.gate__card {
  width: 100%;
  max-width: 34rem;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-panel);
  padding: var(--s-8) var(--s-7) var(--s-7);
  text-align: center;
}
.gate__brand { display: flex; justify-content: center; margin-bottom: var(--s-6); }
.gate__title {
  font-size: var(--t-h2);
  font-weight: 800;
  letter-spacing: -0.01em;
}
.gate__sub {
  margin-top: var(--s-2);
  color: var(--c-text-2);
  font-size: var(--t-sm);
}
.gate__form { margin-top: var(--s-6); display: grid; gap: var(--s-4); }
.gate__error {
  min-height: 1.4rem;
  color: var(--c-red-hi);
  font-size: var(--t-sm);
  font-weight: 600;
}
.gate__note {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-line-soft);
  color: var(--c-text-3);
  font-size: var(--t-xs);
  line-height: 1.5;
}
