/* Opening Passport — web app stylesheet (UX-2). Colors come ONLY from tokens.css vars
 * (gated by tests/test_design_tokens.py). Class names are the pre-UX-2 vocabulary —
 * templates did not have to change to adopt this file. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root { color-scheme: light; }

* { box-sizing: border-box; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0; line-height: 1.5;
  background: var(--surface); color: var(--text);
  font-size: 15px;
}

/* ---- header / nav (TenderScan-adjacent: raised white bar, bordered) ------------------- */
header.appbar {
  background: var(--surface-raised); color: var(--text);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  padding: .6rem 1.2rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
}
.brand {
  font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em;
  color: var(--primary); text-decoration: none; white-space: nowrap;
}
.brand .mark {
  display: inline-block; width: 1.15em; height: 1.15em; vertical-align: -.22em;
  margin-right: .4em; border: .16em solid var(--primary); border-radius: .25em;
  border-right-width: .38em;   /* the wordmark: an opening with its leaf */
}
.brand .phase { color: var(--text-muted); font-weight: 400; font-size: .8rem; }
header.appbar nav { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
header.appbar nav a { color: var(--text); text-decoration: none; font-weight: 500;
                      font-size: .92rem; padding: .25rem 0; border-bottom: 2px solid transparent; }
header.appbar nav a:hover { color: var(--primary); border-bottom-color: var(--primary); }
header.appbar .who { color: var(--text-muted); font-size: .85rem; }
form.navsearch { display: inline-flex; gap: 0; margin: 0; }
form.navsearch input {
  min-width: 13rem; margin: 0; padding: .35rem .6rem; font-size: .9rem;
  border-radius: var(--radius) 0 0 var(--radius); border-right: 0;
}
form.navsearch button {
  margin: 0; border-radius: 0 var(--radius) var(--radius) 0;
  padding: .35rem .7rem; font-size: .9rem;
}

/* ---- layout: the content panel ---------------------------------------------------------- */
main {
  max-width: 1020px; margin: 1.2rem auto; padding: 1.2rem 1.6rem 2rem;
  background: var(--surface-raised); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
h1 { font-size: 1.45rem; letter-spacing: -.01em; margin: .2rem 0 .8rem; }
h2 { font-size: 1.12rem; margin: 1.6rem 0 .5rem; }
h3 { font-size: 1rem; margin: .2rem 0 .4rem; }
.muted { color: var(--text-muted); }
a { color: var(--primary); }
a:hover { color: var(--primary-hover); }
code { font-size: .85em; }

/* ---- tables (compliance density kept; whitespace lives in the chrome) ------------------- */
table { border-collapse: collapse; width: 100%; margin: .6rem 0 1.4rem; font-size: .92rem; }
th, td { border: 1px solid var(--border); padding: .4rem .6rem; text-align: left;
         vertical-align: top; }
th { background: var(--surface); font-weight: 600; }
tbody tr:hover { background: var(--surface); }

/* ---- pills: ONE component, one shape; semantic classes carry custody meaning ------------ */
.pill {
  display: inline-block; padding: .08rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.pill.current, .pill.ok, .pill.status-active { background: var(--saved); color: var(--on-saved); }
.pill.superseded, .pill.status-decommissioned { background: var(--inactive); color: var(--on-inactive); }
.pill.neutral { background: var(--neutral-pill-bg); color: var(--neutral-pill-text); font-weight: 500; }
.pill.warn { background: var(--queued); color: var(--on-queued); }
.pill.bad { background: var(--alarm); color: var(--on-alarm); }

/* ---- boxes / banners --------------------------------------------------------------------- */
.err {
  background: var(--alarm-soft-bg); border: 1px solid var(--alarm-soft-border);
  color: var(--alarm-soft-text); padding: .6rem .8rem; border-radius: var(--radius);
}
.alarm { background: var(--alarm-strong); color: var(--on-alarm-strong); padding: .6rem 1.2rem; }
.alarm a { color: var(--on-alarm-strong); }
.pressure { background: var(--pressure-bg); color: var(--on-pressure); padding: .4rem 1.2rem; }
.restricted {
  background: var(--restricted-bg); border: 1px solid var(--restricted-border);
  color: var(--restricted-text); padding: .6rem .8rem; border-radius: var(--radius);
}

/* ---- forms & buttons ---------------------------------------------------------------------- */
form.inline { display: inline; }
label { display: block; margin: .6rem 0 .15rem; font-weight: 600; font-size: .9rem; }
input, select, textarea {
  padding: .45rem .6rem; min-width: 18rem; max-width: 100%;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface-raised); color: var(--text); font: inherit; font-size: .95rem;
}
button, .btn {
  display: inline-block; background: var(--primary); color: var(--on-primary);
  padding: .45rem 1rem; border-radius: var(--radius); text-decoration: none;
  border: 1px solid var(--primary); font: inherit; font-size: .92rem; font-weight: 600;
  cursor: pointer;
}
button:hover, .btn:hover { background: var(--primary-hover); border-color: var(--primary-hover);
                           color: var(--on-primary); }
button.secondary, .btn.secondary {
  background: var(--surface-raised); color: var(--primary); border-color: var(--border-strong);
}
button.secondary:hover, .btn.secondary:hover { border-color: var(--primary); background: var(--surface); }
button.danger, .btn.danger { background: var(--alarm); border-color: var(--alarm); color: var(--on-alarm); }
button.danger:hover, .btn.danger:hover { background: var(--alarm-strong); border-color: var(--alarm-strong); }

/* ---- cards -------------------------------------------------------------------------------- */
.row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-raised); box-shadow: var(--shadow);
  padding: .8rem 1rem; flex: 1; min-width: 16rem;
}

/* ---- on-page section menu (jumpbar) + the Copy-ID affordance -------------------------------- */
.jumpbar {
  display: flex; gap: .4rem; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 5;
  background: var(--surface-raised); padding: .55rem 0; margin: 0 0 1rem;
  border-bottom: 1px solid var(--border);
}
.jumpbar a {
  padding: .25rem .8rem; border: 1px solid var(--border); border-radius: 999px;
  text-decoration: none; color: var(--text); font-size: .85rem; font-weight: 500;
  white-space: nowrap;
}
.jumpbar a:hover { border-color: var(--primary); color: var(--primary); }
button.copyid { font-size: .8rem; padding: .15rem .7rem; margin-left: .4rem; }

/* ---- login: the brand's front door ---------------------------------------------------------- */
.login { max-width: 26rem; margin: 2.5rem auto; }
.login .brand.big { font-size: 1.5rem; }
.login input { width: 100%; min-width: 0; }
.login form button { width: 100%; padding: .55rem 1rem; font-size: 1rem; }

/* ---- mobile: point phones at the field app -------------------------------------------------- */
.fieldapp-hint {
  display: none; text-align: center; padding: .55rem .9rem;
  background: var(--surface-raised); border-bottom: 1px solid var(--border);
  color: var(--primary); font-size: .9rem; font-weight: 500; text-decoration: none;
}
@media (max-width: 640px), (pointer: coarse) and (max-width: 1024px) {
  .fieldapp-hint { display: block; }
}

/* ---- accessibility: visible focus everywhere (WCAG 2.4.7) --------------------------------- */
a:focus-visible, button:focus-visible, .btn:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px;
}

@media print {
  header.appbar, .noprint { display: none; }
  body { background: var(--surface-raised); }
  main { border: 0; box-shadow: none; margin: 0; max-width: none; }
}
