/* ==========================================================================
   Turkly design tokens
   Single source of truth for colour, type, spacing and layout values.
   Fluid values interpolate between a 360px and a 1440px viewport.
   ========================================================================== */

:root {
  /* ---- Brand palette (supplied) ---------------------------------------- */
  --c-travertine: #F7F5F0;   /* Warm Travertine: primary background */
  --c-limestone:  #EFECE6;   /* Soft Limestone: alternate background */
  --c-charcoal:   #161D22;   /* Deep Bosphorus Charcoal: text, dark sections */
  --c-muted:      #5A626A;   /* Muted secondary text (5.69:1 on travertine) */
  --c-brass:      #9E7E4F;   /* Antique Brass: accents, rules, large text */
  --c-hairline:   #DCD7CD;   /* Hairline borders */

  /* ---- Derived for WCAG AA contrast ------------------------------------ */
  /* Antique Brass measures 3.47:1 on travertine: acceptable for large text,
     rules and UI outlines, but not for body-size text. Use this darker
     brass for any brass-coloured text under 24px on light backgrounds. */
  --c-brass-text:      #7A5F36; /* 5.48:1 on travertine, 5.06:1 on limestone */
  --c-muted-on-dark:   #A3A9AE; /* 7.17:1 on charcoal */
  --c-hairline-on-dark:#2C353C; /* decorative borders on charcoal */
  --c-input-border:    #857F75; /* 3.64:1 on travertine: meets the 3:1 non-text contrast minimum */
  --c-error:           #8B2A2A; /* 7.83:1 on travertine */

  /* ---- Semantic colour roles (remapped by .theme-dark) ----------------- */
  --color-bg:          var(--c-travertine);
  --color-bg-alt:      var(--c-limestone);
  --color-text:        var(--c-charcoal);
  --color-text-muted:  var(--c-muted);
  --color-accent:      var(--c-brass);
  --color-accent-text: var(--c-brass-text);
  --color-border:      var(--c-hairline);
  --color-focus:       var(--c-brass);
  --color-btn-bg:      var(--c-charcoal);
  --color-btn-text:    var(--c-travertine);
  --color-btn-hover:   #2A343B;

  /* ---- Typefaces -------------------------------------------------------- */
  --font-display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-body:    "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-arabic:  "IBM Plex Sans Arabic", "Plus Jakarta Sans", "Segoe UI", Tahoma, sans-serif;

  /* ---- Fluid type scale ------------------------------------------------- */
  --step--2: clamp(0.75rem, 0.7396rem + 0.0463vw, 0.7813rem);  /* 12 to 12.5px */
  --step--1: clamp(0.8125rem, 0.7917rem + 0.0926vw, 0.875rem); /* 13 to 14px */
  --step-0:  clamp(1rem, 0.9688rem + 0.1389vw, 1.0938rem);     /* 16 to 17.5px */
  --step-1:  clamp(1.125rem, 1.0625rem + 0.2778vw, 1.3125rem); /* 18 to 21px */
  --step-2:  clamp(1.3125rem, 1.2083rem + 0.463vw, 1.625rem);  /* 21 to 26px */
  --step-3:  clamp(1.5625rem, 1.375rem + 0.8333vw, 2.125rem);  /* 25 to 34px */
  --step-4:  clamp(1.875rem, 1.5rem + 1.6667vw, 3rem);         /* 30 to 48px */
  --step-5:  clamp(2.25rem, 1.625rem + 2.7778vw, 4.125rem);    /* 36 to 66px */
  --step-6:  clamp(2.625rem, 1.5rem + 5vw, 6rem);              /* 42 to 96px */

  --leading-tight: 1.08;
  --leading-snug:  1.3;
  --leading-body:  1.65;
  --leading-arabic: 1.85;

  --tracking-display: -0.012em;
  --tracking-caps:    0.16em;

  --weight-regular: 400;
  --weight-medium:  500;
  --weight-semibold: 600;

  /* ---- Fluid spacing scale --------------------------------------------- */
  --space-3xs: clamp(0.25rem, 0.2292rem + 0.0926vw, 0.3125rem);
  --space-2xs: clamp(0.5rem, 0.4583rem + 0.1852vw, 0.625rem);
  --space-xs:  clamp(0.75rem, 0.7083rem + 0.1852vw, 0.875rem);
  --space-s:   clamp(1rem, 0.9167rem + 0.3704vw, 1.25rem);
  --space-m:   clamp(1.5rem, 1.375rem + 0.5556vw, 1.875rem);
  --space-l:   clamp(2rem, 1.75rem + 1.1111vw, 2.75rem);
  --space-xl:  clamp(3rem, 2.5833rem + 1.8519vw, 4.25rem);
  --space-2xl: clamp(4rem, 3.1667rem + 3.7037vw, 6.5rem);
  --space-3xl: clamp(5rem, 3.6667rem + 5.9259vw, 9rem);

  /* ---- Layout ----------------------------------------------------------- */
  --container-max:    90rem;   /* 1440px */
  --container-narrow: 60rem;   /* 960px  */
  --measure:          38rem;   /* comfortable reading line */
  --gutter:   clamp(1.25rem, 0.6667rem + 2.5926vw, 3rem);
  --grid-gap: clamp(1rem, 0.6667rem + 1.4815vw, 2rem);
  --header-h: 4.5rem;          /* 72px; raised to 88px at 64em in components.css */

  /* ---- Shape, lines, motion -------------------------------------------- */
  --radius: 2px;
  --border-width: 1px;
  --rule: var(--border-width) solid var(--color-border);
  --duration-fast: 160ms;
  --duration-base: 240ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --tap-target: 2.75rem;       /* 44px minimum touch target */

  /* ---- Layers ----------------------------------------------------------- */
  --z-header: 50;
  --z-skip:   100;

  /* Breakpoints (custom properties cannot be used inside media queries;
     these are recorded here for reference and used literally in CSS):
     md = 48em (768px), lg = 64em (1024px), xl = 80em (1280px). */
}

/* Dark editorial sections: remap the semantic roles, not the components. */
.theme-dark {
  --color-bg:          var(--c-charcoal);
  --color-bg-alt:      #1C252B;
  --color-text:        var(--c-travertine);
  --color-text-muted:  var(--c-muted-on-dark);
  --color-accent:      var(--c-brass);
  --color-accent-text: var(--c-brass);          /* 4.5:1 on charcoal */
  --color-border:      var(--c-hairline-on-dark);
  --color-focus:       var(--c-brass);
  --color-btn-bg:      var(--c-travertine);
  --color-btn-text:    var(--c-charcoal);
  --color-btn-hover:   var(--c-limestone);
  /* --rule must be redeclared: a custom property that uses var() resolves
     where it is declared, so the :root version keeps the light hairline. */
  --rule: var(--border-width) solid var(--color-border);

  background-color: var(--color-bg);
  color: var(--color-text);
}
