/* =====================================================================
   MaaX.io — style.css
   Phase 1: Homepage
   ---------------------------------------------------------------------
   Contents
   1. Design tokens
   2. Reset & base
   3. Utilities (container, sections, buttons, cards, grids)
   4. Navigation
   5. Hero
   6. Categories
   7. Calculators
   8. Guides
   9. Why Choose MaaX
   10. Footer
   11. Modal & calculator forms
   12. Responsive
   13. Motion preferences
   ===================================================================== */

/* ============ 1. Design tokens ============ */
:root {
  /* Brand palette (derived from the MaaX logo) */
  --ink:        #0C1B3A;   /* headings / near-navy */
  --blue-700:   #16309A;   /* deep blue, hovers */
  --blue-600:   #1D3FBF;   /* primary brand blue */
  --blue-100:   #DCE7FB;   /* light blue accent */
  --blue-50:    #EFF4FD;   /* tinted section background */
  --teal-600:   #0F9B78;   /* accent, dark */
  --teal-500:   #17B890;   /* accent from logo arrow */
  --gray-600:   #55607A;   /* body text */
  --gray-400:   #8B94A9;   /* muted text */
  --gray-200:   #E3E8F1;   /* borders */
  --white:      #FFFFFF;

  /* Signature "growth" gradient — mirrors the logo arrow */
  --grad-growth: linear-gradient(90deg, var(--blue-600), var(--teal-500));

  /* Type */
  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body:    "Inter", "Segoe UI", sans-serif;

  /* Shape & elevation */
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(12, 27, 58, 0.05), 0 2px 8px rgba(12, 27, 58, 0.05);
  --shadow-md: 0 6px 20px rgba(12, 27, 58, 0.08);
  --shadow-lg: 0 18px 50px rgba(12, 27, 58, 0.16);

  /* Layout */
  --container: 1160px;
  --nav-height: 72px;
}

/* ============ 2. Reset & base ============ */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 12px);
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--gray-600);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

img { max-width: 100%; display: block; }

a { color: var(--blue-600); text-decoration: none; }

button { font: inherit; cursor: pointer; background: none; border: none; }

:focus-visible {
  outline: 3px solid var(--teal-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 200;
  background: var(--ink);
  color: var(--white);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top 0.2s ease;
}
.skip-link:focus { top: 0; }

/* ============ 3. Utilities ============ */
.container {
  width: min(var(--container), 100% - 48px);
  margin-inline: auto;
}

.section { padding: 88px 0; }
.section-tint { background: var(--blue-50); }

.section-head {
  max-width: 620px;
  margin: 0 auto 52px;
  text-align: center;
}
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); margin-bottom: 12px; }
.section-head p { color: var(--gray-600); }

.section-cta { text-align: center; margin-top: 48px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: 999px;
  padding: 12px 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.btn-lg { padding: 15px 30px; font-size: 1.02rem; }

.btn-primary {
  background: var(--blue-600);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(29, 63, 191, 0.25);
}
.btn-primary:hover {
  background: var(--blue-700);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(29, 63, 191, 0.3);
}

.btn-ghost {
  color: var(--blue-600);
  border: 1.5px solid var(--blue-100);
  background: var(--white);
}
.btn-ghost:hover { border-color: var(--blue-600); transform: translateY(-2px); }

/* Text link buttons inside cards */
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--blue-600);
  margin-top: auto;
  padding: 4px 0;
  transition: gap 0.18s ease, color 0.18s ease;
}
.link-btn:hover { gap: 10px; color: var(--teal-600); }

/* Cards & grids */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-100);
}

.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Icon chips — signature gradient */
.icon-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue-50), #E4F6F0);
  color: var(--blue-600);
  position: relative;
}
.icon-chip::after {
  /* thin gradient ring, echoing the logo arrow */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  background: var(--grad-growth);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.5;
}
.icon-chip svg { width: 26px; height: 26px; }
.icon-chip-sm { width: 48px; height: 48px; border-radius: 14px; }
.icon-chip-sm svg { width: 23px; height: 23px; }

/* ============ 4. Navigation ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.nav.is-scrolled {
  border-bottom-color: var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav-logo img { height: 40px; width: auto; }

.nav-links { display: flex; gap: 6px; }

.nav-link {
  position: relative;
  color: var(--ink);
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color 0.18s ease, background-color 0.18s ease;
}
.nav-link:hover { background: var(--blue-50); color: var(--blue-600); }
.nav-link.is-active { color: var(--blue-600); }
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--grad-growth);
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============ 5. Hero ============ */
.hero {
  background:
    radial-gradient(900px 420px at 88% -10%, rgba(23, 184, 144, 0.10), transparent 60%),
    radial-gradient(900px 460px at 8% 0%, rgba(29, 63, 191, 0.08), transparent 60%),
    var(--white);
  padding: 84px 0 96px;
  overflow: hidden;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: 56px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--teal-600);
  background: #E4F6F0;
  border: 1px solid #C8ECE0;
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(2.4rem, 5.4vw, 3.7rem);
  font-weight: 700;
  margin-bottom: 20px;
}

/* Signature: rising gradient underline, echoing the logo arrow */
.grad-underline {
  position: relative;
  white-space: nowrap;
}
.grad-underline::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.02em;
  height: 0.14em;
  border-radius: 999px;
  background: var(--grad-growth);
  transform: rotate(-1.6deg);
  transform-origin: left center;
}

.hero-sub {
  font-size: 1.13rem;
  max-width: 520px;
  margin-bottom: 32px;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 30px; }

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  list-style: none;
  font-size: 0.92rem;
  color: var(--gray-400);
}
.hero-trust li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero-trust li::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--grad-growth);
}

/* Hero visual */
.hero-visual { position: relative; }

.hero-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 18px;
}

.hero-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}
.hero-card-label {
  display: block;
  font-size: 0.84rem;
  color: var(--gray-400);
  margin-bottom: 2px;
}
.hero-card-value {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--ink);
}
.hero-card-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal-600);
  background: #E4F6F0;
  border-radius: 999px;
  padding: 5px 11px;
}

.hero-chart { width: 100%; height: auto; }

/* Line draws itself on page load */
.hero-line {
  stroke-dasharray: 560;
  stroke-dashoffset: 560;
  animation: draw-line 1.6s ease-out 0.3s forwards;
}
@keyframes draw-line { to { stroke-dashoffset: 0; } }

.hero-card-months {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray-400);
  padding: 8px 6px 0;
}

/* Floating stat chips */
.hero-chip {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  animation: float 5s ease-in-out infinite;
}
.hero-chip strong { display: block; font-family: var(--font-display); color: var(--ink); line-height: 1.2; }
.hero-chip small { color: var(--gray-400); font-size: 0.78rem; }

.hero-chip-1 { top: -22px; right: -14px; }
.hero-chip-2 { bottom: -24px; left: -18px; animation-delay: 2.2s; }

.hero-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: #E4F6F0;
  color: var(--teal-600);
  flex-shrink: 0;
}
.hero-chip-icon svg { width: 20px; height: 20px; }
.hero-chip-icon-alt { background: var(--blue-50); color: var(--blue-600); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

/* ============ 6. Categories ============ */
.category-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 30px 28px;
}
.category-card h3 { font-size: 1.18rem; }
.category-card p { font-size: 0.95rem; flex-grow: 1; }

/* ============ 7. Calculators ============ */
.calc-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 28px 26px;
  position: relative;
  overflow: hidden;
}
/* gradient top edge revealed on hover */
.calc-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3.5px;
  background: var(--grad-growth);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.calc-card:hover::before { opacity: 1; }

.calc-card h3 { font-size: 1.1rem; }
.calc-card p { font-size: 0.94rem; flex-grow: 1; }

/* Explore-button pulse highlight (triggered by JS) */
.calc-card.is-highlighted {
  border-color: var(--teal-500);
  box-shadow: 0 0 0 4px rgba(23, 184, 144, 0.18), var(--shadow-md);
}

/* ============ 8. Guides ============ */
.guide-card { overflow: hidden; display: flex; flex-direction: column; }

.guide-art {
  border-bottom: 1px solid var(--gray-200);
}
.guide-art svg { width: 100%; height: auto; display: block; }

.guide-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 26px 26px;
  flex-grow: 1;
}

.guide-tag {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--blue-600);
  background: var(--blue-50);
  border-radius: 999px;
  padding: 4px 11px;
}
.guide-tag-teal { color: var(--teal-600); background: #E4F6F0; }

.guide-card h3 { font-size: 1.14rem; }
.guide-card p { font-size: 0.94rem; flex-grow: 1; }

/* ============ 9. Why Choose MaaX ============ */
.feature-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 26px 24px;
}
.feature-card h3 { font-size: 1.05rem; }
.feature-card p { font-size: 0.92rem; }

/* ============ 10. Footer ============ */
.footer {
  background: var(--ink);
  color: #B8C2D8;
  padding: 64px 0 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr 1.2fr 1.2fr;
  gap: 40px;
  padding-bottom: 48px;
}

.footer-logo img {
  height: 34px;
  width: auto;
  margin-bottom: 16px;
  /* the logo is dark-on-transparent; brighten it for the dark footer */
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.footer-about p { font-size: 0.92rem; line-height: 1.7; }

.footer-col { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.footer-col h4 {
  color: var(--white);
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.footer-col a,
.footer-link-btn {
  color: #B8C2D8;
  font-size: 0.92rem;
  text-align: left;
  padding: 0;
  transition: color 0.15s ease;
}
.footer-col a:hover,
.footer-link-btn:hover { color: var(--teal-500); }

.footer-bar {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.86rem;
  color: #8B94A9;
}

/* ============ 11. Modal & calculator forms ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 27, 58, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.2s ease;
}

.modal-dialog {
  position: relative;
  width: min(640px, 100%);
  max-height: min(84vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: rise-in 0.25s ease;
  overflow: hidden;
}

@keyframes fade-in { from { opacity: 0; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(14px); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-head h2 { font-size: 1.25rem; }

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--gray-600);
  background: var(--blue-50);
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--blue-100); color: var(--ink); }
.modal-close svg { width: 18px; height: 18px; }

.modal-body {
  padding: 24px 26px 30px;
  overflow-y: auto;
}

/* --- Calculator form --- */
.calc-intro { font-size: 0.94rem; margin-bottom: 20px; }

.calc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 22px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.86rem; font-weight: 600; color: var(--ink); }

.field-input {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus-within {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(29, 63, 191, 0.12);
}
.field-input span {
  padding: 0 0 0 12px;
  color: var(--gray-400);
  font-size: 0.92rem;
}
.field-input input {
  width: 100%;
  border: none;
  background: none;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
}
.field-input input:focus { outline: none; }
/* hide number-input spinners for a cleaner look */
.field-input input::-webkit-outer-spin-button,
.field-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field-input input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* --- Calculator results --- */
.calc-results {
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.calc-result-primary { text-align: center; margin-bottom: 16px; }
.calc-result-primary .label { font-size: 0.86rem; color: var(--gray-600); }
.calc-result-primary .value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  background: var(--grad-growth);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.calc-result-rows { display: grid; gap: 8px; }
.calc-result-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.94rem;
  padding-top: 8px;
  border-top: 1px dashed var(--blue-100);
}
.calc-result-row strong { color: var(--ink); font-weight: 600; }

.calc-warning {
  background: #FDF1EC;
  border: 1px solid #F5CDBC;
  color: #A34A22;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  padding: 12px 14px;
}

.calc-note {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-top: 14px;
}

/* --- Guide / legal articles inside modal --- */
.article h3 { font-size: 1.08rem; margin: 22px 0 8px; }
.article p { font-size: 0.96rem; margin-bottom: 12px; }
.article ul { margin: 0 0 12px 20px; }
.article li { font-size: 0.96rem; margin-bottom: 6px; }
.article .article-meta {
  font-size: 0.84rem;
  color: var(--gray-400);
  margin-bottom: 16px;
}

/* ============ 12. Responsive ============ */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr; }
}

@media (max-width: 880px) {
  .section { padding: 68px 0; }

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

  /* Hero stacks */
  .hero { padding: 56px 0 80px; }
  .hero-inner { grid-template-columns: 1fr; gap: 64px; }
  .hero-sub { max-width: none; }
  .hero-chip-1 { right: 0; }
  .hero-chip-2 { left: 0; }

  /* Mobile navigation */
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 4px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
    padding: 14px 20px 20px;
    display: none;
  }
  .nav-links.is-open { display: flex; }
  .nav-link { padding: 12px 14px; border-radius: var(--radius-sm); }
  .nav-link.is-active::after { display: none; }
}

@media (max-width: 620px) {
  .container { width: min(var(--container), 100% - 36px); }

  .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .hero-actions .btn { width: 100%; }

  .hero-chip { position: static; margin-top: 14px; animation: none; }
  .hero-visual { display: flex; flex-direction: column; }

  .calc-fields { grid-template-columns: 1fr; }

  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bar { flex-direction: column; text-align: center; }
}

/* ============ 13. Motion preferences ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .hero-line { stroke-dashoffset: 0; animation: none; }
}
