/* Shared across every page. See DESIGN.md before changing anything here. */

@font-face {
  font-family: "Roboto";
  src: url("fonts/roboto-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* The only background colour in the project. Depth comes from borders, never fills. */
  --bg: #08080a;
  --fg: #f2f2f0;
  --muted: #9a9aa4;
  --line: #1e1e24;
  --line-strong: #2e2e37;
  --accent: #3ddc84;
  --warn: #f0b429;
  --bad: #f2616b;
  --radius: 0.6rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 4.5rem 1.5rem;
  /* Sticky footer: short pages still push it to the bottom of the viewport. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: "Roboto", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; width: 100%; max-width: 46rem; margin: 0 auto; }
/* Two-pane tools need room for both panes; everything else stays at reading width. */
main.wide { max-width: 72rem; }
/* The footer rule must line up with the content above it, not stop short of it. */
body:has(main.wide) .site-footer { max-width: 72rem; }

a { color: var(--accent); }

h1 {
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  margin: 0 0 0.75rem;
}

.lede {
  color: var(--muted);
  max-width: 34rem;
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.label {
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 3.5rem 0 1rem;
}
.label + .label-note { margin: -0.6rem 0 1rem; color: var(--muted); font-size: 0.85rem; }

/* Icons ------------------------------------------------------------------ */
/* Lucide (ISC). Injected by assets/icons.js — never use an emoji instead. */

.icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-good { color: var(--accent); }
.icon-warn { color: var(--warn); }
.icon-bad { color: var(--bad); }
.icon-info { color: var(--muted); }

/* Cards ------------------------------------------------------------------ */

.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.875rem; }
@media (min-width: 40rem) { .grid { grid-template-columns: 1fr 1fr; } }

.card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  height: 100%;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  background: none;
}
/* A tool you can open reads as solid and slightly brighter-edged; one that is not
   yet built stays dashed and recedes. */
a.card { border-color: var(--line-strong); transition: border-color 160ms ease; }
a.card:hover { border-color: var(--accent); }
a.card:hover .card-state .icon { transform: translateX(2px); }
a.card:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Announced by screen readers, invisible on screen. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.card--pending { border-style: dashed; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.card-name { font-size: 1.0625rem; font-weight: 500; letter-spacing: -0.01em; }
.card--pending .card-name { color: var(--muted); font-weight: 400; }

.card-state {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
a.card .card-state { color: var(--accent); }
.card-state .icon { width: 0.85rem; height: 0.85rem; transition: transform 160ms ease; }

.card-blurb { color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

/* Forms ------------------------------------------------------------------ */

form { display: flex; gap: 0.5rem; margin: 2rem 0 0; flex-wrap: wrap; }

input[type="text"] {
  flex: 1 1 18rem;
  padding: 0.8rem 1rem;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font: inherit;
}
input[type="text"]::placeholder { color: var(--muted); }
input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Safari and iOS paint autofilled fields a fixed pale yellow that background-color
   cannot override. The inset shadow is the only way to hold the one background. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: 0 0 0 100px var(--bg) inset;
  box-shadow: 0 0 0 100px var(--bg) inset;
  caret-color: var(--fg);
}

button {
  padding: 0.8rem 1.4rem;
  background: var(--accent);
  color: #06210f;
  border: 0;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }

/* Once the button wraps below the input it should own the row — a stub button
   floating under a full-width field reads as broken. */
@media (max-width: 30rem) {
  form { flex-direction: column; }
  input[type="text"] { flex: 1 1 auto; width: 100%; }
  button { width: 100%; }
}

textarea {
  width: 100%;
  margin-top: 2rem;
  padding: 0.9rem 1rem;
  min-height: 9rem;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font: inherit;
  line-height: 1.55;
  resize: none;
}
textarea::placeholder { color: var(--muted); }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

select {
  padding: 0.55rem 0.7rem;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}
select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
select option { background: var(--bg); color: var(--fg); }

.choices {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-top: 2rem;
}
.choices label { color: var(--muted); font-size: 0.8rem; }
@media (max-width: 30rem) {
  .choices { flex-direction: column; align-items: stretch; }
  .choices select { width: 100%; }
}

/* A colour tool has to show the colour. These are samples of the thing being judged,
   not page surfaces, so they do not count against the one-background rule. */
.swatch {
  display: block;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 1rem;
  line-height: 1.5;
}
.swatch-row { display: grid; gap: 0.75rem; margin-top: 1rem; }
@media (min-width: 40rem) { .swatch-row { grid-template-columns: 1fr 1fr; } }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.actions button { flex: 0 0 auto; }
button.secondary { background: none; border: 1px solid var(--line-strong); color: var(--fg); }
button.secondary:not(:disabled):hover { border-color: var(--accent); }
@media (max-width: 30rem) { .actions { flex-direction: column; } .actions button { width: 100%; } }

/* Two-pane tools: paste on the left, result on the right. */
.panes { display: grid; gap: 0.875rem; margin-top: 2rem; }
@media (min-width: 52rem) { .panes { grid-template-columns: 1fr 1fr; } }
.pane { display: flex; flex-direction: column; gap: 0.45rem; min-width: 0; }
.pane-label {
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Both panes are a fixed height and scroll inside themselves. Letting them grow with
   the content pushes the buttons off the bottom of a long document. */
.panes textarea,
.panes .output {
  margin-top: 0;
  height: clamp(18rem, 55vh, 34rem);
  min-height: 0;
  flex: none;
  overflow: auto;
}

/* JSON tokens. Foreground only — the background never changes. */
.t-key { color: var(--fg); }
.t-str { color: var(--accent); }
.t-num { color: var(--warn); font-variant-numeric: tabular-nums; }
.t-lit { color: var(--muted); }

/* Read-only output people copy out of. */
.output {
  margin: 0;
  font-family: inherit;
  max-height: 34rem;
  overflow: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1.55;
}

.note { color: var(--muted); font-size: 0.8rem; margin-top: 0.75rem; }

/* Data -------------------------------------------------------------------- */

dl {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.925rem;
}
@media (max-width: 34rem) {
  dl { grid-template-columns: 1fr; gap: 0.15rem; }
  dd { margin-bottom: 0.6rem; }
}
dt { color: var(--muted); overflow-wrap: anywhere; }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
dd.data { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }

/* Findings ---------------------------------------------------------------- */

.findings { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.finding { display: flex; gap: 0.7rem; align-items: flex-start; font-size: 0.925rem; }
.finding .icon { margin-top: 0.2rem; }
.finding span { color: var(--muted); }
.finding b { font-weight: 500; color: var(--fg); }

.verdict {
  display: flex;
  gap: 0.9rem;
  margin: 2.25rem 0 0;
  padding: 1.15rem 1.3rem;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
}
.verdict .icon { width: 1.3rem; height: 1.3rem; margin-top: 0.15rem; }
/* The heading can carry a name parsed out of a file, so it has to break. */
.verdict h2 { margin: 0; font-size: 1.1rem; font-weight: 500; overflow-wrap: anywhere; }
.verdict p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.verdict--good { border-left-color: var(--accent); }
.verdict--info { border-left-color: var(--line-strong); }
.verdict--warn { border-left-color: var(--warn); }
.verdict--bad { border-left-color: var(--bad); }

/* Caveats and footer ------------------------------------------------------ */

.caveats {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.caveats strong { color: var(--fg); font-weight: 500; }
.caveats ul { margin: 0.5rem 0 0; padding-left: 1.1rem; display: grid; gap: 0.25rem; }

.site-footer {
  flex: none;
  width: 100%;
  max-width: 46rem;
  margin: 4rem auto 0;
  padding-top: 3rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}
.site-footer-note {
  margin: 0 auto;
  max-width: 30rem;
  font-size: 0.85rem;
  line-height: 1.65;
  text-wrap: pretty;
}
.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 1.5rem 0 0;
  font-size: 0.75rem;
}
/* Quiet by default, lifts to full contrast on hover — matches the portfolio footer. */
.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.site-footer a:hover { color: var(--fg); }
.site-footer .sep { color: var(--line-strong); }

[hidden] { display: none !important; }
