@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ===== VARIABLES ===== */
:root {
  --bg: #FAFBFC;
  --bg-2: #FFFFFF;
  --card: rgba(0, 0, 0, 0.03);
  --line: rgba(0, 0, 0, 0.10);
  --text: #1A1D23;
  --muted: #65708A;
  --accent: #6C4FE0;
  --accent-2: #1DB888;
  --content-max: 1200px;
  --padding-desktop: 80px;
  --padding-tablet: 40px;
  --padding-mobile: 20px;
}

/* ===== RESET ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== BACKGROUND ===== */
.bg-gradient {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(108, 79, 224, 0.06), transparent 50%),
    radial-gradient(circle at bottom left, rgba(29, 184, 136, 0.04), transparent 50%);
  z-index: 0;
  pointer-events: none;
}

/* ===== HOMEPAGE HERO ===== */
.hero {
  padding: 40px var(--padding-desktop) 120px;
  position: relative;
  z-index: 2;
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.hamburger {
  display: none;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.logo {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
  padding: 10px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.logo span {
  color: var(--accent-2);
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a {
  padding: 10px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.cta {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-top: 80px;
  align-items: start;
}

.eyebrow {
  color: var(--accent-2);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  font-size: 56px;
  margin: 20px 0;
  font-family: "Space Grotesk", sans-serif;
}

.subhead {
  font-size: 18px;
  color: var(--muted);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin: 32px 0;
}

/* ===== BUTTONS ===== */
button {
  cursor: pointer;
  border: none;
  font-family: inherit;
  min-height: 44px;
  min-width: 44px;
}

.primary {
  background: linear-gradient(135deg, var(--accent), #a855f7);
  color: white;
  padding: 14px 28px;
  border-radius: 10px;
  font-weight: 600;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 14px 28px;
  border-radius: 10px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary {
  background: transparent;
  border: 1px solid var(--accent-2);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Guide CTA — accent pill button */
.guide-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 20px;
  text-decoration: none;
  transition: opacity 0.2s, transform 0.15s;
}
.guide-cta:hover { opacity: 0.85; transform: translateY(-1px); }

/* ===== STATS ===== */
.stats {
  display: flex;
  gap: 24px;
}

.stat {
  font-size: 22px;
  font-weight: 700;
  display: block;
}

.label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ===== HERO CARD ===== */
.hero-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 28px;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.hero-card-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.muted {
  color: var(--muted);
  margin-bottom: 16px;
}

.field-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

/* ===== FORM ELEMENTS ===== */
label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  position: relative;
}

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
  cursor: help;
  position: absolute;
  right: 12px;
  bottom: 12px;
}

.info::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  bottom: 140%;
  transform: none;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  width: max-content;
  max-width: min(260px, 80vw);
  white-space: normal;
  display: none;
  z-index: 5;
}

.info:hover::after,
.info:focus::after {
  display: block;
}

input {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  padding-right: 38px;
  min-height: 44px;
  -webkit-appearance: none;
}

select {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  -webkit-appearance: none;
}

.result {
  background: rgba(124, 92, 255, 0.15);
  padding: 12px 14px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
}

/* ===== SECTIONS (Homepage) ===== */
.section {
  padding: 80px var(--padding-desktop);
  position: relative;
  z-index: 2;
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px;
}

.section h2 {
  font-size: 40px;
  font-family: "Space Grotesk", sans-serif;
}

/* ===== GRID / CARDS ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 20px;
  border-radius: 14px;
}

.card p {
  color: var(--muted);
  margin: 10px 0 16px;
}

.pill {
  display: inline-flex;
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  min-height: 44px;
  min-width: 44px;
  align-items: center;
  justify-content: center;
}

/* ===== ADS ===== */
.ad {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

/* ===== LAYOUT HELPERS ===== */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 20px;
}

.list {
  margin-top: 18px;
  display: grid;
  gap: 12px;
  color: var(--muted);
}

.list li {
  padding: 10px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.panel {
  border: 1px solid var(--line);
  background: var(--card);
  padding: 24px;
  border-radius: 16px;
}

.stack {
  display: grid;
  gap: 10px;
  margin: 16px 0 20px;
  color: var(--muted);
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.columns p {
  color: var(--muted);
  margin-top: 10px;
}

/* ===== FAQ ===== */
.faq {
  background: rgba(0, 0, 0, 0.02);
  border-radius: 20px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

/* ===== CALCULATOR PAGES ===== */
.calculator {
  padding: 40px var(--padding-desktop) 80px;
  position: relative;
  z-index: 2;
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.calc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.calc-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.calc-intro {
  display: grid;
  gap: 8px;
}

.guide-link {
  width: fit-content;
  margin-top: 6px;
  white-space: normal;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.calc-card,
.calc-results {
  min-width: 0;
}

.calc-card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.calc-results {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 16px;
  display: grid;
  gap: 18px;
  align-content: start;
  justify-items: center;
  width: 100%;
  box-sizing: border-box;
}

.calc-results > * {
  width: 100%;
}

.result-card {
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.4);
  padding: 20px;
  border-radius: 14px;
  text-align: center;
}

.big-result {
  font-size: 34px;
  font-weight: 700;
  margin-top: 8px;
}

.result-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  text-align: center;
}

.calc-facts {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.calc-facts ul {
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

/* ===== ADVANCED / SCHEDULE / CHIPS ===== */
.advanced-toggle {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.advanced-section {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.advanced-section.hidden {
  display: none;
}

.schedule {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  max-height: 260px;
  overflow: auto;
  font-size: 12px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.schedule table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;
}

.schedule th,
.schedule td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  text-align: right;
}

.schedule th:first-child,
.schedule td:first-child {
  text-align: left;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.chart {
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  position: relative;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.chart canvas {
  width: 100% !important;
  height: 360px !important;
  max-height: 400px;
  display: block;
  margin: 0 auto;
}

/* ===== PAGE HERO (Calculator/Blog pages) ===== */
.page-hero {
  padding: 60px var(--padding-desktop) 40px;
  border-bottom: 1px solid var(--line);
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

/* ===== SITE NAV (blog/subpages) ===== */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 32px;
}

.site-nav .logo a {
  color: inherit;
  text-decoration: none;
}

.site-nav .nav-links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  color: var(--muted);
}

.site-nav .nav-links a {
  padding: 10px 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.site-nav .nav-links a:hover {
  color: var(--text);
}

.site-nav .nav-links a.active {
  color: var(--text);
  font-weight: 500;
}

.site-nav .nav-cta {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}

.site-nav .nav-cta:hover {
  background: var(--accent);
  color: #fff;
}

/* Guide CTA Banner */
.guide-cta {
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.12), rgba(69, 214, 169, 0.08));
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
  margin: 40px 0;
}

.guide-cta h3 {
  font-size: 20px;
  margin-bottom: 8px;
  color: var(--text);
}

.guide-cta p {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 15px;
}

.guide-cta .cta-btn {
  display: inline-block;
  background: #6C4FE0;
  color: #ffffff;
  padding: 14px 32px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  transition: background 0.2s, transform 0.15s;
}

.guide-cta .cta-btn:hover {
  background: #6b4de6;
  transform: translateY(-1px);
}

/* Related Guides / Related Tools Grid */
.related-section {
  margin: 48px 0 32px;
}

.related-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--text);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.related-card {
  background: var(--card-bg, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.15s;
  display: block;
}

.related-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.related-card .card-icon {
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.related-card .card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}

.related-card .card-desc {
  font-size: 13px;
  color: var(--muted);
  display: block;
  line-height: 1.5;
}

/* Calculator Guide Link */
.calc-guide-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 14px;
  margin: 8px 0;
  transition: color 0.2s;
}

.calc-guide-link:hover {
  color: #6b4de6;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs .separator {
  margin: 0 6px;
  color: var(--line);
}

/* Featured Calculators Grid (blog index) */
.featured-calculators {
  padding: 60px var(--padding-desktop);
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.featured-calculators h2 {
  font-size: 28px;
  margin-bottom: 8px;
}

.featured-calculators .section-subtitle {
  color: var(--muted);
  margin-bottom: 32px;
}

.featured-calculators .calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.featured-calculators .calc-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 20px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.featured-calculators .calc-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(108, 79, 224, 0.08);
}

.featured-calculators .calc-card .calc-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.featured-calculators .calc-card .calc-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.featured-calculators .calc-card .calc-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.page-hero h1 {
  font-size: 40px;
  margin-bottom: 12px;
}

.page-hero p {
  color: var(--muted);
}

/* ===== LEGAL / FOOTER ===== */
.legal {
  padding: 40px var(--padding-desktop) 80px;
  position: relative;
  z-index: 2;
  display: grid;
  gap: 16px;
  color: var(--muted);
  line-height: 1.7;
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.legal h1 {
  font-size: 36px;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
}

.legal h2,
.legal h3 {
  color: var(--text);
  margin-top: 16px;
  font-family: "Space Grotesk", sans-serif;
}

.legal ul {
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

footer {
  padding: 40px var(--padding-desktop) 80px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  position: relative;
  z-index: 2;
  max-width: calc(var(--content-max) + var(--padding-desktop) * 2);
  margin: 0 auto;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.footer-social {
  display: flex;
  gap: 12px;
  align-items: center;
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer-social a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ===== COOKIE BANNER ===== */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: var(--content-max);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  padding: 18px 20px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  z-index: 999;
}

.cookie-banner.hidden {
  display: none;
}

.cookie-banner p {
  color: var(--muted);
  font-size: 14px;
  flex: 1 1 240px;
}

.cookie-banner button {
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
}

.cookie-actions {
  display: flex;
  gap: 12px;
}

/* ===== CALC-FORM / INPUT-GROUP (legacy structure) ===== */
.calc-form {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}

.calc-form h3,
.calc-results h3 {
  font-family: "Space Grotesk", sans-serif;
  margin-bottom: 16px;
}

.input-group {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.input-group input,
.input-group select {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
}

.note {
  color: var(--muted);
  font-size: 13px;
}

/* =================================================================
   RESPONSIVE BREAKPOINTS — Organized by viewport
   ================================================================= */

/* ---------- TABLET (769px – 1024px) ---------- */
@media (max-width: 1024px) {
  :root {
    --padding-desktop: 40px;
  }

  .hero h1 {
    font-size: 44px;
  }

  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    margin-top: 48px;
  }

  .section h2 {
    font-size: 32px;
  }

  .calculator .calc-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .result-split {
    grid-template-columns: repeat(2, 1fr);
  }

  .chart canvas {
    height: 300px !important;
  }
}

/* ---------- MOBILE (≤ 768px) ---------- */
@media (max-width: 768px) {
  :root {
    --padding-desktop: var(--padding-mobile);
  }

  /* Nav */
  .nav {
    flex-wrap: wrap;
    gap: 12px;
  }

  .nav-links,
  .site-nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    z-index: 999;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }

  .nav-links.open,
  .site-nav .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 12px 20px;
    min-height: 44px;
  }

  .site-nav .nav-cta {
    display: none;
  }

  .site-nav {
    margin-bottom: 20px;
  }

  .nav, .site-nav {
    position: relative;
  }

  .hamburger {
    display: flex;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 10px;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
  }

  .hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s, opacity 0.2s;
  }

  .hamburger.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .hamburger.open span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .featured-calculators .calc-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .logo {
    font-size: 18px;
  }

  .cta {
    width: 100%;
    text-align: center;
    padding: 10px 16px;
    font-size: 11px;
  }

  /* Hero */
  .hero {
    padding-top: 24px;
    padding-bottom: 60px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 32px;
    margin-top: 40px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions a {
    width: 100%;
    text-align: center;
  }

  .stats {
    flex-direction: column;
  }

  /* Sections */
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section h2 {
    font-size: 28px;
  }

  /* Calculator pages */
  .calculator {
    padding-top: 24px;
    padding-bottom: 40px;
  }

  .calc-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .calc-top .cta {
    width: 100%;
    text-align: center;
  }

  .calc-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .calculator .calc-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .result-split {
    grid-template-columns: 1fr 1fr;
  }

  .big-result {
    font-size: 28px;
  }

  /* Page hero */
  .page-hero {
    padding-top: 32px;
    padding-bottom: 24px;
  }

  .page-hero h1 {
    font-size: 28px;
  }

  /* Form elements — ensure proper sizing */
  input,
  button,
  select,
  .btn {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
    box-sizing: border-box;
  }

  .calc-card {
    width: 100%;
    max-width: 100%;
  }

  /* Tables scroll horizontally */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Spacing for stacked elements */
  .hero-card,
  .calc-results,
  .panel,
  .card {
    margin-bottom: 16px;
  }

  /* Touch targets */
  button,
  .primary,
  .ghost,
  .secondary {
    min-height: 44px;
    min-width: 44px;
    padding: 12px 16px;
  }

  /* Tooltips reposition */
  .info::after {
    left: 16px;
    right: 16px;
    bottom: 110%;
    max-width: none;
  }

  /* Cookie banner */
  .cookie-banner {
    flex-direction: column;
    align-items: flex-start;
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 14px;
  }

  .cookie-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .cookie-actions button {
    width: 100%;
  }

  /* Footer extra padding for cookie banner */
  footer {
    padding-bottom: 120px;
  }

  /* Legal */
  .legal h1 {
    font-size: 28px;
  }
}

/* ---------- SMALL PHONE (≤ 480px) ---------- */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 26px;
  }

  .subhead {
    font-size: 15px;
  }

  .result-split {
    grid-template-columns: 1fr;
  }

  .chip-row {
    gap: 6px;
  }

  .chip {
    font-size: 10px;
    padding: 5px 8px;
  }

  .big-result {
    font-size: 24px;
  }

  .page-hero h1 {
    font-size: 24px;
  }

  .chart canvas {
    height: 220px !important;
  }

  .chart {
    padding: 10px;
  }
}

/* ===== SAFARI FIXES ===== */
@media not all and (min-resolution: 0.001dpcm) {
  @supports (-webkit-appearance: none) {
    .nav-links {
      margin: -12px;
    }
    .nav-links a {
      margin: 12px;
    }

    input, select {
      -webkit-appearance: none;
      border-radius: 8px;
    }

    .cookie-banner {
      position: -webkit-sticky;
      position: sticky;
    }
  }
}

/* ===== BLOG IMAGES ===== */
.blog-hero-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  border-radius: 12px;
  margin: 0 auto 2rem;
  display: block;
}

.blog-mid-image {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 10px;
  margin: 2rem auto;
  display: block;
}

/* ===== UNIT CONVERTER TABS ===== */
.converter-tabs {
  display: flex;
  gap: 8px;
  margin: 0 auto 24px;
  max-width: var(--content-max);
  padding: 0 var(--padding-desktop);
  flex-wrap: wrap;
}

.converter-tab {
  flex: 1;
  min-width: 120px;
  padding: 12px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.converter-tab:hover {
  background: rgba(124, 92, 255, 0.1);
  border-color: var(--accent);
  color: var(--text);
}

.converter-tab.active {
  background: rgba(124, 92, 255, 0.15);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(124, 92, 255, 0.2);
}

.converter-panel {
  display: none;
}

.converter-panel.active {
  display: block;
}

.swap-btn {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.swap-btn:hover {
  background: rgba(124, 92, 255, 0.15);
  border-color: var(--accent);
  transform: rotate(180deg);
}

@media (max-width: 768px) {
  .converter-tabs {
    padding: 0 var(--padding-mobile);
  }
  .converter-tab {
    font-size: 13px;
    padding: 10px 12px;
    min-width: 90px;
  }
}

/* ===== GUIDES HUB ===== */
.guides-hub {
  padding-top: 20px;
}

.guides-search-wrap {
  margin-bottom: 20px;
}

.guides-search {
  width: 100%;
  padding: 14px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  font-family: "Inter", sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.guides-search:focus {
  border-color: var(--accent);
}

.guides-search::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.guides-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.guide-filter {
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  font-size: 13px;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.guide-filter:hover {
  border-color: var(--accent);
  color: var(--text);
}

.guide-filter.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.guide-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  transition: border-color 0.2s, transform 0.2s;
}

.guide-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.guide-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.guide-meta {
  font-size: 12px;
  color: var(--muted);
}

.guide-card-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}

.guide-card-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}

.guide-card-cta {
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.guides-no-results {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
  font-size: 15px;
}

.guides-bottom {
  text-align: center;
  padding: 20px 0 0;
  border-top: 1px solid var(--line);
}

.guides-bottom .ghost {
  margin-top: 12px;
}

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

  .guides-filters {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  .guide-filter {
    white-space: nowrap;
  }
}

/* ===== AFFILIATE BOOK RECOMMENDATIONS ===== */
.affiliate-books {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.affiliate-books h3 {
  color: var(--text);
  font-family: "Space Grotesk", sans-serif;
  margin-bottom: 16px;
}

.affiliate-books .affiliate-disclosure {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
  font-style: italic;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.book-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s;
}

.book-card:hover {
  border-color: var(--accent);
}

.book-card .book-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.book-card .book-author {
  color: var(--muted);
  font-size: 13px;
}

.book-card .book-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  flex: 1;
}

.book-card .book-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.book-card .book-link:hover {
  text-decoration: underline;
}

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

/* ===== AUTO LOAN SCHEDULE ===== */
#autoSchedule {
  max-height: 320px; overflow-y: auto; margin-top: 1rem;
  scrollbar-width: thin; scrollbar-color: rgba(108,79,224,0.3) transparent;
}
#autoSchedule::-webkit-scrollbar { width: 6px; }
#autoSchedule::-webkit-scrollbar-track { background: transparent; }
#autoSchedule::-webkit-scrollbar-thumb { background: rgba(108,79,224,0.3); border-radius: 3px; }
#autoSchedule table { width: 100%; }
#autoSchedule th { position: sticky; top: 0; background: var(--bg-2); z-index: 1; }

/* ===== BLOG POST STYLES ===== */
.blog-article { max-width: 800px; margin: 0 auto; padding: 2rem; }
.article-header { margin-bottom: 2rem; }
.blog-article .article-title { font-size: 2.5rem; margin-bottom: 0.5rem; color: var(--text); }
.article-meta { color: var(--muted); font-size: 0.95rem; }
.article-author { color: var(--accent-2); }
.article-content { color: #374151; line-height: 1.8; font-size: 1.1rem; }
.article-content h2 { color: var(--text); margin-top: 2rem; }
.article-content p { margin-bottom: 1.25rem; }
.article-content a { color: var(--accent-2); }
.article-content ul { margin: 1rem 0 1.5rem 1.5rem; }
.article-content li { margin-bottom: 0.5rem; }
.calculator-cta {
  background: rgba(29, 184, 136, 0.1);
  border: 1px solid var(--accent-2);
  border-radius: 12px; padding: 1.5rem; margin: 2rem 0; text-align: center;
}
.calculator-cta a {
  display: inline-block; background: var(--accent-2); color: var(--text);
  padding: 0.75rem 1.5rem; border-radius: 8px; text-decoration: none;
  margin-top: 0.5rem; font-weight: 600;
}
.signature {
  font-style: italic; color: var(--accent-2);
  margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line);
}
.blog-hero-image { width: 100%; height: auto; border-radius: 12px; margin-bottom: 1.5rem; }
.blog-header { padding: 1rem 2rem; border-bottom: 1px solid var(--line); }
.blog-footer {
  text-align: center; padding: 2rem; color: var(--muted);
  font-size: 0.9rem; border-top: 1px solid var(--line); margin-top: 2rem;
}
.blog-footer a { color: var(--accent-2); }
.author-link { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(108, 79, 224, 0.3); }

/* ===== BLOG INDEX STYLES ===== */
.blog-list { max-width: 800px; margin: 0 auto; padding: 2rem; }
.blog-post-card {
  background: var(--card); border-radius: 12px; padding: 1.5rem;
  margin-bottom: 1.5rem; border: 1px solid var(--line);
  display: flex; gap: 1.25rem; align-items: flex-start;
}
.blog-post-card:hover { background: rgba(0, 0, 0, 0.05); }
.post-thumb { width: 160px; min-width: 160px; height: 80px; border-radius: 8px; object-fit: cover; }
.post-body { flex: 1; min-width: 0; }
.post-title { font-size: 1.5rem; margin-bottom: 0.5rem; }
.post-title a { color: var(--text); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.75rem; }
.post-excerpt { color: #6B7280; line-height: 1.6; }
.year-divider {
  color: var(--accent-2); font-size: 1.2rem; font-weight: 600;
  margin: 2rem 0 1rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(29, 184, 136, 0.3);
}
.blog-filters { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; align-items: flex-end; }
.filter-group { display: flex; flex-direction: column; gap: 0.25rem; }
.filter-group label { color: var(--muted); font-size: 0.85rem; }
.filter-group select {
  background: var(--card); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.5rem 1rem; font-size: 0.95rem; cursor: pointer;
}
.filter-group select:hover { border-color: var(--accent-2); }
.filter-chip {
  background: var(--accent-2); color: var(--text);
  padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.85rem;
  display: flex; align-items: center; gap: 0.25rem;
}
.filter-chip button { background: none; border: none; color: var(--text); cursor: pointer; font-weight: bold; }

/* ===== BLOG AUTHOR STYLES ===== */
.author-profile { max-width: 800px; margin: 0 auto; padding: 2rem; }
.author-hero { display: flex; gap: 2rem; align-items: center; margin-bottom: 2rem; }
.author-avatar { width: 150px; height: 150px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.author-info h1 { font-size: 2rem; color: var(--text); margin-bottom: 0.25rem; }
.author-title { color: #3b82f6; font-size: 1.1rem; font-weight: 500; }
.author-bio { color: var(--muted); line-height: 1.8; font-size: 1.05rem; margin-bottom: 2rem; }
.author-section { margin-bottom: 2rem; }
.author-section h2 {
  color: var(--text); font-size: 1.3rem; margin-bottom: 1rem;
  padding-bottom: 0.5rem; border-bottom: 1px solid var(--line);
}
.author-creds { list-style: none; padding: 0; }
.author-creds li {
  color: var(--muted); padding: 0.5rem 0; padding-left: 1.5rem;
  position: relative; font-size: 0.95rem;
}
.author-creds li::before { content: "✓"; position: absolute; left: 0; color: #3b82f6; font-weight: 700; }
.author-articles { display: flex; flex-direction: column; gap: 0.75rem; }
.author-article {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.25rem; background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: var(--text); transition: background 0.2s;
}
.author-article:hover { background: rgba(0, 0, 0, 0.05); }
.author-article:visited { color: var(--text); }
.author-article .article-title { color: var(--text); font-size: 0.95rem; font-weight: 500; }
.article-arrow { color: #3b82f6; font-size: 1.2rem; }
.back-to-blog { display: inline-block; color: var(--muted); text-decoration: none; font-size: 0.9rem; margin-bottom: 1.5rem; }
.back-to-blog:hover { color: #3b82f6; }

@media (max-width: 600px) {
  .blog-post-card { flex-direction: column; }
  .post-thumb { width: 100%; height: 120px; min-width: unset; }
  .blog-filters { flex-direction: column; }
  .filter-group { width: 100%; }
  .filter-group select { width: 100%; }
  .author-hero { flex-direction: column; text-align: center; }
  .author-avatar { width: 120px; height: 120px; }
  .author-info h1 { font-size: 1.5rem; }
}

/* ===== iOS SAFE AREA ===== */
@supports (padding: max(0px)) {
  body {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}
