@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,700;1,9..40,400&family=Plus+Jakarta+Sans:wght@500;600;700&display=swap");

/* Design tokens, from DESIGN.md. Change these to restyle the whole site. */
:root {
  /* Colors */
  --navy: #0f172a;
  --navy-hover: #020617;
  --slate: #64748b;
  --slate-dark: #475569; /* helper text, ghost buttons */
  --sage: #059669;
  --sage-text: #047857; /* sage darkened a step so links pass contrast on white */
  --background: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --line-strong: #cbd5e1;
  --accent: var(--navy);
  --pass: #15803d;
  --fail: #b91c1c;
  --error: #ef4444;
  --success-fill: #22c55e15;
  --warning-fill: #eab30815;
  --warning-text: #854d0e;
  --error-fill: #ef444415;
  --info: #0ea5e9;

  /* Fonts */
  --font-head: "Plus Jakarta Sans", "DM Sans", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Spacing (8px base) */
  --xs: 4px;
  --sm: 8px;
  --md: 16px;
  --lg: 24px;
  --xl: 32px;
  --2xl: 48px;
  --3xl: 64px;

  /* Radius */
  --r-sm: 4px;
  --r: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* Elevation */
  --shadow-sm: 0 1px 3px #0f172a08;
  --shadow: 0 2px 6px #0f172a0d;
  --shadow-md: 0 4px 16px #0f172a12;
  --shadow-lg: 0 8px 32px #0f172a1a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--sage-text);
}

a:hover {
  text-decoration-thickness: 2px;
}

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

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--xl) var(--md) var(--3xl);
}

/* Headings and small text */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.brand {
  margin: 0;
  color: var(--navy);
  font-family: var(--font-head);
  font-size: 1.25rem;
  font-weight: 700;
}

nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--sm);
}

nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--sm);
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

nav a:hover {
  color: var(--navy);
}

.nav-group {
  margin-left: var(--sm);
  color: var(--slate);
  font-size: 0.75rem;
  font-weight: 500;
}

.nav-group:first-child {
  margin-left: 0;
}

nav a[aria-current="page"] {
  color: var(--navy);
  border-bottom-color: var(--navy);
  font-weight: 700;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: var(--font-head);
  color: var(--navy);
}

h1 {
  margin: var(--lg) 0 var(--md);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--md);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

h3 {
  margin: var(--lg) 0 var(--xs);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
}

h4,
h5 {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}

p {
  margin: 0 0 0.75rem;
}

.banner {
  margin-bottom: var(--lg);
  padding: var(--md);
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: var(--r);
  background: var(--card);
}

.tag {
  padding: var(--xs) 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--background);
  color: var(--navy);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
}

.hint {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

.error {
  padding: var(--md);
  border: 1px solid var(--line);
  border-left: 4px solid var(--error);
  border-radius: var(--r);
  background: var(--card);
  color: var(--fail);
  font-weight: 500;
}

.warning {
  color: var(--fail);
}

.question-text {
  padding: 12px var(--md);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--background);
}

details {
  margin-top: 1rem;
}

summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  color: var(--sage-text);
  font-weight: 500;
  cursor: pointer;
}

.scale {
  margin-top: 0.5rem;
}

.scale dt {
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
}

.scale dd {
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 400;
}

.note {
  margin-top: var(--2xl);
  padding-top: var(--md);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Cards: the white boxes */

.card {
  margin-bottom: var(--md);
  padding: var(--lg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.875rem;
}

dd {
  margin: 0 0 0.75rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.empty {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

ol {
  margin: 0;
  padding-left: 1.25rem;
}

ol.steps {
  margin-bottom: 1rem;
}

code,
#grades-file {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* file names only, never results */
  font-size: 0.875em;
}

/* Profile form */

.field {
  margin-bottom: 0.25rem;
}

.field textarea,
.field input,
.field select {
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  column-gap: 1rem;
}

.field-error {
  min-height: 1.25rem;
  margin: var(--xs) 0 var(--sm);
  color: var(--error);
  font-size: 0.75rem;
}

[aria-invalid="true"] {
  border: 2px solid var(--error) !important;
  box-shadow: 0 0 0 3px #ef444418;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 44px;
  margin: var(--sm) 0 var(--md);
  padding: 12px 0;
  font-size: 0.875rem;
  line-height: 1.5;
  cursor: pointer;
}

.checkbox-row input {
  flex: none;
  margin-top: 2px;
}

.field .checkbox-row {
  margin: 0;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--navy);
}

#goals legend {
  font-weight: 400;
}

/* Asking a model directly */

.ask-model {
  margin-top: 1.25rem;
  padding-top: var(--md);
  border-top: 1px solid var(--line);
}

.ask-row {
  display: flex;
  gap: var(--sm);
}

.ask-row select {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

.ask-row button {
  flex: none;
}

/* Run page */

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sm);
  margin-top: var(--md);
}

.button-row + .hint {
  margin-top: 12px;
}

.prewrap {
  font-style: normal;
  white-space: pre-wrap;
}

.run-case {
  padding: var(--md) 0;
  border-top: 1px solid var(--line);
}

.run-case h4 {
  margin: 0 0 var(--xs);
  font-size: 1rem;
}

.checks-list {
  margin: 0.25rem 0;
  padding: 0;
  list-style: none;
}

.passed {
  color: var(--pass);
  font-weight: 700;
}

.tag.case-differs {
  border-color: transparent;
  background: var(--warning-fill);
  color: var(--warning-text);
}

.case-compared {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}

.case-compared h5 {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
}

/* Results page: the scoreboard table and the failure cards */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th,
td {
  padding: var(--sm) 12px var(--sm) 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  white-space: nowrap;
}

thead th {
  border-bottom-color: var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.failure-group h3 {
  margin: var(--xl) 0 12px;
  font-size: 1.25rem;
}

.failure h4 {
  margin: 0;
  font-size: 1.125rem;
}

.failure .failure-meta {
  margin: 0.25rem 0 0.75rem;
}

.failure dd {
  font-weight: 400;
}

.failed {
  color: var(--fail);
  font-weight: 700;
}

.answer-text {
  max-height: 24rem;
  margin-top: var(--sm);
  padding: 12px var(--md);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  background: var(--background);
  font-size: 0.9375rem;
  white-space: pre-wrap;
}

.failure-actions {
  margin: 1rem 0 0;
}

/* Layout: side by side on wide screens, stacked on phones */

.compare {
  display: grid;
  column-gap: 1rem;
}

@media (min-width: 48rem) {
  .compare,
  .checks {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    column-gap: 1rem;
  }
}

/* Grading: radio buttons and checkboxes styled as buttons */

fieldset {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

legend,
.field-label {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  color: var(--navy);
  font-size: 0.875rem;
  font-weight: 500;
}

fieldset .hint {
  margin: -0.25rem 0 0.5rem;
}

.choice {
  position: relative;
  display: inline-block;
  margin: 0 var(--xs) var(--sm) 0;
}

.choice input {
  position: absolute;
  opacity: 0;
}

.choice span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--xs) var(--md);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--background);
  color: var(--navy);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

.choice span:hover {
  border-color: var(--navy);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.choice input:checked + span {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}

.choice input[value="pass"]:checked + span {
  border-color: transparent;
  background: var(--success-fill);
  color: var(--pass);
  box-shadow: inset 0 0 0 2px var(--pass);
}

.choice input[value="fail"]:checked + span {
  border-color: transparent;
  background: var(--error-fill);
  color: var(--fail);
  box-shadow: inset 0 0 0 2px var(--fail);
}

textarea,
input[type="text"],
input[type="email"],
input[type="number"],
select {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-bottom: var(--md);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--navy);
  font: inherit;
}

textarea:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="number"]:hover,
select:hover {
  border-color: var(--navy);
}

textarea:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus {
  padding: 9px 13px;
  border: 2px solid var(--navy);
  outline: 0;
  box-shadow: 0 0 0 3px #0f172a18;
}

textarea:disabled,
input:disabled,
select:disabled {
  background: var(--line-soft);
  border-color: var(--line);
}

textarea::placeholder,
input::placeholder {
  color: var(--slate);
}

select {
  margin-bottom: var(--lg);
}

button {
  min-height: 44px;
  padding: 10px 22px;
  border: 0;
  border-radius: var(--r);
  background: var(--navy);
  box-shadow: var(--shadow-sm);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}

button:hover {
  background: var(--navy-hover);
}

/* Space between a note and the buttons below it */
.hint + button {
  margin-top: var(--sm);
}

button.secondary {
  border: 1px solid var(--navy);
  background: transparent;
  box-shadow: none;
  color: var(--navy);
}

button.secondary:hover {
  background: #0f172a0a;
}

button.small {
  min-height: 44px; /* stays 44px tall for touch, even though it looks smaller */
  padding: 6px 14px;
}

.browser-grades {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.browser-grades li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--xs) var(--md);
  min-height: 48px;
  padding: var(--sm) 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.875rem;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--navy);
}

button.secondary:disabled {
  background: transparent;
}

/* Ingredient facts */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.fact-card {
  margin-top: 1rem;
}

.fact-card summary {
  color: var(--navy);
  font-family: var(--font-head);
  font-weight: 600;
  cursor: pointer;
}

.fact-card h4 {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.fact-card td {
  white-space: normal;
}

.status-uncertain {
  color: var(--warning-text);
  font-weight: 700;
}

/* Cloudflare's human check, between the email box and the button */
#human-check {
  margin: var(--sm) 0;
}
