/* ═══════════════════════════════════════════════════════
   Norbis Design System — Base Layer
   Light corporate theme: Swiss precision × Editorial elegance
   2026 CSS: @layer, view-transitions, oklch, nesting
   ═══════════════════════════════════════════════════════ */

@layer reset, tokens, base, layout, components, utilities;

/* ── VIEW TRANSITIONS ── */
@view-transition {
  navigation: auto;
}

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

  html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-optical-sizing: auto;
    hanging-punctuation: first last;
  }

  img { max-width: 100%; display: block; }
  a { color: inherit; text-decoration: none; }
  button { font-family: inherit; cursor: pointer; border: none; background: none; }
  input, textarea, select { font-family: inherit; }
  ul, ol { list-style: none; }
}

/* ── DESIGN TOKENS ── */
@layer tokens {
  :root {
    /* Core backgrounds */
    --bg: #fafaf9;
    --bg-elevated: #ffffff;
    --bg-surface: #f2f1ef;
    --bg-muted: #eae9e6;

    /* Borders */
    --border: rgba(0,0,0,0.07);
    --border-active: rgba(0,0,0,0.14);

    /* Text */
    --text: #1a1a2e;
    --text-secondary: #55546a;
    --text-tertiary: #8e8da0;

    /* Gold accent */
    --accent: #a8872e;
    --accent-hover: #c9a53c;
    --accent-subtle: rgba(168,135,46,0.07);
    --accent-glow: rgba(168,135,46,0.12);

    /* Status */
    --success: #2d7d56;
    --success-subtle: rgba(45,125,86,0.08);
    --info: #3a73a0;
    --error: #b93e3e;
    --whatsapp: #25D366;

    /* Typography */
    --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
    --font-body: 'Urbanist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Fluid Type Scale */
    --text-xs:   clamp(0.6875rem, 0.625rem + 0.2vw, 0.75rem);
    --text-sm:   clamp(0.8125rem, 0.775rem + 0.15vw, 0.875rem);
    --text-base: clamp(0.9375rem, 0.875rem + 0.2vw, 1rem);
    --text-lg:   clamp(1.0625rem, 0.975rem + 0.3vw, 1.125rem);
    --text-xl:   clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
    --text-2xl:  clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    --text-3xl:  clamp(2rem, 1.5rem + 2vw, 3rem);
    --text-4xl:  clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
    --text-5xl:  clamp(2.75rem, 1.75rem + 4vw, 4.25rem);

    /* Line Heights */
    --leading-tight:   1.15;
    --leading-display: 1.2;
    --leading-snug:    1.3;
    --leading-normal:  1.6;
    --leading-relaxed: 1.75;
    --leading-loose:   1.85;

    /* Letter Spacing */
    --tracking-tighter: -0.03em;
    --tracking-tight:   -0.02em;
    --tracking-normal:  0;
    --tracking-wide:    0.05em;
    --tracking-wider:   0.1em;
    --tracking-widest:  0.15em;

    /* Spacing */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  40px;
    --space-2xl: 64px;
    --space-3xl: 120px;

    /* Shadows — soft, warm-toned */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.10);
    --shadow-xl: 0 20px 64px rgba(0,0,0,0.12);

    /* Borders & Radius */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   20px;
    --radius-full: 100px;

    /* Transitions */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast:   0.18s;
    --duration-normal: 0.32s;
    --duration-slow:   0.7s;
  }
}

/* ── BASE ── */
@layer base {
  body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    position: relative;
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--leading-display);
    text-wrap: balance;
    color: var(--text);
  }

  h5, h6 {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: var(--leading-snug);
  }

  p {
    text-wrap: pretty;
  }

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

  :focus-visible {
    outline: 1.5px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
  }

  ::-webkit-scrollbar {
    width: 6px;
  }

  ::-webkit-scrollbar-track {
    background: var(--bg);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--border-active);
    border-radius: 3px;

    &:hover {
      background: var(--text-tertiary);
    }
  }
}

/* ── SCROLL PROGRESS BAR ── */
@layer utilities {
  .scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    z-index: 9999;
    background: transparent;
    pointer-events: none;
  }

  .scroll-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px var(--accent-glow);
  }
}
