/*
  CostBuddy website — follows docs/brand/06_brand_manual_final.md and the refreshed app UI
  (src/CostBuddy.MAUI/Resources/Styles/Colors.xaml + Styles.xaml on feature/ui-refresh-mockups).
  Deep Teal = structure & trust · Vibrant Coral = actions only · Off-White = calm surfaces.
  Poppins 600/700 for headings, Inter 400/500 for text · 8-point spacing · cards 12px, buttons 8px.
*/
:root {
  --teal: #005B6A;
  --teal-hover: #1A6B79;
  --teal-dark: #004652;
  --teal-tint: #E6F0F2;
  --coral: #FF6F61;
  --coral-hover: #FF7D71;
  --coral-pressed: #E6645A;
  --coral-text: #C94A3E;
  --coral-tint: #FFEDEB;
  --charcoal: #333333;
  --muted: #6C757D;
  --off-white: #F8F9FA;
  --line: #E9ECEF;
  --surface: #FFFFFF;
  --green: #28A745;
  --green-text: #1E7B34;
  --green-tint: #E8F5EC;

  --radius-card: 12px;
  --radius-btn: 8px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 24px 64px rgba(0, 70, 82, 0.18);

  --font-head: "Poppins", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --wrap: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.6 var(--font-body);
  color: var(--charcoal);
  background: var(--off-white);
  -webkit-font-smoothing: antialiased;
}
html.i18n-pending body { opacity: 0; }
body { transition: opacity .15s ease; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; color: var(--charcoal); margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-weight: 700; font-size: clamp(2.25rem, 5vw, 3.5rem); line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p { margin: 0; }
.wrap { width: min(var(--wrap), calc(100% - 32px)); margin: 0 auto; }
.icon { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -0.125em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -48px; background: var(--teal); color: #fff; padding: 8px 16px; border-radius: var(--radius-btn); z-index: 100; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid rgba(255, 111, 97, 0.55); outline-offset: 2px; }

/* ---------- Buttons (manual §3.3: primary coral, secondary outlined coral, tertiary teal text) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 24px; border-radius: var(--radius-btn);
  font: 600 16px/1 var(--font-head); text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s, color .15s, transform .15s;
  white-space: nowrap;
}
.btn .icon { font-size: 20px; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 15px; }
.btn-primary { background: var(--coral); color: #fff; }
.btn-primary:hover { background: var(--coral-hover); }
.btn-primary:active { background: var(--coral-pressed); }
.btn-secondary { background: var(--surface); color: var(--coral-pressed); border-color: var(--coral); }
.btn-secondary:hover { background: var(--coral-tint); }
.btn-tertiary { color: var(--teal); padding: 0 8px; }
.btn-tertiary:hover { color: var(--teal-hover); text-decoration: underline; }
.btn-light { background: #fff; color: var(--teal); }
.btn-light:hover { background: var(--teal-tint); }
.btn-outline-light { color: #fff; border-color: rgba(255,255,255,.55); }
.btn-outline-light:hover { background: rgba(255,255,255,.1); }
.btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.actions { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 72px; }
.brand-link { display: block; flex: none; }
.brand-link img { height: 36px; width: auto; }
.main-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.main-nav a {
  font: 500 15px var(--font-body); color: var(--charcoal); text-decoration: none;
  padding: 8px 12px; border-radius: var(--radius-btn); position: relative; white-space: nowrap;
}
.main-nav a:hover { color: var(--teal); background: var(--teal-tint); }
.main-nav a[aria-current="page"] { color: var(--teal); }
.main-nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 3px; border-radius: 2px; background: var(--coral);
}
.header-tools { display: flex; align-items: center; gap: 12px; }
.lang-picker { position: relative; display: flex; align-items: center; color: var(--teal); }
.lang-picker .icon { position: absolute; left: 10px; font-size: 18px; pointer-events: none; }
.lang-select {
  appearance: none; height: 40px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-btn); padding: 0 32px 0 36px; font: 500 14px var(--font-body); color: var(--charcoal); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23005B6A' stroke-width='2' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.lang-select:hover { border-color: #CED4DA; }
.nav-toggle {
  display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-btn); color: var(--teal); font-size: 22px; align-items: center; justify-content: center; cursor: pointer;
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 96px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; filter: blur(8px); }
.hero::before { width: 560px; height: 560px; right: -120px; top: -160px; background: radial-gradient(circle, rgba(0, 91, 106, 0.12), transparent 70%); }
.hero::after { width: 420px; height: 420px; left: -160px; bottom: -120px; background: radial-gradient(circle, rgba(255, 111, 97, 0.12), transparent 70%); }
.hero-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font: 500 14px var(--font-body); color: var(--teal); box-shadow: var(--shadow-card);
}
.eyebrow b { background: var(--coral); color: #fff; font: 600 12px var(--font-head); padding: 3px 10px; border-radius: 999px; }
.hero h1 { margin: 24px 0 16px; }
.hero h1 .cost { color: var(--teal); }
.hero h1 .buddy { color: var(--coral); }
.lead { font-size: 1.1875rem; color: var(--muted); max-width: 34rem; }
.hero .actions { margin-top: 32px; }
.checks { list-style: none; padding: 0; margin: 32px 0 0; display: flex; flex-wrap: wrap; gap: 8px 24px; font: 500 15px var(--font-body); }
.checks li { display: flex; align-items: center; gap: 8px; }
.checks .icon { color: var(--green); font-size: 20px; }

/* ---------- Device frames for mockup screenshots ---------- */
.devices { position: relative; padding: 0 0 64px; }
.device-desktop {
  border-radius: var(--radius-card); overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow-float); border: 1px solid rgba(0, 0, 0, 0.06);
}
.device-phone {
  width: 100%; max-width: 300px; border-radius: 44px; padding: 10px; background: #1F2B2F;
  box-shadow: var(--shadow-float), inset 0 0 0 2px #3A4A50;
}
.device-phone img { border-radius: 34px; width: 100%; }
.devices .device-phone { position: absolute; width: 31%; right: -8px; bottom: 0; }
.devices .device-desktop { width: 94%; }
.phone-row { display: flex; gap: 24px; justify-content: center; align-items: flex-end; }
.phone-row .device-phone { max-width: 260px; }
.phone-row .device-phone:nth-child(2) { transform: translateY(-24px); }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 720px; margin: 0 auto 56px; text-align: center; }
.section-head p { margin-top: 16px; color: var(--muted); font-size: 1.125rem; }
.kicker { display: inline-block; font: 600 14px var(--font-head); color: var(--coral-text); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 12px; }
.muted { color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  box-shadow: var(--shadow-card); padding: 24px;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.feature-card h3 { margin: 16px 0 8px; }
.feature-card p { color: var(--muted); }
.badge {
  width: 48px; height: 48px; border-radius: 24px; display: grid; place-items: center; font-size: 24px;
  background: var(--teal-tint); color: var(--teal); flex: none;
}
.badge.coral { background: var(--coral-tint); color: var(--coral-pressed); }
.badge.green { background: var(--green-tint); color: var(--green-text); }

/* audience chips */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); font: 500 15px var(--font-body); color: var(--charcoal); text-decoration: none;
}
.chip .icon { color: var(--teal); font-size: 18px; }
a.chip:hover { border-color: var(--teal); }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: step; }
.step { text-align: center; }
.step .device-phone { margin: 0 auto 32px; max-width: 250px; }
.step-num {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 20px;
  background: var(--coral); color: #fff; font: 700 18px var(--font-head); margin-bottom: 12px;
}
.step h3 { margin-bottom: 8px; }
.step p { color: var(--muted); max-width: 22rem; margin: 0 auto; }

/* split feature rows */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; }
.split + .split { margin-top: 112px; }
.split.reverse .split-media { order: 2; }
.split-media { display: flex; justify-content: center; }
.split-media .device-phone { max-width: 300px; }
.split-text h2 { margin-bottom: 16px; }
.split-text > p { color: var(--muted); font-size: 1.125rem; }
.ticks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 14px; }
.ticks li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; }
.ticks .icon { width: 24px; height: 24px; padding: 4px; border-radius: 12px; background: var(--coral-tint); color: var(--coral-pressed); margin-top: 1px; }
.ticks b { font-weight: 600; }

/* teal band (light logo on Deep Teal, manual §2.1 variant 3) */
.band { background: var(--teal); color: #fff; position: relative; overflow: hidden; }
.band::after {
  content: ""; position: absolute; right: -80px; top: -80px; width: 360px; height: 360px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 111, 97, .28), transparent 70%);
}
.band h2, .band h3 { color: #fff; }
.band p { color: rgba(255, 255, 255, 0.85); }
.band-inner { position: relative; z-index: 1; display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: center; padding: 80px 0; }
.band-logo { height: 40px; width: auto; margin-bottom: 24px; }
.band .actions { margin-top: 32px; }
.band-media { display: flex; justify-content: center; gap: 20px; align-items: flex-end; }
.band-media .device-phone { max-width: 220px; }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.stat-num { font: 700 2.25rem var(--font-head); color: var(--teal); }
.stat-num.coral { color: var(--coral); }
.stat-label { color: var(--muted); font-size: .95rem; }

/* use cases */
.usecase { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.usecase + .usecase { margin-top: 96px; }
.usecase.reverse .usecase-media { order: 2; }
.usecase-media { display: flex; justify-content: center; }
.usecase-tag { display: inline-flex; align-items: center; gap: 8px; font: 600 14px var(--font-head); color: var(--teal); background: var(--teal-tint); padding: 6px 12px; border-radius: 999px; margin-bottom: 16px; }
.usecase h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 12px; }
.usecase > div > p { color: var(--muted); font-size: 1.0625rem; }
.quote { margin-top: 24px; padding: 16px 20px; border-left: 4px solid var(--coral); background: var(--surface); border-radius: 0 var(--radius-card) var(--radius-card) 0; font-style: italic; color: var(--charcoal); }
.illus {
  width: 100%; max-width: 440px; aspect-ratio: 1 / 1; border-radius: 24px; background: var(--teal-tint);
  display: grid; place-items: center; position: relative; overflow: hidden;
}
.illus .icon { font-size: 120px; color: var(--teal); stroke-width: 1.5; }
.illus::after { content: ""; position: absolute; width: 55%; height: 55%; right: -12%; bottom: -12%; border-radius: 50%; background: var(--coral-tint); z-index: 0; }
.illus .icon { position: relative; z-index: 1; }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(2, minmax(0, 420px)); justify-content: center; gap: 24px; }
.plan { padding: 32px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--teal); position: relative; }
.plan-tag { position: absolute; top: -14px; left: 32px; background: var(--teal); color: #fff; font: 600 13px var(--font-head); padding: 4px 12px; border-radius: 999px; }
.plan h3 { font-size: 1.5rem; }
.plan .price { font: 700 3rem/1 var(--font-head); color: var(--teal); margin: 16px 0 4px; }
.plan .price small { font: 500 1rem var(--font-body); color: var(--muted); }
.plan .ticks { margin-bottom: 32px; flex: 1; }
.plan.soon .price { color: var(--coral); font-size: 2rem; }

.faq { max-width: 800px; margin: 0 auto; display: grid; gap: 12px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 0 24px; }
.faq summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; font: 600 17px var(--font-head); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .icon { color: var(--teal); font-size: 20px; transition: transform .2s; }
.faq details[open] summary .icon { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--muted); }

/* page hero (sub pages) */
.page-hero { padding: 72px 0 56px; text-align: center; }
.page-hero h1 { font-size: clamp(2rem, 4.4vw, 3rem); max-width: 820px; margin: 0 auto; }
.page-hero .lead { margin: 20px auto 0; max-width: 40rem; }
.page-hero .actions { justify-content: center; margin-top: 32px; }

/* get the app */
.store-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.store {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px; border-radius: var(--radius-card);
  background: #1F2B2F; color: #fff; text-decoration: none; position: relative;
}
.store .icon { font-size: 34px; }
.store small { display: block; font: 500 12px var(--font-body); opacity: .75; text-transform: uppercase; letter-spacing: .06em; }
.store strong { font: 600 20px var(--font-head); }
.store .soon { position: absolute; top: -10px; right: 16px; background: var(--coral); color: #fff; font: 600 12px var(--font-head); padding: 3px 10px; border-radius: 999px; }
.store[aria-disabled="true"] { cursor: default; }
.notice {
  display: flex; gap: 16px; align-items: flex-start; padding: 20px 24px; border-radius: var(--radius-card);
  background: var(--coral-tint); border: 1px solid #FFD3CE; color: var(--charcoal); text-align: left;
}
.notice .icon { color: var(--coral-pressed); font-size: 24px; margin-top: 2px; }
.notice h3 { font-size: 1.0625rem; margin-bottom: 4px; }
.progress-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.progress-list li { display: grid; grid-template-columns: 40px 1fr; gap: 16px; align-items: start; }
.progress-list .badge { width: 40px; height: 40px; font-size: 20px; }
.progress-list b { display: block; font: 600 16px var(--font-head); }
.progress-list span { color: var(--muted); font-size: .95rem; }
.version-meta { font: 500 14px var(--font-body); color: var(--muted); margin-top: 12px; }
.code-box {
  margin-top: 16px; padding: 16px; border-radius: var(--radius-card); background: var(--off-white);
  border: 1.5px dashed var(--teal); font: 600 1.75rem var(--font-head); letter-spacing: .18em; text-align: center; color: var(--teal);
}

/* ---------- Footer ---------- */
.site-footer { background: var(--teal-dark); color: rgba(255, 255, 255, 0.8); padding: 64px 0 32px; font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 48px; }
.site-footer img { height: 34px; width: auto; margin-bottom: 16px; }
.site-footer h4 { color: #fff; font-size: 15px; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.site-footer a { color: rgba(255, 255, 255, 0.85); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.15); margin-top: 48px; padding-top: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 14px; }
.dev-pill { display: inline-flex; align-items: center; gap: 8px; }
.dev-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 4px rgba(255, 111, 97, .25); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Responsive: tablet 768–1279, mobile 320–767 (manual §3.2) ---------- */
@media (max-width: 1100px) {
  .main-nav a { padding: 8px 8px; font-size: 14px; }
  .header-tools .btn { display: none; }
}
@media (max-width: 960px) {
  .site-header .wrap { gap: 12px; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .main-nav {
    position: absolute; top: 72px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px 16px 16px; display: none; box-shadow: var(--shadow-card);
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 8px; font-size: 16px; }
  .main-nav a[aria-current="page"]::after { left: 0; right: auto; top: 12px; bottom: 12px; width: 3px; height: auto; }
  .header-tools .btn { display: inline-flex; }
  .hero-grid, .split, .usecase, .band-inner { grid-template-columns: 1fr; gap: 48px; }
  .split.reverse .split-media, .usecase.reverse .usecase-media { order: 0; }
  .split + .split, .usecase + .usecase { margin-top: 80px; }
  .grid-3, .grid-4, .stats, .store-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .hero { padding: 48px 0 72px; }
  .section { padding: 72px 0; }
}
@media (max-width: 767px) {
  .header-tools .btn { display: none; }
  .lang-select { width: 44px; padding: 0; color: transparent; background-image: none; }
  .lang-select option { color: var(--charcoal); }
  .lang-picker .icon { left: 12px; font-size: 20px; }
  .grid-3, .grid-4, .grid-2, .steps, .plans, .store-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .phone-row .device-phone:nth-child(3) { display: none; }
  .phone-row .device-phone:nth-child(2) { transform: none; }
  .band-media .device-phone:nth-child(2) { display: none; }
  .devices .device-phone { width: 38%; right: -4px; }
  .actions .btn { flex: 1 1 auto; }
  .section-head { margin-bottom: 40px; }
  .card, .plan { padding: 20px; }
}
[hidden] { display: none !important; }
