/* =============================================================================
   NewChapters Cleanings — design tokens
   Source of truth: docs/design-system.md (contrast table, rules, composition).
   This file only declares @font-face + custom properties. No element styles.

   Layers
     1. Brand palette  (--nc-*)        raw values from the logo / client palette
     2. Extended neutrals & feedback   derived, contrast-checked (WCAG 2.2 AA)
     3. Semantic roles (--color-*)     what components should use
     4. Type, space, layout, shape, elevation, z-index, motion, states

   Dark sections: add  data-theme="dark"  to the section; semantic roles flip.
   Breakpoints (use the literals; custom properties cannot be used in @media):
     360 / 390 phones (fluid from 320) · 768 tablet · 1440 desktop · 1920 wide
     @media (min-width: 48em) · (min-width: 90em) · (min-width: 120em)
   ========================================================================== */

/* ---- Fonts (OFL-1.1, self-hosted, latin subset, 3 files ≈ 43 KB) ------------
   Preload the two above-the-fold files in <head>:
   <link rel="preload" href="/fonts/cormorant-garamond-latin-500-normal.woff2" as="font" type="font/woff2" crossorigin>
   <link rel="preload" href="/fonts/jost-latin-400-normal.woff2" as="font" type="font/woff2" crossorigin>   */
@font-face {
  font-family: 'Cormorant Garamond';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/cormorant-garamond-latin-500-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;
}
/* Italic face retired (Refero review, decisions.md): no decorative italic word swaps in headings. */
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/jost-latin-400-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;
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/jost-latin-600-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;

  /* ===== 1. Brand palette (client-defined; do not alter) ================== */
  --nc-champagne: #b29760;   /* logo colour. Decoration, large fills, text ON DARK only */
  --nc-gold: #d8c596;        /* soft gold. Accents, hover fills, text/focus ON DARK    */
  --nc-ivory: #f4eedf;       /* dominant background                                    */
  --nc-stone: #c9bba4;       /* hairlines, quiet fills, secondary text ON DARK         */
  --nc-carbon: #191816;      /* text on light, dark sections                           */

  /* ===== 2. Extended (derived from the brand; contrast-checked) =========== */
  --nc-ivory-50: #fbf8f0;    /* raised surface: inputs, cards                  */
  --nc-ivory-200: #ebe3d0;   /* alternate band / sunken surface                */
  --nc-champagne-700: #76602f; /* champagne darkened for TEXT on light (≥4.7:1) */
  --nc-champagne-800: #5e4b22; /* link hover / pressed text (7.2:1 on ivory)    */
  --nc-gold-active: #c2aa74; /* pressed state of the primary button            */
  --nc-carbon-800: #262420;  /* raised surface on dark                         */
  --nc-carbon-700: #3b3832;  /* secondary text on light (10:1)                 */
  --nc-carbon-600: #5b564c;  /* muted text on light (6.3:1)                    */
  --nc-carbon-500: #6b655a;  /* UI borders / icons on light (5.0:1)            */
  --nc-error: #9e2b1e;       /* 6.4:1 on ivory                                 */
  --nc-error-bg: #f7e6e1;
  --nc-error-on-dark: #f2a89c; /* 9.2:1 on carbon                              */
  --nc-success: #3f6137;     /* 6.1:1 on ivory                                 */
  --nc-success-bg: #e8eedf;

  /* ===== 3. Semantic roles — LIGHT (default) ============================== */
  --color-bg: var(--nc-ivory);
  --color-bg-raised: var(--nc-ivory-50);
  --color-bg-alt: var(--nc-ivory-200);
  --color-bg-inverse: var(--nc-carbon);

  --color-text: var(--nc-carbon);            /* 15.3:1 on ivory */
  --color-text-secondary: var(--nc-carbon-700); /* 10.1:1 */
  --color-text-muted: var(--nc-carbon-600);  /* 6.3:1 on ivory, 5.7:1 on ivory-200 */
  --color-text-accent: var(--nc-champagne-700); /* 5.2:1 on ivory, 4.7:1 on ivory-200; eyebrows, links */
  --color-text-inverse: var(--nc-ivory);

  --color-decor: var(--nc-champagne);        /* rules, ornaments, logo: NEVER for text (2.4:1) */
  --color-line: rgb(25 24 22 / 0.16);        /* hairline dividers (decorative)  */
  --color-line-strong: var(--nc-carbon-500); /* essential UI borders (≥3:1)     */

  --color-action-bg: var(--nc-champagne);    /* primary CTA fill  — text carbon 6.3:1 */
  --color-action-fg: var(--nc-carbon);
  --color-action-bg-hover: var(--nc-gold);   /* lightens on hover — text carbon 10.4:1 */
  --color-action-bg-active: var(--nc-gold-active);
  --color-action2-fg: var(--nc-carbon);      /* secondary: outline carbon     */
  --color-action2-border: var(--nc-carbon);
  --color-action2-bg-hover: var(--nc-carbon);
  --color-action2-fg-hover: var(--nc-ivory);

  --color-link: var(--nc-champagne-700);
  --color-link-hover: var(--nc-carbon);

  --color-field-bg: var(--nc-ivory-50);
  --color-field-border: var(--nc-carbon-500);       /* 5.4:1 */
  --color-field-border-hover: var(--nc-carbon-700);
  --color-field-border-focus: var(--nc-carbon);
  --color-placeholder: var(--nc-carbon-600);

  --color-focus: var(--nc-carbon);           /* 15.3:1 on ivory */
  --color-selection-bg: var(--nc-gold);
  --color-selection-fg: var(--nc-carbon);

  --color-error: var(--nc-error);
  --color-error-bg: var(--nc-error-bg);
  --color-success: var(--nc-success);
  --color-success-bg: var(--nc-success-bg);

  --color-disabled-bg: #e6dfcf;
  --color-disabled-fg: #7a7469;              /* exempt from 1.4.3, kept legible (3.5:1) */
  --color-disabled-border: rgb(25 24 22 / 0.18);

  --color-scrim: rgb(25 24 22 / 0.55);       /* modal/nav overlay */
  --scrim-photo-bottom: linear-gradient(to top, rgb(25 24 22 / 0.72) 0%, rgb(25 24 22 / 0.32) 45%, rgb(25 24 22 / 0) 100%);
  --scrim-photo-flat: rgb(25 24 22 / 0.45);  /* only with ivory text; verify on the real photo */

  /* ===== Typography ======================================================= */
  --font-serif: 'Cormorant Garamond', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --font-sans: 'Jost', 'Avenir Next', Avenir, 'Segoe UI', system-ui, sans-serif;
  --fw-sans-regular: 400;
  --fw-sans-strong: 600;
  --fw-serif: 500;            /* the only serif weight shipped: never use 700 (faux bold) */

  /* Fluid scale, 360px → 1440px viewport */
  --text-xs: clamp(0.75rem, 0.73rem + 0.1vw, 0.8125rem);       /* 12–13  eyebrow caps only  */
  --text-sm: clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);     /* 14–15  captions, meta     */
  --text-base: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);         /* 16–18  body               */
  --text-lg: clamp(1.1875rem, 1.1rem + 0.45vw, 1.5rem);        /* 19–24  lead paragraph     */
  --text-xl: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);              /* 24–32  h4 / card title (serif) */
  --text-2xl: clamp(2rem, 1.6rem + 1.9vw, 3.25rem);            /* 32–52  h2 (serif)         */
  --text-3xl: clamp(2.5rem, 1.8rem + 3.4vw, 5rem);             /* 40–78  h1 (serif)         */
  --text-4xl: clamp(3rem, 2rem + 5vw, 7rem);                   /* 48–104 hero display       */
  --text-numeral: clamp(8rem, 5rem + 14vw, 21rem);             /* 128–336 Chapter II ornament only (aria-hidden) */

  --lh-tight: 1.05;           /* display */
  --lh-heading: 1.12;
  --lh-snug: 1.3;
  --lh-body: 1.6;
  --ls-display: -0.012em;
  --ls-body: 0;
  --ls-caps: 0.2em;           /* eyebrows & descriptor-style labels (echoes LUXURY CLEANING SERVICES) */
  --ls-button: 0.14em;
  --measure: 62ch;            /* max line length for prose */

  /* ===== Space (4px base) ================================================= */
  --space-3xs: 0.25rem;
  --space-2xs: 0.5rem;
  --space-xs: 0.75rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  --space-3xl: 6rem;
  --space-block: clamp(2.5rem, 1.5rem + 4vw, 5rem);            /* inside a section  */
  --space-section: clamp(5rem, 3rem + 8vw, 10rem);             /* between sections: generous */
  --space-hero-pad: clamp(6rem, 4rem + 8vw, 11rem);

  /* ===== Layout =========================================================== */
  --container-prose: 40rem;     /* 640  */
  --container-md: 62rem;        /* 992  */
  --container-lg: 80rem;        /* 1280 */
  --container-xl: 90rem;        /* 1440: design width */
  --container-max: 120rem;      /* 1920: cap for full-bleed content */
  --gutter: clamp(1.25rem, 0.5rem + 3.2vw, 4rem);
  --grid-gap: clamp(1rem, 0.5rem + 1.6vw, 2rem);
  --header-h: clamp(4rem, 3.6rem + 1vw, 5rem);
  --tap-min: 2.75rem;           /* 44px touch target (WCAG 2.5.8 minimum is 24px) */

  --ar-portrait: 4 / 5;
  --ar-landscape: 3 / 2;
  --ar-wide: 16 / 9;
  --ar-band: 21 / 9;
  --ar-square: 1 / 1;

  /* ===== Shape / borders / elevation ====================================== */
  --radius-xs: 2px;             /* photos, buttons: sharp, editorial */
  --radius-sm: 4px;             /* fields, chips */
  --radius-md: 8px;
  --radius-pill: 999px;
  --border-hairline: 1px solid var(--color-line);
  --border-strong: 1px solid var(--color-line-strong);
  --border-width-focus: 2px;

  --shadow-sm: 0 1px 2px rgb(25 24 22 / 0.06);
  --shadow-md: 0 1px 2px rgb(25 24 22 / 0.05), 0 8px 24px rgb(25 24 22 / 0.08);
  --shadow-lg: 0 2px 4px rgb(25 24 22 / 0.05), 0 24px 56px rgb(25 24 22 / 0.14);

  /* ===== Z-index ========================================================== */
  --z-base: 0;
  --z-raised: 10;
  --z-sticky: 100;      /* sticky mobile CTA bar */
  --z-header: 200;
  --z-overlay: 300;     /* mobile menu */
  --z-modal: 400;
  --z-toast: 500;
  --z-skip: 1000;       /* skip link */

  /* ===== Motion ===========================================================
     Rules in design-system.md §6. State changes use these tokens; depth layers
     (styles.css, "Depth & interaction") move with the scroll or a fine pointer.
     Animate only transform-family properties + opacity.                    */
  --dur-instant: 80ms;
  --dur-fast: 160ms;    /* hover, press, focus */
  --dur-base: 280ms;    /* menu, accordion, header, hero fade */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);      /* default, entrances */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);      /* accordion, layout  */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);              /* exits              */
  --ease-emphasis: cubic-bezier(0.16, 1, 0.3, 1);     /* hero fade          */

  /* ===== States (compose in components) =================================== */
  --focus-ring: var(--border-width-focus) solid var(--color-focus);
  --focus-offset: 3px;
  --opacity-disabled: 1;       /* disabled uses colour tokens, not opacity */
  --cursor-disabled: not-allowed;
}

/* ===== Dark sections: <section data-theme="dark"> ========================= */
[data-theme='dark'] {
  color-scheme: dark;
  --color-bg: var(--nc-carbon);
  --color-bg-raised: var(--nc-carbon-800);
  --color-bg-alt: var(--nc-carbon-800);

  --color-text: var(--nc-ivory);                 /* 15.3:1 */
  --color-text-secondary: var(--nc-stone);       /* 9.4:1  */
  --color-text-muted: var(--nc-stone);
  --color-text-accent: var(--nc-gold);           /* 10.4:1 */
  --color-text-inverse: var(--nc-carbon);

  --color-decor: var(--nc-champagne);            /* 6.3:1: also valid for text here */
  --color-line: rgb(244 238 223 / 0.18);
  --color-line-strong: var(--nc-stone);

  --color-action-bg: var(--nc-champagne);        /* text carbon 6.3:1; boundary vs bg 6.3:1 */
  --color-action-fg: var(--nc-carbon);
  --color-action-bg-hover: var(--nc-gold);
  --color-action-bg-active: var(--nc-gold-active);
  --color-action2-fg: var(--nc-ivory);
  --color-action2-border: var(--nc-stone);
  --color-action2-bg-hover: var(--nc-ivory);
  --color-action2-fg-hover: var(--nc-carbon);

  --color-link: var(--nc-gold);
  --color-link-hover: var(--nc-ivory);

  --color-field-bg: var(--nc-carbon-800);
  --color-field-border: var(--nc-stone);
  --color-field-border-hover: var(--nc-ivory);
  --color-field-border-focus: var(--nc-gold);
  --color-placeholder: var(--nc-stone);

  --color-focus: var(--nc-gold);                 /* 10.4:1 on carbon */
  --color-error: var(--nc-error-on-dark);
  --color-error-bg: rgb(242 168 156 / 0.12);

  --color-disabled-bg: #2c2a25;
  --color-disabled-fg: #8a8478;
  --color-disabled-border: rgb(244 238 223 / 0.14);
}

/* ===== Reduced motion: tokens collapse, state changes stay instant ======== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-instant: 0.01ms;
    --dur-fast: 0.01ms;
    --dur-base: 0.01ms;
  }
}
