/* ================================================================
   YG-Base v1.0 — Minimal CSS foundation for YouGrow SSG sites

   This file ships with the framework. Do not edit in your project.
   Override tokens and add all design styles in theme.css.
   ================================================================ */

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


/* ================================================================
   BASE — Normalize and structural reset

   No colors. No font families. No design opinions.
   Makes HTML structurally consistent across browsers.
   ================================================================ */

@layer base {

  /* --- Box sizing -------------------------------------------- */

  *, *::before, *::after {
    box-sizing: border-box;
  }


  /* --- Root -------------------------------------------------- */

  html {
    overflow-x: hidden;
  }

  /* Smooth scroll — only when motion is acceptable */
  @media (prefers-reduced-motion: no-preference) {
    html {
      scroll-behavior: smooth;
    }
  }


  /* --- Body -------------------------------------------------- */

  body {
    min-height: 100svh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }


  /* --- Margin reset ------------------------------------------ */

  /* Remove default margins. Themes re-apply spacing through
     custom properties and semantic classes, not browser defaults. */
  body,
  h1, h2, h3, h4, h5, h6,
  p, figure, blockquote, dl, dd {
    margin: 0;
  }


  /* --- Lists ------------------------------------------------- */

  /* Flush lists — themes add back padding/bullets as needed */
  ul, ol {
    list-style: none;
    margin: 0;
    padding: 0;
  }


  /* --- Heading scale ----------------------------------------- */

  /* Proportional em scale — not fixed px.
     Themes control effective sizes via font-size on html/body.
     This replaces Bootstrap's fixed-pixel heading scale. */
  h1 { font-size: 2.5em; }
  h2 { font-size: 2em; }
  h3 { font-size: 1.625em; }
  h4 { font-size: 1.25em; }
  h5 { font-size: 1em; }
  h6 { font-size: 0.875em; }


  /* --- Media ------------------------------------------------- */

  img, video, canvas, svg, picture {
    display: block;
    max-width: 100%;
  }

  img {
    height: auto; /* Prevent image distortion */
  }


  /* --- Forms ------------------------------------------------- */

  /* Fix browser inconsistency: form controls don't inherit font by default */
  input, button, textarea, select {
    font: inherit;
  }

  /* Prevent horizontal overflow from textareas */
  textarea {
    resize: vertical;
  }


  /* --- Accessibility ----------------------------------------- */

  /* Respect the HTML hidden attribute universally */
  [hidden] {
    display: none !important;
  }

  /* Focus indicator — respects user's color preference via currentColor */
  :focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 3px;
    border-radius: 2px;
  }

  /* Disable all motion for users who prefer reduced motion */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }

}


/* ================================================================
   TOKENS — CSS custom property schema

   Defaults are functional minimums — readable, not beautiful.
   Themes override every token. Themes add their own tokens freely.

   NAMING CONVENTION:
   Use --color-*, --font-*, --space-*, --radius-*, --shadow-*
   Do NOT use shadcn naming (--background, --foreground, --primary-foreground)
   Mapping: --background → --color-bg, --foreground → --color-text,
            --muted-foreground → --color-text-muted, --border → --color-line
   ================================================================ */

@layer tokens {

  :root {

    /* ----------------------------------------------------------
       Colors
       9 core semantic tokens. All should be overridden in themes.
       Themes may add site-specific tokens beyond these.
       Examples: --color-bg-dark, --color-accent-warm,
                 --color-primary-hover: color-mix(in srgb, var(--color-primary) 80%, black)
       ---------------------------------------------------------- */

    --color-bg:          #ffffff;         /* Page background */
    --color-bg-alt:      #f5f5f5;         /* Alt section bg — zebra sections, inset panels */
    --color-text:        #1a1a1a;         /* Body text */
    --color-text-muted:  #6b7280;         /* Secondary / muted text */
    --color-heading:     currentColor;    /* Heading text — inherits body by default */
    --color-primary:     #0066cc;         /* Primary brand / action color */
    --color-accent:      #0066cc;         /* Accent / secondary brand color */
    --color-line:        rgba(0, 0, 0, 0.1); /* Borders and dividers */
    --color-link:        var(--color-primary); /* Link color */


    /* ----------------------------------------------------------
       Typography
       System-ui defaults — themes always set real fonts.
       Load web fonts in theme.css before declaring --font-* tokens.
       ---------------------------------------------------------- */

    --font-body:            system-ui, sans-serif;
    --font-heading:         var(--font-body);
    --font-mono:            ui-monospace, monospace;
    --font-size-base:       1rem;
    --line-height-body:     1.6;
    --line-height-heading:  1.2;


    /* ----------------------------------------------------------
       Spacing
       4 core tokens. Extended schema names (--space-xs, --space-2xl,
       --space-3xl) have no base defaults — define in theme as needed.

       Optional: drive the whole scale from a single unit:
         --space-unit: 0.5rem;
         --space-sm:   calc(var(--space-unit) * 2);  / * 16px * /
         --space-md:   calc(var(--space-unit) * 3);  / * 24px * /
         --space-lg:   calc(var(--space-unit) * 5);  / * 40px * /
         --space-xl:   calc(var(--space-unit) * 8);  / * 64px * /
       ---------------------------------------------------------- */

    --space-sm:   1rem;     /* Tight: inline items, icon+label, small insets */
    --space-md:   1.5rem;   /* Default: stacked elements, card padding */
    --space-lg:   2.5rem;   /* Sub-blocks: between major content groups */
    --space-xl:   4rem;     /* Sections: hero spacing, section padding */


    /* ----------------------------------------------------------
       Border radius
       All default to 0 — no design opinion.
       --radius-full is always 9999px (pill / circle).
       ---------------------------------------------------------- */

    --radius-sm:    0;
    --radius-md:    0;
    --radius-lg:    0;
    --radius-full:  9999px;


    /* ----------------------------------------------------------
       Shadows
       All default to none — flat design by default.
       Define in theme if design uses elevation.
       ---------------------------------------------------------- */

    --shadow-sm:   none;
    --shadow-md:   none;
    --shadow-lg:   none;


    /* ----------------------------------------------------------
       Transitions
       Functional defaults — rarely need overriding.
       Themes use these for hover states, open/close, entrance animations.
       ---------------------------------------------------------- */

    --transition-fast:   150ms ease-out;  /* Micro-interactions: hover color */
    --transition-base:   250ms ease-out;  /* Standard state changes */
    --transition-slow:   400ms ease-out;  /* Entrance animations, emphasis */


    /* ----------------------------------------------------------
       Container
       Used by the .container utility class.
       ---------------------------------------------------------- */

    --container-max-width:  1200px;
    --container-padding:    1.5rem;

  }

}


/* ================================================================
   UTILITIES — Structural utilities only

   This layer is intentionally tiny. Three classes, that's it.
   Do not add spacing utilities, flex utilities, or color helpers.
   Everything beyond these three belongs in theme.css.
   ================================================================ */

@layer utilities {

  /* Container — single-axis centering with max-width */
  .container {
    width: 100%;
    max-width: var(--container-max-width);
    margin-inline: auto;
    padding-inline: var(--container-padding);
  }


  /* Screen-reader-only — hide visually, keep in accessibility tree */
  .sr-only,
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }


  /* Skip link — hidden until focused, for keyboard / screen reader users.
     Place at the very top of <body>:
     <a href="#main-content" class="skip-link">Skip to main content</a> */
  .skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: 9999;
    padding: 0.5rem 1rem;
    background: #000;
    color: #fff;
    font-size: 0.875rem;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
    transition: top var(--transition-fast);

    &:focus {
      top: 0;
    }
  }

}
