/* ============================================================
   Cresus Paie — BASE
   Design Tokens · Reset · Typography
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&display=swap');

/* ─── Custom Properties ─────────────────────────────────────── */

:root {

  /* Brand Colors (Cresus Paie brand board) */
  --color-tetsu-kon-blue:  #17184B;
  --color-tetsu-kon-blue-hover: #242666;
  --color-duranta-yellow:  #D8E63C;
  --color-nordic-breeze:   #D3DDE7;
  --color-cloud-dancer:    #FAF9F6;
  --color-white:           #FFFFFF;

  /* Nav ink — exact shade from the supplied nav-bar asset (Rectangle 5.png)
     and logo SVG accents; a deliberate darker variant of Tetsu-Kon Blue,
     distinct enough from --color-tetsu-kon-blue to keep as its own token. */
  --color-nav-ink: #0C0F53;

  /* Semantic Colors */
  --color-bg-main:         var(--color-cloud-dancer);
  --color-bg-dark:         var(--color-tetsu-kon-blue);
  --color-bg-light:        var(--color-white);
  --color-bg-neutral:      var(--color-nordic-breeze);
  --color-text-primary:    var(--color-tetsu-kon-blue);
  --color-text-on-dark:    var(--color-white);
  --color-text-muted:      rgba(23, 24, 75, 0.64);
  --color-text-muted-dark: rgba(255, 255, 255, 0.72);
  --color-border-light:    rgba(23, 24, 75, 0.12);
  --color-border-dark:     rgba(255, 255, 255, 0.16);
  --color-accent-primary:  var(--color-duranta-yellow);

  /* Typography */
  /* Geist is not yet available on this machine — falls back to system-ui.
     Swap in @font-face rules here once .woff2 files are supplied. */
  --font-display:  'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-interface: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;

  --weight-normal:   400;
  --weight-medium:   600;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* Typography Scale */
  --size-display-lg: clamp(2.25rem, 2.6vw + 1.75rem, 4.25rem);
  --size-display-md: clamp(1.75rem, 1.8vw + 1.4rem, 3rem);
  --size-h1: 2rem;
  --size-h2: 1.75rem;
  --size-h3: clamp(1.25rem, 0.8vw + 1.05rem, 1.75rem);
  --size-body: 1rem;
  --size-sm: 0.875rem;

  --line-height-display: 1.05;
  --line-height-heading: 1.2;
  --line-height-body:    1.6;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;

  /* Layout */
  --container-max:    1320px;
  --container-narrow: 1080px;
  --nav-height:       85px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;
  /* Bottom-corner radius measured off the supplied nav-bar asset (Rectangle 5.png) */
  --radius-nav: 24px;

  /* Shadows (neutral — refine once section mockups arrive in Phase 2) */
  --shadow-sm: 0 4px 12px rgba(23, 24, 75, 0.08);
  --shadow-md: 0 12px 32px rgba(23, 24, 75, 0.12);
  --shadow-lg: 0 24px 64px rgba(23, 24, 75, 0.18);

  /* Motion */
  --transition-smooth: color 0.3s ease, background-color 0.3s ease,
    border-color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;

  /* Z-index */
  --z-nav: 50;
}

/* Motion is deliberately restrained: a short native smooth scroll and a
   small section lift provide polish without the weight of a scroll library. */
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height, 72px) + 1rem);
}

.crx-motion-ready .crx-reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 360ms ease-out, transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.crx-motion-ready .crx-reveal.is-revealed {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ─── Reset ──────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-interface);
  font-size: var(--size-body);
  font-weight: var(--weight-normal);
  line-height: var(--line-height-body);
  color: var(--color-text-primary);
  background-color: var(--color-bg-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition-smooth);
}

button, input, textarea, select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--color-duranta-yellow);
  outline-offset: 3px;
}

ul, ol {
  list-style: none;
}

/* ─── Base Elements ───────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6, .font-display {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--line-height-heading);
  color: var(--color-text-primary);
}

h1 { font-size: var(--size-display-lg); line-height: var(--line-height-display); }
h2 { font-size: var(--size-display-md); margin-bottom: var(--space-md); }
h3 { font-size: var(--size-h2); }
h4 { font-size: var(--size-h3); }

p {
  font-size: var(--size-body);
  line-height: var(--line-height-body);
  color: var(--color-text-muted);
}

/* ─── Buttons ─────────────────────────────────────────────────── */

button, .btn {
  font-family: var(--font-interface);
  font-weight: var(--weight-semibold);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background-color: var(--color-tetsu-kon-blue);
  color: var(--color-white);
}

.btn-primary:hover {
  background-color: var(--color-tetsu-kon-blue-hover);
}

.btn-accent {
  background-color: var(--color-duranta-yellow);
  color: var(--color-tetsu-kon-blue);
}

.btn-accent:hover {
  opacity: 0.9;
}

/* ─── Typography Utilities ───────────────────────────────────── */

.h1 { font-family: var(--font-display); font-size: var(--size-display-lg); line-height: var(--line-height-display); font-weight: var(--weight-bold); }
.h2 { font-family: var(--font-display); font-size: var(--size-display-md); line-height: var(--line-height-heading); font-weight: var(--weight-bold); }
.h3 { font-family: var(--font-display); font-size: var(--size-h2); line-height: var(--line-height-heading); font-weight: var(--weight-bold); }

.body-lg { font-size: 1.125rem; line-height: var(--line-height-body); }
.body-sm { font-size: var(--size-sm); line-height: var(--line-height-body); }

.label {
  font-size: var(--size-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ─── Screen Reader / Accessibility ─────────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.alignwide { max-width: var(--container-max); margin-inline: auto; }
.alignfull  { width: 100%; max-width: 100%; }

/* ─── Astra: Force full-width on all custom page templates ────
   Overrides Astra's boxed container, sidebar wrapper and entry-
   content max-width so sections bleed edge-to-edge.            */
body.page-template .ast-container,
body.page-template #primary.content-area,
body.page-template #main.site-main,
body.page-template .site-content,
body.page-template .entry-content,
body.page-template article.page {
  max-width: 100% !important;
  width:     100% !important;
  padding-left:  0 !important;
  padding-right: 0 !important;
  margin-left:   0 !important;
  margin-right:  0 !important;
}

body.page-template {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

.crx-page {
  width: 100%;
  max-width: 100%;
}

/* Belt-and-braces: some Astra wrappers paint their own white background
   and/or keep a boxed max-width regardless of the body-class override
   above (depends on Astra layout settings). Neutralize the background
   so --color-bg-main shows through, and let the header/footer break out
   to the full viewport width no matter what ancestor constrains them. */
html, body {
  background-color: var(--color-bg-main);
}

#page,
.site,
#content,
.site-content,
#primary,
.content-area,
#main,
.site-main,
.ast-container {
  background-color: transparent !important;
}

.crx-nav--dark,
.crx-footer {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

body.page-template #ast-scroll-top,
body.page-template .ast-scroll-top-icon,
body.page-template .ast-scroll-to-top-right {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
