/* The app (/app/ on the web, and the native Android/iOS shell). Colours come ONLY from the brand
   tokens in /brand.css (linked first by public/index.html); every text/background pair used here is
   checked by tests/site/brand-contrast.test.ts. Navy header bar, cream page, white cards, navy text,
   gold for the one primary action, teal for links / step markers. */
:root {
  --bg: var(--ph-cream);
  --card: var(--ph-white);
  --line: var(--ph-line);
  --ink: var(--ph-navy);
  --dim: var(--ph-navy-muted);
  --edge: var(--ph-navy-muted);
  --go: var(--ph-gold);
  --soft: var(--ph-teal);
  --focus: var(--ph-navy);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  /* Accessibility: 18px+ base, high contrast, legible in low light. */
  font: 18px/1.6 var(--ph-font);
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 14px 18px 12px;
  position: relative;
  background: var(--ph-navy);
  color: var(--ph-white);
  /* full-bleed navy bar even when #app is a centred column */
  box-shadow: 0 0 0 100vmax var(--ph-navy);
  clip-path: inset(0 -100vmax);
}
header .t { font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; padding-right: 138px; }
header .s { font-size: 14px; color: var(--ph-pale-blue-gray); margin-top: 2px; padding-right: 138px; }
header button:focus-visible { outline: 3px solid var(--ph-white); outline-offset: 2px; }
header a.t { display: block; color: var(--ph-white); text-decoration: none; min-height: 44px; padding-top: 4px; padding-bottom: 4px; border-radius: 6px; }
header a.t:hover { text-decoration: underline; text-underline-offset: .2em; }
header a.home-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 44px; margin: 8px 8px 0 0; padding: 0 14px; border: 2px solid var(--ph-gold); border-radius: 8px; color: var(--ph-white); font-weight: 700; text-decoration: none; }
header a.home-btn:hover { background: var(--ph-navy-muted, rgba(255,255,255,.08)); }
header a.home-btn:focus-visible { outline: 3px solid var(--ph-white); outline-offset: 2px; }
header a.t:focus-visible { outline: 3px solid var(--ph-white); outline-offset: 2px; }
/* EN | ES | TL (one button per language in shared/lang.ts); the current one is gold. */
header .lang-switch {
  position: absolute;
  top: 14px;
  right: 12px;
  display: flex;
  gap: 4px;
}
header .lang-toggle,
header button.quiet.lang-toggle {
  width: auto;
  min-width: 40px;
  min-height: 44px;
  padding: 6px 7px;
  margin: 0;
  text-align: center;
  color: var(--ph-white);
  border: 1px solid var(--ph-pale-blue-gray);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
}
header .lang-toggle:active { color: var(--ph-white); }
header button.lang-toggle[aria-current="true"],
header button.quiet.lang-toggle[aria-current="true"] { background: var(--ph-gold); color: var(--ph-navy); border: 1px solid var(--ph-gold); }
/* Draft translation notice (shared/lang.ts draftNotice): small, under the title, never alarming. */
@media (max-width: 420px) { header .t { font-size: 14px; letter-spacing: .02em; } }
header .draft-note { margin: 8px 0 0; font-size: 14px; line-height: 1.45; color: var(--ph-pale-blue-gray); }
header .draft-note button.draft-note-en {
  display: inline;
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ph-white);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .15em;
}
/* House mark before the title: a mask, so its colour is the gold token (no colour in the SVG). */
header .t::before {
  content: "";
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  margin-right: .45em;
  vertical-align: -.3em;
  background: var(--ph-gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M5 19 20 6l15 13M10 16v17h20V16M17 33v-8h6v8' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M5 19 20 6l15 13M10 16v17h20V16M17 33v-8h6v8' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

main#stage { flex: 1; padding: 18px; }
footer { padding: 12px 18px 26px; border-top: 1px solid var(--line); font-size: 14px; color: var(--dim); }

h1, h2 { font-size: 23px; line-height: 1.3; margin: 0 0 10px; font-weight: 800; color: var(--ph-navy); }
h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .09em; text-transform: uppercase; color: var(--dim); }
p { margin: 0 0 14px; }
.lead { font-size: 20px; }
.dim { color: var(--dim); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 14px; box-shadow: 0 1px 3px rgba(20, 45, 67, .08); }

button {
  font: inherit;
  width: 100%;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--edge);
  border-radius: 12px;
  padding: 15px 16px;
  margin: 0 0 10px;
  cursor: pointer;
  min-height: 48px;
}
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button:active { background: var(--ph-pale-blue-gray); }
button.go { background: var(--go); border-color: var(--go); color: var(--ph-navy); font-weight: 700; }
button.go:active { background: var(--go); }
button.quiet { background: transparent; color: var(--soft); border-color: transparent; padding: 10px 2px; text-decoration: underline; text-underline-offset: .15em; }
button.quiet:active { background: transparent; color: var(--ink); }

/* Back + Save row (2026-11-25): bottom of every answer/step screen. Back = secondary (white,
   navy-muted edge), Save = secondary-strong (navy outline, bold) — gold stays the one primary
   action on each screen. */
.nav-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 6px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.nav-row button { width: auto; flex: 1 1 0; min-width: 120px; min-height: 52px; margin: 0; text-align: center; font-weight: 700; }
.nav-row .nav-back { background: var(--card); color: var(--ink); border-color: var(--edge); }
.nav-row .nav-back::before { content: "\2190\00a0"; content: "\2190\00a0" / ""; }
.nav-row .nav-save { background: var(--card); color: var(--ph-navy); border: 3px solid var(--ph-navy); }
.nav-row .nav-status { flex: 1 0 100%; margin: 0; min-height: 1.6em; color: var(--ink); font-weight: 600; }
.nav-row .nav-status:empty { min-height: 0; }
/* An earlier answer, shown again after Back. */
button[aria-pressed="true"] { border: 3px solid var(--ph-navy); }
button[aria-pressed="true"]::after { content: " \2713"; font-weight: 800; }

/* Kiosk mode: large touch targets, no small/incidental text actions. */
#app.kiosk button { min-height: 64px; font-size: 20px; padding: 20px 18px; }
#app.kiosk .lead { font-size: 23px; }
#app.kiosk header .lang-toggle { min-height: 48px; padding: 8px 10px; font-size: 17px; }
#app.kiosk header .draft-note button.draft-note-en { min-height: 0; padding: 0; font-size: inherit; }

.kv { display: flex; gap: 10px; margin: 7px 0; }
.kv .k { color: var(--dim); min-width: 84px; font-size: 15px; }
.kv .v { flex: 1; }

.fade { animation: f .3s; }
@keyframes f { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.mirror { border: 1px solid var(--line); border-left: 6px solid var(--soft); background: var(--card); border-radius: 14px; padding: 16px; margin: 0 0 14px; }

.chain-list { padding-left: 20px; margin: 0 0 14px; }
.chain-list li { margin: 0 0 6px; }
.chain-list li::marker { color: var(--soft); font-weight: 800; }

.crisis { margin-top: 10px; font-size: 15px; }
.crisis-list { list-style: none; padding: 0; margin: 6px 0; }
.crisis-list a { color: var(--soft); font-weight: 700; }
.crisis-list a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.crisis-disclaimer { font-size: 13px; }

label { display: block; font-size: 14px; color: var(--dim); margin: 10px 0 4px; }
input {
  font: inherit;
  width: 100%;
  background: var(--card);
  color: var(--ink);
  border: 2px solid var(--edge);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 6px;
  min-height: 48px;
}
input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

a { color: var(--soft); }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main#stage:focus { outline: none; }

/* Header: "Done on this computer? Sign out and clear" (web only) — always visible, never tiny. */
header .clear-device {
  width: auto;
  display: inline-block;
  margin: 8px 0 0;
  padding: 10px 12px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ph-white);
  border: 2px solid var(--ph-gold);
  background: transparent;
  text-decoration: none;
}
header .clear-device:active { background: transparent; color: var(--ph-white); }

.recovery-phrase {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: .04em;
  background: var(--card);
  color: var(--ph-navy);
  border: 3px solid var(--soft);
  border-radius: 12px;
  padding: 16px;
  word-spacing: .3em;
}
.share-code { font-size: 28px; font-weight: 700; letter-spacing: .12em; }
.hint { font-size: 15px; margin: 0 0 10px; }
.print-link, .map-link { display: inline-block; padding: 8px 0; min-height: 44px; }

/* W0.6: links inside a step's text (VA pages, dmv.nv.gov) — long URLs wrap instead of widening
   the screen at 375px. */
.text-link { overflow-wrap: anywhere; word-break: break-word; }
/* Phone field: the number stays readable text; each number also gets a call button (platform.call). */
.kv.kv-phone { flex-wrap: wrap; }
.call-row { flex: 1 0 100%; margin-top: 2px; }
.call-row button.call-btn { width: auto; display: inline-block; white-space: nowrap; margin: 0 14px 0 0; padding: 8px 2px; min-height: 44px; }
/* A step's official forms: white cards; the print/download link is a large outline button (navy
   text and edge on white) — gold stays the one primary action on the screen ("I did it"). */
.forms { margin: 0 0 14px; }
.form-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 12px; }
.form-item h4 { margin: 0 0 6px; font-size: 19px; line-height: 1.3; color: var(--ph-navy); }
.form-item p { margin: 0 0 10px; }
a.form-btn {
  display: block;
  background: var(--card);
  color: var(--ph-navy);
  border: 3px solid var(--ph-navy);
  border-radius: 12px;
  padding: 13px 16px;
  margin: 4px 0 10px;
  min-height: 52px;
  font-weight: 700;
  text-decoration: none;
}
a.form-btn::before { content: "\2193\00a0"; content: "\2193\00a0" / ""; }
a.form-btn:hover { text-decoration: underline; text-underline-offset: .15em; }
a.form-btn:active { background: var(--ph-pale-blue-gray); }
a.form-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 12px; }
.form-langs, .form-official { font-size: 16px; }
.form-langs a, .form-official a { display: inline-block; padding: 6px 0; min-height: 44px; }
#app.kiosk a.form-btn { min-height: 64px; font-size: 20px; padding: 20px 18px; }

/* Desktop / shared computers (library, shelter, caseworker office) — operator 2026-11-24.
   Not a stretched phone column: bigger type, the screen on the left, the always-there tools
   (save progress, share, crisis numbers) in a sticky side column on the right. */
@media (min-width: 1024px) {
  html, body { font-size: 20px; }
  #app {
    max-width: 1180px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-rows: auto 1fr;
    column-gap: 40px;
    padding: 0 32px;
  }
  header { grid-column: 1 / -1; padding: 20px 0 16px; }
  header .t { font-size: 21px; letter-spacing: .06em; }
  header .s { font-size: 15px; }
  header .lang-switch { top: 20px; right: 0; }
  main#stage { grid-column: 1; padding: 28px 0 48px; max-width: 760px; }
  footer {
    grid-column: 2;
    align-self: start;
    position: sticky;
    top: 0;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 28px 0 28px 28px;
    font-size: 16px;
  }
  h1, h2 { font-size: 28px; }
  .lead { font-size: 24px; }
  .kv .k { min-width: 120px; font-size: 16px; }
  button { padding: 14px 18px; }
  button:hover { border-color: var(--ph-navy); }
  button.go:hover { border-color: var(--ph-navy); }
  header button:hover, header button.quiet:hover { border-color: var(--ph-white); color: var(--ph-white); }
  button.quiet:hover { color: var(--ink); text-decoration: underline; }
  footer button.quiet { border: 2px solid var(--edge); padding: 12px 14px; color: var(--ink); background: var(--card); text-decoration: none; }
  .crisis { font-size: 17px; }
  .crisis-disclaimer { font-size: 15px; }
}
@media (min-width: 1600px) {
  html, body { font-size: 21px; }
  #app { max-width: 1320px; grid-template-columns: minmax(0, 1fr) 420px; }
}
