/* renewal-watch. Hand-written, no build step, system fonts only.
   Change a token, not a rule. Light is the default; the dark tokens appear
   twice (chosen by hand via <html data-mode="dark">, and "Auto" on a device
   in dark mode) and must stay identical (tests/test_frontend.py).
   Status is always word + colour, never colour alone. */

:root {
  color-scheme: light;
  --page: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #efefea;
  --ink: #15171a;
  --ink-2: #3f444b;
  --muted: #5f646b;
  --line: #dcdcd5;
  --line-strong: #b9b9b0;
  --accent: #1f5c4a;
  --accent-ink: #ffffff;
  --accent-wash: #e2efe9;
  --link: #1d5a8f;
  --focus: #2b6cb0;
  --fine-ink: #1b6a34;
  --fine-wash: #e4f3e8;
  --due-ink: #1d5a8f;
  --due-wash: #e5eef8;
  --overdue-ink: #7d4a00;
  --overdue-wash: #fbefd8;
  --critical-ink: #a3361a;
  --critical-wash: #fbe5dd;
  --expired-ink: #9b1c2c;
  --expired-wash: #f9e2e5;
  --problem-ink: #643a99;
  --problem-wash: #efe7f9;
  --unchecked-ink: #55575c;
  --unchecked-wash: #ebebe7;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 2px 8px rgb(0 0 0 / 0.04);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --text: 1rem;
  --text-small: 0.875rem;
  --text-lead: 1.125rem;
  --text-h1: clamp(1.6rem, 1.2rem + 2vw, 2.25rem);
  --text-h2: 1.25rem;
  --leading: 1.55;
  --radius: 10px;
  --tap: 44px;
  --gutter: 16px;
  --shell: 960px;
  --measure: 68ch;
}

:root[data-mode="dark"] {
  color-scheme: dark;
  --page: #111315;
  --surface: #1a1d20;
  --surface-2: #23272b;
  --ink: #eceeef;
  --ink-2: #c9cdd1;
  --muted: #a1a7ad;
  --line: #2e3337;
  --line-strong: #464c52;
  --accent: #6cc3a2;
  --accent-ink: #0d1412;
  --accent-wash: #16302a;
  --link: #8cc0f0;
  --focus: #8cc0f0;
  --fine-ink: #7fd69a;
  --fine-wash: #16301f;
  --due-ink: #8cc0f0;
  --due-wash: #172738;
  --overdue-ink: #f2c46d;
  --overdue-wash: #352a12;
  --critical-ink: #f5a083;
  --critical-wash: #3a2118;
  --expired-ink: #f59aa6;
  --expired-wash: #3a1a20;
  --problem-ink: #c8a8f2;
  --problem-wash: #2a2038;
  --unchecked-ink: #b7bbc0;
  --unchecked-wash: #2a2d31;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    color-scheme: dark;
    --page: #111315;
    --surface: #1a1d20;
    --surface-2: #23272b;
    --ink: #eceeef;
    --ink-2: #c9cdd1;
    --muted: #a1a7ad;
    --line: #2e3337;
    --line-strong: #464c52;
    --accent: #6cc3a2;
    --accent-ink: #0d1412;
    --accent-wash: #16302a;
    --link: #8cc0f0;
    --focus: #8cc0f0;
    --fine-ink: #7fd69a;
    --fine-wash: #16301f;
    --due-ink: #8cc0f0;
    --due-wash: #172738;
    --overdue-ink: #f2c46d;
    --overdue-wash: #352a12;
    --critical-ink: #f5a083;
    --critical-wash: #3a2118;
    --expired-ink: #f59aa6;
    --expired-wash: #3a1a20;
    --problem-ink: #c8a8f2;
    --problem-wash: #2a2038;
    --unchecked-ink: #b7bbc0;
    --unchecked-wash: #2a2d31;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 2px 8px rgb(0 0 0 / 0.3);
  }
}

/* --- base ------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font: var(--text) / var(--leading) var(--font);
}

main {
  flex: 1;
  padding-block: 32px 48px;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.6em;
}

h1 {
  font-size: var(--text-h1);
}

h2 {
  font-size: var(--text-h2);
  margin-top: 1.6em;
}

p,
ul,
ol {
  margin: 0 0 1em;
}

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

code,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

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

.shell {
  width: 100%;
  max-width: calc(var(--shell) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus {
  top: 8px;
}

/* --- frame ---------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding-block: 8px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-small);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink-2);
}

/* --- controls --------------------------------------------------------------- */

input,
select,
textarea,
button {
  font: inherit;
  font-size: max(16px, 1rem); /* no zoom on focus in mobile Safari */
}

input,
select,
textarea {
  min-height: var(--tap);
  padding: 8px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 8px 18px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.mode-switch {
  margin-right: 8px;
}

/* --- content ---------------------------------------------------------------- */

.hero .lead,
.lead {
  font-size: var(--text-lead);
  color: var(--ink-2);
  max-width: var(--measure);
}

.prose {
  max-width: var(--measure);
}

.draft {
  padding: 12px 14px;
  background: var(--surface-2);
  border-left: 4px solid var(--line-strong);
  border-radius: 4px;
}

.message {
  max-width: var(--measure);
}

/* Status words and colours are fixed (CLAUDE.md); the word is always shown. */
.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--status-ink);
  background: var(--status-wash);
}

.status[data-status="fine"] {
  --status-ink: var(--fine-ink);
  --status-wash: var(--fine-wash);
}

.status[data-status="due"] {
  --status-ink: var(--due-ink);
  --status-wash: var(--due-wash);
}

.status[data-status="overdue"] {
  --status-ink: var(--overdue-ink);
  --status-wash: var(--overdue-wash);
}

.status[data-status="critical"] {
  --status-ink: var(--critical-ink);
  --status-wash: var(--critical-wash);
}

.status[data-status="expired"] {
  --status-ink: var(--expired-ink);
  --status-wash: var(--expired-wash);
}

.status[data-status="problem"] {
  --status-ink: var(--problem-ink);
  --status-wash: var(--problem-wash);
}

.status[data-status="unchecked"] {
  --status-ink: var(--unchecked-ink);
  --status-wash: var(--unchecked-wash);
}

/* --- utilities --------------------------------------------------------------- */

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

.mono {
  font-family: var(--mono);
}

.note {
  padding: 10px 14px;
  background: var(--surface-2);
  border-left: 4px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink-2);
  max-width: var(--measure);
}

.plain {
  margin: 0 0 0.5em;
  padding: 0;
  list-style: none;
}

/* --- header navigation ------------------------------------------------------------ */

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 20px;
}

.nav-links {
  display: flex;
  gap: 0 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--ink-2);
}

/* --- the check form ------------------------------------------------------------------ */

.check-form {
  max-width: 560px;
  margin-block: 24px 8px;
}

.check-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-row input {
  flex: 1 1 220px;
  min-width: 0;
}

.field-error {
  margin: 8px 0 0;
  color: var(--critical-ink);
  font-weight: 600;
}

.form-status:empty {
  display: none;
}

.form-status {
  margin: 8px 0 0;
  color: var(--ink-2);
}

altcha-widget {
  display: block;
  margin-top: 12px;
  --altcha-border-radius: var(--radius);
  --altcha-border-color: var(--line);
  --altcha-color-base: var(--surface);
  --altcha-color-base-content: var(--ink);
  --altcha-color-primary: var(--accent);
  --altcha-color-success: var(--fine-ink);
  --altcha-color-error: var(--critical-ink);
  --altcha-max-width: 100%;
}

button:disabled,
input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- landing ------------------------------------------------------------------------- */

.point-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px 24px;
  margin: 32px 0 16px;
  padding: 0;
  list-style: none;
}

.point-list h3 {
  font-size: var(--text-lead);
  margin-bottom: 0.3em;
}

.point-list p {
  color: var(--ink-2);
}

/* --- the result page ----------------------------------------------------------------- */

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mono-heading {
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.checked-at {
  color: var(--muted);
}

.progress {
  padding: 12px 14px;
  background: var(--due-wash);
  color: var(--ink);
  border-radius: var(--radius);
  max-width: var(--measure);
}

.summary-line {
  font-size: var(--text-lead);
  font-weight: 600;
  max-width: var(--measure);
}

.timeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

@media (min-width: 720px) {
  .timeline {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.step {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.step p {
  margin-bottom: 0.4em;
}

.step-date {
  font-weight: 700;
}

.step-title {
  color: var(--ink-2);
}

.step-text {
  font-size: var(--text-small);
  color: var(--ink-2);
}

.card {
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 8px;
}

.card-head h3 {
  margin: 0;
  font-size: var(--text-lead);
  overflow-wrap: anywhere;
}

.cert-facts,
.domain-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 16px;
  margin: 0 0 1em;
}

.domain-facts {
  grid-template-columns: 1fr;
}

.cert-facts dt,
.domain-facts dt {
  color: var(--muted);
  font-size: var(--text-small);
}

.cert-facts dd,
.domain-facts dd {
  margin: 0;
}

.schedule {
  color: var(--ink-2);
}

.finding {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 4px solid var(--overdue-ink);
  background: var(--overdue-wash);
  border-radius: 4px;
}

.finding p {
  margin-bottom: 0.4em;
}

.finding-title {
  font-weight: 700;
}

.key {
  font-weight: 600;
}

.rhythm h4 {
  margin: 1em 0 0.3em;
  font-size: var(--text);
}

.forecast {
  margin: 0 0 1em;
  padding: 0;
  list-style: none;
}

.forecast li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.forecast p {
  margin-bottom: 0.3em;
}

.how summary {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  cursor: pointer;
  color: var(--link);
}

.evidence {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-2);
  font-size: var(--text-small);
}

.cta {
  margin-top: 32px;
  padding: 16px;
  background: var(--accent-wash);
  border-radius: var(--radius);
}

.cta h2 {
  margin-top: 0;
}

fieldset {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 4px;
  font-weight: 600;
}

.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  overflow-wrap: anywhere;
}

.pick input {
  width: 22px;
  height: 22px;
  min-height: 0;
  flex: none;
}

/* --- prose pages ---------------------------------------------------------------- */

.data {
  width: 100%;
  margin: 0 0 1em;
  border-collapse: collapse;
}

.data th,
.data td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.coming-soon {
  max-width: 560px;
  margin-block: 16px;
}

.coming-soon label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

/* --- the watch (signed in) --------------------------------------------------------- */

.muted {
  color: var(--muted);
}

.small {
  font-size: var(--text-small);
  overflow-wrap: anywhere;
}

.notice {
  padding: 10px 14px;
  background: var(--accent-wash);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  max-width: var(--measure);
}

.form-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: var(--text-small);
}

.check-form .pick {
  display: flex;
  font-weight: 400;
}

.check-form select {
  flex: 1 1 220px;
  min-width: 0;
}

.check-form textarea {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

button.secondary,
button.danger {
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
}

button.danger {
  color: var(--expired-ink);
  border-color: var(--expired-ink);
}

form.inline {
  display: inline;
  margin: 0;
}

.link-button {
  min-height: var(--tap);
  padding: 0;
  color: var(--ink-2);
  background: none;
  font-weight: 400;
  text-decoration: underline;
}

.settings {
  margin: 0 0 20px;
}

.finding form {
  margin-top: 8px;
}

/* Tables collapse to cards on phones (CLAUDE.md, "Mobile first"). */
@media (max-width: 640px) {
  .data.stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .data.stack tr {
    display: block;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .data.stack td {
    display: grid;
    grid-template-columns: 9em 1fr;
    gap: 8px;
    padding: 4px 0;
    border: 0;
    overflow-wrap: anywhere;
  }

  .data.stack td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: var(--text-small);
  }
}
