/* ============================================
   CHLOE PESSOA — Base Styles & Design Tokens
   ============================================ */

/* CSS Layers for specificity control */
@layer reset, tokens, typography, base;

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500&family=Inter:wght@300;400;500;600&display=swap');

/* ── Design Tokens ── */
@layer tokens {
  :root {
    /* Colors */
    --color-black: #000000;
    --color-white: #FFFFFF;
    --color-accent: #C9A96E;
    --color-accent-light: #D4BA8A;
    --color-surface: #F5F5F5;
    --color-surface-dark: #0A0A0A;
    --color-text-primary: #1A1A1A;
    --color-text-secondary: #6B6B6B;
    --color-text-muted: #999999;
    --color-border: #E5E5E5;
    --color-border-dark: #2A2A2A;
    --color-overlay: rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Inter', 'Helvetica Neue', sans-serif;

    /* Font Sizes (fluid) */
    --text-xs: clamp(0.625rem, 0.5rem + 0.25vw, 0.75rem);
    --text-sm: clamp(0.75rem, 0.65rem + 0.3vw, 0.875rem);
    --text-base: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
    --text-lg: clamp(1rem, 0.9rem + 0.4vw, 1.125rem);
    --text-xl: clamp(1.125rem, 1rem + 0.5vw, 1.25rem);
    --text-2xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
    --text-3xl: clamp(2rem, 1.5rem + 1.5vw, 2.5rem);
    --text-4xl: clamp(2.5rem, 1.8rem + 2vw, 3.5rem);
    --text-5xl: clamp(3rem, 2rem + 3vw, 5rem);
    --text-6xl: clamp(3.5rem, 2.5rem + 4vw, 7rem);
    --text-hero: clamp(4rem, 3rem + 5vw, 10rem);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;
    --space-5xl: 8rem;
    --space-section: clamp(5rem, 4rem + 5vw, 10rem);

    /* Layout */
    --max-width: 1400px;
    --max-width-narrow: 900px;
    --gutter: clamp(1.5rem, 1rem + 2vw, 4rem);

    /* Transitions */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 0.2s;
    --duration-normal: 0.4s;
    --duration-slow: 0.8s;
    --duration-slower: 1.2s;

    /* Border Radius */
    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 8px;

    /* Z-index */
    --z-cursor: 9999;
    --z-nav: 1000;
    --z-overlay: 900;
    --z-modal: 800;
  }
}

/* ── Reset ── */
@layer reset {
  *, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
  }

  body {
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
  }

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

  a {
    color: inherit;
    text-decoration: none;
  }

  button {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
    color: inherit;
  }

  ul, ol {
    list-style: none;
  }

  input, textarea {
    font: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
  }

  ::selection {
    background: var(--color-accent);
    color: var(--color-white);
  }
}

/* ── Typography ── */
@layer typography {
  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: 400;
    color: var(--color-text-primary);
    background-color: var(--color-white);
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  h1 { font-size: var(--text-hero); }
  h2 { font-size: var(--text-5xl); }
  h3 { font-size: var(--text-4xl); }
  h4 { font-size: var(--text-3xl); }
  h5 { font-size: var(--text-2xl); }
  h6 { font-size: var(--text-xl); }

  p {
    line-height: 1.8;
    color: var(--color-text-secondary);
  }

  .text-accent {
    color: var(--color-accent);
  }

  .text-uppercase {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-family: var(--font-body);
    font-weight: 500;
  }

  .text-label {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    font-weight: 500;
    color: var(--color-text-muted);
  }
}

/* ── Base Layout ── */
@layer base {
  .container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--gutter);
  }

  .container--narrow {
    max-width: var(--max-width-narrow);
  }

  .section {
    padding: var(--space-section) 0;
    position: relative;
  }

  .section--dark {
    background-color: var(--color-surface-dark);
    color: var(--color-white);
  }

  .section--dark p {
    color: var(--color-text-muted);
  }

  .section--surface {
    background-color: var(--color-surface);
  }

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

  /* Divider */
  .divider {
    width: 60px;
    height: 1px;
    background: var(--color-accent);
    margin: var(--space-lg) 0;
  }

  .divider--center {
    margin-left: auto;
    margin-right: auto;
  }

  /* Page loader */
  .page-loader {
    position: fixed;
    inset: 0;
    background: var(--color-black);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s var(--ease-out-expo), visibility 0.6s;
  }

  .page-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .page-loader__text {
    font-family: var(--font-display);
    font-size: var(--text-3xl);
    color: var(--color-white);
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
  }

  .page-loader__bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--color-accent);
    width: 0%;
    transition: width 1.5s var(--ease-out-expo);
  }

  .page-loader.loading .page-loader__bar {
    width: 100%;
  }
}
