/*
 * Islamic Portal design tokens: the shared foundation (Part 39). Loaded first by every layout of this site
 * (_Layout, _ImmersiveLayout, the Teen Academy's _TeensLayout), before any other stylesheet.
 *
 * The same names exist on all three sites (this one, the kids site and the portal), each with the value that site
 * already uses, so a component written with them looks right wherever it lands. Colours, shadows and fonts are not
 * here: they belong to each experience and change with the theme (layout.css on this site, teens.css for the Teen
 * Academy). The full inventory, the rules and the contrast pairs are in docs/learning-universe/DESIGN-SYSTEM.md; the
 * living style guide is /design (Teen Academy: /teens/design).
 *
 * Values equal what layout.css used before this file existed. layout.css still defines the older names itself
 * (--ip-space-*, --ip-radius-*, --ip-text-*, --ip-ease, --ip-spring); DesignSystemConventionTests keeps the two equal.
 * New work uses these tokens instead of literal values.
 */

:root {
  /* Spacing: a 4px rhythm up to 1rem, then wider steps. */
  --ip-space-1: .25rem;
  --ip-space-2: .5rem;
  --ip-space-3: .75rem;
  --ip-space-4: 1rem;
  --ip-space-5: 1.5rem;
  --ip-space-6: 2rem;
  --ip-space-7: 2.5rem;
  --ip-space-8: 3rem;
  --ip-space-9: 4rem;
  --ip-space-10: 5rem;

  /* Radii: chips and inputs (sm), cards (md, lg), feature panels (xl), pills and round buttons (pill). */
  --ip-radius-xs: 6px;
  --ip-radius-sm: 8px;
  --ip-radius-md: 12px;
  --ip-radius-lg: 16px;
  --ip-radius-xl: 20px;
  --ip-radius-pill: 999px;

  /* Type scale: the steps from xl up grow with the viewport. */
  --ip-text-xs: .75rem;
  --ip-text-sm: .875rem;
  --ip-text-base: 1rem;
  --ip-text-lg: 1.0625rem;
  --ip-text-xl: clamp(1.15rem, 1.08rem + .3vw, 1.3rem);
  --ip-text-2xl: clamp(1.35rem, 1.2rem + .7vw, 1.75rem);
  --ip-text-3xl: clamp(1.7rem, 1.35rem + 1.5vw, 2.4rem);
  --ip-text-4xl: clamp(2rem, 1.45rem + 2.4vw, 3.2rem);
  --ip-leading-tight: 1.2;  /* headings, buttons */
  --ip-leading-body: 1.5;   /* running text (Bootstrap's body) */

  /* Motion (Part 39.5): durations by purpose. */
  --ip-motion-fast: 150ms;    /* colour, focus, small state changes */
  --ip-motion-base: 200ms;    /* hover feedback on buttons, chips, links */
  --ip-motion-lift: 250ms;    /* a card lifting on hover or focus (.ip-lift) */
  --ip-motion-panel: 300ms;   /* panels, drawers, menus, a card expanding */
  --ip-motion-slow: 400ms;    /* page entrance, content revealed on scroll */
  --ip-motion-scene: 600ms;   /* scene and map transitions */

  /* Easing: ease-out for things arriving, spring for playful feedback, standard for colour. */
  --ip-ease-out: cubic-bezier(.2, .7, .2, 1);
  --ip-ease-spring: cubic-bezier(.34, 1.4, .64, 1);
  --ip-ease-standard: ease;
  --ip-ease-in-out: ease-in-out;

  /* Stacking: Bootstrap's scale, which the site shell follows. */
  --ip-z-raised: 1;
  --ip-z-dropdown: 1000;
  --ip-z-sticky: 1020;
  --ip-z-header: 1030;
  --ip-z-modal: 1055;
  --ip-z-overlay: 1080;  /* the search palette, above the header */
  --ip-z-toast: 1090;
  --ip-z-skip: 2000;     /* the skip link, above everything */

  /* Breakpoints (Bootstrap 5). Custom properties cannot be used inside @media, so these are for scripts and as the
   * reference: write (min-width: 768px) or (max-width: 767.98px). */
  --ip-bp-sm: 576px;
  --ip-bp-md: 768px;
  --ip-bp-lg: 992px;
  --ip-bp-xl: 1200px;
  --ip-bp-2xl: 1400px;

  /* Focus and touch. */
  --ip-focus-width: 3px;
  --ip-focus-offset: 2px;
  --ip-control-h: 42px;  /* a standard button or field (.ip-btn) */
}

/* The Teen Academy stacks its own shell (sticky filters 20, glass header 80, menus 90, skip link 300,
 * celebration 400); its Bootstrap modals and toasts keep the site's values. */
.tn {
  --ip-z-sticky: 20;
  --ip-z-dropdown: 90;
  --ip-z-header: 80;
  --ip-z-overlay: 400;  /* the celebration burst */
  --ip-z-skip: 300;
  --ip-focus-offset: 3px;
}

/* Less motion: anything timed with the tokens becomes instant (the layouts also cut every transition then). */
@media (prefers-reduced-motion: reduce) {
  :root {
    --ip-motion-fast: .01ms;
    --ip-motion-base: .01ms;
    --ip-motion-lift: .01ms;
    --ip-motion-panel: .01ms;
    --ip-motion-slow: .01ms;
    --ip-motion-scene: .01ms;
  }
}
