/* ==========================================================================
   PaycheckLedger — design tokens
   Palette:  --ink (deep navy) / --paper (stub cream) / --ledger (green, net pay)
             --brick (deductions accent) / --graphite (secondary text) / --gold (accent)
   Type:     Space Grotesk (display) · IBM Plex Sans (body/UI) · IBM Plex Mono (ledger numbers)
   ========================================================================== */

:root {
  --ink: #12213B;
  --ink-soft: #1D3358;
  --paper: #FBF8F2;
  --paper-line: #DCD3BE;
  --ledger: #1F6F54;
  --ledger-dark: #164F3D;
  --brick: #A9432E;
  --graphite: #5B6572;
  --gold: #E7B549;
  --bg: #F3F1EC;
  --white: #FFFFFF;

  --font-display: "Space Grotesk", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius-sm: 6px;
  --radius-md: 10px;
  --shadow-card: 0 1px 2px rgba(18,33,59,0.06), 0 8px 24px rgba(18,33,59,0.06);
  --shadow-stub: 0 20px 50px rgba(18,33,59,0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--gold); color: var(--ink); padding: 10px 16px;
  z-index: 100; font-weight: 600;
}
.skip-link:focus { left: 12px; top: 12px; }

a { color: var(--ink-soft); }

h1, h2, h3 { font-family: var(--font-display); color: var(--ink); margin: 0 0 .5em; letter-spacing: -0.01em; }

/* ---------------------------- Header ---------------------------- */
.site-header {
  background: var(--ink);
  color: var(--paper);
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 18px; padding-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--gold); color: var(--ink);
  font-family: var(--font-mono); font-weight: 700; font-size: 18px;
}
.brand-text { font-family: var(--font-display); font-weight: 600; font-size: 20px; color: var(--paper); }
.brand-accent { color: var(--gold); }
.tax-year-badge {
  margin: 0; font-family: var(--font-mono); font-size: 13px;
  color: var(--ink); background: var(--gold);
  padding: 5px 12px; border-radius: 999px; font-weight: 600;
}

/* ---------------------------- Hero ---------------------------- */
.hero { padding: 56px 24px 32px; text-align: left; max-width: 900px; }
.eyebrow {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em;
  font-size: 13px; color: var(--ledger-dark); font-weight: 600; margin: 0 0 12px;
}
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.1; }
.hero-sub { color: var(--graphite); font-size: 17px; max-width: 640px; }

/* ---------------------------- Layout grid ---------------------------- */
.calculator-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 28px;
  align-items: start;
  padding-bottom: 48px;
}

/* ---------------------------- Form / cards ---------------------------- */
.calc-form { counter-reset: card-step; }

.card {
  background: var(--white);
  border: 1px solid #E4E0D5;
  border-top: 4px solid var(--ledger);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 26px 24px 22px;
  margin: 0 0 22px;
  counter-increment: card-step;
}
.card legend {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 600; font-size: 18px;
  color: var(--ink); padding: 4px 14px 4px 6px; margin-left: -6px;
  background: var(--white);
  border: 1px solid #E4E0D5;
  border-radius: 999px;
}
.card legend::before {
  content: counter(card-step);
  display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ledger); color: var(--white);
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}
.field-note { color: var(--graphite); font-size: 13px; margin: 2px 0 16px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px 18px;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid #EFEBE0;
}
.field-row:first-of-type { margin-top: 16px; padding-top: 0; border-top: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.hint { font-weight: 400; color: var(--graphite); font-size: 12px; }

input[type="number"], select {
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 10px 12px;
  border: 1.5px solid #D6D1C3;
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  width: 100%;
}
input[type="number"]:hover, select:hover { border-color: var(--ledger); }
input[type="number"]:focus, select:focus {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--ink-soft);
}

.deduction-table-head {
  display: grid;
  grid-template-columns: 1fr 90px 130px;
  gap: 10px;
  padding: 0 12px 8px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  color: var(--graphite);
}

.deduction-row {
  display: grid;
  grid-template-columns: 1fr 90px 130px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.deduction-table-body .deduction-row:nth-child(even) { background: var(--paper); }
.deduction-row label { font-size: 14px; font-weight: 500; color: var(--ink); }

.disclaimer-inline {
  font-size: 13px; color: var(--graphite); border-left: 3px solid var(--gold);
  padding-left: 12px; margin: 8px 0 0;
}

/* ---------------------------- Pay stub (signature element) ---------------------------- */
.stub-wrap { position: sticky; top: 20px; }

.stub {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-stub);
  position: relative;
  overflow: hidden;
  padding: 26px 24px 22px;
  border: 1px solid var(--ink);
}

/* torn / perforated top edge */
.stub-tear {
  position: absolute; top: 0; left: 0; right: 0; height: 14px;
  background:
    radial-gradient(circle at 10px 0, transparent 7px, var(--paper) 7.5px) top left / 20px 14px repeat-x;
  background-color: var(--ink);
}
.stub-tear::before { content: ""; }

.stub-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 10px; margin-bottom: 14px;
  border-bottom: 2px dashed var(--paper-line);
  padding-bottom: 12px;
}
.stub-label { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin: 0; color: var(--ink); }
.stub-period {
  font-family: var(--font-mono); font-size: 12px; color: var(--graphite);
  text-transform: uppercase; letter-spacing: .06em; margin: 0;
}

.stub-section {
  margin-bottom: 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.stub-section-title {
  font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--white); margin: -12px -14px 10px; font-weight: 700;
  background: var(--ink-soft);
  padding: 6px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.stub-line {
  display: flex; align-items: baseline; gap: 6px;
  font-family: var(--font-mono); font-size: 14px; color: var(--ink);
  padding: 4px 0;
}
.stub-line span {
  color: var(--graphite);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.stub-line span::after {
  content: " ..........................................................................";
  color: var(--paper-line);
  letter-spacing: 2px;
}
.stub-line b { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stub-line.total { border-top: 1px solid var(--paper-line); margin-top: 4px; padding-top: 6px; font-weight: 700; }
.stub-line.total span::after { content: ""; }

.stub-net {
  background: var(--ledger);
  color: var(--white);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex; justify-content: space-between; align-items: center;
  margin: 18px 0 16px;
  border: 2px solid var(--ledger-dark);
  box-shadow: 0 8px 20px rgba(31,111,84,0.4);
}
.stub-net span {
  font-family: var(--font-mono); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .07em;
}
.stub-net b { font-family: var(--font-mono); font-size: 28px; font-variant-numeric: tabular-nums; }

.stub-foot {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--paper-line);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.stub-foot-item { display: flex; flex-direction: column; gap: 2px; }
.stub-foot-item span { font-size: 11px; color: var(--graphite); text-transform: uppercase; letter-spacing: .04em; }
.stub-foot-item b { font-family: var(--font-mono); font-size: 15px; color: var(--ink); }

.stub-disclaimer { font-size: 12px; color: var(--graphite); text-align: center; margin-top: 10px; }

#lineOvertimeRow.is-zero, #lineBonusRow.is-zero, #lineAddMedicareRow.is-zero,
#lineStateRow.is-zero, #lineLocalRow.is-zero { display: none; }

/* ---------------------------- Info / FAQ sections ---------------------------- */
.info-section, .faq-section { padding: 40px 24px 8px; }
.info-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px; margin-top: 20px;
}
.info-card {
  background: var(--white); border: 1px solid #E4E0D5; border-radius: var(--radius-md);
  padding: 18px 20px; box-shadow: var(--shadow-card);
}
.info-card h3 { font-size: 16px; margin-bottom: 8px; }
.info-card p { color: var(--graphite); font-size: 14px; margin: 0; }

.faq-section { padding-bottom: 60px; }
.faq-section details {
  background: var(--white); border: 1px solid #E4E0D5; border-radius: var(--radius-sm);
  padding: 14px 18px; margin-bottom: 10px;
}
.faq-section summary { font-weight: 600; cursor: pointer; font-family: var(--font-display); }
.faq-section p { color: var(--graphite); margin: 10px 0 0; font-size: 14.5px; }

/* ---------------------------- Footer ---------------------------- */
.site-footer { background: var(--ink); color: #C6CBD6; padding: 22px 0; margin-top: 20px; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 13px; }
.footer-links a { color: var(--gold); text-decoration: none; margin-left: 16px; }
.footer-links a:first-child { margin-left: 0; }

/* ---------------------------- Responsive ---------------------------- */
@media (max-width: 900px) {
  .calculator-grid { grid-template-columns: 1fr; }
  .stub-wrap { position: static; }
  .header-inner { flex-direction: row; }
}

@media (max-width: 520px) {
  .hero { padding: 36px 20px 24px; }
  .card, .stub { padding: 18px 16px; }
  .deduction-table-head { display: none; }
  .deduction-row { grid-template-columns: 1fr; }
  .deduction-row label { margin-bottom: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
