/* =====================================================================
   AlexaFit site design system (v5.0)
   Mirrors the app's own system (foodsync/components/ui/design):
   light luxury wellness, white cards on a cool canvas, one heavy number
   per metric, colour carries meaning, brand purple for actions only.
   Loaded last on every page. Base element rules use :where() so that
   page-specific styles keep winning.
   ===================================================================== */

@font-face {
  font-family: 'Glacial Indifference';
  src: url('../fonts/glacial-indifference-bold.otf') format('opentype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Glacial Indifference';
  src: url('../fonts/glacial-indifference-regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand (BRAND scale in constants/theme.ts) */
  --af-brand-50: #F4F1FE;
  --af-brand-100: #E9E3FD;
  --af-brand-200: #D3C7FB;
  --af-brand-400: #8467EA;
  --af-brand: #5B3ADB;
  --af-brand-600: #4B2CC4;
  --af-brand-700: #3B219D;
  --af-brand-800: #2D1A78;
  --af-brand-900: #1E1250;

  /* Neutrals */
  --af-ink: #0E1B33;
  --af-ink-soft: #36435A;
  --af-ink-muted: #5F6B80;
  --af-line: #E6E9F0;
  --af-canvas: #F6F7FB;
  --af-surface: #FFFFFF;

  /* Metric tones: base / soft / ink */
  --af-calories: #FF7A1A;  --af-calories-soft: #FFF1E5;  --af-calories-ink: #A84D00;
  --af-protein: #EC5B82;   --af-protein-soft: #FDEBF0;   --af-protein-ink: #B4234A;
  --af-carbs: #14B3AC;     --af-carbs-soft: #E2F6F5;     --af-carbs-ink: #0A706C;
  --af-fat: #F5B400;       --af-fat-soft: #FFF6D9;       --af-fat-ink: #8A6200;
  --af-water: #2F8CFF;     --af-water-soft: #E6F1FF;     --af-water-ink: #1559B3;
  --af-fasting: #4F55D8;   --af-fasting-soft: #ECEDFB;   --af-fasting-ink: #33378F;
  --af-success: #28D48D;   --af-success-soft: #E3F9EF;   --af-success-ink: #11774D;

  /* Type */
  --af-font-display: 'Glacial Indifference', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --af-font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --af-text-hero: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
  --af-text-h2: clamp(2rem, 1.5rem + 2vw, 3.1rem);
  --af-text-h3: clamp(1.35rem, 1.2rem + 0.6vw, 1.7rem);
  --af-text-lead: clamp(1.05rem, 1rem + 0.25vw, 1.2rem);

  /* Space & shape */
  --af-space-section: clamp(4.5rem, 3rem + 5vw, 8.5rem);
  --af-radius-card: 24px;
  --af-radius-pill: 999px;
  --af-shadow-card: 0 1px 2px rgba(14, 27, 51, 0.04), 0 12px 32px -12px rgba(14, 27, 51, 0.14);
  --af-shadow-float: 0 2px 6px rgba(14, 27, 51, 0.06), 0 30px 60px -20px rgba(30, 18, 80, 0.35);

  /* Motion */
  --af-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --af-fast: 160ms;
  --af-normal: 320ms;
}

/* ---------- Base ---------- */
:where(body) {
  font-family: var(--af-font-body);
  color: var(--af-ink-soft);
  background: var(--af-surface);
  -webkit-font-smoothing: antialiased;
}

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

:where(a) {
  color: var(--af-brand);
}

:where(a, button, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--af-brand-200);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- Header (all pages) ---------- */
.header.navbar-area:not(.af-header-dark) {
  background: rgba(255, 255, 255, 0.82) !important;
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(230, 233, 240, 0.8);
  box-shadow: none !important;
}

.header.navbar-area:not(.af-header-dark) .navbar-nav .nav-item a {
  font-family: var(--af-font-body);
  font-weight: 600;
  font-size: 15px;
  color: var(--af-ink-soft) !important;
  transition: color var(--af-fast) ease;
}

.header.navbar-area:not(.af-header-dark) .navbar-nav .nav-item a:hover,
.header.navbar-area:not(.af-header-dark) .navbar-nav .nav-item a.active {
  color: var(--af-brand) !important;
}

.af-nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 18px;
  padding: 10px 18px;
  border-radius: var(--af-radius-pill);
  background: var(--af-ink);
  color: #fff !important;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  transition: transform var(--af-fast) var(--af-ease), background var(--af-fast) ease;
}

.af-nav-cta:hover {
  background: var(--af-brand);
  transform: translateY(-1px);
}

.af-header-dark .af-nav-cta {
  background: #fff;
  color: var(--af-brand-700) !important;
}

.af-header-dark .af-nav-cta:hover {
  background: var(--af-brand-50);
}

@media (max-width: 991px) {
  .af-nav-cta { display: none; }
}

/* ---------- Footer (all pages) ---------- */
.footer {
  background: var(--af-brand-900) !important;
  color: rgba(255, 255, 255, 0.72);
}

.footer a {
  color: rgba(255, 255, 255, 0.9) !important;
}

.footer a:hover {
  color: #fff !important;
  text-decoration: underline;
}

.af-footer {
  padding: 72px 0 32px;
}

.af-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}

.af-footer__brand p {
  margin-top: 16px;
  max-width: 30ch;
  color: rgba(255, 255, 255, 0.65);
  font-size: 15px;
  line-height: 1.6;
}

.af-footer h3 {
  font-family: var(--af-font-body);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 14px;
}

.af-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 15px;
}

.af-footer__bottom {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.55);
}

@media (max-width: 767px) {
  .af-footer__grid { grid-template-columns: 1fr 1fr; }
  .af-footer__brand { grid-column: 1 / -1; }
}

/* ---------- Buttons ---------- */
.af-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: 16px;
  font-family: var(--af-font-body);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--af-fast) var(--af-ease), box-shadow var(--af-normal) var(--af-ease), background var(--af-fast) ease;
}

.af-btn:hover { transform: translateY(-2px); }
.af-btn:active { transform: translateY(0) scale(0.98); }

.af-btn--primary {
  background: var(--af-brand);
  color: #fff !important;
  box-shadow: 0 10px 24px -10px rgba(91, 58, 219, 0.7);
}

.af-btn--primary:hover { background: var(--af-brand-600); box-shadow: 0 16px 30px -12px rgba(91, 58, 219, 0.75); }

.af-btn--dark {
  background: var(--af-ink);
  color: #fff !important;
}

.af-btn--dark:hover { background: #1c2b48; }

.af-btn--ghost {
  background: var(--af-surface);
  color: var(--af-ink) !important;
  box-shadow: inset 0 0 0 1.5px var(--af-line);
}

.af-btn--ghost:hover { box-shadow: inset 0 0 0 1.5px var(--af-brand-200); }

.af-btn i { font-size: 20px; }

.af-store {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.1;
}

.af-store small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.75;
}

/* ---------- Layout helpers ---------- */
.af-section {
  padding: var(--af-space-section) 0;
  position: relative;
}

.af-section--canvas { background: var(--af-canvas); }

.af-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--af-radius-pill);
  background: var(--af-brand-50);
  color: var(--af-brand-700);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.af-eyebrow__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--af-success);
  box-shadow: 0 0 0 4px var(--af-success-soft);
}

.af-h2 {
  font-size: var(--af-text-h2);
  line-height: 1.05;
  font-weight: 700;
  margin: 18px 0 16px;
  text-wrap: balance;
}

.af-lead {
  font-size: var(--af-text-lead);
  line-height: 1.6;
  color: var(--af-ink-muted);
  max-width: 56ch;
  text-wrap: pretty;
}

.af-center { text-align: center; }
.af-center .af-lead { margin-left: auto; margin-right: auto; }

/* ---------- Phone mockup (real app screens) ---------- */
.af-phone {
  --w: 270px;
  position: relative;
  width: var(--w);
  flex-shrink: 0;
  padding: calc(var(--w) * 0.035);
  border-radius: calc(var(--w) * 0.17);
  background: linear-gradient(145deg, #2a2f3d 0%, #0b0e15 45%, #1d2230 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.14),
    0 0 0 1px rgba(14, 27, 51, 0.5),
    var(--af-shadow-float);
}

.af-phone__screen {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--w) * 0.135);
  background: var(--af-canvas);
  aspect-ratio: 600 / 1305;
}

.af-phone__screen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dynamic Island, positioned to match the iPhone 17 Pro captures */
.af-phone__screen::after {
  content: '';
  position: absolute;
  top: 1.55%;
  left: 34.4%;
  width: 31.2%;
  height: 4.3%;
  border-radius: var(--af-radius-pill);
  background: #000;
}

.af-phone--sm { --w: 220px; }
.af-phone--lg { --w: 300px; }

/* ---------- Floating metric chips (echo the app's tone chips) ---------- */
.af-chip {
  position: absolute;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--af-shadow-card);
  font-size: 13px;
  line-height: 1.25;
  color: var(--af-ink-muted);
  white-space: nowrap;
}

.af-chip strong {
  display: block;
  font-size: 15px;
  color: var(--af-ink);
  font-variant-numeric: tabular-nums;
}

.af-chip__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  font-size: 18px;
}

.af-tone-calories { background: var(--af-calories-soft); color: var(--af-calories-ink); }
.af-tone-protein  { background: var(--af-protein-soft);  color: var(--af-protein-ink); }
.af-tone-carbs    { background: var(--af-carbs-soft);    color: var(--af-carbs-ink); }
.af-tone-fat      { background: var(--af-fat-soft);      color: var(--af-fat-ink); }
.af-tone-water    { background: var(--af-water-soft);    color: var(--af-water-ink); }
.af-tone-fasting  { background: var(--af-fasting-soft);  color: var(--af-fasting-ink); }
.af-tone-success  { background: var(--af-success-soft);  color: var(--af-success-ink); }
.af-tone-brand    { background: var(--af-brand-50);      color: var(--af-brand-700); }

@media (prefers-reduced-motion: no-preference) {
  .af-float { animation: af-float 7s ease-in-out infinite; }
  .af-float--late { animation-delay: -3.5s; }
  @keyframes af-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
  }
}

/* ---------- Accordion (FAQ) refresh, all pages ---------- */
.faq .accordion-item {
  border: 1px solid var(--af-line) !important;
  border-radius: 18px !important;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: none;
}

.faq .accordion-button {
  font-family: var(--af-font-body);
  font-weight: 700;
  color: var(--af-ink) !important;
  background: var(--af-surface) !important;
}

.faq .accordion-button .serial {
  color: var(--af-brand) !important;
  background: var(--af-brand-50) !important;
}

/* ---------- Language switcher (shared; light header) ---------- */
.language-switcher[hidden] { display: none !important; }
.language-dropdown { position: relative; display: inline-block; }

.header.navbar-area:not(.af-header-dark) button.language-btn {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--af-radius-pill);
  border: 1.5px solid var(--af-line);
  background: var(--af-surface);
  color: var(--af-ink-soft);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.header.navbar-area:not(.af-header-dark) button.language-btn:hover {
  border-color: var(--af-brand-200);
}

.current-lang { display: flex; align-items: center; gap: 8px; }
.current-lang::after { content: '▾'; font-size: 11px; }

.language-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 170px;
  padding: 6px;
  border-radius: 16px;
  background: var(--af-surface);
  box-shadow: var(--af-shadow-float);
  z-index: 1000;
}

.language-dropdown.active .language-dropdown-content { display: block; }

.language-dropdown-content a,
.language-dropdown-content a.language-btn {
  display: block;
  padding: 10px 12px;
  border: 0 !important;
  border-radius: 10px;
  background: transparent !important;
  color: var(--af-ink-soft) !important;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.language-dropdown-content a:hover,
.language-dropdown-content a.active {
  background: var(--af-brand-50) !important;
  color: var(--af-brand-700) !important;
}

/* ---------- Inner-page hero (consultation, guide, contact…) ---------- */
.af-page-hero {
  position: relative;
  padding: clamp(130px, 8rem + 3vw, 170px) 0 clamp(48px, 3rem + 2vw, 80px);
  background:
    radial-gradient(55% 70% at 90% 10%, rgba(132, 103, 234, 0.22) 0%, rgba(132, 103, 234, 0) 70%),
    radial-gradient(40% 60% at 100% 100%, rgba(255, 122, 26, 0.12) 0%, rgba(255, 122, 26, 0) 70%),
    var(--af-canvas);
}

.af-page-hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: center;
}

.af-page-hero__title {
  font-size: clamp(2.3rem, 1.6rem + 2.6vw, 3.8rem);
  line-height: 1.02;
  font-weight: 700;
  margin: 18px 0 18px;
  text-wrap: balance;
}

.af-mini-steps {
  list-style: none;
  margin: 0;
  padding: 8px;
  display: grid;
  gap: 4px;
  border-radius: var(--af-radius-card);
  background: var(--af-surface);
  box-shadow: var(--af-shadow-card);
}

.af-mini-steps li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
}

.af-mini-steps li + li { box-shadow: 0 -1px 0 var(--af-line); }

.af-mini-steps__n {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-family: var(--af-font-display);
  font-weight: 700;
  font-size: 18px;
}

.af-mini-steps strong {
  display: block;
  color: var(--af-ink);
  margin-bottom: 2px;
}

.af-mini-steps span span,
.af-mini-steps li > span:last-child {
  color: var(--af-ink-muted);
  font-size: 15px;
  line-height: 1.5;
}

.af-footer--compact { padding: 28px 0; }

@media (max-width: 991px) {
  .af-page-hero__grid { grid-template-columns: 1fr; }
}

/* ---------- Consultation form, aligned with the app's cards ---------- */
.form-container { background: var(--af-surface) !important; padding: 56px 0 96px !important; }

.form-container .form-card {
  border-radius: 28px !important;
  box-shadow: var(--af-shadow-card), inset 0 0 0 1px var(--af-line) !important;
}

.form-container .progress { background: var(--af-brand-50) !important; height: 8px !important; border-radius: 8px !important; }
.form-container .progress-bar { background: var(--af-brand) !important; border-radius: 8px !important; }

.form-container .btn-next,
.form-container .btn-submit,
.form-container button[type="submit"] {
  background: var(--af-brand) !important;
  border-radius: 14px !important;
}

.form-container .form-card { scroll-margin-top: 100px; }

/* ---------- Guide steps ---------- */
.guide-section .step-card {
  border: 0 !important;
  border-radius: 28px !important;
  box-shadow: var(--af-shadow-card), inset 0 0 0 1px var(--af-line) !important;
}

.guide-section .step-number {
  background: var(--af-brand) !important;
  font-family: var(--af-font-display);
}

.guide-section .step-title { font-family: var(--af-font-display); color: var(--af-ink); }

.guide-section .step-image--phone {
  height: auto !important;
  background: linear-gradient(160deg, var(--af-brand-50) 0%, #E6F1FF 100%) !important;
  border-radius: 24px !important;
  padding: 32px 16px !important;
  display: flex;
  justify-content: center;
}

.guide-section .step-image--done {
  height: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px !important;
  border-radius: 20px !important;
  background: var(--af-success-soft) !important;
  color: var(--af-success-ink);
  font-weight: 700;
}

.guide-section .step-image--done p { margin: 0; color: inherit; }

.guide-section .step-actions {
  border-radius: 16px !important;
  background: var(--af-canvas) !important;
  border-left: 4px solid var(--af-brand) !important;
}

/* ---------- Program: "inside the app" flow ---------- */
.af-flow {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(56px, 6vw, 96px) 20px;
}

.af-flow__head { text-align: center; margin-bottom: 40px; }

.af-flow__label {
  display: inline-block;
  padding: 6px 12px;
  border-radius: var(--af-radius-pill);
  background: var(--af-brand-50);
  color: var(--af-brand-700) !important;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
}

.af-flow__head h2 {
  font-family: var(--af-font-display) !important;
  font-size: var(--af-text-h2) !important;
  line-height: 1.05;
  color: var(--af-ink) !important;
}

.af-flow__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.af-flow__card {
  position: relative;
  padding: 0 0 26px;
  border-radius: 28px;
  background: var(--af-surface);
  box-shadow: inset 0 0 0 1px var(--af-line);
  overflow: hidden;
}

.af-flow__visual {
  display: flex;
  justify-content: center;
  height: 330px;
  overflow: hidden;
  padding-top: 32px;
  margin-bottom: 22px;
}

.af-flow__visual--brand { background: linear-gradient(170deg, var(--af-brand-50), #fff); }
.af-flow__visual--calories { background: linear-gradient(170deg, var(--af-calories-soft), #fff); }
.af-flow__visual--success { background: linear-gradient(170deg, var(--af-success-soft), #fff); }

.af-flow__n {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0 24px 10px;
  border-radius: 10px;
  background: var(--af-brand);
  color: #fff;
  font-weight: 800;
}

.af-flow__card h3 {
  margin: 0 24px 6px;
  font-family: var(--af-font-display) !important;
  font-size: 1.4rem !important;
  color: var(--af-ink) !important;
}

.af-flow__card p {
  margin: 0 24px;
  color: var(--af-ink-muted) !important;
  line-height: 1.6;
}

@media (max-width: 991px) {
  .af-flow__grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
}

/* ---------- App CTA band (content and landing pages) ---------- */
.af-app-cta__card {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 52px);
  border-radius: var(--af-radius-card);
  background: var(--af-surface);
  border: 1px solid var(--af-line);
  box-shadow: 0 28px 64px -36px rgba(45, 26, 120, 0.45);
  text-align: center;
}
.af-app-cta__card .af-lead { margin: 0 auto; }
.af-app-cta__buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

/* ---------- Plan hub: pick a calorie level ---------- */
.af-plan-hub__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.af-plan-hub__card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px 22px 20px;
  border-radius: 20px;
  background: var(--af-surface);
  border: 1px solid var(--af-line);
  color: var(--af-ink);
  text-decoration: none;
  transition: transform var(--af-normal) var(--af-ease), border-color var(--af-normal) var(--af-ease), box-shadow var(--af-normal) var(--af-ease);
}
.af-plan-hub__card:hover,
.af-plan-hub__card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--af-brand-200);
  box-shadow: 0 18px 40px -28px rgba(45, 26, 120, 0.5);
  color: var(--af-ink);
}
.af-plan-hub__card:focus-visible { outline: 3px solid var(--af-brand-200); outline-offset: 2px; }
.af-plan-hub__kcal {
  font-family: var(--af-font-display);
  font-size: 2.1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--af-calories-ink);
}
.af-plan-hub__card--list .af-plan-hub__kcal { color: var(--af-carbs-ink); }
.af-plan-hub__meta { color: var(--af-ink-muted); font-size: 15px; }
@media (prefers-reduced-motion: reduce) {
  .af-plan-hub__card { transition: none; }
  .af-plan-hub__card:hover, .af-plan-hub__card:focus-visible { transform: none; }
}
