/* ==========================================================================
   AIxFamily website theme
   Visual language: InApp template (website-templete/inapp-1.0.0) — white surfaces,
   hairline neutral borders, one warm orange accent, Poppins, pastel-tinted cards
   with solid icon tiles.
   Interaction: Apple fluid-interface principles — instant press feedback, a
   translucent header material that content scrolls under, scroll-edge separation
   instead of a hard divider, size-specific tracking, symmetric enter/exit motion,
   and full reduced-motion / reduced-transparency / high-contrast support.
   ========================================================================== */

:root {
  /* Neutrals (InApp gray scale) */
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  /* Brand + status (InApp) */
  --primary: #e66239;
  --primary-hover: #d4532b;
  --primary-press: #c24a24;
  --primary-soft: #fdf1ec;
  --primary-line: #f7d4c6;
  --green: #00a844;      /* InApp #00C951, deepened for text contrast on white */
  --green-solid: #00c951;
  --green-soft: #ebfbf1;
  --green-line: #bdeed0;
  --cyan: #0094b3;
  --cyan-solid: #00b8db;
  --cyan-soft: #e8f8fc;
  --cyan-line: #bde9f3;
  --yellow-solid: #f0b100;
  --yellow-soft: #fef8e6;
  --yellow-line: #f7e3a6;

  /* Semantic */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-muted: var(--gray-50);
  --border: var(--gray-200);
  --text: var(--gray-900);
  --text-2: var(--gray-600);
  --text-3: var(--gray-500);
  --ring: 0 0 0 4px rgba(230, 98, 57, 0.16);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(23, 23, 23, 0.04);
  --shadow: 0 1px 2px rgba(23, 23, 23, 0.04), 0 8px 24px -12px rgba(23, 23, 23, 0.12);

  /* Motion: critically damped feel — quick, no overshoot (Apple default) */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.64, 0, 0.78, 0); /* mirrored curve for the reverse path */
  --dur-press: 100ms;
  --dur: 220ms;

  --header-h: 68px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main { flex: 1; }
img, svg { display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
::selection { background: var(--primary-soft); color: var(--text); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.site-bg { display: none; } /* old gradient layer, no longer used */

/* Typography: weight + size + leading as a set; tracking tightens as size grows */
h1, h2, h3, h4 { color: var(--text); margin: 0; }
h1 { font-size: clamp(2.4rem, 5.2vw, 3.6rem); font-weight: 500; line-height: 1.08; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.25rem); font-weight: 500; line-height: 1.18; letter-spacing: -0.02em; }
h3 { font-size: 1.35rem; font-weight: 500; line-height: 1.3; letter-spacing: -0.01em; }
h4 { font-size: 1.05rem; font-weight: 600; line-height: 1.4; letter-spacing: -0.005em; }
p { margin: 0; }

/* ---------- Header: translucent material, scroll-edge separation ---------- */
[data-include="header"] { position: sticky; top: 0; z-index: 50; min-height: var(--header-h); }
.site-header {
  background: rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), background-color var(--dur) var(--ease-out);
}
.site-header.scrolled { border-bottom-color: rgba(23, 23, 23, 0.08); box-shadow: 0 6px 20px -16px rgba(23, 23, 23, 0.25); }
.nav { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 1.15rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; letter-spacing: 0;
}
.brand .mark::before { content: 'AI'; }
.brand .name .x { color: var(--primary); }
.brand small { display: block; font-size: 0.7rem; font-weight: 400; color: var(--text-3); letter-spacing: 0.01em; line-height: 1.2; }
.brand .name { line-height: 1.15; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0 0 0 auto; padding: 0; }
.nav-links a {
  display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 0.9rem; font-weight: 500;
  transition: background-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.nav-links a:hover { background: var(--gray-100); color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--primary); background: var(--primary-soft); }
.nav-cta { margin-left: 4px; }
.nav-links a.btn { color: #fff; background: var(--primary); padding: 9px 14px; }
.nav-links a.btn:hover { background: var(--primary-hover); color: #fff; }
.nav-links a.btn:active { background: var(--primary-press); }
.menu-toggle {
  display: none; width: 40px; height: 40px; margin-left: auto; padding: 0; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
  align-items: center; justify-content: center;
}
.menu-toggle svg { width: 20px; height: 20px; }
.menu-toggle .icon-close { display: none; }
.site-header.open .menu-toggle .icon-open { display: none; }
.site-header.open .menu-toggle .icon-close { display: block; }

/* ---------- Buttons: feedback on press, not on release ---------- */
.btn, button.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: 0.95rem; font-weight: 500; line-height: 1;
  padding: 13px 20px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer;
  background: var(--primary); color: #fff; text-decoration: none; white-space: nowrap;
  transition: background-color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), transform var(--dur-press) var(--ease-out), box-shadow var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: scale(0.97); background: var(--primary-press); }
.btn:disabled { opacity: 0.6; cursor: default; transform: none; }
.btn-sm { padding: 9px 14px; font-size: 0.875rem; }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-outline:active { background: var(--gray-100); }
.btn-block { width: 100%; }

/* ---------- Forms (InApp sign-in style) ---------- */
.input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text);
  padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.input::placeholder { color: var(--gray-400); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; color: var(--text); margin-bottom: 6px; }

/* ---------- Chips / eyebrow ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--primary-press);
  font-size: 0.8rem; font-weight: 500; letter-spacing: 0.01em;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); }
.kicker { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--primary); margin-bottom: 12px; }

/* ---------- Home: hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 64px; align-items: center; padding: 72px 0 56px; }
.hero h1 { margin: 22px 0 20px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.lede { font-size: 1.12rem; line-height: 1.7; color: var(--text-2); max-width: 34em; margin-bottom: 24px; }
.meta-line { display: flex; align-items: center; gap: 10px; font-size: 0.92rem; color: var(--text-2); }
.meta-line .tick { width: 22px; height: 22px; border-radius: 6px; background: var(--green-soft); color: var(--green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.meta-line svg { width: 14px; height: 14px; }

.signup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow); }
.signup .badge { display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 500; color: var(--text-2); margin-bottom: 14px; }
.signup .badge .tile { width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.signup .badge svg { width: 16px; height: 16px; }
.signup h3 { margin-bottom: 8px; }
.signup p.sub { font-size: 0.93rem; color: var(--text-2); margin-bottom: 22px; }
.field { display: flex; flex-direction: column; gap: 12px; }
.reassure { display: flex; align-items: flex-start; gap: 8px; margin-top: 16px; font-size: 0.82rem; line-height: 1.55; color: var(--text-3); }
.reassure svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--text-3); }
.msg { display: none; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 500; }
.msg.show { display: block; animation: msg-in var(--dur) var(--ease-out); }
.msg.ok { background: var(--green-soft); border: 1px solid var(--green-line); color: #00753a; }
.msg.err { background: #fff1f1; border: 1px solid #fecaca; color: #c81e1e; }
@keyframes msg-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Home: sections ---------- */
.section { padding: 72px 0; }
.section-head { max-width: 40em; margin-bottom: 40px; }
.section-head h2 { margin-bottom: 14px; }
.section-head p { color: var(--text-2); font-size: 1.05rem; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 0; }

/* Feature cards — InApp tinted stat-card style: pastel fill, matching line, solid icon tile */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { border-radius: var(--radius); padding: 26px; border: 1px solid var(--border); background: var(--surface); transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out); }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .ic { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: #fff; margin-bottom: 18px; }
.card .ic svg { width: 21px; height: 21px; }
.card h4 { margin-bottom: 8px; }
.card p { color: var(--text-2); font-size: 0.94rem; }
.card.tint-orange { background: var(--primary-soft); border-color: var(--primary-line); }
.card.tint-orange .ic { background: var(--primary); }
.card.tint-green { background: var(--green-soft); border-color: var(--green-line); }
.card.tint-green .ic { background: var(--green-solid); }
.card.tint-cyan { background: var(--cyan-soft); border-color: var(--cyan-line); }
.card.tint-cyan .ic { background: var(--cyan-solid); }

/* Steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.step { position: relative; padding: 26px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.step .num {
  width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary-press); border: 1px solid var(--primary-line); font-weight: 600; font-size: 0.95rem; margin-bottom: 16px;
}
.step h4 { margin-bottom: 6px; }
.step p { color: var(--text-2); font-size: 0.93rem; }

/* Mission band */
.mission { margin: 8px 0 0; padding: 56px 48px; border-radius: var(--radius-lg); background: var(--gray-900); color: #fff; text-align: center; }
.mission .quote { font-size: clamp(1.35rem, 2.5vw, 1.8rem); font-weight: 400; line-height: 1.45; letter-spacing: -0.015em; max-width: 26em; margin: 0 auto 16px; }
.mission .attr { font-size: 0.8rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.14em; color: var(--gray-400); }

/* Closing CTA */
.closing { text-align: center; padding: 80px 0 88px; }
.closing h2 { margin-bottom: 12px; }
.closing p { color: var(--text-2); font-size: 1.05rem; max-width: 30em; margin: 0 auto 28px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-muted); border-top: 1px solid var(--border); padding: 40px 0; }
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; font-size: 0.88rem; color: var(--text-3); }
.foot .brand { font-size: 1rem; }
.foot .brand .mark { width: 30px; height: 30px; border-radius: 8px; font-size: 0.72rem; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.foot-links a { color: var(--text-2); }
.foot-links a:hover { color: var(--primary); text-decoration: none; }
.foot .copy a { color: var(--text-2); }

/* ---------- Legal / content pages ---------- */
.legal { max-width: 820px; margin: 0 auto; padding: 56px 24px 88px; }
.legal .backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 0.88rem; margin-bottom: 28px; }
.legal .backlink:hover { color: var(--primary); text-decoration: none; }
.legal h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: 10px; }
.legal .updated { display: inline-block; font-size: 0.82rem; color: var(--text-3); background: var(--gray-100); border-radius: 999px; padding: 4px 12px; margin-bottom: 8px; }
.legal .intro { font-size: 1.08rem; color: var(--text-2); margin: 18px 0 36px; }
.legal h2 { font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em; margin: 44px 0 12px; padding-top: 8px; }
.legal h2:has(+ .h2-sub) { margin-bottom: 4px; }
.legal h3 { font-size: 1.05rem; font-weight: 600; margin: 26px 0 10px; }
.legal p { color: var(--text-2); margin: 0 0 16px; }
.legal ul, .legal ol { color: var(--text-2); margin: 0 0 16px; padding-left: 22px; }
.legal li { margin-bottom: 8px; }
.legal li::marker { color: var(--gray-400); }
.legal strong { color: var(--text); font-weight: 600; }
.legal .h2-sub { font-size: 0.9rem; color: var(--text-3); margin: 0 0 18px; }
.legal .foot-note { font-size: 0.85rem; color: var(--text-3); margin: 0 0 40px; }

.callout { margin: 24px 0 36px; padding: 18px 20px; border-radius: var(--radius); background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--text-2); font-size: 0.95rem; }
.callout strong { color: var(--primary-press); }

.toc { margin: 0 0 40px; padding: 22px 24px; border-radius: var(--radius); background: var(--surface-muted); border: 1px solid var(--border); }
.legal .toc p { margin: 0 0 10px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; }
.toc li { margin-bottom: 6px; font-size: 0.92rem; }
.toc a { color: var(--text-2); }
.toc a:hover { color: var(--primary); text-decoration: none; }

.table-wrap { overflow-x: auto; margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th { text-align: left; font-weight: 500; color: var(--text); background: var(--surface-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.data-table tr:last-child td { border-bottom: 0; }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.tag.yes { background: var(--yellow-soft); border-color: var(--yellow-line); color: #8a6500; }
.tag.no { background: var(--green-soft); border-color: var(--green-line); color: #00753a; }
.legend { display: flex; flex-wrap: wrap; gap: 20px; margin: 0 0 32px; font-size: 0.88rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }

/* Entrance: short, small, no overshoot (UI default = critically damped) */
.fade-in { animation: rise 420ms var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */
/* App store links */
.store-links { display: flex; flex-wrap: wrap; gap: 24px 32px; margin-top: 32px; }
.store-group { display: flex; flex-direction: column; gap: 10px; }
.store-label { margin: 0; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.store-label span { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--gray-100); color: var(--text-2); font-size: 0.7rem; letter-spacing: 0.02em; text-transform: none; }
.store-row { display: flex; flex-wrap: wrap; gap: 10px; }
.store-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 16px 7px 13px; border-radius: 10px; background: var(--gray-900); color: #fff; line-height: 1.1; transition: background-color .15s ease, transform .15s ease; }
.store-btn:hover { background: #000; color: #fff; text-decoration: none; }
.store-btn:active { transform: scale(0.97); }
.store-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.store-btn svg { width: 22px; height: 22px; flex: none; }
.store-btn span { display: flex; flex-direction: column; font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; }
.store-btn small { font-size: 0.66rem; font-weight: 400; opacity: 0.85; letter-spacing: 0.01em; }
@media (prefers-reduced-motion: reduce) { .store-btn { transition: none; } .store-btn:active { transform: none; } }

@media (max-width: 1020px) {
  .menu-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; left: 12px; right: 12px; top: calc(var(--header-h) - 4px);
    flex-direction: column; align-items: stretch; gap: 2px; padding: 8px;
    background: var(--surface); /* solid: a translucent panel nested in the translucent header loses legibility */
    border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 16px 40px -16px rgba(23, 23, 23, 0.3);
    /* Enters and exits along the same path, anchored to the menu button */
    transform-origin: top right; opacity: 0; transform: translateY(-6px) scale(0.98); pointer-events: none; visibility: hidden;
    transition: opacity 180ms var(--ease-in), transform 180ms var(--ease-in), visibility 0s linear 180ms;
  }
  .site-header.open .nav-links {
    opacity: 1; transform: none; pointer-events: auto; visibility: visible;
    transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out), visibility 0s;
  }
  .nav-links a { padding: 12px 14px; font-size: 0.95rem; }
  .nav-cta { margin: 6px 0 0; }
  .nav-cta .btn { width: 100%; }
  .site-header { position: relative; }
}
@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 48px 0 40px; }
  .grid, .steps { grid-template-columns: 1fr; }
  .section { padding: 56px 0; }
  .mission { padding: 40px 24px; }
  .toc ol { columns: 1; }
}
@media (max-width: 560px) {
  .wrap { padding: 0 16px; }
  .brand small { display: none; }
  .signup { padding: 24px; }
  .legal { padding: 36px 16px 64px; }
  .foot { flex-direction: column; align-items: flex-start; }
}

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; }
  .btn:active, .card:hover { transform: none; }
  .nav-links, .site-header.open .nav-links { transform: none !important; } /* cross-fade only */
}
@media (prefers-reduced-transparency: reduce) {
  .site-header, .nav-links { background: #ffffff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
}
@media (prefers-contrast: more) {
  :root { --border: var(--gray-400); --text-2: var(--gray-800); --text-3: var(--gray-700); }
  .site-header { background: #ffffff; border-bottom-color: var(--gray-400); }
}
