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

@layer tokens {
  /* Self-hosted Manrope Variable (OFL) — Latin-Ext */
  @font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/manrope-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }

  /* Self-hosted Manrope Variable (OFL) — Latin */
  @font-face {
    font-family: "Manrope";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/assets/fonts/manrope-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

  /* Self-hosted JetBrains Mono Variable (OFL) — Latin-Ext */
  @font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }

  /* Self-hosted JetBrains Mono Variable (OFL) — Latin */
  @font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("/assets/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

  :root {
    color-scheme: light dark;

    /* Typography */
    --font-sans: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* Fluid Type Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
    --text-xl: clamp(1.2rem, 1.1rem + 0.4vw, 1.375rem);
    --text-2xl: clamp(1.45rem, 1.25rem + 0.85vw, 1.875rem);
    --text-3xl: clamp(1.8rem, 1.45rem + 1.4vw, 2.5rem);
    --text-hero: clamp(2.15rem, 1.65rem + 2.25vw, 3.35rem);

    /* Spacing & Radii */
    --space-section: clamp(3.75rem, 7vw, 6.25rem);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --container-max: 68rem;

    /* Warm Light Mode Defaults (Exact Merowech Solutions Logo Palette) */
    --bg: #FBF6EF;
    --surface: #F3EADF;
    --surface-elevated: #FFF7ED;
    --ink: #2B1A12;
    --muted: #7C5A47;
    --subtle: #967461;
    --border: #E5D7C6;
    --border-strong: #D0BBA3;
    --accent: #C2410C;
    --accent-hover: #9A3412;
    --accent-soft: #F6E4D7;
    --accent-ink: #FFF7ED;
    --code-bg: #EFE5D8;
    --backdrop: rgba(43, 26, 18, 0.45);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #18100C;
      --surface: #231712;
      --surface-elevated: #2C1E17;
      --ink: #FFF7ED;
      --muted: #C9B2A3;
      --subtle: #987E6E;
      --border: #3A281F;
      --border-strong: #50392D;
      --accent: #EA580C;
      --accent-hover: #F97316;
      --accent-soft: #311D14;
      --accent-ink: #FFF7ED;
      --code-bg: #1E140F;
      --backdrop: rgba(10, 6, 4, 0.68);
    }
  }

  html[data-theme="light"] {
    color-scheme: light;
  }

  html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #18100C;
    --surface: #231712;
    --surface-elevated: #2C1E17;
    --ink: #FFF7ED;
    --muted: #C9B2A3;
    --subtle: #987E6E;
    --border: #3A281F;
    --border-strong: #50392D;
    --accent: #EA580C;
    --accent-hover: #F97316;
    --accent-soft: #311D14;
    --accent-ink: #FFF7ED;
    --code-bg: #1E140F;
    --backdrop: rgba(10, 6, 4, 0.68);
  }
}
