/* CalcHub — shared styles. Light, professional, no frameworks. */
:root {
  --accent: #1668dc;
  --accent-dark: #0e4da8;
  --accent-soft: #e9f1fd;
  --ink: #182230;
  --muted: #5b6675;
  --line: #dfe6ef;
  --bg: #ffffff;
  --panel: #f7fafd;
  --radius: 12px;
  --good: #1c7c3e;
  --warn: #a86a12;
  --bad: #c0392b;
}

* { box-sizing: border-box; }

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

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

.wrap { max-width: 1060px; margin: 0 auto; padding: 0 20px; }

h1, h2, h3 { line-height: 1.25; color: var(--ink); }
h1 { font-size: 2rem; margin: 0.6em 0 0.4em; }
h2 { font-size: 1.35rem; margin: 1.6em 0 0.6em; }
h3 { font-size: 1.1rem; }

p { margin: 0.6em 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }
.main-nav a {
  margin-left: 22px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}
.main-nav a:hover { color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(180deg, var(--accent-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
  padding: 56px 0 48px;
}
.hero h1 { font-size: 2.4rem; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero .lede {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 640px;
  margin: 0;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 8px 0 8px;
}
.card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.card:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(22, 104, 220, 0.12);
  transform: translateY(-2px);
}
.card h3 { margin: 0 0 6px; font-size: 1.05rem; color: var(--accent-dark); }
.card p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.category-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---------- Calculator layout ---------- */
.breadcrumb { font-size: 0.88rem; color: var(--muted); margin: 22px 0 0; }
.breadcrumb a { color: var(--muted); }
.lede { font-size: 1.08rem; color: var(--muted); max-width: 720px; }

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 26px 0 10px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.panel h2 { margin-top: 0; font-size: 1.15rem; }
.panel.results { background: #fff; border-top: 4px solid var(--accent); }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 6px;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field select {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
}
.field input:focus, .field select:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(22, 104, 220, 0.25);
}
.input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-pill { position: relative; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span {
  display: inline-block;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
  color: var(--muted);
}
.radio-pill input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.radio-pill input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--muted); font-size: 0.95rem; }
.result-row .v { font-weight: 700; font-size: 1.05rem; text-align: right; }
.result-big {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-dark);
  letter-spacing: -0.02em;
  margin: 4px 0 2px;
}
.result-sub { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}
.badge.good { background: #e3f3e8; color: var(--good); }
.badge.warn { background: #fdf0da; color: var(--warn); }
.badge.bad { background: #fbe4e1; color: var(--bad); }
.badge.info { background: var(--accent-soft); color: var(--accent-dark); }
.error { color: var(--bad); font-weight: 600; }

/* sleep options */
.time-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}
.time-option:last-child { border-bottom: none; }
.time-option .t { font-size: 1.4rem; font-weight: 800; color: var(--accent-dark); }
.time-option .c { color: var(--muted); font-size: 0.9rem; text-align: right; }

/* ---------- Prose / FAQ ---------- */
.prose { max-width: 760px; }
.prose ul { padding-left: 1.3em; }
.formula {
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.98rem;
  overflow-x: auto;
  margin: 14px 0;
}
details.faq {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
}
details.faq summary {
  padding: 14px 18px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before {
  content: "+ ";
  color: var(--accent);
  font-weight: 800;
}
details.faq[open] summary::before { content: "– "; }
details.faq .faq-body { padding: 0 18px 16px; color: var(--muted); }
details.faq .faq-body p { margin: 0.4em 0; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--panel);
  margin-top: 56px;
  padding: 36px 0 28px;
  font-size: 0.92rem;
  color: var(--muted);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}
.footer-grid h3 { font-size: 0.95rem; margin: 0 0 10px; color: var(--ink); }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 6px; }
.footer-grid a { color: var(--muted); }
.footer-grid a:hover { color: var(--accent); }
.disclaimer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  font-size: 0.85rem;
}
.copy { font-size: 0.85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  h1 { font-size: 1.65rem; }
  .hero { padding: 36px 0 32px; }
  .hero h1 { font-size: 1.9rem; }
  .calc-grid { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .main-nav a { margin-left: 14px; }
  .result-big { font-size: 1.7rem; }
}

.footer-legal { text-align: center; margin: 1.2rem 0 0.4rem; font-size: 0.92rem; }
.footer-legal a { color: inherit; text-decoration: none; margin: 0 0.35rem; }
.footer-legal a:hover { text-decoration: underline; }

/* Buttons + GPA dynamic rows */
.btn {
  display: inline-block;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn:hover { filter: brightness(0.93); }
.btn-danger {
  background: #fff;
  color: #b3261e;
  border: 1px solid #e5c4c1;
  padding: 10px 14px;
  align-self: end;
}
.course-row { grid-template-columns: 1fr 1fr auto; align-items: end; margin-bottom: 12px; }
.course-row select.grade {
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  width: 100%;
}

/* Rich-result components (mortgage benchmark) */
.donut-wrap { display: flex; align-items: center; gap: 1.1rem; margin: 1rem 0 0.4rem; }
.donut { width: 118px; height: 118px; flex: 0 0 auto; transform: rotate(-90deg); }
.donut-bg { fill: none; stroke: var(--line); stroke-width: 20; }
.donut-seg { fill: none; stroke-width: 20; }
.seg-p { stroke: var(--accent); }
.seg-i { stroke: var(--warn); }
.legend { list-style: none; margin: 0; padding: 0; font-size: 0.93rem; }
.legend li { margin: 0.35em 0; color: var(--muted); }
.legend .sw { display: inline-block; width: 0.8em; height: 0.8em; border-radius: 3px; margin-right: 0.45em; vertical-align: baseline; }
.sw-p { background: var(--accent); }
.sw-i { background: var(--warn); }
.legend b { color: var(--ink); font-weight: 600; }

details.sched { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 1.6rem 0; }
details.sched summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style: none; }
details.sched summary::-webkit-details-marker { display: none; }
details.sched summary::before { content: "+ "; color: var(--accent); }
details.sched[open] summary::before { content: "– "; }
details.sched .sched-body { padding: 0 18px 16px; overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; margin: 0.6rem 0; }
.data-table th, .data-table td { padding: 0.5rem 0.7rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table thead th { color: var(--muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tbody tr:last-child td { border-bottom: none; }

.verdict { font-weight: 600; color: var(--accent-dark); margin-top: 0.8rem; }

/* Line chart + sliders (mortgage benchmark) */
input[type="range"] { width: 100%; accent-color: var(--accent); margin-top: 6px; cursor: pointer; }
.line-chart { width: 100%; height: auto; display: block; }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart .tick { fill: var(--muted); font-size: 12px; }
.line-chart .line-bal { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.line-chart .line-int { fill: none; stroke: var(--warn); stroke-width: 2.5; stroke-dasharray: 7 4; stroke-linejoin: round; }
.line-chart .line-goal { fill: none; stroke: var(--warn); stroke-width: 2; stroke-dasharray: 8 5; }
.legend-row { display: flex; gap: 1.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.legend-row li { margin: 0; }
.hbar{display:flex;height:34px;border-radius:8px;overflow:hidden;background:var(--line);margin:.8rem 0}
.hbar>div{height:100%}
.hbar-pv{background:var(--accent)}
.hbar-gain{background:var(--good)}
.hbar-loss{background:var(--bad)}

/* Paycheck breakdown (salary.html) */
.hbar-take{background:var(--good)}
.hbar-fed{background:var(--warn)}
.hbar-state{background:#8e5bd6}
.hbar-fica{background:var(--accent)}
.hbar-other{background:var(--muted)}
.sw-take{background:var(--good)}
.sw-fed{background:var(--warn)}
.sw-state{background:#8e5bd6}
.sw-fica{background:var(--accent)}
.sw-other{background:var(--muted)}
label.check{display:flex;align-items:flex-start;gap:.55rem;cursor:pointer;font-weight:500}
label.check input{width:1.05rem;height:1.05rem;margin-top:.2rem;accent-color:var(--accent)}
label.check .hint{font-weight:400;color:var(--muted);font-size:.88rem}
