/* Public application page. Same paper-and-ink palette as the portal, standalone so the page loads
   without the portal shell, and so it can be framed by the public site as a widget. */
/* ---------------------------------------------------------------- type ---- */
/* Self-hosted from /fonts/, so text no longer waits on two third-party connections before it can
   render in its own face. Latin subset only: the record is kept in English, and anything outside
   the range falls through to the system font rather than downloading another file. Fraunces is
   cut to the 400-700 weights the stylesheets use, with its full optical-size axis kept so the
   80px gate title and a 15px card heading each get the cut drawn for their size. The italic is the
   single 400 face it always was. The same block is in /styles.css; keep the two in step.
   Licences: /fonts/OFL.txt. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Fallbacks reshaped to the web fonts' measure. Until a face arrives, the system font standing in
   for it is scaled to the same average letter width and given the same ascent and descent, so a
   line wraps where it will wrap in the real face and the swap does not shove the page down. The
   figures come from each pair's English-text advance widths and typographic ascent/descent. Arial
   stands in on Apple and Windows and Roboto on Android; the two measure within 1% of each other,
   so they share one set. Where none of these is installed the face is skipped and the stack below
   carries on to the generic family, exactly as before. */
@font-face {
  font-family: "Fraunces Fallback";
  font-style: normal;
  src: local("Georgia");
  size-adjust: 108%;
  ascent-override: 90.55%;
  descent-override: 23.61%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Fraunces Fallback";
  font-style: italic;
  src: local("Georgia Italic"), local("Georgia-Italic");
  size-adjust: 92.21%;
  ascent-override: 106.06%;
  descent-override: 27.65%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Archivo Fallback";
  src: local("Arial"), local("ArialMT"), local("Roboto");
  size-adjust: 98.7%;
  ascent-override: 88.96%;
  descent-override: 21.28%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "IBM Plex Mono Fallback";
  src: local("Courier New"), local("CourierNewPSMT");
  size-adjust: 100%;
  ascent-override: 102.52%;
  descent-override: 27.5%;
  line-gap-override: 0%;
}

:root {
  --paper: #f4efe6;
  --paper-2: #ece5d8;
  --paper-3: #e2d9c8;
  --ink: #1c2230;
  --ink-2: #2b3444;
  --ink-soft: #566175;
  --ink-faint: #8b93a3;
  --clay: #a6512f;
  --clay-deep: #823d21;
  --moss: #4c6a48;
  --gold: #9d7818;
  --rule: rgba(28, 34, 48, 0.14);
  --rule-strong: rgba(28, 34, 48, 0.28);
  --display: "Fraunces", "Fraunces Fallback", Georgia, serif;
  --body: "Archivo", "Archivo Fallback", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", "IBM Plex Mono Fallback", ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--body); -webkit-text-size-adjust: 100%; }
a { color: var(--clay-deep); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 20; }
.skip:focus { left: 1rem; }
.mono { font-family: var(--mono); font-size: .85rem; color: var(--ink-soft); margin: 0; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.masthead { padding: 1.25rem clamp(1rem, 4vw, 2.5rem) 1rem; border-bottom: 1px solid var(--rule-strong); display: grid; gap: .5rem; grid-template-columns: 1fr auto; align-items: end; }
.masthead__brand { display: flex; gap: .85rem; align-items: center; }
.masthead__brand img { border-radius: 50%; }
.kicker { margin: 0; font: 500 .72rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--clay); }
h1 { margin: .1rem 0 0; font: 700 clamp(1.5rem, 3.4vw, 2.2rem)/1.1 var(--display); letter-spacing: -.01em; }
h2 { margin: 0; font: 650 1.2rem/1.2 var(--display); }
h3 { margin: 1.25rem 0 .5rem; font: 600 .78rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); }
.masthead__note { grid-column: 1 / -1; margin: 0; max-width: 60rem; color: var(--ink-2); }
.masthead__links { grid-column: 2; grid-row: 1; display: flex; gap: 1rem; align-items: center; font-size: .92rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--clay-deep); text-decoration: underline; font: inherit; cursor: pointer; }

.tabs { display: none; }
.layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(20rem, .85fr); gap: 0; min-height: calc(100vh - 12rem); }

/* ------------------------------------------------------------- chat ---- */
.chat { display: flex; flex-direction: column; border-right: 1px solid var(--rule-strong); min-height: 32rem; max-height: calc(100vh - 9rem); position: sticky; top: 0; }
.chat__log { flex: 1; overflow-y: auto; padding: 1.25rem clamp(1rem, 3vw, 2rem); display: flex; flex-direction: column; gap: .75rem; }
.msg { max-width: 44rem; padding: .7rem .95rem; border: 1px solid var(--rule); border-radius: 2px 14px 14px 14px; background: #fffaf2; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg--user { align-self: flex-end; background: var(--ink); color: var(--paper); border-color: var(--ink); border-radius: 14px 2px 14px 14px; }
.msg--note { align-self: center; background: transparent; border-style: dashed; font-size: .88rem; color: var(--ink-soft); }
.msg__who { display: block; font: 500 .68rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; opacity: .7; margin-bottom: .3rem; }
.typing { display: inline-flex; gap: .3rem; padding: .9rem 1rem; }
.typing span { width: .45rem; height: .45rem; border-radius: 50%; background: var(--ink-faint); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat__interim { margin: 0 clamp(1rem, 3vw, 2rem) .5rem; font-style: italic; color: var(--ink-soft); }
.composer { border-top: 1px solid var(--rule-strong); padding: .85rem clamp(1rem, 3vw, 2rem) 1rem; background: var(--paper-2); }
.composer textarea { width: 100%; resize: vertical; min-height: 3.2rem; font: inherit; padding: .65rem .8rem; border: 1px solid var(--rule-strong); border-radius: 6px; background: #fffdf8; color: var(--ink); }
.composer__actions { display: flex; gap: .75rem; align-items: center; justify-content: flex-end; margin-top: .55rem; flex-wrap: wrap; }
.composer__hint { margin: .45rem 0 0; font-size: .8rem; color: var(--ink-soft); }
.toggle { display: inline-flex; gap: .4rem; align-items: center; font-size: .88rem; margin-right: auto; }
.icon-btn { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--rule-strong); background: #fffdf8; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.icon-btn[aria-pressed="true"] { background: var(--clay); color: #fff; border-color: var(--clay); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 .4rem rgba(166, 81, 47, .18); } }

.btn { font: 600 .95rem/1 var(--body); padding: .75rem 1.2rem; border-radius: 6px; border: 1px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; min-height: 2.75rem; }
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--clay { background: var(--clay); border-color: var(--clay); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--block { width: 100%; }

/* ------------------------------------------------------------ panel ---- */
.panel { padding: 1.25rem clamp(1rem, 3vw, 2rem) 2rem; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; border-bottom: 1px solid var(--rule-strong); padding-bottom: .6rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .8rem; }
.field { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--ink-2); position: relative; }
.field--wide { grid-column: 1 / -1; }
.field input, .field select, .field textarea { font: inherit; font-size: .95rem; padding: .5rem .6rem; border: 1px solid var(--rule-strong); border-radius: 4px; background: #fffdf8; color: var(--ink); min-height: 2.5rem; }
.field textarea { min-height: 4.2rem; resize: vertical; }
.field input[aria-invalid="true"] { border-color: var(--clay); }
.field__msg { font-size: .78rem; color: var(--ink-soft); }
.field__msg--bad { color: var(--clay-deep); }
.checks { display: flex; flex-wrap: wrap; gap: .4rem .9rem; }
.check { display: inline-flex; gap: .45rem; align-items: flex-start; font-size: .92rem; }
.check input { margin-top: .25rem; width: 1.05rem; height: 1.05rem; accent-color: var(--ink); }
.saved-flash { animation: saved 1.4s ease-out; }
@keyframes saved { from { background: rgba(157, 120, 24, .22); } to { background: #fffdf8; } }

.suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 2px 0 0; padding: 0; list-style: none; background: #fffdf8; border: 1px solid var(--rule-strong); border-radius: 4px; box-shadow: 0 10px 24px -14px rgba(28, 34, 48, .5); max-height: 14rem; overflow-y: auto; }
.suggest li { padding: .45rem .6rem; cursor: pointer; font-size: .9rem; }
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--paper-3); }
.suggest small { color: var(--ink-soft); }

.criteria { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.criteria li { display: grid; grid-template-columns: 1.5rem 1fr; gap: .4rem; font-size: .9rem; }
.criteria .mark { font-weight: 700; }
.criteria .met .mark { color: var(--moss); }
.criteria .not_met .mark { color: var(--clay-deep); }
.criteria .unknown .mark { color: var(--ink-faint); }
.criteria small { display: block; color: var(--ink-soft); }
.status-chip { display: inline-block; padding: .2rem .55rem; border-radius: 999px; font: 600 .75rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .05em; border: 1px solid currentColor; }
.status-chip--likely_eligible { color: var(--moss); }
.status-chip--needs_information { color: var(--gold); }
.status-chip--likely_ineligible { color: var(--clay-deep); }

.drop { border: 2px dashed var(--rule-strong); border-radius: 8px; padding: 1rem; text-align: center; background: #fffaf2; transition: background .15s, border-color .15s; }
.drop.is-over { background: var(--paper-3); border-color: var(--clay); }
.drop p { margin: .3rem 0; }
.drop__row { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; align-items: center; margin-top: .5rem; }
.doclist { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .5rem; }
.doclist li { border: 1px solid var(--rule); border-radius: 6px; padding: .55rem .7rem; background: #fffdf8; font-size: .88rem; }
.doclist .verdict { font: 600 .72rem/1 var(--mono); text-transform: uppercase; margin-left: .4rem; }
.verdict--consistent { color: var(--moss); } .verdict--needs_review, .verdict--not_checked { color: var(--gold); } .verdict--suspect { color: var(--clay-deep); }
.doclist ul { margin: .35rem 0 0; padding-left: 1.1rem; color: var(--ink-soft); }
.progress { height: 4px; background: var(--paper-3); border-radius: 2px; overflow: hidden; margin-top: .5rem; }
.progress span { display: block; height: 100%; width: 40%; background: var(--clay); animation: indeterminate 1.1s infinite ease-in-out; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.missing { margin: .5rem 0 0; padding-left: 1.1rem; font-size: .9rem; color: var(--clay-deep); }
.certify { margin-top: 1rem; padding: .8rem; border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--paper-2); font-size: .9rem; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.done { padding: 1.5rem; border: 1px solid var(--rule-strong); border-radius: 8px; background: #fffaf2; }
.done h2 { font-size: 1.6rem; }
.done .big { font: 600 1.35rem/1.2 var(--mono); color: var(--clay-deep); margin: .4rem 0 1rem; }

/* ---------------------------------------------------------- skeletons ---- */
.skeleton-stack { display: grid; gap: .7rem; padding-top: .6rem; }
.sk { border-radius: 8px; background: linear-gradient(90deg, var(--paper-2), var(--paper-3), var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; }
.sk--bubble { height: 3.4rem; max-width: 30rem; } .sk--short { max-width: 16rem; align-self: flex-end; }
.sk--line { height: 1rem; width: 40%; } .sk--field { height: 2.5rem; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .7rem 1.1rem; border-radius: 6px; font-size: .92rem; z-index: 30; max-width: min(92vw, 34rem); }
.toast--bad { background: var(--clay-deep); }
.footnote { margin: 0; padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.5rem; border-top: 1px solid var(--rule); font-size: .78rem; color: var(--ink-soft); }

/* --------------------------------------------------------- small / embed ---- */
@media (max-width: 860px) {
  .masthead { grid-template-columns: 1fr; }
  .masthead__links { grid-column: 1; grid-row: auto; }
  .tabs { display: flex; position: sticky; top: 0; z-index: 6; background: var(--paper); border-bottom: 1px solid var(--rule-strong); }
  .tabs button { flex: 1; padding: .8rem; background: none; border: 0; border-bottom: 3px solid transparent; font: 600 .95rem var(--body); color: var(--ink-soft); cursor: pointer; }
  .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--clay); }
  .tabs__badge:not(:empty) { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--clay); color: #fff; font-size: .75rem; margin-left: .3rem; }
  .layout { grid-template-columns: 1fr; }
  .chat { border-right: 0; max-height: none; position: static; min-height: 70vh; }
  .layout [role="tabpanel"][data-inactive] { display: none; }
  .grid2 { grid-template-columns: 1fr; }
}
.embed .masthead__note, .embed .footnote, .embed .masthead__brand img { display: none; }
.embed .masthead { padding: .75rem 1rem; }
.embed h1 { font-size: 1.25rem; }
.embed .tabs { display: flex; position: sticky; top: 0; z-index: 6; background: var(--paper); border-bottom: 1px solid var(--rule-strong); }
.embed .tabs button { flex: 1; padding: .7rem; background: none; border: 0; border-bottom: 3px solid transparent; font: 600 .92rem var(--body); color: var(--ink-soft); cursor: pointer; }
.embed .tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--clay); }
.embed .layout { grid-template-columns: 1fr; min-height: 0; }
.embed .chat { border-right: 0; max-height: none; position: static; min-height: calc(100vh - 7.5rem); }
.embed .layout [role="tabpanel"][data-inactive] { display: none; }
.embed .grid2 { grid-template-columns: 1fr; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
