/* QtyLab — dark navy tool site, mobile-first */
:root {
  --bg: #0b1220;
  --bg-elevated: #121a2b;
  --bg-card: #162033;
  --border: #243049;
  --border-strong: #334155;
  --text: #e8eef8;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --accent-dim: rgba(56, 189, 248, 0.12);
  --accent-border: rgba(56, 189, 248, 0.35);
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --max: 960px;
  --header-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }

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

.qtylab-app {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img { max-width: 100%; height: auto; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  min-height: var(--header-h);
  height: auto;
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo:hover { color: var(--accent); text-decoration: none; }
.logo-mark {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.nav a {
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.nav a:hover { color: var(--text); background: var(--accent-dim); text-decoration: none; }
.nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-dim);
}

/* Main */
.qtylab-app .qtylab-main,
.qtylab-app main {
  flex: 1;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* Hero */
.hero {
  margin-bottom: 2rem;
  padding: 1.5rem 0 0.5rem;
}
.hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.hero .tagline {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 36em;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.trust-row li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.trust-row li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}

/* Cards grid */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
@media (min-width: 640px) {
  .calc-grid { grid-template-columns: repeat(3, 1fr); }
}
.calc-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.calc-card:hover {
  border-color: var(--accent-border);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.calc-card h2 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
  color: var(--accent);
}
.calc-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Page headings */
.page-intro { margin-bottom: 1.5rem; }
.page-intro h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  font-weight: 750;
  letter-spacing: -0.02em;
}
.page-intro p {
  margin: 0;
  color: var(--text-muted);
  max-width: 40em;
}

/* Calculator layout */
.calc-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 720px) {
  .calc-layout { grid-template-columns: 1fr 1fr; align-items: start; }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 650;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 0.9rem;
}
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 550;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.form-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.25rem;
}
.input-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.input-row input,
.input-row select {
  flex: 1;
}
input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  appearance: none;
  -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input:hover, select:hover { border-color: var(--text-dim); }
.unit-label {
  display: flex;
  align-items: center;
  padding: 0 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
  min-width: 3.2rem;
  justify-content: center;
}

.tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 550;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tab-btn:hover { color: var(--text); border-color: var(--border-strong); }
.tab-btn[aria-selected="true"] {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}
.tab-panel[hidden] { display: none; }

/* Results */
.results {
  background: var(--bg-elevated);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.results h2 {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.result-primary {
  margin-bottom: 1rem;
}
.result-primary .value {
  font-size: 2rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.15;
}
.result-primary .unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.25rem;
}
.result-grid {
  display: grid;
  gap: 0.65rem;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}
.result-row .label { color: var(--text-muted); }
.result-row .val {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.9rem;
}
.assumptions {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}
.assumptions strong { color: var(--text-muted); font-weight: 550; }

.share-row {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 550;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn:hover { border-color: var(--accent-border); color: var(--accent); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.share-status {
  font-size: 0.8rem;
  color: var(--success);
  min-height: 1.2em;
}

/* FAQ */
.faq {
  margin-top: 2.5rem;
}
.faq h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
}
.faq details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  padding: 0.85rem 1rem;
}
.faq summary {
  cursor: pointer;
  font-weight: 550;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.faq details[open] summary::after { content: "−"; }
.faq details p {
  margin: 0.65rem 0 0;
  color: var(--text-muted);
  font-size: 0.925rem;
}

/* Related */
.related {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.related h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}
.related ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.related a {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
}
.related a:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}

/* Prose (about, privacy) */
.prose {
  max-width: 40em;
}
.prose h1 {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 750;
}
.prose h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.15rem;
}
.prose p, .prose li {
  color: var(--text-muted);
}
.prose ul { padding-left: 1.25rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 1.5rem 1rem;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }

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

.noscript-note {
  background: var(--bg-card);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--warning);
}

/* Results hierarchy polish */
.result-primary {
  margin-bottom: 1.15rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.result-primary .value {
  font-size: clamp(2.35rem, 6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.05;
}
.result-primary .unit {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.35rem;
}
.result-primary .result-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}
.result-grid {
  gap: 0.35rem;
}
.result-row {
  padding: 0.4rem 0;
  border-top: none;
  border-bottom: 1px solid rgba(36, 48, 73, 0.65);
  font-size: 0.9rem;
}
.result-row:last-child { border-bottom: none; }
.result-row .label {
  color: var(--text-dim);
  font-size: 0.85rem;
}
.result-row .val {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Soft affiliate suggestion slot */
.affiliate-suggest {
  margin-top: 1.15rem;
  padding: 0.9rem 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-border);
}
.affiliate-suggest h3 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.affiliate-suggest .suggest-text {
  margin: 0 0 0.55rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.4;
}
.affiliate-suggest .suggest-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.affiliate-suggest .suggest-links a {
  display: inline-block;
  padding: 0.3rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 550;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.affiliate-suggest .suggest-links a:hover {
  border-color: var(--accent-border);
  color: var(--accent-hover);
  text-decoration: none;
}
.affiliate-suggest .disclosure {
  margin: 0;
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.35;
}


/* —— WordPress + GeneratePress compatibility —— */
.qtylab-app {
  /* Isolate from theme flex/grid quirks */
  display: block;
  min-height: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  border-radius: var(--radius);
  margin: 0 -0.5rem; /* slight bleed in content area */
}
.qtylab-app .qtylab-main {
  flex: none;
  max-width: var(--max);
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 2.5rem;
}
/* Soften theme content title collision: hide duplicate H1 if theme prints title AND we print H1 */
body.qtylab-page .entry-header,
body.qtylab-page .page-header {
  /* Keep for SEO if preferred; uncomment to hide theme title:
  display: none;
  */
}
body.qtylab-page .inside-article,
body.qtylab-page .entry-content {
  max-width: none;
}
/* Ensure form controls aren't overridden by theme */
.qtylab-app input[type="number"],
.qtylab-app input[type="text"],
.qtylab-app select,
.qtylab-app button,
.qtylab-app .btn {
  font: inherit;
}
.qtylab-app a.calc-card {
  text-decoration: none;
  color: inherit;
}
.qtylab-app a.calc-card:hover {
  text-decoration: none;
  color: inherit;
}
/* Keep theme chrome; only the calculator card is dark */
body.qtylab-page .entry-content > .qtylab-app:first-child {
  margin-top: 0;
}
