:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --muted: #94a3b8;
  --text: #f1f5f9;
  --accent: #14b8a6;
  --danger: #f87171;
  --warn: #fbbf24;
  --border: #334155;
  --border-strong: #475569;
  --prose-muted: #e2e8f0;
  --btn-secondary-bg: #334155;
  --btn-secondary-fg: #f1f5f9;
  --badge-ok-bg: rgba(20, 184, 166, 0.25);
  --badge-ok-fg: #5eead4;
  --badge-fail-bg: rgba(248, 113, 113, 0.2);
  --accent-soft: rgba(20, 184, 166, 0.06);
  --btn-primary-fg: #042f2e;
}

[data-theme="light"] {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --muted: #64748b;
  --text: #0f172a;
  --accent: #0d9488;
  --danger: #dc2626;
  --warn: #b45309;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --prose-muted: #334155;
  --btn-secondary-bg: #e2e8f0;
  --btn-secondary-fg: #0f172a;
  --badge-ok-bg: rgba(13, 148, 136, 0.18);
  --badge-ok-fg: #0f766e;
  --badge-fail-bg: rgba(220, 38, 38, 0.12);
  --accent-soft: rgba(13, 148, 136, 0.08);
  --btn-primary-fg: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

.wrap {
  max-width: min(94vw, 76rem);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.site-top {
  border-bottom: 1px solid var(--border);
  margin: -0.25rem -0.25rem 2rem;
  padding-bottom: 1.25rem;
}

@media (min-width: 640px) {
  .nav-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem 1.5rem;
  }
}

.nav-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

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

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.35rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

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

.nav-links a.active {
  color: var(--accent);
  font-weight: 600;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  vertical-align: middle;
}

.theme-toggle:hover .theme-toggle-track {
  opacity: 0.92;
  filter: brightness(1.08);
}

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

.theme-toggle-track {
  display: block;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--border-strong);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--text);
  box-shadow:
    0 1px 2px rgb(0 0 0 / 0.2),
    0 0 1px rgb(0 0 0 / 0.12);
  transition: transform 0.22s ease;
}

[data-theme="light"] .theme-toggle-thumb {
  transform: translateX(calc(2.75rem - 1.125rem - 4px));
}

.site-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  padding-bottom: 1rem;
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.65rem, 3vw, 2.1rem);
  font-weight: 650;
}

.site-header .lead {
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.1rem);
  max-width: 55ch;
}

.prose {
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 65ch;
}

.prose h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.65rem;
  font-weight: 650;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 1.1rem;
  margin: 1.35rem 0 0.5rem;
  font-weight: 600;
  color: var(--text);
}

.prose p {
  margin: 0 0 1rem;
  color: var(--prose-muted);
}

.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose a {
  font-weight: 500;
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.home-copy h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
}

.home-photo {
  margin: 0 auto;
  padding: 0;
  align-self: center;
  width: fit-content;
  max-width: 100%;
}

.home-photo img {
  display: block;
  width: auto;
  max-width: min(100%, 280px);
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 28px rgb(0 0 0 / 0.18);
}

[data-theme="light"] .home-photo img {
  box-shadow: 0 4px 20px rgb(15 23 42 / 0.08);
}

.home-photo-caption {
  margin: 0.65rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.citation {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.98rem;
  line-height: 1.55;
  border: 1px solid var(--border);
  border-left-width: 3px;
}

.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone input[type="file"] {
  display: none;
}

.btn {
  display: inline-block;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  border: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: var(--btn-primary-fg);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-fg);
  margin-left: 0.5rem;
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-strong);
}

.message-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  font-size: 0.88rem;
}

.message-list li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.message-list li.blocking {
  color: var(--danger);
}

.message-list li.warning {
  color: var(--warn);
}

.gate-form input[type="password"] {
  width: 100%;
  max-width: 20rem;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  margin: 0.5rem 0 1rem;
}

.instructions {
  font-size: 0.88rem;
  color: var(--muted);
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-ok {
  background: var(--badge-ok-bg);
  color: var(--badge-ok-fg);
}

.badge-fail {
  background: var(--badge-fail-bg);
  color: var(--danger);
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
