/* Question pages, the hub and how-it-works. Borderless M3 like the app: tonal surfaces, no
   outlines or dividers. Body text 18px. Generated by tools/build-pages.mjs. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: var(--body-l);
  background: var(--md-surface);
  color: var(--md-on-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--md-primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, p, ul, ol, figure { margin: 0; }
[hidden] { display: none !important; }
small { font-size: 0.85em; color: var(--md-on-surface-variant); }
.a-table td, .a-table thead small { white-space: nowrap; }
.a-table small { display: block; }

/* App bar */
.a-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
  min-height: 64px;
  background: var(--md-surface-container);
}
.a-brand { display: flex; align-items: center; gap: 10px; font: var(--title-l); color: var(--md-on-surface); text-decoration: none; }
.a-brand img { border-radius: 8px; }
.a-open {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-full);
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  font: var(--label-l); text-decoration: none; white-space: nowrap;
}

/* Page */
.a-main {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px 48px;
  display: flex; flex-direction: column; gap: 20px;
}
.a-crumbs ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant); }
.a-crumbs li + li::before { content: '›'; margin-right: 8px; color: var(--md-on-surface-variant); }
.a-crumbs a { color: var(--md-on-surface-variant); }
h1 { font: 500 30px/38px var(--font); letter-spacing: -0.2px; }
h2 { font: var(--headline-s); margin-top: 16px; }
.a-meta { font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant); margin-top: -8px; }
.a-lead { font: 400 20px/30px var(--font); color: var(--md-on-surface-variant); }
.a-main p, .a-main li { max-width: 68ch; }

/* The direct answer */
.a-answer {
  background: var(--md-primary-container); color: var(--md-on-primary-container);
  border-radius: var(--r-xl); padding: 20px;
  font: 400 20px/30px var(--font);
}
.a-answer b { font-weight: 650; }

/* Tables: tonal, no lines */
.a-table { display: flex; flex-direction: column; gap: 8px; }
.a-table table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--md-surface-container-low);
  border-radius: var(--r-l); overflow: hidden;
  font-variant-numeric: tabular-nums;
}
.a-table caption { caption-side: top; text-align: left; font: var(--title-m); padding: 0 0 10px; }
.a-table th, .a-table td { padding: 10px 10px; text-align: left; vertical-align: top; font-weight: 400; }
.a-table thead th { background: var(--md-surface-container-high); font: var(--label-l); color: var(--md-on-surface-variant); }
.a-table tbody tr:nth-child(even) { background: var(--md-surface-container); }
.a-table tbody th { font-weight: 500; }
.a-table .n { text-align: right; }
.a-table thead th:first-child, .a-table tbody th { padding-left: 16px; }
.a-table tr > :last-child { padding-right: 16px; }
.a-table figcaption { font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant); }

/* Call to action */
.a-cta {
  background: var(--md-secondary-container); color: var(--md-on-secondary-container);
  border-radius: var(--r-xl); padding: 24px 20px;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
  margin-top: 12px;
}
.a-cta h2 { margin: 0; font: var(--title-l); }
.a-btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 28px; margin-top: 6px;
  border-radius: var(--r-full);
  background: var(--md-primary); color: var(--md-on-primary);
  font: var(--label-l); text-decoration: none;
}
.a-btn:hover, .a-open:hover { box-shadow: inset 0 0 0 100px color-mix(in srgb, currentColor 8%, transparent); }

/* Related questions and hub lists: tonal cards */
.a-related { display: flex; flex-direction: column; gap: 12px; }
.a-related ul, .a-hub { list-style: none; padding: 0; display: grid; gap: 8px; }
.a-related li, .a-hub li { max-width: none; }
.a-related a[href^='/']:not([href='/questions/']), .a-hub a {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 20px; border-radius: var(--r-l);
  background: var(--md-surface-container-low);
  text-decoration: none; color: var(--md-on-surface);
  transition: background-color 150ms var(--ease);
}
.a-related a[href^='/']:not([href='/questions/']):hover, .a-hub a:hover { background: var(--md-surface-container-high); }
.a-rel-title { font: var(--title-m); color: var(--md-primary); }
.a-rel-blurb { font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant); }
.a-sources { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font: var(--label-l); font-weight: 400; }

/* Footer */
.a-foot {
  max-width: 760px; margin: 0 auto;
  padding: 24px 16px max(40px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
  font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant);
}

@media (min-width: 840px) {
  .a-main { padding-top: 24px; gap: 24px; }
  h1 { font: 500 38px/46px var(--font); }
  .a-answer { padding: 24px 28px; }
  .a-cta { padding: 28px; }
  .a-related ul, .a-hub { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .a-table th, .a-table td { padding: 10px 6px; }
  .a-table thead th:first-child, .a-table tbody th { padding-left: 12px; }
  .a-table tr > :last-child { padding-right: 12px; }
  .a-open { padding: 0 12px; }
}
@media (max-width: 380px) {
  .a-table table { font-size: 17px; }
  .a-table th, .a-table td { padding: 8px 4px; }
  .a-table thead th:first-child, .a-table tbody th { padding-left: 10px; }
  .a-table tr > :last-child { padding-right: 10px; }
}

/* ---------- Calculator boxes (js/widgets.js) ---------- */
.a-widget {
  background: var(--md-surface-container-high);
  border-radius: var(--r-xl); padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}
.a-widget h2 { margin: 0; font: var(--title-l); }
.w-grid { display: grid; gap: 14px; }
.w-field { display: flex; flex-direction: column; gap: 6px; position: relative; min-width: 0; }
.w-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 36px; font: var(--label-l); color: var(--md-on-surface-variant); }
.w-label small { font-weight: 400; }
.w-input {
  display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 16px;
  background: var(--md-surface-container-highest);
  border-radius: var(--r-m);
  transition: background-color 150ms var(--ease);
}
.w-input:focus-within { background: color-mix(in srgb, var(--md-primary) 12%, var(--md-surface-container-highest)); }
.w-input input, .w-input select {
  flex: 1; min-width: 0; width: 100%;
  border: 0; outline: none; background: transparent; color: inherit;
  font: var(--body-l); padding: 14px 0;
}
.w-input input + span + input { margin-left: 8px; }
.w-input select { appearance: auto; cursor: pointer; }
.w-input span { color: var(--md-on-surface-variant); white-space: nowrap; }
.w-input input::-webkit-search-cancel-button { display: none; }
.w-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-full); background: var(--md-surface-container-highest); }
.w-seg button {
  border: 0; cursor: pointer; min-height: 32px; padding: 0 12px;
  border-radius: var(--r-full); background: transparent;
  font: var(--label-l); color: var(--md-on-surface-variant);
}
.w-seg button[aria-checked='true'] { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.w-results {
  list-style: none; margin: 4px 0 0; padding: 6px;
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5;
  background: var(--md-surface-container-lowest);
  border-radius: var(--r-m);
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.18);
  max-height: 320px; overflow-y: auto;
}
.w-results li { padding: 12px 14px; border-radius: 12px; cursor: pointer; max-width: none; }
.w-results li:hover, .w-results li:focus { background: var(--md-surface-container-high); outline: none; }
.w-result { display: flex; flex-direction: column; gap: 6px; background: var(--md-surface-container-low); border-radius: var(--r-l); padding: 16px 18px; }
.w-big { font: var(--title-l); }
.w-big b { font: 500 40px/48px var(--font); color: var(--md-primary); font-variant-numeric: tabular-nums; }
.w-hint { font: var(--label-l); font-weight: 400; color: var(--md-on-surface-variant); }
.w-more { align-self: flex-start; font: var(--label-l); }
@media (min-width: 600px) {
  .w-grid { grid-template-columns: 1fr 1fr; }
  .w-wide { grid-column: 1 / -1; }
}
