/* ==========================================================================
   Apexphin design system - tokens, base, layout, utilities
   Loaded by layouts/app + layouts/auth (landing) and reusable for dashboard.
   ========================================================================== */

:root {
  /* Palette */
  --ax-ink: #0B1626;
  --ax-ink-2: #12233A;
  --ax-ink-3: #1A2F4D;
  --ax-canvas: #F6F7F9;
  --ax-surface: #FFFFFF;
  --ax-surface-2: #FBFBFC;
  --ax-line: #E4E8EE;
  --ax-line-strong: #CFD6E0;
  --ax-text: #0F1B2D;
  --ax-muted: #5B6778;
  --ax-subtle: #8792A2;

  --ax-primary: #1E4FD8;
  --ax-primary-hover: #183FB0;
  --ax-primary-tint: #EAF0FD;
  --ax-primary-rgb: 30, 79, 216;

  --ax-accent: #D9C29A;
  --ax-accent-strong: #8A6A35; /* sand for text on light surfaces (AA) */
  --ax-accent-tint: #F6EFE2;

  --ax-success: #1F8A5B;
  --ax-success-tint: #E7F4EE;
  --ax-warning: #8F5E12;      /* text-safe amber */
  --ax-warning-base: #B7791F;
  --ax-warning-tint: #FBF1E0;
  --ax-danger: #C2413B;
  --ax-danger-tint: #FBECEB;
  --ax-info: #2B6CB0;
  --ax-info-tint: #E8F1FA;

  /* On-dark text */
  --ax-on-dark: #FFFFFF;
  --ax-on-dark-muted: rgba(255, 255, 255, 0.72);
  --ax-on-dark-subtle: rgba(255, 255, 255, 0.52);
  --ax-on-dark-line: rgba(255, 255, 255, 0.12);

  /* Type */
  --ax-font-head: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --ax-font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --ax-fs-xs: 0.75rem;
  --ax-fs-sm: 0.875rem;
  --ax-fs-md: 1rem;
  --ax-fs-lg: 1.125rem;
  --ax-fs-xl: 1.25rem;
  --ax-fs-h4: 1.375rem;
  --ax-fs-h3: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
  --ax-fs-h2: clamp(1.875rem, 1.3rem + 2.2vw, 3rem);
  --ax-fs-h1: clamp(2.375rem, 1.5rem + 3.6vw, 4.25rem);

  /* Spacing (8px scale) */
  --ax-1: 4px;
  --ax-2: 8px;
  --ax-3: 12px;
  --ax-4: 16px;
  --ax-5: 24px;
  --ax-6: 32px;
  --ax-7: 40px;
  --ax-8: 48px;
  --ax-9: 64px;
  --ax-10: 80px;
  --ax-11: 96px;
  --ax-12: 128px;

  /* Shape */
  --ax-r-sm: 8px;
  --ax-r: 12px;
  --ax-r-lg: 20px;
  --ax-r-xl: 28px;
  --ax-pill: 999px;

  /* Elevation */
  --ax-sh-1: 0 1px 2px rgba(11, 22, 38, 0.05), 0 1px 1px rgba(11, 22, 38, 0.03);
  --ax-sh-2: 0 6px 20px rgba(11, 22, 38, 0.07);
  --ax-sh-3: 0 18px 48px rgba(11, 22, 38, 0.12);
  --ax-ring: 0 0 0 3px rgba(var(--ax-primary-rgb), 0.28);

  /* Layout */
  --ax-container: 1200px;
  --ax-gutter: 24px;
  --ax-header-h: 72px;

  --ax-ease: cubic-bezier(.2, .7, .2, 1);
  --ax-dur: 200ms;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body.ax {
  margin: 0;
  min-width: 320px;
  font-family: var(--ax-font-body);
  font-size: var(--ax-fs-md);
  line-height: 1.6;
  color: var(--ax-text);
  background: var(--ax-canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
:where(.ax) :where(img, svg, video) { max-width: 100%; height: auto; }
:where(.ax) img { display: block; }
:where(.ax) a { color: var(--ax-primary); text-decoration: none; transition: color var(--ax-dur) var(--ax-ease); }
:where(.ax) a:where(:hover) { color: var(--ax-primary-hover); }
:where(.ax) p { margin: 0 0 var(--ax-4); }
:where(.ax) p:where(:last-child) { margin-bottom: 0; }
:where(.ax) :where(ul, ol) { margin: 0; padding: 0; }
:where(.ax) button { font: inherit; }
:where(.ax) :focus-visible { outline: 2px solid var(--ax-primary); outline-offset: 2px; border-radius: 4px; }
:where(.ax) ::selection { background: rgba(var(--ax-primary-rgb), .18); }

:where(.ax) :where(h1, h2, h3, h4, h5, h6) {
  margin: 0 0 var(--ax-4);
  font-family: var(--ax-font-head);
  color: var(--ax-text);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
:where(.ax) :where(h1) { font-size: var(--ax-fs-h1); letter-spacing: -0.035em; line-height: 1.04; }
:where(.ax) :where(h2) { font-size: var(--ax-fs-h2); letter-spacing: -0.03em; }
:where(.ax) :where(h3) { font-size: var(--ax-fs-h3); }
:where(.ax) :where(h4) { font-size: var(--ax-fs-h4); }
:where(.ax) :where(h5) { font-size: var(--ax-fs-lg); letter-spacing: -0.01em; }
:where(.ax) :where(h6) { font-size: var(--ax-fs-md); letter-spacing: 0; }

/* Mixed-weight headline: <h2 class="ax-display"><span class="ax-thin">Light words</span> bold words</h2> */
.ax-display { font-weight: 700; }
.ax-thin { font-weight: 300; letter-spacing: -0.03em; }
.ax-display .ax-thin { color: inherit; opacity: .92; }

.ax-lead { font-size: var(--ax-fs-lg); line-height: 1.65; color: var(--ax-muted); max-width: 60ch; }
.ax-small { font-size: var(--ax-fs-sm); }
.ax-xs { font-size: var(--ax-fs-xs); }
.ax-muted { color: var(--ax-muted) !important; }
.ax-subtle { color: var(--ax-subtle) !important; }
.ax-num, .ax-money { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* Skip link */
.ax-skip { position: absolute; left: 16px; top: -100px; z-index: 5000; padding: 10px 16px; border-radius: var(--ax-pill); background: var(--ax-ink); color: #fff !important; font-weight: 600; font-size: var(--ax-fs-sm); }
.ax-skip:focus { top: 12px; }

/* ---------- Layout ---------- */
.ax-container {
  width: 100%;
  max-width: calc(var(--ax-container) + var(--ax-gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--ax-gutter);
}
.ax-container--narrow { max-width: calc(820px + var(--ax-gutter) * 2); }
.ax-section { padding-block: var(--ax-11); position: relative; }
.ax-section--sm { padding-block: var(--ax-9); }
.ax-section--flush-top { padding-top: 0; }
.ax-section--white { background: var(--ax-surface); }
.ax-section--canvas { background: var(--ax-canvas); }
.ax-section--sand { background: var(--ax-accent-tint); }
.ax-section--dark { background: var(--ax-ink); color: var(--ax-on-dark-muted); }
.ax-section--dark-2 { background: var(--ax-ink-2); color: var(--ax-on-dark-muted); }
.ax-section--dark h1, .ax-section--dark h2, .ax-section--dark h3, .ax-section--dark h4, .ax-section--dark h5,
.ax-section--dark-2 h1, .ax-section--dark-2 h2, .ax-section--dark-2 h3, .ax-section--dark-2 h4, .ax-section--dark-2 h5 { color: var(--ax-on-dark); }
.ax-section--dark .ax-lead, .ax-section--dark-2 .ax-lead { color: var(--ax-on-dark-muted); }

.ax-section-head { max-width: 760px; margin-bottom: var(--ax-8); }
.ax-section-head--center { margin-inline: auto; text-align: center; }
.ax-section-head--center .ax-lead { margin-inline: auto; }
.ax-section-head--split { max-width: none; display: grid; grid-template-columns: 1.1fr .9fr; gap: var(--ax-6) var(--ax-9); align-items: end; }

.ax-grid { display: grid; gap: var(--ax-5); }
.ax-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ax-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ax-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ax-grid-auto { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.ax-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ax-9); align-items: center; }
.ax-split--wide-left { grid-template-columns: 1.15fr .85fr; }
.ax-split--wide-right { grid-template-columns: .85fr 1.15fr; }
.ax-stack > * + * { margin-top: var(--ax-4); }
.ax-flex { display: flex; gap: var(--ax-3); }
.ax-flex-wrap { flex-wrap: wrap; }
.ax-items-center { align-items: center; }
.ax-justify-between { justify-content: space-between; }
.ax-justify-center { justify-content: center; }
.ax-gap-2 { gap: var(--ax-2); } .ax-gap-4 { gap: var(--ax-4); } .ax-gap-5 { gap: var(--ax-5); }

/* ---------- Utilities ---------- */
.ax-text-center { text-align: center; }
.ax-text-right { text-align: right; }
.ax-mt-0 { margin-top: 0 !important; } .ax-mb-0 { margin-bottom: 0 !important; }
.ax-mt-2 { margin-top: var(--ax-2); } .ax-mt-4 { margin-top: var(--ax-4); } .ax-mt-5 { margin-top: var(--ax-5); } .ax-mt-6 { margin-top: var(--ax-6); } .ax-mt-8 { margin-top: var(--ax-8); }
.ax-mb-2 { margin-bottom: var(--ax-2); } .ax-mb-4 { margin-bottom: var(--ax-4); } .ax-mb-6 { margin-bottom: var(--ax-6); } .ax-mb-8 { margin-bottom: var(--ax-8); }
.ax-w-100 { width: 100%; }
.ax-hidden { display: none !important; }
.ax-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ax-rounded { border-radius: var(--ax-r); } .ax-rounded-lg { border-radius: var(--ax-r-lg); }
.ax-divider { height: 1px; background: var(--ax-line); border: 0; margin: var(--ax-6) 0; }
.ax-text-primary { color: var(--ax-primary) !important; }
.ax-text-sand { color: var(--ax-accent-strong) !important; }
.ax-text-success { color: var(--ax-success) !important; }
.ax-text-danger { color: var(--ax-danger) !important; }
.ax-text-white { color: #fff !important; }
.ax-icon { width: 1.25em; height: 1.25em; flex-shrink: 0; display: inline-block; vertical-align: -0.2em; }
.ax-icon--sm { width: 1em; height: 1em; }
.ax-icon--lg { width: 1.5em; height: 1.5em; }

/* Media frames */
.ax-media { position: relative; overflow: hidden; border-radius: var(--ax-r-lg); background: var(--ax-ink-2); isolation: isolate; }
.ax-media img { width: 100%; height: 100%; object-fit: cover; }
.ax-media--4x3 { aspect-ratio: 4 / 3; }
.ax-media--4x5 { aspect-ratio: 4 / 5; }
.ax-media--16x9 { aspect-ratio: 16 / 9; }

/* Scroll reveal (JS adds .is-in; without JS everything stays visible) */
.ax-js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ax-ease), transform .7s var(--ax-ease); }
.ax-js [data-reveal].is-in { opacity: 1; transform: none; }
.ax-js [data-reveal-delay="1"] { transition-delay: .08s; }
.ax-js [data-reveal-delay="2"] { transition-delay: .16s; }
.ax-js [data-reveal-delay="3"] { transition-delay: .24s; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .ax-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ax-split, .ax-split--wide-left, .ax-split--wide-right { gap: var(--ax-7); }
}
@media (max-width: 860px) {
  :root { --ax-gutter: 20px; }
  .ax-section { padding-block: var(--ax-9); }
  .ax-section--sm { padding-block: var(--ax-8); }
  .ax-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ax-split, .ax-split--wide-left, .ax-split--wide-right, .ax-section-head--split { grid-template-columns: minmax(0, 1fr); }
  .ax-section-head { margin-bottom: var(--ax-6); }
}
@media (max-width: 600px) {
  :root { --ax-gutter: 16px; }
  .ax-grid-2, .ax-grid-3, .ax-grid-4 { grid-template-columns: minmax(0, 1fr); }
  .ax-section { padding-block: var(--ax-8); }
  .ax-lead { font-size: var(--ax-fs-md); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .ax-js [data-reveal] { opacity: 1 !important; transform: none !important; }
}
