/* ==========================================================================
   NVM Pet - Variation A (Heritage Industrial) Design System
   ==========================================================================
   Source of truth: projects/nvmpet/brand-guidelines.json
   Token-only CSS - never raw hex/px/font-family in section CSS.

   Animation restraint per design-direction.md:
   no parallax, no auto-carousels, no transition: all.
   Variation A buttons use --radius-md (6px) per Big Barker restraint.
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */

:root {
    /* === Core Brand Colors (from brand-guidelines.json colors block) ===== */
    --color-primary: #002030;            /* Manufacturing Navy */
    --color-primary-light: #0a3a55;      /* derived */
    --color-primary-dark: #001520;       /* derived */

    --color-secondary: #4090b0;          /* Pet Comfort Cyan */
    --color-secondary-light: #5aa9c5;    /* derived */
    --color-secondary-dark: #2e7593;     /* derived */

    --color-accent: #A87544;             /* Heritage Bronze - awards/cert/review accents */
    --color-accent-light: #c08a55;       /* derived */
    --color-accent-dark: #8a5e35;        /* derived */

    /* RGB pairs for shadow/overlay math */
    --color-primary-rgb: 0, 32, 48;
    --color-secondary-rgb: 64, 144, 176;

    /* === Navy-tinted Neutral Scale =====================================
       Interpolated from brand-guidelines neutrals:
       #F7F4EE (warm off-white) -> #D4DCE0 (slate border)
       -> #4A5764 (muted slate) -> #002030 (primary)        */
    --gray-50:  #F7F4EE;   /* Warm Off-White (background_alt) */
    --gray-100: #ECECE5;   /* derived warm tint */
    --gray-200: #D4DCE0;   /* Slate Border (border_subtle) */
    --gray-300: #B4BFC6;   /* derived */
    --gray-400: #8A95A0;   /* Disabled Slate (text_muted) */
    --gray-500: #6B7682;   /* derived */
    --gray-600: #4A5764;   /* Muted Slate (text_secondary) */
    --gray-700: #2F3B47;   /* derived */
    --gray-800: #1A2A36;   /* derived */
    --gray-900: #002030;   /* Manufacturing Navy (text_primary) */

    /* === Semantic Colors (from brand-guidelines.json semantic block) ==== */
    --color-success: #2E7D52;
    --color-warning: #C9740F;
    --color-error:   #B8323F;
    --color-info:    #4090b0;            /* matches Pet Comfort Cyan */

    /* === Background Colors ============================================== */
    --bg-primary:   #FFFFFF;             /* Pure White (background_primary) */
    --bg-secondary: var(--gray-50);      /* Warm Off-White (background_alt) */
    --bg-dark:      var(--color-primary);
    --bg-darker:    var(--color-primary-dark);

    /* === Surface Colors ================================================= */
    --surface-card:    var(--bg-primary);
    --surface-elevated: var(--bg-primary);

    /* === Text Colors ==================================================== */
    --text-primary:   var(--gray-900);   /* Manufacturing Navy */
    --text-secondary: var(--gray-600);   /* Muted Slate */
    --text-tertiary:  var(--gray-400);   /* Disabled Slate */
    --text-muted:     var(--gray-400);
    --text-inverse:   var(--gray-50);    /* Off-White on Dark (text_on_dark) */
    --text-on-dark:   var(--gray-50);
    --text-link:       var(--color-secondary);
    --text-link-hover: var(--color-primary);

    /* === Border Colors ================================================== */
    --border-color:      var(--gray-200);
    --border-color-dark: var(--gray-300);
    --border-width: 1px;

    /* === Typography (Variation A pairing) =============================== */
    --font-heading: 'Fraunces', Georgia, serif;
    --font-body:    'Mulish', system-ui, sans-serif;

    /* Font Sizes - clamp() values from brand-guidelines.json shared_scale */
    --text-hero:  clamp(3.5rem, 7vw, 6rem);
    --text-h1:    clamp(2.75rem, 5vw, 5rem);
    --text-h2:    clamp(2rem, 4vw, 4rem);
    --text-h3:    clamp(1.5rem, 2.5vw, 2.25rem);
    --text-h4:    clamp(1.125rem, 1.5vw, 1.75rem);
    --text-body-large: 1.125rem;
    --text-body:       1rem;
    --text-body-small: 0.875rem;
    --text-caption:    0.75rem;

    /* Legacy scale aliases (so utility classes keep working) */
    --text-xs:   var(--text-caption);
    --text-sm:   var(--text-body-small);
    --text-base: var(--text-body);
    --text-md:   var(--text-body-large);
    --text-lg:   var(--text-body-large);
    --text-xl:   var(--text-h4);
    --text-2xl:  var(--text-h3);
    --text-3xl:  var(--text-h3);
    --text-4xl:  var(--text-h2);
    --text-5xl:  var(--text-h1);
    --text-6xl:  var(--text-hero);

    /* Font Weights */
    --font-light: 300;
    --font-regular: 400;
    --font-medium: 500;
    --font-semibold: 600;
    --font-bold: 700;
    --font-extrabold: 800;
    --font-black: 900;

    /* Line Heights */
    --leading-heading: 1.1;
    --leading-body:    1.65;
    --leading-none:    1;
    --leading-tight:   1.1;
    --leading-snug:    1.3;
    --leading-normal:  1.5;
    --leading-relaxed: 1.65;
    --leading-loose:   1.85;

    /* Letter Spacing */
    --tracking-heading: -0.02em;
    --tracking-body:    0;
    --tracking-tighter: -0.05em;
    --tracking-tight:   -0.02em;
    --tracking-normal:  0;
    --tracking-wide:    0.025em;
    --tracking-wider:   0.05em;
    --tracking-widest:  0.1em;

    /* Text wrapping */
    --text-wrap-heading: balance;
    --body-max-measure:  68ch;

    /* === Spacing Scale (from brand-guidelines.json web_system.spacing) === */
    --space-xs:  4px;
    --space-sm:  8px;
    --space-md:  16px;
    --space-lg:  24px;
    --space-xl:  48px;
    --space-2xl: 64px;
    --space-3xl: 96px;
    --space-4xl: 128px;

    /* CTA isolation: min 64px above any trailing CTA */
    --space-cta-above: var(--space-2xl);

    /* Section + container */
    --section-padding: clamp(80px, 10vw, 160px);
    --container-width: 1280px;
    --container-narrow: 960px;
    --container-padding: clamp(16px, 3vw, 32px);

    /* Aliases for utility classes */
    --container-max: var(--container-width);

    /* === Border Radius (from brand-guidelines.json border_radius) ========
       Variation A uses --radius-md (6px) for CTA buttons per
       Big Barker restraint. Cards use --radius-lg (12px) default. */
    --radius-none: 0;
    --radius-sm:   2px;
    --radius-md:   6px;
    --radius-lg:   12px;
    --radius-xl:   20px;
    --radius-pill: 999px;
    --radius-full: var(--radius-pill);
    --radius-2xl:  var(--radius-xl);

    /* === Shadows (navy-tinted per brand-guidelines.json) ================ */
    --shadow-ground:   none;
    --shadow-raised:   0 1px 2px rgba(0,32,48,0.06), 0 1px 3px rgba(0,32,48,0.04);
    --shadow-elevated: 0 4px 8px rgba(0,32,48,0.06), 0 8px 20px rgba(0,32,48,0.08);
    --shadow-overlay:  0 12px 32px rgba(0,32,48,0.12), 0 24px 64px rgba(0,32,48,0.16);

    /* Aliases for utility classes */
    --shadow-sm:  var(--shadow-raised);
    --shadow-md:  var(--shadow-elevated);
    --shadow-lg:  var(--shadow-elevated);
    --shadow-xl:  var(--shadow-overlay);
    --shadow-2xl: var(--shadow-overlay);

    /* === Transitions (from brand-guidelines.json animation) =============
       NOTE: never use `transition: all` per design-direction.md.
       Always specify the exact property animated. */
    --easing-default: cubic-bezier(0.16, 1, 0.3, 1);
    --easing-quick:   cubic-bezier(0.4, 0, 0.2, 1);
    --easing-smooth:  cubic-bezier(0.215, 0.61, 0.355, 1);

    --duration-micro: 150ms;
    --duration-base:  300ms;
    --duration-slow:  500ms;

    /* Aliases */
    --transition-fast:  var(--duration-micro);
    --transition-base:  var(--duration-base);
    --transition-slow:  var(--duration-slow);
    --ease-spring:      var(--easing-default);
    --ease-out:         var(--easing-quick);
    --ease-smooth:      var(--easing-smooth);

    /* === Icon Size Tiers ================================================ */
    --icon-sm:  20px;
    --icon-md:  32px;
    --icon-lg:  48px;
    --icon-xl:  64px;
    --icon-2xl: 80px;

    /* === Z-Index Scale ================================================== */
    --z-behind:   -1;
    --z-base:     0;
    --z-raised:   10;
    --z-dropdown: 100;
    --z-sticky:   200;
    --z-overlay:  300;
    --z-modal:    400;
    --z-popover:  500;
    --z-toast:    600;
    --z-max:      9999;
}


/* --------------------------------------------------------------------------
   CSS Reset
   -------------------------------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-body);
    font-weight: var(--font-regular);
    line-height: var(--leading-body);
    letter-spacing: var(--tracking-body);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

address {
    font-style: normal;
}


/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: var(--font-bold);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-heading);
    color: var(--text-primary);
    text-wrap: var(--text-wrap-heading);
}

h1 {
    font-size: var(--text-h1);
    font-weight: var(--font-extrabold);
}

h2 {
    font-size: var(--text-h2);
}

h3 {
    font-size: var(--text-h3);
}

h4 {
    font-size: var(--text-h4);
}

h5 {
    font-size: var(--text-body-large);
    font-weight: var(--font-semibold);
}

h6 {
    font-size: var(--text-body);
    font-weight: var(--font-semibold);
}

p {
    margin-bottom: var(--space-md);
    line-height: var(--leading-body);
    color: var(--text-secondary);
    max-width: var(--body-max-measure);
}

p:last-child {
    margin-bottom: 0;
}

strong, b {
    font-weight: var(--font-semibold);
}


/* --------------------------------------------------------------------------
   Layout: Container
   -------------------------------------------------------------------------- */

.container {
    width: 100%;
    max-width: var(--container-width);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-padding);
    padding-right: var(--container-padding);
}

.container--narrow {
    max-width: var(--container-narrow);
}

.container--wide {
    max-width: 1440px;
}


/* --------------------------------------------------------------------------
   Layout: Section
   -------------------------------------------------------------------------- */

.section {
    padding-top: var(--section-padding);
    padding-bottom: var(--section-padding);
}

.section--alt {
    background-color: var(--bg-secondary);
}

.section--dark {
    background-color: var(--bg-dark);
    color: var(--text-on-dark);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
    color: var(--text-on-dark);
}

.section--dark p {
    color: var(--gray-200);
}


/* --------------------------------------------------------------------------
   Flexbox Utilities
   -------------------------------------------------------------------------- */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }


/* --------------------------------------------------------------------------
   Grid Utilities
   -------------------------------------------------------------------------- */

.grid {
    display: grid;
    gap: var(--space-xl);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
    .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid--2,
    .grid--3,
    .grid--4 { grid-template-columns: 1fr; }
}


/* --------------------------------------------------------------------------
   Buttons (Variation A: square-ish per Big Barker restraint - --radius-md)
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    min-height: 52px;
    font-family: var(--font-body);
    font-size: var(--text-body);
    font-weight: var(--font-semibold);
    line-height: 1;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--duration-base) var(--easing-default),
                border-color var(--duration-base) var(--easing-default),
                color var(--duration-base) var(--easing-default),
                transform var(--duration-base) var(--easing-default),
                box-shadow var(--duration-base) var(--easing-default);
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--color-secondary);
    outline-offset: 2px;
}

/* Primary - navy background, off-white text, cyan on hover */
.btn--primary {
    background-color: var(--color-primary);
    color: var(--text-on-dark);
    border-color: var(--color-primary);
}

.btn--primary:hover {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-elevated);
}

/* Secondary - transparent with navy border, fills on hover */
.btn--secondary {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn--secondary:hover {
    background-color: var(--color-primary);
    color: var(--text-on-dark);
    border-color: var(--color-primary);
}

/* Outline */
.btn--outline {
    background-color: transparent;
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.btn--outline:hover {
    background-color: var(--color-primary);
    color: var(--text-on-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-elevated);
}

/* Sizes */
.btn--sm {
    padding: var(--space-sm) var(--space-md);
    min-height: 40px;
    font-size: var(--text-body-small);
}

.btn--lg {
    padding: var(--space-md) var(--space-2xl);
    font-size: var(--text-body-large);
}

.btn--full { width: 100%; }

.btn__icon {
    display: inline-flex;
    flex-shrink: 0;
}


/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="password"],
textarea,
select {
    display: block;
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-micro) var(--easing-quick),
                box-shadow var(--duration-micro) var(--easing-quick);
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--color-secondary);
    box-shadow: 0 0 0 3px rgba(64, 144, 176, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

textarea {
    min-height: 120px;
    resize: vertical;
}

label {
    display: block;
    margin-bottom: var(--space-xs);
    font-size: var(--text-body-small);
    font-weight: var(--font-medium);
    color: var(--text-primary);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%234A5764' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: var(--space-xl);
}
