:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --green-ink: #14532d;
  --amber: #d97706;
  --amber-bg: #fef3c7;
  --amber-ink: #78350f;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-ink: #7f1d1d;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1rem;
}

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

/* Header */
.site-header {
  padding: 2.5rem 0 1.25rem;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.site-header h1 {
  margin: 0 0 0.4rem;
  font-size: 1.85rem;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 1rem;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
}

/* Form */
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 600; padding: 0; margin-bottom: 0.5rem; }

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.field span { font-weight: 500; }
.field input,
.field select {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  min-height: 44px;
  width: 100%;
}
.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.dim-inputs {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.dim-inputs .field { flex: 1 1 6rem; min-width: 5.5rem; }
.dim-x {
  font-size: 1.1rem;
  color: var(--muted);
  padding-bottom: 0.75rem;
}

.unit-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-left: auto;
  align-self: flex-end;
}
.unit-btn {
  font: inherit;
  background: #fff;
  color: var(--ink-soft);
  border: 0;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
}
.unit-btn + .unit-btn { border-left: 1px solid var(--line); }
.unit-btn.is-active {
  background: var(--ink);
  color: #fff;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}
@media (min-width: 480px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.optional {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  margin-bottom: 1rem;
  background: #fafafa;
}
.optional summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.93rem;
  padding: 0.25rem 0;
}
.optional[open] summary { margin-bottom: 0.6rem; }

.cta {
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  width: 100%;
  min-height: 48px;
  cursor: pointer;
  letter-spacing: 0.01em;
}
.cta:hover { background: var(--accent); }
.cta:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-error {
  color: var(--red);
  font-size: 0.92rem;
  margin: 0.6rem 0 0;
  min-height: 1.2em;
}

/* Results */
.results h2 { margin-bottom: 0.85rem; }
.result-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.result-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.result-row:last-child { border-bottom: 0; }
.result-row dt {
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0;
}
.result-row dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}
.result-area {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.badge-green { background: var(--green-bg); color: var(--green-ink); }
.badge-amber { background: var(--amber-bg); color: var(--amber-ink); }
.badge-red   { background: var(--red-bg);   color: var(--red-ink); }
.badge-text { color: var(--ink); font-weight: 500; }

/* Recommendations */
.recs h2 { margin-bottom: 0.4rem; }
.recs-intro {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.recs-intro a { color: var(--accent); text-decoration: none; }
.recs-intro a:hover { text-decoration: underline; }

.lights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.loading { color: var(--muted); font-size: 0.95rem; margin: 0; }

.light-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: #fff;
}
.light-card h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.005em;
}
.light-best-for {
  margin: 0;
  display: inline-block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  font-weight: 600;
}
.light-specs {
  margin: 0.25rem 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.light-specs dt { font-weight: 500; color: var(--muted); margin: 0; }
.light-specs dd { margin: 0; font-variant-numeric: tabular-nums; }

.light-cta {
  margin-top: auto;
  display: inline-block;
  text-align: center;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.85rem;
  min-height: 40px;
  line-height: 1.6;
}
.light-cta:hover { background: var(--accent); }

.disclosure {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 1rem 0 0;
  border-top: 1px solid var(--line);
  padding-top: 0.85rem;
  line-height: 1.5;
}

/* FAQ */
.faq h2 { margin-bottom: 0.6rem; }
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0;
}
.faq details:last-of-type { border-bottom: 0; }
.faq summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink);
  list-style: none;
  padding-right: 1.5rem;
  position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0.1rem; top: 0;
  color: var(--muted);
  font-weight: 400;
  font-size: 1.2rem;
}
.faq details[open] summary::after { content: "−"; }
.faq p { margin: 0.6rem 0 0; color: var(--ink-soft); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding: 1.5rem 0 2rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer p { margin: 0.25rem 0; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.copy { font-size: 0.82rem; }

/* Methodology page reuses these styles via a .prose wrapper */
.prose {
  max-width: 64ch;
  margin: 0 auto;
}
.prose h1 { font-size: 1.65rem; margin: 1.5rem 0 0.5rem; }
.prose h2 { font-size: 1.2rem; margin: 1.5rem 0 0.4rem; }
.prose p, .prose li { color: var(--ink-soft); }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.92em;
}
.prose pre {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-size: 0.88rem;
}
.prose pre code { border: 0; padding: 0; background: none; }
.prose a { color: var(--accent); }

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f1f5f9;
    --ink-soft: #cbd5e1;
    --muted: #94a3b8;
    --line: #1e293b;
    --bg: #020617;
    --card: #0f172a;
    --accent: #2dd4bf;
    --green-bg: #14532d;
    --green-ink: #bbf7d0;
    --amber-bg: #78350f;
    --amber-ink: #fde68a;
    --red-bg: #7f1d1d;
    --red-ink: #fecaca;
  }
  .field input, .field select, .unit-btn, .light-card, .optional {
    background: #0b1220;
  }
  .unit-btn.is-active { background: var(--accent); color: #0f172a; }
  .cta { background: var(--accent); color: #0f172a; }
  .cta:hover { background: #5eead4; }
  .light-cta { background: var(--accent); color: #0f172a; }
  .light-cta:hover { background: #5eead4; }
  .site-header { background: linear-gradient(180deg, #0f172a 0%, var(--bg) 100%); }
}
