/* ---------------------------------------------------------------------------
   Base layer: tokens, typography, layout, controls.
   Loaded on every page.

   Every colour is stated twice - once for light, once for dark - and never
   inherited into a surface that sets its own background. That rule exists
   because a single "color: inherit" once made every value on the page
   invisible in dark mode while the data was perfectly fine.
   --------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  --bg:            #f5f5f7;
  --surface:       #ffffff;
  --surface-2:     #f5f5f7;
  --surface-sunk:  #fafafa;
  --border:        #e3e3e6;
  --border-strong: #d2d2d7;

  --text:          #1d1d1f;
  --text-dim:      #6e6e73;
  --text-faint:    #8e8e93;

  --accent:        #0071e3;
  --accent-hover:  #0077ed;
  --accent-soft:   #e8f1fd;
  --on-accent:     #ffffff;

  --good:          #1d7f45;
  --good-soft:     #e4f4ea;
  --warn:          #9a6400;
  --warn-soft:     #fdf3e3;
  --bad:           #c9312a;
  --bad-soft:      #fdecec;

  --radius-lg: 18px;
  --radius:    12px;
  --radius-sm: 8px;

  --shadow:    0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto,
          system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #000000;
    --surface:       #1c1c1e;
    --surface-2:     #2c2c2e;
    --surface-sunk:  #161618;
    --border:        #2f2f31;
    --border-strong: #3a3a3c;

    --text:          #f5f5f7;
    --text-dim:      #a1a1a6;
    --text-faint:    #8e8e93;

    --accent:        #0a84ff;
    --accent-hover:  #3d9bff;
    --accent-soft:   #12243a;
    --on-accent:     #ffffff;

    --good:          #4ad07d;
    --good-soft:     #122a1c;
    --warn:          #e5b23c;
    --warn-soft:     #2e2513;
    --bad:           #ff6961;
    --bad-soft:      #331a19;

    --shadow:    0 1px 2px rgba(0,0,0,.5), 0 8px 24px rgba(0,0,0,.45);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 28px;
  height: 52px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

header .brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--text);
}

header .who {
  font-size: 13px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

header a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 2px;
  border-radius: var(--radius-sm);
  transition: color .15s ease;
}

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

/* --- layout -------------------------------------------------------------- */

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.021em;
  font-weight: 600;
  margin: 0 0 6px;
}

h2 { font-size: 19px; letter-spacing: -.012em; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 15px; letter-spacing: -.006em; font-weight: 600; margin: 0 0 2px; }

p.lead {
  font-size: 16px;
  color: var(--text-dim);
  margin: 0 0 28px;
  max-width: 62ch;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text);
}

/* --- surfaces ------------------------------------------------------------ */

.card, .section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px 30px;
  margin-bottom: 22px;
}

.section > h2 + .section-note { margin-top: 0; }

.section-note, .muted, p.help {
  color: var(--text-dim);
  font-size: 13.5px;
}

.section-note { margin: 0 0 18px; max-width: 68ch; }

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

input[type=text], input[type=email], input[type=url], input[type=number],
input[type=date], input[type=file], select, textarea {
  font: inherit;
  font-size: 15px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

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

input:focus-visible, select:focus-visible, textarea:focus-visible,
button:focus-visible, a:focus-visible, summary:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

textarea { min-height: 96px; resize: vertical; }

button, .button-link {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 9px 18px;
  border: 0;
  border-radius: 980px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .15s ease, opacity .15s ease;
}

button:hover, .button-link:hover {
  background: var(--accent-hover);
  color: var(--on-accent);
  text-decoration: none;
}

button.small, .button-link {
  padding: 7px 15px;
  font-size: 13.5px;
}

button.plain, .button-link.plain {
  background: var(--surface-2);
  color: var(--text);
}
button.plain:hover, .button-link.plain:hover {
  background: var(--border);
  color: var(--text);
}

button.danger {
  background: transparent;
  color: var(--bad);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
button.danger:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.inline-form { display: inline; }

/* --- sign-in ------------------------------------------------------------- */

body.narrow main { max-width: 460px; padding-top: 88px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}

.card input[type=email] { width: 100%; }
.card button[type=submit] { margin-top: 18px; }

.errors { color: var(--bad); font-size: 13px; margin-top: 8px; }

/* --- messages ------------------------------------------------------------ */

.messages { list-style: none; padding: 0; margin: 0 0 22px; }
.messages li {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}
.messages li.success { background: var(--good-soft); color: var(--good); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.messages li.error   { background: var(--bad-soft);  color: var(--bad);  border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }

/* --- guidance panel ------------------------------------------------------ */

.guide {
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.guide h2 { font-size: 14px; margin: 0 0 10px; letter-spacing: -.004em; }
.guide ul { margin: 0; padding-left: 20px; }
.guide li { margin: 6px 0; font-size: 13.5px; line-height: 1.5; }
.guide li.muted { color: var(--text-dim); }
.guide form { margin-top: 14px; }

/* --- tables -------------------------------------------------------------- */

.grid { border-collapse: collapse; width: 100%; }
.grid th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-faint);
  padding: 0 12px 10px;
}
.grid td {
  padding: 14px 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}
.grid tr:hover td { background: var(--surface-sunk); }

/* --- badges -------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 980px;
  background: var(--surface-2);
  color: var(--text-dim);
  margin-left: 6px;
  vertical-align: 2px;
}
.badge.locked   { background: var(--warn-soft); color: var(--warn); }
.badge.deviates { background: var(--good-soft); color: var(--good); }

/* --- disclosure ---------------------------------------------------------- */

details summary {
  cursor: pointer;
  font-size: 13.5px;
  color: var(--accent);
  list-style: none;
  padding: 4px 0;
  user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: "›";
  display: inline-block;
  margin-right: 7px;
  transition: transform .15s ease;
  font-weight: 600;
}
details[open] > summary::before { transform: rotate(90deg); }

pre {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}


header .sep {
  width: 1px;
  height: 16px;
  background: var(--border-strong);
  display: inline-block;
}
header .me { color: var(--text-faint); }
@media (max-width: 720px) {
  header { height: auto; padding: 10px 18px; flex-wrap: wrap; }
  header .who { gap: 8px; font-size: 12px; }
  header .sep { display: none; }
  main { padding: 28px 18px 60px; }
  h1 { font-size: 24px; }
  .card, .section { padding: 20px 18px; border-radius: var(--radius); }
}


/* --- About ---------------------------------------------------------------- */

.about .dedication {
  margin: 0 0 26px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface-sunk);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

.about h2 {
  margin: 26px 0 8px;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.about ul.about-areas {
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
  color: var(--text);
}

.about ul.about-areas li {
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.about ul.about-areas li:last-child { border-bottom: 0; }

.about .byline {
  margin-left: 8px;
  font-size: 14px;
  color: var(--text-dim);
}

/* The name carries its byline wherever it appears. */
header .brand .byline {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-faint);
}
@media (max-width: 720px) {
  header .brand .byline { display: none; }
}
