/* ==========================================================================
   Upstream — app shell
   Layout and navigation chrome. The components themselves live in
   components.css and are shared with the design board.
   ========================================================================== */

html,
body {
  height: 100%;
}

body {
  background: var(--s3);
}

/* A phone-width column, centred on anything wider. */
#app {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow-x: hidden;
}

/* The scan route has nothing to scroll, so give it the *small* viewport: any
   overflow at all lets the page scroll, which is what retracts the URL bar and
   resizes everything underneath the viewfinder. */
#app[data-route="scan"] {
  min-height: 100svh;
  overflow: hidden;
}

.pad {
  padding: 0 20px;
}

.view {
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

.view__title {
  font: 700 26px/1.15 var(--font-sans);
  letter-spacing: -0.02em;
  color: var(--tx);
  margin-top: 20px;
  text-wrap: pretty;
}

.view__sub {
  font: 400 12.5px/1.45 var(--font-sans);
  color: var(--tx3);
  margin-top: 7px;
}

.verdict-slot {
  margin-top: 26px;
}

.block {
  margin-top: 32px;
}

.block__label {
  display: block;
  margin-bottom: 6px;
}

/* A label with an action on the same baseline. */
.block__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.link-btn {
  font: 500 12px/1 var(--font-sans);
  color: var(--tx3);
  cursor: pointer;
}

.link-btn:hover {
  color: var(--ink);
}

.block__note {
  font: 400 12px/1.55 var(--font-sans);
  color: var(--tx3);
  margin-top: 12px;
  text-wrap: pretty;
}

.state-line {
  font: 400 14px/1.55 var(--font-sans);
  color: var(--tx2);
  margin-top: 16px;
  text-wrap: pretty;
}

.barcode {
  font-size: 13px;
  color: var(--tx2);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   App bar
   -------------------------------------------------------------------------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: env(safe-area-inset-top, 0px) 20px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.appbar__back {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 500 13px/1 var(--font-sans);
  color: var(--tx2);
  cursor: pointer;
}

/* The reticle's corner bracket, at back-button scale. */
.appbar__back::before {
  content: "";
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.appbar__back:hover {
  color: var(--tx);
}

.appbar__code {
  font-size: 11px;
  color: var(--tx3);
}

/* --------------------------------------------------------------------------
   Search field — the same document line as the scan screen's search, with a
   real input in it.
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line2);
}

.field::before {
  content: "";
  flex: none;
  width: 2px;
  height: 16px;
  background: var(--ink);
}

.field:focus-within {
  border-bottom-color: var(--ink);
}

.field__input {
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  color: var(--tx);
  font: 500 15px/1.2 var(--font-sans);
}

.field__input::placeholder {
  color: var(--tx3);
}

.field__input:focus {
  outline: none;
}

.field__input::-webkit-search-cancel-button {
  display: none;
}

/* --------------------------------------------------------------------------
   Button — same rule-and-label logic as everything else.
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  margin-top: 20px;
  padding: 12px 0;
  border-bottom: 2px solid var(--ink);
  font: 600 13.5px/1 var(--font-sans);
  color: var(--ink);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Scan screen, fluid
   The board pins the component to 402 × 600; in the app it fills the column.
   -------------------------------------------------------------------------- */

/* Fixed, not absolute: sized by `100dvh` the viewfinder is short while the
   browser's URL bar is showing and jumps taller when it retracts. A fixed box
   pinned top and bottom fills the viewport from the first frame and stays put. */
.scan--fluid {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(480px, 100%);
  height: auto;
  overscroll-behavior: none;
}

/* A replaced element does not stretch to `inset: 0` the way a box does — it
   falls back to its 300 × 150 intrinsic size unless told otherwise. */
video.scan__feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scan--fluid .reticle {
  top: 31%;
  width: min(262px, 66%);
  height: auto;
  aspect-ratio: 262 / 162;
}

.scan--fluid .reticle__line {
  top: 45%;
}

/* --------------------------------------------------------------------------
   Rules — the campaign methodology, set as a numbered register so the
   decision procedure reads as checkable as the verdicts it produces.
   -------------------------------------------------------------------------- */

.rules {
  margin-top: 12px;
}

.rules > li {
  display: grid;
  grid-template-columns: 16px 1fr;
  column-gap: 11px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.rules > li:last-child {
  border-bottom: 0;
}

.rules__n {
  font: 400 10.5px/1 var(--font-sans);
  color: var(--tx3);
  padding-top: 3px;
}

.rules__t {
  font: 400 13px/1.5 var(--font-sans);
  color: var(--tx2);
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Prototype notice — the app speaking about itself, so it takes the ink
   accent rather than any verdict colour. It must never be mistaken for a
   statement about a company.
   -------------------------------------------------------------------------- */

.notice {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line2);
  font: 400 11.5px/1.55 var(--font-sans);
  color: var(--tx3);
  text-wrap: pretty;
}

.notice__tag {
  font-weight: 600;
  color: var(--ink);
}

.notice__tag::after {
  content: " — ";
  color: var(--tx3);
}
