/* w2-1099.css — styles specific to the 1099 vs W-2 Salary Calculator.
   Reuses the shared tokens (global.css) and form/result classes from
   calculator.css (.field, .input-wrap, .affix, .card, .seg-toggle, .breakdown,
   .section-label, .check-inline, .field-row, .results-empty, .btn-secondary).
   New here: the two-offer grid, the verdict hero, the side-by-side comparison
   cards, the benefits ledger, plus the tip/glossary patterns shared with the
   rental tool. */

/* Guard against sideways scroll on phones from AdSense (see rental.css). */
.ad-unit { max-width: 100%; overflow: hidden; }
.ad-unit .adsbygoogle { max-width: 100%; }

/* Tooltip popovers are absolutely positioned and up to 250px wide; near the right
   edge on a phone they'd push the page sideways (they count toward scroll width
   even while hidden). `overflow-x: clip` stops the shift WITHOUT creating a scroll
   container, so the sticky header keeps working (plain `hidden` would break it). */
body { overflow-x: clip; }

/* Two-offer layout wants a little more room than the default container. */
.container { max-width: 1080px; }
.site-header .nav { max-width: 1080px; }

/* ---- Form scaffolding ---- */
.w2-form { display: flex; flex-direction: column; gap: 1rem; }

/* Inputs/selects: this form keeps its card-style fieldsets, so it opts OUT of
   .calc-form (whose `fieldset { border:none }` would flatten the cards). Mirror
   the shared .calc-form input styling here so fields match the other tools. */
.w2-form input[type='number'],
.w2-form input[type='text'],
.w2-form select {
  width: 100%; font-size: 1rem; font-family: inherit;
  padding: 0.65rem 0.8rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); appearance: none;
}
.w2-form input:focus, .w2-form select:focus { border-color: var(--accent); }
/* Let inputs/wraps shrink inside grid/flex columns instead of forcing a min width. */
.w2-form input, .w2-form select, .w2-form .input-wrap { min-width: 0; }
/* The SSTB checkbox label can wrap on narrow screens. */
.w2-form .check-inline { flex-wrap: wrap; }
/* Style every hint like .field .hint — including bare hints not inside a .field. */
.w2-form .hint { font-weight: 400; color: var(--text-faint); font-size: 0.82rem; }
/* Demote the card legend to a normal in-card heading (float trick avoids the
   legend sitting in the fieldset's top border). */
.w2-form fieldset > legend {
  float: left; width: 100%; font-weight: 700; font-size: 1.05rem;
  padding: 0; margin-bottom: 0.75rem;
}
/* The element after the floated legend must clear it, or grids/rows wrap beside it. */
.w2-form fieldset > legend + * { clear: both; }
.field-intro { margin: -0.25rem 0 0.75rem; font-size: 0.9rem; }
.group-label {
  margin: 1rem 0 0.5rem; font-size: 0.82rem; font-weight: 700;
  color: var(--text-muted); display: flex; align-items: center; gap: 0.1rem;
}
.field-grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
@media (max-width: 620px) { .field-grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Trailing unit affix (e.g. "%", "/hr") needs a touch more right padding. */
.input-wrap:has(.affix--suffix) input { padding-right: 2.4rem; }
.seg-toggle--inline { margin-bottom: 0.85rem; }

/* ---- The two offer cards ---- */
.offer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
/* Below ~tablet width, stack the two offers (iPad portrait is 768, so 820 keeps it one column there). */
@media (max-width: 820px) { .offer-grid { grid-template-columns: 1fr; } }
.offer-card { margin: 0; }
.offer-card legend { display: flex; align-items: center; gap: 0.5rem; }
.offer-w2 { border-top: 3px solid var(--accent); }
.offer-1099 { border-top: 3px solid var(--success); }
.offer-tag {
  display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 0.12rem 0.45rem; border-radius: 6px; color: #fff;
}
.offer-w2 .offer-tag, .compare-card .offer-tag { background: var(--accent); }
.offer-1099 .offer-tag { background: var(--success); }
#w2-compare-1099 .offer-tag { background: var(--success); }

/* ---- Results ---- */
.w2-results { margin-top: 1.5rem; }

/* Verdict hero — the headline "make you whole" rate. */
.verdict-hero {
  text-align: center; padding: 1.5rem 1.25rem;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
}
.verdict-eyebrow { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.verdict-rate {
  font-size: clamp(2rem, 7vw, 2.9rem); font-weight: 800; line-height: 1.1;
  color: var(--accent); margin: 0.35rem 0 0.5rem; font-variant-numeric: tabular-nums;
}
.verdict-text { max-width: 56ch; margin: 0 auto 1rem; color: var(--text-muted); font-size: 0.95rem; line-height: 1.55; }
.verdict-hero .seg-toggle { margin-top: 0.25rem; }

/* Side-by-side value comparison. */
.compare-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 620px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 1.1rem 1.2rem;
}
.compare-card.is-winner { border-color: var(--success); box-shadow: 0 0 0 1px var(--success); }
.compare-head { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.95rem; }
.compare-tag {
  position: absolute; top: -0.7rem; right: 0.9rem;
  background: var(--success); color: #052e16; font-size: 0.7rem; font-weight: 800;
  padding: 0.15rem 0.6rem; border-radius: 999px;
}
.compare-value { font-size: 1.9rem; font-weight: 800; margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
.compare-sub { font-size: 0.78rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.compare-lines { list-style: none; margin: 0.85rem 0 0; padding: 0.85rem 0 0; border-top: 1px solid var(--border); display: grid; gap: 0.35rem; }
.compare-lines li { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; }
.compare-lines li span:first-child { color: var(--text-muted); }
.compare-lines li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.compare-lines li.is-pos span:last-child { color: var(--success); }
.compare-lines li.is-neg span:last-child { color: #dc2626; }
.compare-lines li.is-total { border-top: 1px solid var(--border); margin-top: 0.2rem; padding-top: 0.4rem; font-weight: 700; }
.compare-lines li.is-total span:first-child { color: var(--text); }
.compare-note { margin: 0.7rem 0 0; font-size: 0.8rem; color: var(--text-faint); line-height: 1.4; }

/* Benefits ledger. */
.ledger { padding: 0.4rem 0.5rem; }
.ledger table { width: 100%; border-collapse: collapse; }
.ledger th, .ledger td { padding: 0.55rem 0.6rem; font-size: 0.9rem; text-align: left; }
.ledger td:last-child { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ledger tbody tr { border-bottom: 1px solid var(--border); }
.ledger .ledger-total th, .ledger .ledger-total td { font-weight: 800; border-top: 2px solid var(--border); border-bottom: none; }
/* The note spans both columns, so it's also td:last-child — undo the amount
   column's nowrap/right-align here or the long sentence blows out the table. */
.ledger .ledger-note td { color: var(--text-faint); font-size: 0.8rem; font-weight: 400; padding-top: 0.3rem; white-space: normal; text-align: left; }
.ledger .l-key { color: var(--text-muted); }
.ledger .l-sub { display: block; font-size: 0.76rem; color: var(--text-faint); }

/* Two-column tax breakdown inside the <details>. */
.breakdown-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
@media (max-width: 620px) { .breakdown-cols { grid-template-columns: 1fr; } }
.breakdown-cols caption { text-align: left; font-weight: 700; font-size: 0.9rem; padding-bottom: 0.3rem; }

.handoff-row { margin-top: 1.25rem; }
.handoff-row .btn-secondary { cursor: pointer; display: inline-block; text-decoration: none; }

/* ---- Share bar ---- */
.share-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.5rem; }
.share-bar .btn-secondary { cursor: pointer; }
.share-status { min-height: 1.2em; }

/* ---- Tooltips (shared pattern with the rental tool) ---- */
.tip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 1.05rem; height: 1.05rem; padding: 0; margin-left: 0.25rem;
  border: 1px solid var(--border); border-radius: 50%;
  background: var(--surface-2); color: var(--text-faint);
  font-family: inherit; font-size: 0.68rem; font-weight: 800; line-height: 1;
  cursor: help; position: relative; vertical-align: middle; flex: none;
}
.tip:hover, .tip:focus-visible, .tip.is-open { color: #fff; background: var(--accent); border-color: var(--accent); }
.tip::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 250px;
  background: var(--text); color: var(--bg);
  padding: 0.55rem 0.7rem; border-radius: 8px;
  font-size: 0.78rem; font-weight: 500; line-height: 1.45; letter-spacing: normal;
  text-align: left; text-transform: none; white-space: normal;
  box-shadow: var(--shadow-lg); z-index: 80;
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease; pointer-events: none;
}
.tip::before {
  content: ''; position: absolute; top: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-bottom-color: var(--text);
  opacity: 0; visibility: hidden; transition: opacity 0.12s ease; z-index: 80;
}
.tip:hover::after, .tip:focus-visible::after, .tip.is-open::after,
.tip:hover::before, .tip:focus-visible::before, .tip.is-open::before { opacity: 1; visibility: visible; }
/* Desktop only: keep popovers from spilling off the right edge in the compare
   cards. (On mobile the popover becomes a centered bottom bar — see below — so
   this edge-anchor must not apply there or it would override it.) */
@media (min-width: 821px) {
  .compare-card .tip:last-child::after { left: auto; right: 0; transform: none; }
}

/* On phones/tablets, tips can sit anywhere across the row, so no left/right anchor
   stays on screen for all of them. Drop the popover into a centered bar pinned to
   the bottom of the viewport — always fully visible regardless of the button's
   position. (overflow-x: clip on body doesn't trap fixed elements, so this is
   viewport-positioned.) */
@media (max-width: 820px) {
  .tip::after {
    position: fixed; left: 1rem; right: 1rem; bottom: 1rem; top: auto;
    width: auto; max-width: 460px; margin-inline: auto; transform: none;
    font-size: 0.85rem; padding: 0.7rem 0.85rem;
  }
  .tip::before { display: none; } /* no caret in bottom-bar mode */
}

/* ---- Glossary (shared pattern with the rental tool) ---- */
.glossary-grid { display: grid; gap: 0.85rem; grid-template-columns: 1fr; margin-top: 1rem; }
@media (min-width: 680px) { .glossary-grid { grid-template-columns: 1fr 1fr; } }
.glossary-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0.85rem 1rem;
}
.glossary-item h3 { margin: 0 0 0.3rem; font-size: 1rem; display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; }
.glossary-item .g-target {
  font-size: 0.7rem; font-weight: 700; color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
  padding: 0.08rem 0.45rem; border-radius: 999px; white-space: nowrap;
}
.glossary-item p { margin: 0; font-size: 0.9rem; color: var(--text-muted); }

/* ---- Print / Save-as-PDF report ----
   Hidden on screen; the only thing shown when printing. Light colors inline. */
.print-report { display: none; }
@media print {
  body > *, main.container > * { display: none !important; }
  main.container { display: block !important; max-width: none; padding: 0; margin: 0; }
  #w2-print-report { display: block !important; }
  #w2-print-report { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]:after { content: ''; }
}
@page { margin: 14mm; }
