:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --border: #dbe3ee;
  --brand-blue: #2f6fed;
  --brand-amber: #f4b000;
  --tint-blue: #ecf2ff;
  --tint-amber: #fff7e6;
  --accent: var(--brand-blue);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--brand-blue);
}

a:hover {
  color: #245dd0;
}

.site-header,
.site-footer {
  background: #0f0f12;
  color: #fff;
}

.site-header__inner,
main {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
}

.site-brand,
.site-nav a,
.site-footer a { color: #fff; text-decoration: none; }

.site-brand {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.site-brand__ohm { color: #7dd3fc; }
.site-brand__deck { color: #fbbf24; }

.site-nav { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.site-nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  line-height: 1.1;
}
.site-nav a:hover {
  background: rgba(47, 111, 237, 0.2);
}
.site-nav a[aria-current="page"] {
  background: var(--tint-blue);
  color: var(--brand-blue);
  text-decoration: none;
}

main { padding: 1.2rem 0 2rem; }
main > section,
.card,
.calculator-ui,
.safety-warning {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.safety-warning {
  background: var(--tint-amber);
  border-color: #f3d38b;
  border-left: 4px solid var(--brand-amber);
}

.safety-warning h3 {
  margin: 0 0 0.5rem;
}

.safety-warning p {
  margin: 0.45rem 0;
}

.safety-warning ol {
  margin: 0.45rem 0 0;
  padding-left: 1.2rem;
}

.safety-warning--guide {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: 52px 1fr;
  align-items: start;
}

.safety-warning__icon {
  width: 52px;
  height: 52px;
  display: block;
}

@media (max-width: 640px) {
  .safety-warning--guide {
    grid-template-columns: 1fr;
  }

  .safety-warning__icon {
    width: 44px;
    height: 44px;
  }
}

h1, h2 { margin-top: 0; }

.site-footer { width: 100%; padding: 1rem 0 1.2rem; }
.site-footer__nav {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.site-footer__nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer__copyright {
  display: block;
  width: min(980px, calc(100% - 2rem));
  margin: 0.35rem auto 0;
  font-size: 0.9rem;
  text-align: left;
  padding: 0;
}

.site-footer__disclaimer {
  width: min(980px, calc(100% - 2rem));
  margin: 0.6rem auto 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.noncalc-disclaimer {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.guide-source-note {
  margin: 0.35rem 0 0.9rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

.guide-source-note a {
  color: inherit;
  text-decoration: underline;
}

.guide-source-note a:hover {
  color: var(--text);
}

.ad-card {
  margin: 10px 0;
  padding: 0;
}

.ad-card .adsbygoogle {
  display: block;
  width: 100%;
}

.ad-card .adsbygoogle[data-ad-status="unfilled"] {
  display: none !important;
  height: 0 !important;
}

/* Diagrams */
.diagram,
.diagram-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.field-hint {
  margin: 6px 0 12px;
  font-size: 0.9em;
  opacity: 0.85;
}

.result-box {
  padding: 10px 12px;
  border-radius: 12px;
  margin-top: 10px;
}

.result-box--success {
  background: rgba(46, 204, 113, 0.12);
  border: 1px solid rgba(46, 204, 113, 0.25);
}

/* Guide: Electricity Basics intro readability + TOC */
.guide-intro-card {
  width: 100%;
  max-width: none;
  display: block;
}

.guide-intro-card p,
.guide-intro-card ul,
.guide-intro-card h2 {
  margin-bottom: 0.75rem;
}

.guide-intro-card .guide-toc {
  columns: 1;
  padding-left: 1.1rem;
}

.guide-intro-card .guide-intro-note {
  font-size: 0.95rem;
  color: var(--muted);
  margin-top: 0.85rem;
  margin-bottom: 0;
}

.guide-table-wrap {
  overflow-x: auto;
}

.guide-basic-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 32rem;
  background: #fff;
}

.guide-basic-table caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  margin-bottom: 0.45rem;
  color: var(--muted);
}

.guide-basic-table th,
.guide-basic-table td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.6rem;
  text-align: left;
  vertical-align: top;
}

.guide-basic-table th {
  background: #f8fafc;
}

.guide-basic-table tbody tr:nth-child(even) {
  background: #fbfdff;
}

/* Homepage guides section: 2-column max grid */
.guides-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 640px) {
  .guides-grid {
    grid-template-columns: 1fr;
  }
}

/* Guides hub cards */
.guide-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 700px) {
  .guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .guide-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.guide-card-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.guide-card-link {
  text-decoration: none;
}

.guide-card-link:hover {
  text-decoration: underline;
}

.guide-card-desc {
  margin: 0;
  opacity: 0.92;
}

.calc-grid {
  display: grid;
  gap: 14px;
}

@media (min-width: 700px) {
  .calc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .calc-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.calc-card-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.calc-card-link {
  text-decoration: none;
}

.calc-card-link:hover {
  text-decoration: underline;
}

.calc-card-desc {
  margin: 0;
  opacity: 0.92;
}

.home-quick-calc__controls {
  width: min(100%, 24rem);
}

.home-quick-calc__controls label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.home-quick-calc__controls input {
  width: 100%;
  min-height: 44px;
  margin-bottom: 0.8rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.home-quick-calc__result {
  margin: 0.5rem 0;
}

/* Home: Option A layout */
.home-grid-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 760px) {
  .site-header__inner { align-items: flex-start; flex-direction: column; gap: 0.6rem; }
  .ohms-visual__grid { grid-template-columns: 1fr; }
  .home-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .site-nav a { min-height: 44px; }
}

.calculator-ui label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.calculator-ui input {
  width: 100%;
  max-width: 18rem;
  min-height: 44px;
  margin-bottom: 0.8rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.calculator-ui select {
  width: 100%;
  max-width: 18rem;
  min-height: 44px;
  margin-bottom: 0.8rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

.calculator-result,
.calculator-subresult {
  margin: 0.5rem 0;
}

.conversion-guide {
  display: grid;
  gap: 0.75rem;
}

.conversion-guide__block,
.conversion-guide__example {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
}

.conversion-guide__block h3,
.conversion-guide__example p {
  margin-top: 0;
}

.conversion-guide__formula code,
.conversion-guide__example code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.4;
  display: inline-block;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.18rem 0.45rem;
}

.voltage-drop-explain p {
  margin: 0.45rem 0;
}

.voltage-drop-explain ul {
  margin: 0.45rem 0 0.65rem;
}

.voltage-drop-examples p {
  margin: 0.45rem 0;
}

.card--highlight-amber {
  background: var(--tint-amber);
  border-color: #f3d38b;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.calculator-assumptions-toggle {
  margin-bottom: 1rem;
}

.calculator-assumptions-toggle summary {
  cursor: pointer;
  font-weight: 600;
}

/* Ohm’s Law visual (mobile) */
.ohms-visual p,
.ohms-visual li {
  line-height: 1.55;
}

.ohms-visual h2 {
  margin-top: 0;
}

.ohms-visual h3 {
  margin-top: 18px;
}

.ohms-visual__grid {
  display: grid;
  gap: 16px;
  align-items: start;
}

@media (min-width: 900px) {
  .ohms-visual__grid {
    grid-template-columns: 260px 1fr;
  }
}

@media (max-width: 899px) {
  .ohms-visual__grid {
    grid-template-columns: 1fr;
  }
}

.ohms-triangle {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 220px;
  height: auto;
  color: #111827;
}

.ohms-formulas {
  margin: 0;
  padding-left: 18px;
}

.ohms-formulas li {
  margin: 12px 0;
}

.ohms-formulas code {
  display: inline-block;
  margin-bottom: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
}

.ohms-formulas p {
  margin: 6px 0;
}

.calculator-ui .js-reset {
  min-height: 44px;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.ohm-quick-grid {
  display: grid;
  gap: 0.75rem 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 40rem;
}

@media (max-width: 760px) {
  .ohm-quick-grid {
    grid-template-columns: 1fr;
  }
}

.calculator-ui input.ohm-input-known {
  background: #fff5bf;
  border-color: #e7d06b;
}

.calculator-ui input.ohm-input-computed {
  background: #e6f8eb;
  border-color: #8fd6a5;
}

.calculator-ui input.ohm-input-conflict {
  background: #ffe9e9;
  border-color: #e79b9b;
}

.contact-page .contact-form {
  width: min(100%, 36rem);
}

.contact-page .contact-form .form-field {
  margin-bottom: 0.8rem;
}

.contact-page .contact-form label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.contact-page .contact-form input,
.contact-page .contact-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
}

.contact-page .contact-form textarea {
  resize: vertical;
}

.contact-page .contact-form .form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.contact-page .contact-form button[type="submit"] {
  min-height: 44px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
}

/* Infographic embed */
.infographic-figure {
  max-width: 100%;
  margin: 1.5rem auto;
  text-align: center;
}
.infographic-figure img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.infographic-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}
.infographic-download {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--accent);
}
.infographic-download:hover {
  text-decoration: underline;
}

.media-embed {
  margin-top: 1rem;
}

.video-embed-section {
  text-align: center;
}

.video-embed-section > p {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
}

.media-embed--video {
  width: min(100%, 900px);
  margin-left: auto;
  margin-right: auto;
}

.media-embed__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f0f12;
}

.media-embed__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-embed__note {
  margin: 0.85rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--muted);
}
