/* Layout and components. Colours come from tokens.css only. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 1rem;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.6rem 1rem;
  z-index: 10;
}

.skip-link:focus {
  left: 0;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
}

.lockup:hover {
  text-decoration: none;
}

.lockup-mark {
  display: block;
  width: 28px;
  height: 28px;
}

.lockup-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.lockup-word {
  font-weight: 700;
  font-size: 0.98rem;
  letter-spacing: 0.16em;
}

.lockup-by {
  margin-top: 0.32rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.92rem;
}

.site-nav a {
  color: var(--ink-muted);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent);
}

/* Main -------------------------------------------------------------------- */

.site-main {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.eyebrow {
  margin: 0 0 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 0 0 1rem;
  max-width: 54ch;
  font-size: 1.08rem;
  color: var(--ink-muted);
}

/* Form -------------------------------------------------------------------- */

.check-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.75rem;
  max-width: 34rem;
}

.check-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.check-form input::placeholder {
  color: var(--ink-muted);
  opacity: 0.8;
}

.check-form button {
  flex: 0 0 auto;
  padding: 0.8rem 1.15rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.check-form button:hover {
  opacity: 0.92;
}

.check-form-compact {
  margin-top: 1.25rem;
  max-width: 26rem;
}

.form-hint {
  margin: 0.8rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.form-error {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  color: var(--bad);
}

/* Home sections ----------------------------------------------------------- */

.overview,
.prose-block {
  margin-top: 3rem;
}

.overview h2 {
  margin-top: 0;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.9rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-item {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.check-item h3 {
  letter-spacing: 0.01em;
}

.check-item p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.prose-block {
  max-width: 62ch;
}

/* Report ------------------------------------------------------------------ */

.report-head {
  display: grid;
  grid-template-columns: minmax(11rem, 13rem) 1fr;
  gap: 2rem;
  align-items: start;
}

.score-card {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.skyline {
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  height: 4.6rem;
}

.skyline-bar {
  width: 0.62rem;
  background: var(--grade-ink, var(--accent));
  border-radius: 3px 3px 0 0;
}

.score-body {
  min-width: 0;
}

.score-caption {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.score-grade {
  margin: 0.15rem 0 0;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--grade-ink, var(--ink));
}

.score-number {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  color: var(--ink-muted);
}

.score-number span {
  font-size: 0.85rem;
}

.score-verdict {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

/* Grade colours and the three bars of the skyline. */
.grade-a {
  --grade-ink: var(--good);
}
.grade-b {
  --grade-ink: var(--good);
}
.grade-c {
  --grade-ink: var(--warn);
}
.grade-d {
  --grade-ink: var(--warn);
}
.grade-e {
  --grade-ink: var(--bad);
}
.grade-f {
  --grade-ink: var(--bad);
}

.grade-a .skyline-bar:nth-child(1),
.grade-b .skyline-bar:nth-child(1),
.grade-c .skyline-bar:nth-child(1) {
  height: 100%;
}
.grade-a .skyline-bar:nth-child(2) {
  height: 100%;
}
.grade-b .skyline-bar:nth-child(2) {
  height: 100%;
}
.grade-c .skyline-bar:nth-child(2) {
  height: 74%;
}
.grade-d .skyline-bar:nth-child(1) {
  height: 72%;
}
.grade-d .skyline-bar:nth-child(2) {
  height: 52%;
}
.grade-e .skyline-bar:nth-child(1) {
  height: 46%;
}
.grade-e .skyline-bar:nth-child(2) {
  height: 32%;
}
.grade-f .skyline-bar:nth-child(1) {
  height: 24%;
}
.grade-f .skyline-bar:nth-child(2) {
  height: 16%;
}
.grade-a .skyline-bar:nth-child(3) {
  height: 100%;
}
.grade-b .skyline-bar:nth-child(3) {
  height: 72%;
}
.grade-c .skyline-bar:nth-child(3) {
  height: 44%;
}
.grade-d .skyline-bar:nth-child(3) {
  height: 34%;
}
.grade-e .skyline-bar:nth-child(3) {
  height: 22%;
}
.grade-f .skyline-bar:nth-child(3) {
  height: 10%;
}

.report-intro h1 {
  overflow-wrap: anywhere;
}

.report-meta {
  margin: 0.6rem 0 0;
  font-size: 0.88rem;
  color: var(--ink-muted);
}

.report-note {
  margin: 1rem 0 0;
  padding-left: 0.8rem;
  border-left: 3px solid var(--border);
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.findings {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}

.finding {
  padding: 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--status-ink, var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.status-pass {
  --status-ink: var(--good);
  --status-soft: var(--good-soft);
}
.status-warn {
  --status-ink: var(--warn);
  --status-soft: var(--warn-soft);
}
.status-fail {
  --status-ink: var(--bad);
  --status-soft: var(--bad-soft);
}
.status-info {
  --status-ink: var(--info);
  --status-soft: var(--info-soft);
}

.finding-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.finding-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.pill {
  flex: 0 0 auto;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--status-soft);
  color: var(--status-ink);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.finding-summary {
  margin: 0.8rem 0 0;
  max-width: 66ch;
}

.block {
  margin-top: 1rem;
}

.block-label {
  display: block;
  margin: 0 0 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.record {
  margin: 0;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.record-fix {
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
}

.finding-why {
  margin: 1rem 0 0;
  max-width: 66ch;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.finding-why .block-label {
  margin-bottom: 0.25rem;
}

.finding-note {
  margin: 1rem 0 0;
  padding-left: 0.8rem;
  border-left: 2px solid var(--border);
  max-width: 66ch;
  font-size: 0.86rem;
  color: var(--ink-muted);
}

.footnote {
  margin: 2rem 0 0;
  max-width: 62ch;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* Prose pages ------------------------------------------------------------- */

.page {
  max-width: 64ch;
}

.page h2 {
  margin-top: 2.4rem;
}

.weights {
  width: 100%;
  max-width: 26rem;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.weights th,
.weights td {
  padding: 0.5rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.weights th {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.weights th:last-child,
.weights td:last-child {
  width: 6rem;
  text-align: right;
}

.plain-list {
  padding-left: 1.1rem;
  max-width: 66ch;
}

.plain-list li {
  margin: 0.55rem 0;
}

/* Footer ------------------------------------------------------------------ */

.site-footer {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.footer-line {
  margin: 0;
}

.footer-nav {
  display: flex;
  gap: 1rem;
}

/* Small screens ----------------------------------------------------------- */

@media (max-width: 40rem) {
  .report-head {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .score-card {
    max-width: 20rem;
  }

  .check-form {
    flex-direction: column;
  }

  .check-form button {
    width: 100%;
  }

  .site-header {
    flex-wrap: wrap;
  }
}
