/* ============================================================
   Base
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:         #f5f5f5;
  --green:      #00b341;
  --green-dk:   #007a2f;
  --green-lt:   #e6f7ec;
  --blue:       #1d4ed8;
  --amber:      #b45309;
  --text:       #111827;
  --muted:      #6b7280;
  --card-bg:    #ffffff;
  --border:     #e5e7eb;
  --result-bg:  #f0faf3;
  --radius:     14px;
  --shadow:     0 2px 6px rgba(0,0,0,.07), 0 6px 20px rgba(0,0,0,.08);
  --shadow-lg:  0 6px 12px rgba(0,0,0,.1), 0 16px 40px rgba(0,0,0,.12);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

h1, h2, h3 { line-height: 1.2; font-weight: 800; }

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

/* ============================================================
   Layout
   ============================================================ */

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ============================================================
   Header / Nav
   ============================================================ */

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: .8rem;
  padding-bottom: .8rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.5px;
}

.site-logo:hover { text-decoration: none; color: var(--green); }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .2rem;
}

.site-nav a {
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  padding: .35rem .7rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.site-nav a:hover {
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  color: var(--green);
  background: var(--green-lt);
  font-weight: 600;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  background: linear-gradient(140deg, #0f1a2e 0%, #1a2d4a 100%);
  padding: 4.5rem 0 4rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  margin-bottom: 1rem;
  letter-spacing: -.5px;
}

.hero h1 span {
  color: #67e8a0;
}

.hero-lead {
  font-size: 1.1rem;
  color: rgba(255,255,255,.75);
  max-width: 580px;
  line-height: 1.65;
}

/* ============================================================
   Calculator Cards (Home Page)
   ============================================================ */

.calculators-section {
  padding: 3rem 0 2rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .calc-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .calc-grid { grid-template-columns: repeat(3, 1fr); }
}

.calc-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  box-shadow: var(--shadow);
  color: #fff;
  text-decoration: none;
  transition: box-shadow .2s, transform .15s;
}

.calc-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
  text-decoration: none;
}

.calc-card--compare {
  background: linear-gradient(140deg, #007a2f 0%, #00b341 100%);
}

.calc-card--charging {
  background: linear-gradient(140deg, #1e3a8a 0%, #2563eb 100%);
}

.calc-card--sacrifice {
  background: linear-gradient(140deg, #92400e 0%, #d97706 100%);
}

.calc-card__icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
  opacity: 0.9;
}

.calc-card__title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: .6rem;
  color: #fff;
}

.calc-card__desc {
  font-size: .9rem;
  color: rgba(255,255,255,.82);
  line-height: 1.6;
  flex: 1;
  margin-bottom: 1.75rem;
}

.calc-card__cta {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .875rem;
  font-weight: 700;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  background: rgba(255,255,255,.2);
  color: #fff;
  align-self: flex-start;
  transition: background .15s;
}

.calc-card:hover .calc-card__cta {
  background: rgba(255,255,255,.32);
}

/* ============================================================
   About / Content Section (Home Page)
   ============================================================ */

.about-section {
  padding: 0 0 3.5rem;
}

.about-section p,
.about-section ul,
.about-section ol {
  margin-bottom: 1rem;
  max-width: 700px;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.7;
}

.about-section strong { color: var(--text); }

/* ============================================================
   Calculator Pages (shared)
   ============================================================ */

.page-header {
  background: linear-gradient(140deg, #0f1a2e 0%, #1a2d4a 100%);
  padding: 1.25rem 0 1rem;
}

.page-header h1 {
  font-size: clamp(1.15rem, 2.5vw, 1.6rem);
  color: #fff;
}

.page-header p {
  color: rgba(255,255,255,.8);
  max-width: 600px;
}

.calc-page {
  padding: 1.25rem 0 3rem;
}

/* Two-column layout: inputs left, results right */

.calc-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.5rem;
}

@media (max-width: 740px) {
  .calc-layout { grid-template-columns: 1fr; }
}

.calc-layout > .calc-panel,
.calc-layout > .results-panel {
  margin-bottom: 0;
}

@media (min-width: 741px) {
  .calc-layout > .results-panel {
    position: sticky;
    top: 4.25rem;
  }
}

.calc-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

/* Fieldset / inputs */

fieldset {
  border: none;
  margin-bottom: 0.5rem;
}

legend {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
  width: 100%;
  display: block;
}

.field { margin-bottom: .7rem; }

.field label {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: .2rem;
  color: var(--text);
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: .45rem .65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .95rem;
  color: var(--text);
  background: var(--card-bg);
  transition: border-color .15s;
  appearance: none;
}

.field input[type="number"]:focus,
.field input[type="text"]:focus,
.field select:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
  border-color: var(--green);
}

.field input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
  min-height: 44px;
}

.field-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.field-row input[type="range"] { flex: 1; }

.field-row .range-value {
  font-weight: 600;
  min-width: 3.5ch;
  text-align: right;
  font-size: .9rem;
}

/* Paired input grid */

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 .75rem;
}

/* Results */

.results-panel {
  background: var(--result-bg);
  border: 1px solid #b8e6c8;
  border-top: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.results-panel h2 {
  font-size: .68rem;
  font-weight: 700;
  color: var(--green-dk);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: .85rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid #c8e6d4;
}

.result-highlight { margin-bottom: 1rem; }

.result-highlight__label {
  font-size: .8rem;
  color: var(--muted);
  margin-bottom: .1rem;
}

.result-highlight__value {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--green);
  line-height: 1.1;
}

.result-highlight__value--neutral { color: var(--text); }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  margin-bottom: .85rem;
}

.result-item__label {
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .1rem;
}

.result-item__value {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.result-context {
  font-size: .82rem;
  color: var(--muted);
  font-style: italic;
  margin-top: .35rem;
}

/* Chart */

.chart-wrap {
  margin-top: 1rem;
  max-height: 180px;
}

/* Affiliate block */

.affiliate-block {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}

.affiliate-block a { font-weight: 600; }

/* Page prose */

.page-prose {
  max-width: 720px;
  font-size: .9rem;
  color: var(--muted);
  line-height: 1.7;
}

.page-prose h2 {
  font-size: 1rem;
  color: var(--text);
  margin: 1.25rem 0 .4rem;
}

.page-prose p { margin-bottom: .75rem; }

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: auto;
}

.site-footer .container {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.footer-copy,
.footer-disclosure {
  font-size: .8rem;
  color: var(--muted);
}

/* ============================================================
   Field helpers
   ============================================================ */

.field-note {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .3rem;
}

.field-hint {
  margin-bottom: .5rem;
}

.field-hint summary {
  font-size: .8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}

.field-hint summary::before {
  content: "ⓘ";
  font-style: normal;
}

.field-hint summary::-webkit-details-marker { display: none; }

.field-hint[open] summary { margin-bottom: .4rem; }

.field-hint p {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.5;
  background: var(--bg);
  border-radius: 6px;
  padding: .5rem .75rem;
}

/* ============================================================
   Salary sacrifice breakdown panel
   ============================================================ */

.breakdown-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #c8e6d4;
}

.breakdown-panel h3 {
  font-size: .8rem;
  font-weight: 700;
  color: var(--green-dk);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: .75rem;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}

@media (max-width: 500px) {
  .breakdown-grid { grid-template-columns: 1fr 1fr; }
}

.breakdown-item__label {
  font-size: .78rem;
  color: var(--muted);
  margin-bottom: .1rem;
}

.breakdown-item__value {
  font-size: 1rem;
  font-weight: 700;
}

.breakdown-item__value--positive { color: var(--green); }
.breakdown-item__value--cost     { color: var(--amber); }

/* ============================================================
   Calculator notice (warnings)
   ============================================================ */

.calc-notice {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: .875rem;
  color: var(--text);
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 3px solid var(--amber);
}

.calc-notice--info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 3px solid var(--blue);
}

/* ============================================================
   Utilities
   ============================================================ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
