/* mycdc - the page reads as a disclosure document rather than a sign-in
   portal: stone stock, olive-graphite ink, a text serif for prose, and
   monospace reserved strictly for real machine data.
   The palette deliberately avoids ComfortDelGro's own blue and cyan-teal, and
   avoids the red of a learner plate too - a page asking for a CDC password
   should not be dressed as either CDC or officialdom. Moss marks what you can
   check; plum marks a limit; nothing else is coloured. */

:root {
  --stock: #e8e7e0;       /* page ground: stone, the colour of form paper */
  --card: #f7f6f1;        /* raised paper: the form panel, the fingerprint */
  --ink: #252a1f;         /* graphite with an olive cast, not black */
  --ink-soft: #5a5f4e;
  --rule: #cbc9bd;
  --seal: #4b6320;        /* verified, checkable, safe to do */
  --seal-lift: #a8c46a;   /* the same idea, legible on the dark blocks */
  --caution: #7a2f47;     /* limits and caveats. Used nowhere else. */
  --machine: #22261d;     /* the blocks that hold machine output */

  --measure: 35rem;
  --pad: clamp(1.15rem, 5vw, 2rem);

  /* on the dark blocks */
  --on-machine: #eceade;
  --on-machine-soft: #c4c1b0;
  --on-machine-mute: #9a9885;
  --on-machine-rule: #454a3a;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--stock);
  color: var(--ink);
  font-family: Newsreader, Georgia, "Times New Roman", serif;
  font-size: 1.125rem;
  line-height: 1.62;
  font-optical-sizing: auto;
}

p { margin: 0; text-wrap: pretty; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }

a {
  color: var(--seal);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--ink); }

code, .mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86em;
}

abbr[title] { text-decoration: underline dotted #a9a795; cursor: help; }

/* algorithm names read as one token, so they never break across lines */
.nb { white-space: nowrap; }

:focus-visible {
  outline: 2.5px solid var(--seal);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- provenance: the first thing read, and the thing a fake page omits --- */

.provenance {
  background: var(--machine);
  color: var(--on-machine-soft);
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.7rem var(--pad);
}

.provenance p {
  max-width: var(--measure);
  margin: 0 auto;
}

.provenance a { color: var(--seal-lift); }
.provenance a:hover { color: #fff; }

/* --- opening ------------------------------------------------------------- */

.opening {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2.5rem, 9vw, 4.5rem) var(--pad) clamp(2rem, 7vw, 3rem);
}

.opening h1 {
  font-size: clamp(2.05rem, 7vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin-bottom: 1.15rem;
}

.lede { color: var(--ink-soft); }
.lede + .lede { margin-top: 0.85rem; }

/* --- page rhythm --------------------------------------------------------- */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(3rem, 9vw, 4.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 9vw, 4rem);
}

main h2 {
  font-size: clamp(1.4rem, 4.2vw, 1.7rem);
  letter-spacing: -0.012em;
  line-height: 1.2;
  margin-bottom: 0.7rem;
}

h3.sub {
  font-size: 1.18rem;
  margin: 2rem 0 0.85rem;
}

h3.sub--first { margin-top: 1.2rem; }

.section-lede { color: var(--ink-soft); margin-bottom: 1.5rem; }

.aside {
  margin-top: 1.4rem;
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-soft);
}
.aside code { font-style: normal; }

/* --- the specimen: one loud element, and it is the page's evidence ------- */

.specimen {
  background: var(--machine);
  color: var(--on-machine);
  padding: clamp(1.4rem, 5.5vw, 2rem) var(--pad);
  /* pulled to the viewport edges on phones, where the measure is the screen */
  margin: 0 calc(-1 * var(--pad));
}

.specimen h2 { color: #fff; margin-bottom: 0.45rem; }

.specimen__note {
  color: var(--on-machine-mute);
  font-size: 0.97rem;
  font-style: italic;
}

.specimen__note[data-tone="error"] { color: #d3a08a; }

.bytemap {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: grid;
  gap: 1.15rem;
  animation: arrive 0.45s ease-out both;
}

.bytemap li {
  display: grid;
  gap: 0.3rem;
  padding-left: 0.9rem;
  border-left: 2px solid var(--on-machine-rule);
}

/* the sealed credentials themselves: the one row that matters most */
.bytemap li:last-child { border-left-color: var(--seal-lift); }

.bytemap__what { font-size: 0.98rem; line-height: 1.35; }

.bytemap__where {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.76rem;
  color: var(--on-machine-mute);
}

.bytemap__value {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--seal-lift);
  /* hex breaks between byte pairs, never through one */
  overflow-wrap: break-word;
}

.specimen__caption {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--on-machine-rule);
  font-size: 0.97rem;
  color: var(--on-machine-soft);
}

.specimen__caption code { color: var(--on-machine); }

@keyframes arrive {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- the flow: a spine, with the wire labelled between stations ---------- */

.flow {
  margin: 0 0 0.5rem;
  padding: 0;
}

.flow__node {
  position: relative;
  padding-left: 1.7rem;
}

/* a filled station for the two machines that hold your password, hollow for
   CDC, which is somebody else's */
.flow__node::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 11px;
  height: 11px;
  background: var(--seal);
  border: 2px solid var(--seal);
}

.flow__node--far::before { background: var(--stock); border-color: var(--ink-soft); }

.flow__node h3 { font-size: 1.02rem; }

.flow__node p {
  color: var(--ink-soft);
  font-size: 0.99rem;
  margin-top: 0.2rem;
}

.flow__wire {
  position: relative;
  margin: 0;
  padding: 0.75rem 0 0.75rem 1.7rem;
  min-height: 2.6rem;
  display: flex;
  align-items: center;
}

.flow__wire::before {
  content: "";
  position: absolute;
  left: 4.5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(#a9a795 0 5px, transparent 5px 10px);
}

.flow__wire span {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}

.flow figcaption {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* --- stages: a real sequence, so it gets real numbers ------------------- */

.stages {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: stage;
  display: grid;
  gap: 1.35rem;
}

.stages li {
  counter-increment: stage;
  position: relative;
  padding-left: 2.4rem;
}

.stages li::before {
  content: counter(stage);
  position: absolute;
  left: 0;
  top: 0.1em;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--seal);
  border-bottom: 2px solid var(--seal);
  padding: 0 0.35rem 0.1rem 0;
}

.stages p { color: var(--ink-soft); }
.stages strong { color: var(--ink); font-weight: 600; }

/* --- ledger: two headed groups, because a rule colour alone cannot tell a
       reader which kind of fact they are looking at -------------------------- */

.ledger {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem;
}

.ledger li {
  padding-left: 1.15rem;
  border-left: 4px solid var(--rule);
}

.ledger--yes li { border-left-color: var(--seal); }
.ledger--no li { border-left-color: var(--caution); }

.ledger h4 { font-size: 1rem; line-height: 1.3; }

.ledger p {
  color: var(--ink-soft);
  font-size: 1.01rem;
  margin-top: 0.25rem;
}

/* --- checks -------------------------------------------------------------- */

.checks { margin: 0; }

.checks dt {
  font-weight: 600;
  font-size: 1.05rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

.checks dt:first-of-type { padding-top: 0; border-top: none; }

.checks dd {
  margin: 0.3rem 0 1.5rem;
  color: var(--ink-soft);
  font-size: 1.01rem;
}

.checks dd p { color: inherit; }
.checks dd p + p { margin-top: 0.7rem; }
.checks dt code { font-size: 0.9em; font-weight: 500; }

.fingerprint {
  display: block;
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.79rem;
  line-height: 1.7;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.fingerprint[data-state="pending"] { color: var(--ink-soft); font-style: italic; }
.fingerprint[data-state="error"] { color: var(--caution); font-style: italic; }

/* --- the ask, which comes last on purpose ------------------------------- */

.ask {
  background: var(--card);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--seal);
  border-radius: 3px;
  padding: clamp(1.35rem, 5vw, 2rem);
}

.field { margin-bottom: 1.2rem; }

label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"], input[type="password"] {
  width: 100%;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1.5px solid #b5b2a2;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
}

/* dark enough to read as a format hint (5:1), which is the only reason it
   is there */
input::placeholder { color: #726f61; }
input:focus-visible { border-color: var(--seal); outline-offset: 1px; }

.reveal { display: flex; gap: 0.5rem; }

.reveal button {
  flex: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0 0.9rem;
  border: 1.5px solid #b5b2a2;
  border-radius: 3px;
  background: var(--stock);
  color: var(--ink-soft);
  cursor: pointer;
  min-width: 4.4rem;
}

.reveal button:hover { color: var(--ink); border-color: var(--ink-soft); }

.go {
  width: 100%;
  font-family: inherit;
  font-size: 1.06rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  margin-top: 0.4rem;
  border: none;
  border-radius: 3px;
  background: var(--seal);
  color: #fff;
  cursor: pointer;
}

.go:hover { background: #3d5119; }
.go[disabled] { background: #8d8f80; cursor: progress; }

.status {
  margin-top: 0.9rem;
  font-size: 0.97rem;
  color: var(--ink-soft);
  min-height: 1.5em;
}

.status[data-tone="error"] { color: var(--caution); font-weight: 500; }

/* --- result: machine output, so it shares the specimen's surface -------- */

.result {
  background: var(--machine);
  color: var(--on-machine);
  padding: clamp(1.35rem, 5vw, 2rem);
  border-radius: 3px;
}

.result h2 { color: #fff; margin-bottom: 0.4rem; }
.found { color: var(--on-machine-mute); margin-bottom: 1.2rem; }

.upcoming {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 1.1rem 0 0;
  display: grid;
  gap: 0.9rem;
  border-top: 1px solid var(--on-machine-rule);
}

.upcoming li { font-size: 1rem; line-height: 1.35; }

.upcoming .when {
  display: block;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.78rem;
  color: var(--on-machine-mute);
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}

.urllabel { color: var(--on-machine-mute); font-size: 0.92rem; font-weight: 500; }

.urlrow { display: flex; gap: 0.5rem; margin: 0.3rem 0 1.2rem; }

#url {
  flex: 1 1 auto;
  min-width: 0;
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 0.79rem;
  padding: 0.6rem 0.65rem;
  border: 1.5px solid #4d5240;
  border-radius: 3px;
  background: #191c14;
  color: var(--on-machine-soft);
}

#copy {
  flex: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0 0.95rem;
  border: 1.5px solid #4d5240;
  border-radius: 3px;
  background: #343a2a;
  color: var(--on-machine);
  cursor: pointer;
  min-width: 5.3rem;
}

#copy:hover { background: #3f4633; }
#copy[data-done="1"] { background: var(--seal); border-color: var(--seal); }

.adds { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.add {
  flex: 1 1 12rem;
  text-align: center;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.68rem 1rem;
  border-radius: 3px;
  border: 1.5px solid #565c47;
  color: var(--on-machine);
}

.add:hover { background: rgba(255,255,255,.06); color: #fff; }

.add--primary {
  background: var(--seal);
  border-color: var(--seal);
  color: #fff;
}

.add--primary:hover { background: #57721f; }

.manual {
  margin-top: 1.4rem;
  border-top: 1px solid var(--on-machine-rule);
  padding-top: 1rem;
  font-size: 0.97rem;
  color: var(--on-machine-soft);
}

.manual summary { cursor: pointer; font-weight: 500; color: var(--on-machine); }
.manual p { margin-top: 0.75rem; }
.manual strong { color: #fff; font-weight: 600; }

.manual code {
  background: rgba(0,0,0,.35);
  padding: 0.12em 0.35em;
  border-radius: 2px;
  color: var(--seal-lift);
}

/* --- footer -------------------------------------------------------------- */

footer {
  background: var(--machine);
  color: var(--on-machine-mute);
  font-size: 0.95rem;
  padding: clamp(1.75rem, 6vw, 2.5rem) var(--pad);
}

footer p { max-width: var(--measure); margin: 0 auto; }
footer p + p { margin-top: 0.8rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.4rem; }
footer a { color: var(--seal-lift); }
footer a:hover { color: #fff; }

/* --- motion: only where something actually changed ---------------------- */

.result[data-enter="1"] { animation: settle 0.3s cubic-bezier(.2,.7,.3,1) both; }

@keyframes settle {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

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

/* --- wider viewports ----------------------------------------------------- */

@media (min-width: 46rem) {
  :root { --measure: 38rem; }

  .specimen { margin: 0; border-radius: 3px; }

  .ledger { grid-template-columns: 1fr 1fr; gap: 1.6rem 2rem; align-items: start; }
}
