/* CobraCalc — styles.css
   Palette: white bg, navy primary, green positive, amber warning, red cliff */

:root {
  --navy: #1B3A6B;
  --navy-dark: #142c52;
  --green: #2E7D32;
  --amber: #F57C00;
  --red: #C62828;
  --ink: #1f2733;
  --muted: #5b6573;
  --line: #e2e6ec;
  --bg-soft: #f6f8fb;
  --radius: 10px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  color: var(--ink);
  background: #fff;
  line-height: 1.55;
  font-size: 16px;
}

a { color: var(--navy); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header / nav */
.site-header {
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--navy);
  text-decoration: none;
  letter-spacing: -0.3px;
}
.brand svg { flex: none; display: block; width: 34px; height: 34px; }
.brand .accent { color: var(--green); }
.nav a {
  text-decoration: none;
  color: var(--muted);
  margin-left: 18px;
  font-size: 0.95rem;
}
.nav a:hover { color: var(--navy); }

/* Hero */
.hero {
  background: linear-gradient(135deg, #eaf3ff 0%, #f4f9f2 55%, #fff 100%);
  border-bottom: 1px solid var(--line);
  border-top: 4px solid var(--green);
  padding: 34px 0 28px;
}
.hero h1 {
  margin: 0 0 8px;
  font-size: 1.9rem;
  color: var(--navy);
  letter-spacing: -0.5px;
}
.hero p { margin: 0; color: var(--ink); max-width: none; }

/* Hero feature strip — colorful value-prop pills with icons */
.feature-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
}
.feature {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px 8px 8px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(20,44,82,0.07);
}
.feature-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  flex: none;
}
.feature-ico.ico-green { background: var(--green); }
.feature-ico.ico-navy { background: var(--navy); }

/* Calculator layout: form on the left, results on the right (above the fold).
   The wide "customize income" grid is a full-width row below this. On narrower
   screens the two columns stack so the results table never has to scroll. */
.calc-main { padding-top: 26px; }
.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  align-items: stretch; /* form card stretches to match the results column height */
}
.layout > * { min-width: 0; }
.results-col { display: flex; flex-direction: column; }
#results { display: flex; flex-direction: column; gap: 22px; }
#yearGridSection { margin-top: 22px; }
@media (max-width: 1260px) {
  .layout { grid-template-columns: 1fr; }
}

/* Form grid — fields flow into columns and bottom-align so inputs line up
   in a row even when a label wraps to two lines. */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 18px;
  align-items: end;
}
.form-grid .field { margin-bottom: 0; }

/* Card / panel */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #fff;
}
.card h2 { margin-top: 0; font-size: 1.15rem; color: var(--navy); }

/* Form */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 4px; }
/* Hint text — used in fields, legends, and labels. Always a muted sub-line. */
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 1px; letter-spacing: 0; }
/* Inline variant — muted text that stays on the same line (e.g. "(optional)") */
.hint-inline { font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-left: 5px; }

/* Info tooltip icon + styled custom tooltip (reliably visible, unlike native title) */
.info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px; height: 15px;
  margin-left: 3px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: help;
  vertical-align: text-top;
}
.info:focus { outline: 2px solid var(--navy); outline-offset: 1px; }

/* Shared tooltip bubble — used by form info icons and table headers (data-tip) */
.info[data-tip]::after,
table.results th[data-tip]::after,
table.yeargrid th[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 230px;
  background: var(--ink);
  color: #fff;
  padding: 8px 11px;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  z-index: 60;
  pointer-events: none;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}
.info[data-tip]:hover::after,
.info[data-tip]:focus::after,
table.results th[data-tip]:hover::after,
table.results th[data-tip]:focus::after,
table.yeargrid th[data-tip]:hover::after,
table.yeargrid th[data-tip]:focus::after { opacity: 1; visibility: visible; }

table.results th[data-tip], table.yeargrid th[data-tip] { position: relative; cursor: help; }
input[type="number"], select {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--navy); outline-offset: 0; border-color: var(--navy); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 12px 4px;
  margin: 26px 0 14px;
}
fieldset legend { font-weight: 700; font-size: 1.05rem; color: var(--navy); padding: 0 6px; }

/* Collapsible "+ more" sections that keep the form short on first view */
.more-fields { margin: 4px 0 16px; }
.more-fields > summary {
  cursor: pointer; list-style: none; user-select: none;
  color: var(--navy); font-weight: 600; font-size: 0.9rem; padding: 4px 0;
}
.more-fields > summary::-webkit-details-marker { display: none; }
.more-fields > summary::before { content: "+ "; font-weight: 700; }
.more-fields[open] > summary::before { content: "– "; }
.more-fields[open] > summary { margin-bottom: 10px; }
/* Explicit collapse — guarantees the content hides when closed across browsers */
.more-fields:not([open]) > *:not(summary) { display: none; }

.checkbox-row { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 14px; }
.checkbox-row input { margin-top: 3px; }
.checkbox-row input:disabled { cursor: not-allowed; }
.checkbox-row input:disabled ~ label { color: var(--muted); cursor: not-allowed; }
.checkbox-row input:disabled ~ label .hint { color: var(--muted); }
.checkbox-row input { width: auto; }

button.btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
}
button.btn:hover { background: var(--navy-dark); }
button.btn.secondary { background: #fff; color: var(--navy); border: 1px solid var(--navy); }

/* Link styled as a button — used for CTAs on content/guide pages (<a class="btn">). */
a.btn {
  display: inline-block;
  padding: 12px 22px;
  background: var(--navy);
  color: #fff;
  border-radius: 8px;
  font-size: 1.02rem;
  font-weight: 600;
  text-decoration: none;
}
a.btn:hover { background: var(--navy-dark); color: #fff; }

/* Results */
.results-intro { margin: 4px 0 16px; }

/* Verdict banner — the headline finding. Kept navy/neutral (NOT green) so it
   reads as information and doesn't compete with the green affiliate CTA below. */
.summary-banner {
  border-radius: var(--radius);
  padding: 14px 16px 14px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  background: var(--bg-soft);
}
.summary-banner.verdict-market,
.summary-banner.verdict-cobra { border-left-color: var(--navy); background: var(--bg-soft); }
.verdict-head { font-size: 1.12rem; font-weight: 700; line-height: 1.3; color: var(--navy); margin-bottom: 6px; letter-spacing: -0.1px; }
.summary-banner.verdict-market .verdict-head,
.summary-banner.verdict-cobra .verdict-head { color: var(--navy); }
.verdict-body { color: var(--ink); font-size: 0.92rem; }
.verdict-link {
  display: inline-block; margin-top: 12px;
  background: var(--navy); color: #fff; text-decoration: none;
  padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 0.9rem;
}
.verdict-link:hover { background: var(--navy-dark); }
.verdict-warn { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--red); font-size: 0.9rem; }
.summary-banner strong { color: var(--navy); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); }
table.results {
  border-collapse: collapse;
  width: 100%;
  min-width: 640px;
  font-size: 0.82rem;
}
table.results th, table.results td { padding: 8px 7px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.th-sub { font-weight: 400; opacity: 0.78; font-size: 0.86em; }
table.results th { background: var(--navy); color: #fff; font-weight: 600; position: sticky; top: 0; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results tbody tr:nth-child(even) { background: #fafbfd; }
table.results td.rec { font-weight: 700; }
.rec-cobra { color: var(--navy); }
.rec-market { color: var(--green); }
.rec-medicare { color: var(--muted); }
.rec-medicaid { color: #5a7fb5; }

.flag { font-size: 1rem; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 14px 0 0; font-size: 0.82rem; color: var(--ink); }
.legend span { white-space: nowrap; display: inline-flex; align-items: center; }
.legend-note { margin: 6px 0 0; font-size: 0.8rem; color: var(--muted); }

/* Status dots (replaces the old Flag column) */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; flex: none; vertical-align: middle; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-grey { background: var(--muted); }
.dot-medicaid { background: #5a7fb5; }

/* Make the results the visual centerpiece (#3) */
.results-card { border-top: 4px solid var(--navy); box-shadow: 0 6px 24px rgba(27, 58, 107, 0.08); }
.results-title { font-size: 1.4rem; margin-bottom: 12px; }

/* Header cells with a tooltip get a subtle "hover for info" affordance */
table.results th[data-tip] {
  text-decoration: underline dotted rgba(255, 255, 255, 0.55);
  text-underline-offset: 3px;
}

/* Wide primary action under the top form */
.btn-wide { max-width: 360px; }

/* Chart */
.chart-card { margin-top: 0; }
.chart-wrap { position: relative; height: 360px; }

/* CTA — spacing comes from the #results flex gap, so no own margin
   (keeps it evenly centered between the table card and the chart card). */
.cta {
  margin: 0;
  border: 1px solid var(--green);
  background: #eef6ef;
  border-radius: var(--radius);
  padding: 18px;
}
.cta h3 { margin: 0 0 6px; color: var(--green); }
.cta a.cta-link {
  display: inline-block;
  margin-top: 8px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: 8px;
  font-weight: 600;
}
.cta a.cta-link:hover { background: #25642a; }
.cta-disclosure { font-size: 0.8rem; color: var(--muted); margin: 10px 0 0; line-height: 1.4; }
.cta-disclosure a { color: var(--muted); }

.email-capture {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-soft);
}
.email-capture h3 { margin: 0 0 6px; color: var(--navy); }
.email-form { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.email-form input[type="email"] { flex: 1 1 240px; min-width: 0; padding: 11px 14px; }
.email-form button { flex: 0 0 auto; width: auto; padding: 10px 20px; }
.email-form-note { font-size: 0.8rem; color: var(--muted); margin: 8px 0 0; }
#emailMsg { margin-top: 10px; font-size: 0.9rem; color: var(--green); font-weight: 600; }

/* Per-year income grid */
.yeargrid-wrap { overflow-x: auto; margin-top: 10px; }
table.yeargrid { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 0.82rem; }
table.yeargrid th, table.yeargrid td { border: 1px solid var(--line); padding: 4px; }
table.yeargrid th { background: var(--bg-soft); color: var(--navy); }
/* Affordance so users notice the column headings are hoverable for help */
table.yeargrid th[data-tip] { text-decoration: underline dotted rgba(27, 58, 107, 0.45); text-underline-offset: 3px; }
table.yeargrid input { padding: 5px 6px; font-size: 0.82rem; border-radius: 6px; }

/* Edit link shown next to the "Customize income" checkbox once it's on */
.edit-grid-link {
  background: none; border: none; padding: 0; margin: 8px 0 14px;
  color: var(--navy); text-decoration: underline; cursor: pointer;
  font-size: 0.85rem; font-weight: 600;
}
.edit-grid-link:hover { color: var(--navy-dark); }

/* Customize-income modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(20, 30, 45, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: #fff; border-radius: 12px;
  width: 100%; max-width: 920px; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.15rem; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.6rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 8px; }
.modal-close:hover { color: var(--navy); }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); text-align: right; }
.modal-foot .btn { width: auto; display: inline-block; padding: 10px 24px; }

.hidden { display: none !important; } /* must beat id-level display rules (e.g. #results) */
.placeholder-note { color: var(--muted); font-style: italic; }


/* Content pages */
/* Resources page */
.resource-list { display: grid; gap: 16px; margin: 18px 0 8px; }
.resource { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; background: #fff; }
.resource h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--navy); }
.resource p { margin: 0 0 12px; }
.resource a.res-link { display: inline-block; background: var(--navy); color: #fff; text-decoration: none; padding: 9px 16px; border-radius: 8px; font-weight: 600; font-size: 0.95rem; }
.resource a.res-link:hover { background: var(--navy-dark); }
.res-pending { display: inline-block; font-size: 0.8rem; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }
.disclosure-box { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; font-size: 0.9rem; color: var(--muted); margin: 16px 0; }
.wip-banner { background: #fff8e1; border: 1px solid var(--amber); border-radius: var(--radius); padding: 10px 14px; color: #8a5a00; font-size: 0.9rem; margin: 14px 0; }

.content { padding: 28px 0 10px; max-width: 800px; }
.content h1 { color: var(--navy); font-size: 1.7rem; }
.content h2 { color: var(--navy); font-size: 1.2rem; margin-top: 28px; }
.content p, .content li { color: var(--ink); }
.content table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 0.92rem; }
.content table th, .content table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.content table th { background: var(--bg-soft); color: var(--navy); }

/* Static worked-example table + guides list in the calculator empty state. */
.example-table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 0.92rem; }
.example-table th, .example-table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.example-table th { background: var(--bg-soft); color: var(--navy); }
.guides-list { margin: 8px 0 0; padding-left: 20px; }
.guides-list li { margin-bottom: 5px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.site-footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.site-footer a { color: var(--muted); margin-right: 16px; text-decoration: none; }
.site-footer a:hover { color: var(--navy); }

.disclaimer-mini { font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
