/* ==========================================================================
   Aimdal website — one stylesheet for every marketing page.
   Warm cream and charcoal, matching the app (lib/theme/app_colors.dart).
   ========================================================================== */

:root {
  --bg:          #FAF7F2;
  --bg-alt:      #F2ECE3;
  --surface:     #FFFFFF;
  --text:        #1C1A17;
  --text-2:      #5E574E;
  --text-3:      #8A8278;
  --border:      rgba(28, 26, 23, 0.10);
  --border-2:    rgba(28, 26, 23, 0.18);
  --btn-bg:      #1C1A17;
  --btn-text:    #FAF7F2;
  --accent:      #A27B4F;
  --accent-soft: rgba(162, 123, 79, 0.12);
  --nav-bg:      rgba(250, 247, 242, 0.8);
  --shadow:      0 1px 2px rgba(28, 26, 23, 0.04), 0 12px 32px -12px rgba(28, 26, 23, 0.14);
  --font:        "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display:"Instrument Serif", Georgia, serif;
  --radius:      20px;
  --radius-sm:   12px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.section { padding: 112px 0; }
.section--alt { background: var(--bg-alt); }

.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-wrap: balance;
}
.display em { font-style: italic; color: var(--accent); }
.h1 { font-size: clamp(3rem, 7vw, 5.4rem); line-height: 1; }
.h2 { font-size: clamp(2.4rem, 4.6vw, 3.6rem); }

.lead { font-size: 1.15rem; color: var(--text-2); max-width: 34em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 6px 12px; border-radius: 999px;
  margin-bottom: 20px;
}
.section-head { max-width: 640px; margin-bottom: 56px; }
.section-head .lead { margin-top: 16px; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head--center .lead { margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 22px;
  border-radius: 999px;
  font: 600 0.95rem/1 var(--font);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--btn-bg); color: var(--btn-text); box-shadow: var(--shadow); }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-2); }
.btn--secondary:hover { border-color: var(--text-3); }
.btn--sm { height: 38px; padding: 0 16px; font-size: 0.88rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.nav.is-scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; gap: 32px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.nav-links a:not(.btn) {
  display: block; padding: 8px 12px; border-radius: 999px;
  font-size: 0.92rem; font-weight: 500; color: var(--text-2); text-decoration: none;
  transition: color .15s ease, background-color .15s ease;
}
.nav-links a:not(.btn):hover, .nav-links a[aria-current="page"]:not(.btn) { color: var(--text); background: var(--accent-soft); }
.nav-links li:last-child { margin-left: 8px; }
.nav-toggle {
  display: none; margin-left: auto;
  width: 40px; height: 40px; border: 1px solid var(--border-2); border-radius: 12px;
  background: var(--surface); color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle svg { width: 20px; height: 20px; }

/* ---------- Scroll story (home) ----------
   The section is several screens tall; its inner stage sticks to the
   viewport while js/site.js turns scroll position into a phase number
   that drives the text, the phone pose, the screen and the cards. Near
   the end the stage eases into the page's own scroll speed, so leaving the
   pinned part does not jump from standing still to full speed. */
.story { position: relative; height: 320vh; height: 320svh; }
.story-sticky {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  padding-top: 68px;
  overflow: hidden;
  display: flex; align-items: center;
  will-change: transform;
}
/* Clip sideways only (the floating cards poke out on small screens), so the
   phone's soft glow and cast shadow can fade out below the stage instead of
   being cut along its bottom edge once the stage scrolls away. */
@supports (overflow: clip) {
  .story-sticky { overflow: visible; overflow-x: clip; }
}
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.story-texts { display: grid; }
.story-panel { grid-area: 1 / 1; align-self: center; will-change: opacity, transform; }
.story-panel + .story-panel { opacity: 0; }
.story-panel .lead { margin-top: 20px; }
.story-panel .btn-row { margin-top: 36px; }
.step-label {
  display: inline-block; margin-bottom: 18px;
  font-size: 0.82rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
}
.story-stage { display: flex; justify-content: center; align-items: center; }
.phone-fit { position: relative; width: 300px; height: 620px; flex: none; }
.phone-wrap { position: relative; width: 300px; height: 620px; transform: scale(var(--stage-scale, 1)); transform-origin: 0 0; }
.pbr-screens img + img { opacity: 0; }
.float-card[data-phase]:not([data-phase="0"]) { opacity: 0; }
.fc--a { top: 10%;  left: -130px; }
.fc--b { top: 40%;  right: -120px; }
.fc--c { bottom: 18%; left: -110px; }

.story-dots {
  position: absolute; right: 28px; top: 50%; transform: translateY(-50%);
  display: grid; gap: 10px;
}
.story-dots span {
  width: 6px; height: 6px; border-radius: 999px; background: var(--border-2);
  transition: height .3s ease, background-color .3s ease;
}
.story-dots span.is-active { height: 22px; background: var(--text); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: 24px; height: 38px; border: 2px solid var(--border-2); border-radius: 999px;
}
.scroll-hint span {
  position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--text-3);
  animation: scroll-hint 1.8s ease-in-out infinite;
}
@keyframes scroll-hint { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(12px); opacity: 0; } 100% { opacity: 0; } }

.cta-note { margin-top: 28px; font-size: 0.85rem; color: var(--text-3); }

/* ---------- Icon tile ---------- */
.icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
  margin-bottom: 20px;
}
.icon svg { width: 22px; height: 22px; }

/* ---------- Platform cards (Try it + CTA) ---------- */
.platforms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.platform {
  display: flex; flex-direction: column;
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: inherit;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.platform:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.platform--featured { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.platform .icon { margin-bottom: 24px; }
.platform h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.01em; }
.platform p { color: var(--text-2); font-size: 0.95rem; flex: 1; margin-bottom: 24px; }
.platform .go { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.95rem; }
.platform .go svg { width: 16px; height: 16px; transition: transform .2s ease; }
.platform:hover .go svg { transform: translateX(3px); }
.badge {
  align-self: flex-start; margin-bottom: 16px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--btn-text); background: var(--btn-bg); padding: 4px 10px; border-radius: 999px;
}
.platform .badge + .icon { margin-top: 0; }

.cta-band {
  border-radius: calc(var(--radius) + 8px);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 72px 40px;
  text-align: center;
}
.cta-band .lead { margin: 16px auto 32px; }
.cta-band .btn-row { justify-content: center; }

/* ---------- FAQ ---------- */
.faq { max-width: 760px; margin: 0 auto; }
.faq details { border-bottom: 1px solid var(--border); padding: 20px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--text-3); font-weight: 400; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin-top: 12px; color: var(--text-2); }

/* ---------- Simple pages (help, legal, contact) ---------- */
.page-head { padding: 80px 0 40px; }
.page-head .lead { margin-top: 16px; }
.prose { max-width: 760px; padding-bottom: 112px; color: var(--text-2); }
.prose h2 { color: var(--text); font-size: 1.35rem; font-weight: 600; letter-spacing: -0.01em; margin: 40px 0 12px; }
.prose h3 { color: var(--text); font-size: 1.1rem; font-weight: 600; margin: 28px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose a { color: var(--text); font-weight: 500; text-underline-offset: 3px; }
.prose li { margin-bottom: 6px; }
/* Wide tables scroll inside themselves instead of widening the page. */
.prose table { display: block; overflow-x: auto; border-collapse: collapse; max-width: 100%; margin: 16px 0; font-size: 0.92rem; }
.prose { overflow-wrap: break-word; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.prose > :first-child { margin-top: 0; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 64px 0 40px; font-size: 0.92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; }
.footer-brand p { color: var(--text-3); margin-top: 14px; max-width: 22em; }
.footer h4 { font-size: 0.82rem; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer ul a { color: var(--text-2); text-decoration: none; }
.footer ul a:hover { color: var(--text); }
.footer-bottom {
  margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--text-3); font-size: 0.85rem;
}

.footer-internal { margin-left: 10px; color: var(--text-3); text-decoration: none; }
.footer-internal:hover { color: var(--text-2); text-decoration: underline; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .platform { transition: none; }
  .scroll-hint span { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .platforms { grid-template-columns: 1fr 1fr; }
  .story-grid { display: flex; flex-direction: column; justify-content: center; gap: 0; height: 100%; padding-top: 16px; padding-bottom: 16px; }
  .story-texts { flex: none; width: 100%; }
  .story-stage { flex: 1; min-height: 0; width: 100%; }
  .story-panel .lead { margin-top: 12px; font-size: 1.02rem; }
  .story-panel .btn-row { margin-top: 20px; }
  .story-dots { right: 12px; }
  .scroll-hint { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .section { padding: 80px 0; }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border);
  }
  .nav.is-open .nav-links { display: flex; }
  .nav-links a:not(.btn) { padding: 12px; font-size: 1rem; }
  .nav-links li:last-child { margin: 8px 0 0; }
  .nav-links .btn { width: 100%; height: 46px; }
}
@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .platforms { grid-template-columns: 1fr; }
  .story-panel .btn-row .btn { flex: 0 1 auto; }
  .story-panel .h1 { font-size: clamp(2.1rem, 9.5vw, 2.8rem); }
  .story-grid { padding-top: 28px; }
  .fc--a { left: -60px; }
  .fc--b { right: -60px; }
  .fc--c { left: -50px; }
  .float-card { font-size: .74rem; padding: 8px 12px; }
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 40px; }
  .cta-band { padding: 48px 20px; }
  .btn-row .btn { flex: 1 1 100%; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
