/* Styles for the /dpp/:dbpId passport page (dpp-page.ts), per the Ampowr
   Web & Online Design Guide v1.0 (SD-4225). The palette is defined once,
   here; nothing else in this file names a literal colour, and a test
   (test/contrast.e2e-spec.ts) fails if a colour outside it creeps in.

   Every text pairing meets WCAG 2.2 AA (4.5:1), the legal baseline; the
   decision is recorded on SD-4225. Green text and links use the guide's own
   #226B33, since #53BA63 is only 2.45:1 on white. Secondary text uses
   #6F7077, slightly darker than the guide's #77787F (4.40:1, just short of
   AA). #53BA63 stays for fills, the logo and other non-text accents.

   Radix Themes' token layer (spacing, type and radius scales) is vendored,
   scoped to :root, and imported first. The brand tokens below stay the one
   source of truth; the Radix colour names the page uses are aliases of them. */
@import url('/vendor/radix-tokens-3.2.1.css');

:root {
  --brand-green: #53BA63;     /* fills, logo, highlights; never text on white */
  --text-green: #226B33;      /* green text and links (guide hover green): 6.52:1 on white */
  --ink: #2B2C35;             /* body text and headings */
  --black: #000000;           /* text on a --brand-green fill (search highlight): 8.57:1 */
  --white: #FFFFFF;           /* page and card background */
  --tint: #F2F7F3;            /* section backgrounds */
  --text-secondary: #6F7077;  /* secondary text: 4.93:1 on white, 4.55:1 on tint */
  --border: #77787F;          /* borders (non-text) */
  --divider: #ECECEC;         /* dividers and input borders */

  /* Radix vocabulary, pointed at the brand. Rules use these names. */
  --accent-9: var(--brand-green);
  --accent-11: var(--text-green);
  --accent-contrast: var(--black);
  --gray-12: var(--ink);
  --gray-11: var(--text-secondary);
  --gray-6: var(--border);
  --gray-5: var(--divider);
  --color-panel-solid: var(--white);
}

@font-face {
  font-family: 'Titillium Web';
  src: url('/vendor/fonts/TitilliumWeb-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('/vendor/fonts/OpenSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('/vendor/fonts/OpenSans-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Open Sans';
  src: url('/vendor/fonts/OpenSans-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--color-panel-solid);
  color: var(--gray-12);
  font-family: 'Open Sans', system-ui, sans-serif;
  font-size: var(--font-size-3); /* guide body: 15 to 17 */
  line-height: 1.5;
  padding: var(--space-5) var(--space-4) var(--space-9);
}
h1 {
  font-family: 'Titillium Web', 'Open Sans', system-ui, sans-serif;
  font-weight: 700;
}
.page {
  max-width: 880px;
  margin: 0 auto;
}
.header {
  background: var(--tint);
  border: 1px solid var(--gray-5);
  border-radius: var(--radius-4);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.header__eyebrow {
  font-size: var(--font-size-2);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-11);
  margin: 0 0 var(--space-1);
}
/* Guide H1 is 48 to 56; narrower on a phone so a DBP ID still fits one line. */
.header__title {
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1.1;
  margin: 0 0 20px;
  word-break: break-all;
}
.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-4);
}
.kv-grid dt {
  font-size: var(--font-size-2);
  color: var(--gray-11);
  margin-bottom: 2px;
}
.kv-grid dd {
  margin: 0;
  font-size: var(--font-size-3);
  font-weight: 600;
  word-break: break-word;
}
.section {
  background: var(--color-panel-solid);
  border: 1px solid var(--gray-5);
  border-radius: var(--radius-4);
  margin-bottom: var(--space-3);
  overflow: hidden;
}
/* The guide's small-caps label style (as on "BUTTONS", "NAV BAR"): small,
   bold, tracked uppercase in the secondary grey (AA-adjusted, see :root). */
.section__title {
  padding: var(--space-4) 20px;
  font-size: var(--font-size-2);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--gray-11);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.section__title::after {
  content: '▾';
  font-size: var(--font-size-4);
  letter-spacing: 0;
  color: var(--gray-11);
  transition: transform 0.15s ease;
}
.section[open] > .section__title::after {
  transform: rotate(180deg);
}
.section__title::-webkit-details-marker { display: none; }
.section__body {
  border-top: 1px solid var(--gray-5);
}
.field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3) 20px;
  border-top: 1px solid var(--gray-5);
}
.field:first-child { border-top: none; }
.field__label {
  font-size: 15px;
  color: var(--gray-12);
}
.field__value {
  text-align: right;
  font-size: 15px;
  font-weight: 600;
}
.value--empty { color: var(--gray-11); font-weight: 400; }
.value--file { color: var(--gray-12); }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
/* One accent only (guide section 06): green marks status, neutral marks
   everything else. No amber or other secondary colour. */
.badge--restricted { background: var(--gray-5); color: var(--gray-12); }
.badge--pass { background: var(--tint); color: var(--accent-11); border: 1px solid var(--accent-9); }
.not-implemented-note {
  background: var(--color-panel-solid);
  border: 1px solid var(--gray-6);
  color: var(--gray-12);
  border-radius: var(--radius-3);
  padding: 10px 14px;
  font-size: 15px;
  margin-bottom: var(--space-4);
}
.topbar {
  max-width: 880px;
  margin: 0 auto var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
/* Icon mark in the nav bar (guide 01), with clear space equal to its height. */
.topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  font-family: 'Titillium Web', 'Open Sans', system-ui, sans-serif;
  font-weight: 700;
  font-size: var(--font-size-5);
  color: var(--gray-12);
}
.topbar__mark { width: 32px; height: 32px; display: block; }
/* Keeps the label on one line beside the mark and button on a phone. */
@media (max-width: 480px) {
  .topbar__brand { font-size: 16px; }
}
/* No click handler at all (not even an inert one) — a plain button with
   no href/onclick, distinct from the search behavior lower on this page.
   The guide's Secondary Action style: Log in sits in the nav bar, and
   green stays reserved for the page's own accents. */
.login-button {
  appearance: none;
  border: 1px solid var(--gray-12);
  cursor: pointer;
  background: var(--color-panel-solid);
  color: var(--gray-12);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: var(--radius-3);
  white-space: nowrap;
}
.login-button:hover { background: var(--tint); }
.login-button:focus-visible { outline: 2px solid var(--accent-11); outline-offset: 2px; }
.footer {
  max-width: 880px;
  margin: var(--space-5) auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-2);
  color: var(--gray-11);
}
/* Full lockup in the footer (guide 01). */
.footer__link {
  color: var(--accent-11);
  font-weight: 600;
  text-decoration: none;
}
.footer__link:hover { text-decoration: underline; }
.footer__lockup { width: 110px; height: 32px; display: block; }
/* Hidden until the synchronous head script (not Alpine) confirms JS is
   actually available — these controls do nothing without it. Scoped to
   :not(.js) rather than a plain .js-only + separate "show" override: once
   .js is present this rule simply stops applying, so each element's own
   display rule (and, at runtime, Alpine's inline x-show style) takes over
   completely unopposed — no !important fight with x-show's toggling. */
html:not(.js) .js-only { display: none !important; }
.search {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.search__field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--gray-11);
  pointer-events: none;
}
.search__input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--gray-12);
  background: var(--color-panel-solid);
  border: 1px solid var(--gray-5);
  border-radius: var(--radius-3);
  padding: 10px var(--space-7) 10px 38px;
}
/* Hide the native type="search" clear control — the custom one below
   replaces it so there's exactly one, consistently-styled clear button
   across browsers (Chrome/Edge render their own here; Firefox and
   Safari don't, which is the inconsistency prompting this). */
.search__input::-webkit-search-cancel-button { display: none; }
/* Guide 05: green focused border. The outline itself uses --text-green,
   since #53BA63 is only 2.45:1 against white and a focus indicator needs 3:1. */
.search__input:focus {
  border-color: var(--accent-9);
  outline: 2px solid var(--accent-11);
  outline-offset: -1px;
}
.search__clear {
  position: absolute;
  right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: var(--radius-2);
  background: var(--gray-5);
  color: var(--gray-12);
  cursor: pointer;
}
.search__clear:hover { background: var(--tint); }
.search__clear svg { width: 14px; height: 14px; }
/* Rows a search has ruled out — collapsed away entirely rather than left
   dimmed, per what was asked. Sections stay open/closed independently
   (handled in apply()), so an empty-looking open section with zero
   remaining rows is possible and expected if you clear a match. */
.field--hidden { display: none; }
.search__count {
  font-size: var(--font-size-2);
  color: var(--gray-11);
  white-space: nowrap;
}
mark.search-highlight {
  background: var(--accent-9);
  color: var(--accent-contrast);
  border-radius: var(--radius-1);
  padding: 0 1px;
}
/* [x-cloak] would hide pre-hydration content — not used here on
   purpose: the search box's starting state (empty input, no count) is
   already the correct no-JS-yet state, nothing to hide. */
.section-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--space-2);
}
.toggle-all-btn {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--font-size-2);
  font-weight: 700;
  color: var(--accent-11);
  padding: var(--space-1) 2px;
}
.toggle-all-btn:hover { text-decoration: underline; }
.chart {
  padding: var(--space-3) 20px 20px;
  border-top: 1px solid var(--gray-5);
}
.chart__subtitle {
  margin: 0 0 var(--space-4);
  font-size: var(--font-size-2);
  color: var(--gray-11);
  text-align: left;
}
/* Stacked (pie above legend) on narrow screens; side-by-side — pie left,
   legend right — once there's room for both. */
.chart__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}
.chart__svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  flex-shrink: 0;
}
.chart__legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) 20px;
  font-size: var(--font-size-2);
  color: var(--gray-12);
}
.chart__legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart__legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
@media (min-width: 640px) {
  .chart__body {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-6);
  }
  .chart__legend {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 10px;
  }
}
/* The bare domain (GET /): a "Powered by Ampowr" badge, centred. */
body.home {
  min-height: 100vh;
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
}
.home__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-7);
  border: 1px solid var(--gray-5);
  border-radius: var(--radius-4);
  background: var(--color-panel-solid);
}
.home__lockup { width: 165px; height: 48px; display: block; }
.home__text {
  margin: 0;
  font-size: var(--font-size-2);
  color: var(--gray-11);
}
