/* FRISTO web shell. A letter on a desk: the ground is the desk, content sits on paper.
   Palette values mirror tokens.js exactly (contrast.test.mjs enforces it). Post yellow is spent on the
   deadline stamp and nothing else. Fonts are self-hosted: no third-party connection, no consent problem. */

@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("font/ibmplexsans_regular.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("font/ibmplexsans_semibold.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("font/ibmplexmono_regular.ttf") format("truetype");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("font/ibmplexmono_medium.ttf") format("truetype");
}

:root {
  --ground: #EFEEE8;
  --paper: #FBFAF6;
  --ink: #16181D;
  --ink-muted: #5A5F6B;
  --hairline: #D9D7CE;
  --stamp: #F2C200;
  --stamp-ink: #16181D;
  --alarm: #C1121F;
  --alarm-container: #FBE9E9;
  --calm: #1F6F47;
  --calm-container: #E4F2EA;
  --caution: #8A5A00;
  --caution-container: #FCF2DA;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #14161B;
    --paper: #1E2128;
    --ink: #ECEAE3;
    --ink-muted: #9AA0AC;
    --hairline: #2C313A;
    --stamp: #F2C200;
    --stamp-ink: #16181D;
    --alarm: #FF8A80;
    --alarm-container: #3A1D1D;
    --calm: #7FD1A3;
    --calm-container: #16321F;
    --caution: #F5C86B;
    --caution-container: #33280C;
  }
}

:root {
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --gutter: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
}

/* Type scale, ported from FristoType.kt (sp to rem). */
.t-stamp-number { font: 500 2.125rem/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.t-stamp-label { font: 500 0.6875rem/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em; }
.t-display { font: 600 1.75rem/1.15 var(--font-sans); letter-spacing: -0.02em; margin: 0; }
.t-title { font: 600 1.25rem/1.3 var(--font-sans); margin: 0; }
.t-body { font: 400 1rem/1.5 var(--font-sans); }
.t-caption { font: 400 0.8125rem/1.4 var(--font-sans); color: var(--ink-muted); }
.t-eyebrow { font: 500 0.75rem/1.2 var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em; }
.t-amount { font: 500 1.875rem/1.1 var(--font-mono); font-variant-numeric: tabular-nums; }
.t-quote { font: 400 0.9375rem/1.5 var(--font-mono); }

main {
  max-width: 36rem;
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
}

.paper {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 24px var(--gutter);
}

.hero { display: block; width: 100%; height: auto; margin: 0 0 16px; }
.hero .env-body { fill: var(--paper); stroke: var(--hairline); stroke-width: 2; }
.hero .env-flap { fill: none; stroke: var(--hairline); stroke-width: 2; stroke-linejoin: round; }
.hero .env-lines { stroke: var(--ink-muted); stroke-width: 2; stroke-linecap: round; opacity: 0.5; }
.hero .stamp-body { fill: var(--stamp); }
.hero .stamp-edge { fill: none; stroke: var(--stamp-ink); stroke-width: 1.5; opacity: 0.55; }
.hero .stamp-text { fill: var(--stamp-ink); font: 500 11px var(--font-sans); letter-spacing: 0.08em; }

.pitch p { margin: 12px 0 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  font: 600 1rem/1 var(--font-sans);
  cursor: pointer;
}
.button:disabled {
  background: var(--hairline);
  color: var(--ink-muted);
  cursor: not-allowed;
}

.note { margin: 20px 0 0; }

/* The two capture actions. `gap` spaces them on one line and between lines once they wrap, so the
   stacked phone layout keeps a real gap and a shared left edge; margins on the buttons would give an
   8px indent to the second one and no vertical space at all. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.actions > .button { margin: 0; }

/* Two links now, so they need a gap rather than sitting flush; `gap` spaces them on one line and
   between lines once they wrap at phone width. */
footer { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 0 20px; }
footer a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
}

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--paper); }

/* The one piece of motion: the stamp settles when a deadline is armed. */
@keyframes stamp-settle {
  from { transform: scale(1.12) rotate(-3deg); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.stamp-armed { animation: stamp-settle 220ms ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .stamp-armed { animation: none; }
}

/* Capture tray: small paper cards laid out in reading order. No yellow; the stamp is not earned yet. */
.tray-section { margin-top: 24px; }
.tray-section p { margin: 4px 0 0; }
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.page-card {
  position: relative;
  width: 8.5rem;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.page-card img {
  display: block;
  width: 100%;
  height: 9rem;
  object-fit: cover;
  background: var(--ground);
  border: 1px solid var(--hairline);
}
.page-number {
  display: block;
  margin: 6px 0;
  font: 500 0.9375rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.tray-button {
  display: block;
  width: 100%;
  min-height: 44px;
  min-width: 44px;
  margin-top: 4px;
  padding: 0 8px;
  border: 1px solid var(--ink-muted);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.9375rem/1 var(--font-sans);
  cursor: pointer;
}
.tray-button:disabled { color: var(--ink-muted); border-color: var(--hairline); cursor: not-allowed; }

/* Secondary action: quieter than the primary, same 44px target. */
.button-quiet {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink-muted);
  margin-left: 8px;
}
.button-quiet:disabled { color: var(--ink-muted); border-color: var(--hairline); background: var(--paper); }

/* `hidden` must win over the display of any component class (.button is inline-flex). */
[hidden] { display: none !important; }

.button-primary { margin-top: 20px; }
.paper + .paper { margin-top: 16px; }
.disclaimer { max-width: 36rem; }

/* The verdict. A paper card on the desk; the countdown stamp is the one bold, yellow thing on it. */
.result { padding: 20px var(--gutter); }
.result:focus { outline: none; }
.verdict > * + * { margin-top: 20px; }
.verdict p { margin: 0; max-width: 36rem; }
.question { margin: 0 0 8px; color: var(--ink-muted); }

.trust { padding: 12px var(--gutter); border-radius: 8px; }
.trust > * + * { margin-top: 6px; }
.trust p, .trust li { margin: 0; }
.signals { margin: 6px 0 0; padding-left: 1.25rem; }
.trust-calm { background: var(--calm-container); color: var(--calm); }
.trust-caution { background: var(--caution-container); color: var(--caution); }
.trust-alarm { background: var(--alarm-container); color: var(--alarm); }

.letter-head > * + * { margin-top: 6px; }
.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font: 500 0.8125rem/1.4 var(--font-sans);
}
.chip-calm { background: var(--calm-container); color: var(--calm); }
.chip-caution { background: var(--caution-container); color: var(--caution); }
.chip-alarm { background: var(--alarm-container); color: var(--alarm); }

.money-row { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.money-direction { color: var(--ink-muted); }

.deadline {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
}
.deadline:first-of-type { border-top: 0; padding-top: 4px; }
.deadline-body { min-width: 0; flex: 1; }
.deadline-body > * + * { margin-top: 8px; }
.deadline-body h4 { margin: 0; }

/* The stamp: yellow, ink text, Mono number over a caps label. The only use of --stamp on the verdict. */
.deadline-stamp {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 6rem;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--stamp);
  color: var(--stamp-ink);
  transform: rotate(-2deg);
  text-align: center;
}
/* A passed date is the one thing red is for. */
.deadline-stamp.stamp-overdue { background: transparent; color: var(--alarm); border: 2px solid var(--alarm); }
/* Nothing to count yet: outlined, not filled. */
.deadline-stamp.stamp-needs-date { background: transparent; color: var(--ink); border: 2px dashed var(--ink-muted); }
.stamp-big { display: block; }

.due { font-weight: 600; }
.due-calm { color: var(--calm); }
.due-caution { color: var(--caution); }
.due-alarm { color: var(--alarm); }
/* A date we are unsure of is never presented as settled. */
.due-unconfirmed { text-decoration: underline dashed; text-underline-offset: 4px; }

/* The label belongs to the quote below it, so it sits closer to it than to the sentence above. */
.deadline-body > .quote-label + .quote { margin-top: 4px; }

.quote {
  margin: 0;
  padding: 10px 12px;
  background: var(--ground);
  border-left: 3px solid var(--ink-muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.option-list { margin: 0; padding: 0; list-style: none; }
.option { padding: 12px 0; border-top: 1px solid var(--hairline); }
.option:first-child { border-top: 0; padding-top: 0; }
.option-label { font-weight: 600; }
.option-critical { border-left: 3px solid var(--ink); padding-left: 12px; }

.partial, .statutory {
  padding: 12px var(--gutter);
  border-radius: 8px;
  background: var(--caution-container);
  color: var(--caution);
}

@media (max-width: 26rem) {
  .deadline { flex-direction: column; }
}

/* Remind me: a paper-surface prompt under the deadline. No yellow here; the stamp is the only yellow object. */
.remind-panel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.remind-panel > label, .remind-panel > p { flex-basis: 100%; margin: 0; }
.remind-panel .button-quiet { margin-left: 0; }
/* "Something wrong here?" under the verdict. Deliberately quiet and last: it must be findable by someone
   who thinks FRISTO is wrong, without competing with the deadline for the attention of everyone else.
   The hairline above it separates it from the verdict, so it does not read as part of the answer. */
.feedback {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}
.feedback-trigger { margin-left: 0; }
.feedback-panel { display: flex; flex-wrap: wrap; gap: 8px; }
.feedback-panel > p { flex-basis: 100%; margin: 0 0 4px; }
.feedback-options {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feedback-options .button-quiet { margin-left: 0; }
.feedback-cancel { margin-left: 0; }
.feedback-privacy { color: var(--ink-muted); }
.feedback-status:empty { display: none; }
.feedback-status { margin: 12px 0 0; }

.date-input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ink-muted);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1 var(--font-sans);
}
.remind-status:empty { display: none; }

/* The "what to do" line under a doubtful trust banner. Slightly stronger than body text because it
   is the only actionable sentence in that block, and the one a frightened reader most needs. */
.trust-advice {
  margin: 12px 0 0;
  font-weight: 600;
}
