/* Legibl — one stylesheet, no build step, no dependencies.
   The same choice the documentation site makes, for the same reason: a site
   this size does not earn a toolchain, and a second toolchain is a cost paid
   every week against a one-time convenience.

   Light and dark are both first-class. The OS preference decides. */

:root {
  color-scheme: light dark;

  --bg:          #ffffff;
  --bg-soft:     #f6f7f9;
  --bg-code:     #f2f3f5;
  --fg:          #16191d;
  --fg-soft:     #545c66;
  --border:      #dfe3e8;
  --border-soft: #eceef1;
  --accent:      #1f5fbf;
  --accent-soft: #e8f0fc;

  --ok:      #1a7f4b;
  --ok-bg:   #e7f5ee;
  --warn:    #8a5b00;
  --warn-bg: #fdf3e0;
  --bad:     #b3261e;
  --bad-bg:  #fdeceb;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
          Arial, sans-serif;

  --measure: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #14171a;
    --bg-soft:     #1b1f23;
    --bg-code:     #1e2226;
    --fg:          #e6e9ec;
    --fg-soft:     #9aa4ae;
    --border:      #2c3238;
    --border-soft: #23282d;
    --accent:      #79aaf5;
    --accent-soft: #1b2738;

    --ok:      #6dd39b;
    --ok-bg:   #16261e;
    --warn:    #e8b661;
    --warn-bg: #2a2113;
    --bad:     #f28b82;
    --bad-bg:  #2c1a19;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--sans);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--bg);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.masthead-inner {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.wordmark {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-decoration: none;
}

.masthead nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.masthead nav a { color: var(--fg-soft); text-decoration: none; font-size: 0.95rem; }
.masthead nav a:hover { color: var(--fg); text-decoration: underline; }
.masthead .spacer { flex: 1; }

.cta,
button.cta {
  background: var(--accent);
  color: #fff !important;
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  text-decoration: none;
}

/* Page -------------------------------------------------------------------- */

.page {
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

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

h1 { font-size: 2rem; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 0.75rem; }
h2 { font-size: 1.3rem; margin: 2.25rem 0 0.6rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
p  { margin: 0 0 1rem; max-width: var(--measure); }
ul, ol { max-width: var(--measure); }
li { margin: 0.25rem 0; }

.lede { font-size: 1.15rem; color: var(--fg-soft); max-width: var(--measure); }
.muted { color: var(--fg-soft); }
.small { font-size: 0.9rem; }

code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-code);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: 0.875rem; line-height: 1.6; }

/* Layout helpers ---------------------------------------------------------- */

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin: 1.5rem 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  background: var(--bg-soft);
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.table-scroll { overflow-x: auto; margin: 1rem 0; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Callouts and pills ------------------------------------------------------ */

.note, .warn, .stop {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.8rem 1rem;
  border-radius: 0 8px 8px 0;
  margin: 1.25rem 0;
  max-width: var(--measure);
}
.warn { border-left-color: var(--warn); background: var(--warn-bg); }
.stop { border-left-color: var(--bad); background: var(--bad-bg); }
.note p:last-child, .warn p:last-child, .stop p:last-child { margin-bottom: 0; }
.callout-title { display: block; font-weight: 650; margin-bottom: 0.35rem; }

.pill {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-yes { background: var(--ok-bg); color: var(--ok); }
.pill-part { background: var(--warn-bg); color: var(--warn); }
.pill-no { background: var(--bad-bg); color: var(--bad); }

/* Flash ------------------------------------------------------------------- */

.flash {
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin: 0 0 1.25rem;
  max-width: var(--measure);
}
.flash-info { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--bad-bg); color: var(--bad); }

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

form { max-width: var(--measure); }

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 1rem 0 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.6rem;
}

textarea { min-height: 9rem; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button, .button {
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary, .button.secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--border);
}
button.danger, .button.danger { background: var(--bad); }

.field-error { color: var(--bad); font-size: 0.88rem; margin: 0.25rem 0 0; }

.inline-form { display: inline; }

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 1rem; }
.checkbox-row label { margin: 0; font-weight: 400; }
.checkbox-row input { width: auto; }

/* Key display ------------------------------------------------------------- */

.key-once {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
  max-width: 100%;
}
.key-value {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.8rem;
  margin: 0.6rem 0;
  overflow-wrap: anywhere;
}

/* Status ------------------------------------------------------------------ */

.status-banner {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin: 1.25rem 0;
}
.status-ok { background: var(--ok-bg); border-color: var(--ok); }
.status-degraded { background: var(--warn-bg); border-color: var(--warn); }
.status-down { background: var(--bad-bg); border-color: var(--bad); }
.status-unknown { background: var(--bg-soft); }
.status-word { font-weight: 700; font-size: 1.05rem; }

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

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  margin-top: 3rem;
  padding: 2rem 1.25rem 2.5rem;
}
.footer-inner {
  max-width: 68rem;
  margin: 0 auto;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
}
.footer-group h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-soft); margin: 0 0 0.5rem; }
.footer-group ul { list-style: none; margin: 0; padding: 0; }
.footer-group li { margin: 0.25rem 0; }
.footer-group a { color: var(--fg); text-decoration: none; font-size: 0.94rem; }
.footer-group a:hover { text-decoration: underline; }
.footer-note {
  max-width: 68rem;
  margin: 1.75rem auto 0;
  color: var(--fg-soft);
  font-size: 0.88rem;
}
