*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --body-bg: #fafaf9;
  --text: #111827;
  --muted: #6b7280;
  --subtle: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --surface: #f8fafc;
  --surface-hover: #f0f9ff;
  --accent: #0e7490;
  --accent-mid: #0891b2;
  --accent-light: #22d3ee;
  --accent-soft: #f0f9ff;
  --accent-border: #bae6fd;
  --green: #15803d;
  --green-soft: #f0fdf4;
  --green-border: #bbf7d0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.05);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--body-bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout ─────────────────────────────── */

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ─── Header ─────────────────────────────── */

header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0,0,0,0.04);
}

header .container {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  flex-wrap: nowrap;
}

/* ─── Brand / wordmark ───────────────────── */

.logo-mark {
  display: none;
}

.brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  flex-shrink: 0;
  line-height: 1;
}

.brand a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  line-height: 1;
}

.brand a:hover {
  color: var(--text);
  text-decoration: none;
}

.brand-spec {
  color: var(--text);
}

.brand-accent {
  color: var(--accent-mid);
}

/* ─── Hamburger toggle ────────────────────── */

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.45rem;
  margin-left: auto;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
  height: 36px;
  width: 36px;
  flex-shrink: 0;
}

.nav-toggle:hover {
  background: var(--surface-hover);
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.15s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── Nav ─────────────────────────────────── */

nav {
  flex: 1;
  display: flex;
  align-items: center;
}

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.1rem;
  align-items: center;
}

nav > ul > li {
  position: relative;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
  display: block;
  white-space: nowrap;
}

nav a:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

/* ─── Dropdown nav ────────────────────────── */

.has-dropdown > a::after {
  content: " ▾";
  font-size: 0.65em;
  opacity: 0.55;
  vertical-align: middle;
}

.dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 185px;
  z-index: 200;
  padding: 0.4rem;
  list-style: none;
  margin: 0;
}

.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown {
  display: block;
}

.dropdown li {
  display: block;
}

.dropdown a {
  display: block;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  white-space: nowrap;
}

.dropdown a:hover {
  background: var(--surface-hover);
  color: var(--accent-mid);
}

/* ─── Mobile nav ──────────────────────────── */

@media (max-width: 768px) {
  header .container {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
  }

  /* Brand takes remaining space, toggle and hamburger stay inline */
  .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .units-toggle {
    flex-shrink: 0;
    order: 2;
  }

  .nav-toggle {
    display: flex;
    flex-shrink: 0;
    order: 3;
    margin-left: 0;
  }

  /* Nav drops to its own full-width row */
  nav {
    display: none;
    width: 100%;
    flex: 0 0 100%;
    order: 99;
    height: auto;
    border-top: 1px solid var(--border);
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
    margin-top: 0;
  }

  nav.open {
    display: block;
  }

  nav ul {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  nav > ul > li {
    width: 100%;
  }

  nav a {
    padding: 0.55rem 0.5rem;
    font-size: 0.9rem;
    white-space: normal;
  }

  .has-dropdown > a::after {
    float: right;
    margin-top: 2px;
  }

  .dropdown {
    position: static;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--accent-border);
    border-radius: 0;
    margin: 0 0 0 1rem;
    padding: 0.2rem 0;
    background: transparent;
    display: none;
  }

  .has-dropdown.open .dropdown {
    display: block;
  }

  .has-dropdown:hover .dropdown,
  .has-dropdown:focus-within .dropdown {
    display: none;
  }

  .has-dropdown.open .dropdown {
    display: block;
  }

  .dropdown a {
    font-size: 0.875rem;
    padding: 0.45rem 0.8rem;
    color: var(--muted);
  }
}

/* ─── Units segmented control ────────────── */

.units-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 100px;
  padding: 3px;
  gap: 2px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

.units-toggle:hover .units-opt:not(.active) {
  color: var(--text);
}

.units-opt {
  padding: 0.2rem 0.65rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  line-height: 1.5;
  letter-spacing: 0.02em;
  user-select: none;
}

.units-opt.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 4px rgba(14, 116, 144, 0.35);
}

/* ─── General links ──────────────────────── */

a {
  color: var(--accent-mid);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Main content ───────────────────────── */

main.container {
  background: var(--bg);
  margin-top: 0;
  padding-top: 2.5rem;
  padding-bottom: 3.5rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 110px);
}

/* ─── Typography ─────────────────────────── */

h1 {
  font-size: 1.875rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem;
  color: var(--text);
}

h2 {
  font-size: 1.175rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 2rem 0 0.5rem;
  color: var(--text);
}

h3 {
  font-size: 1rem;
  font-weight: 650;
  margin: 1.5rem 0 0.4rem;
}

p {
  margin: 0.5rem 0 1rem;
  color: var(--text);
}

ul, ol {
  margin: 0.5rem 0 1rem;
  padding-left: 1.4rem;
}

li {
  margin-bottom: 0.3rem;
}

/* ─── Tables ──────────────────────────────── */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

th,
td {
  padding: 0.65rem 0.9rem;
  vertical-align: top;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td:not(:last-child),
th:not(:last-child) {
  border-right: 1px solid var(--border);
}

tr:last-child td {
  border-bottom: none;
}

th {
  background: var(--surface);
  font-weight: 600;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

tbody tr:hover {
  background: var(--accent-soft);
}

/* ─── Cards / Boxes ───────────────────────── */

.notice {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.notice:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent-border);
}

.notice h2 {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 700;
}

.notice ul {
  margin-bottom: 0.5rem;
}

.answer-box {
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-left: 4px solid var(--accent-mid);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  font-size: 1.015rem;
  line-height: 1.6;
  color: var(--text);
}

.cta-box {
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  border-left: 4px solid var(--green);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1.5rem;
}

/* ─── Grid ────────────────────────────────── */

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ─── Hero (homepage only) ────────────────── */

.hero {
  background: linear-gradient(135deg, #f0f9ff 0%, #fafaf9 60%, #f0fdf4 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem 2.5rem;
  margin: -2.5rem -1.25rem 2.5rem;
}

.hero-inner {
  max-width: 640px;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  margin-bottom: 0.75rem;
  line-height: 1.1;
}

.hero h1 span {
  color: var(--accent-mid);
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.5rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.12s, transform 0.12s;
  cursor: pointer;
}

.btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-mid);
  color: #fff;
}

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

/* ─── Category cards (homepage) ──────────── */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 0 0 2.5rem;
}

.cat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.5rem 1.2rem;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
  position: relative;
  overflow: hidden;
}

.cat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-mid);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.cat-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}

.cat-card:hover::before {
  transform: scaleX(1);
}

.cat-icon {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.6rem;
  display: block;
}

.cat-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.975rem;
  font-weight: 700;
}

.cat-card p {
  font-size: 0.825rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}

/* ─── Popular searches ────────────────────── */

.popular-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 2rem;
}

.pop-tag {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font-size: 0.825rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.pop-tag:hover {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  text-decoration: none;
}

/* ─── Section label ───────────────────────── */

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-mid);
  margin: 0 0 0.6rem;
}

/* ─── Utility ─────────────────────────────── */

.small {
  color: var(--muted);
  font-size: 0.875rem;
}

/* ─── Footer ──────────────────────────────── */

.site-footer {
  background: #0f1117;
  color: #9ca3af;
  margin-top: 3rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.site-footer .container {
  padding-top: 2.5rem;
  padding-bottom: 0.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #1f2937;
}

.footer-logo {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f9fafb;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.footer-tagline {
  margin: 0;
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.55;
}

.footer-heading {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #f9fafb;
  margin: 0 0 0.65rem;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.footer-col ul a {
  color: #9ca3af;
  text-decoration: none;
  transition: color 0.12s;
}

.footer-col ul a:hover {
  color: #e5e7eb;
}

.footer-bottom {
  padding: 1.25rem 0;
  color: #374151;
  font-size: 0.76rem;
}

.footer-bottom p { margin: 0; }

/* ─── Forms / Buttons ─────────────────────── */

button,
select {
  font: inherit;
}

select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  appearance: auto;
}

select:focus {
  outline: 2px solid var(--accent-mid);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  padding: 0.55rem 1.15rem;
  background: var(--accent-mid);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  transition: background 0.12s, transform 0.1s;
}

button:not(.units-toggle):not(.nav-toggle):hover {
  background: var(--accent);
  transform: translateY(-1px);
}

button:not(.units-toggle):not(.nav-toggle):focus-visible {
  outline: 2px solid var(--accent-mid);
  outline-offset: 2px;
}

.units-toggle:hover,
.units-toggle:focus-visible {
  background: var(--surface);
  transform: none;
  outline: none;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

legend {
  font-weight: 600;
  padding: 0 0.4rem;
  font-size: 0.95rem;
}

fieldset label {
  display: block;
  padding: 0.35rem 0;
  cursor: pointer;
}

fieldset input[type="radio"] {
  margin-right: 0.5rem;
  accent-color: var(--accent-mid);
}

/* ─── Tool result ─────────────────────────── */

#result,
#bulb-identifier-result {
  margin-top: 1.25rem;
}

/* ─── SVG diagrams ────────────────────────── */

svg {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  display: block;
  margin: 1.25rem 0;
}

/* ─── Print ───────────────────────────────── */

@media print {
  .no-print,
  header,
  footer,
  .print-hide {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: none;
  }

  table {
    box-shadow: none;
  }
}

/* ─── Responsive ──────────────────────────── */

@media (max-width: 700px) {
  h1 {
    font-size: 1.5rem;
  }

  .hero {
    padding: 2rem 1.25rem 1.75rem;
    margin: -2.5rem -1.25rem 2rem;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero-sub {
    font-size: 0.95rem;
  }

  .hero-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .btn {
    text-align: center;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  /* ── Mobile: hamburger nav handled by max-width: 768px block ── */

  .grid-two {
    grid-template-columns: 1fr;
  }

  .cat-grid {
    grid-template-columns: 1fr 1fr;
  }

  main.container {
    padding-top: 1.75rem;
    border-left: none;
    border-right: none;
  }

  .site-footer {
    margin-top: 2rem;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  table {
    font-size: 0.8rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th, td {
    padding: 0.5rem 0.65rem;
  }
}

@media (max-width: 400px) {
  .cat-grid {
    grid-template-columns: 1fr;
  }

  .popular-row {
    gap: 0.35rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Cookie consent banner ──────────────── */

#fs-cb {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #0f1117;
  color: #e5e7eb;
  border-top: 1px solid #1f2937;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.35);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

#fs-cb.fs-cb-hidden {
  transform: translateY(110%);
  pointer-events: none;
}

#fs-cb-in {
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.fs-cb-text {
  margin: 0;
  flex: 1 1 280px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.fs-cb-text a {
  color: #67d2e8;
  text-decoration: underline;
}

.fs-cb-text a:hover {
  color: #a5f3fc;
}

.fs-cb-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-shrink: 0;
}

.fs-cb-btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: opacity 0.15s;
  font-family: inherit;
}

.fs-cb-btn:hover { opacity: 0.85; }

.fs-cb-accept {
  background: var(--accent);
  color: #fff;
}

.fs-cb-decline {
  background: transparent;
  color: #d1d5db;
  border: 1px solid #374151;
}

@media (max-width: 520px) {
  #fs-cb-in {
    flex-direction: column;
    align-items: stretch;
  }
  .fs-cb-actions {
    flex-direction: column;
  }
  .fs-cb-btn {
    text-align: center;
  }
}


