/* ============================================================
   DRAPERY LIFE — main.css
   Design System Base: Variables + Reset + Typography + Utilities
   
   Architecture: Mobile-First (min-width: 0 base, scale up)
   Stack: Vanilla CSS with Custom Properties
   Brand: BRAND_GUIDELINES.md v1.0
   
   Load order:
   1. main.css       ← this file (design system + reset)
   2. components.css ← buttons, cards, forms, modals
   3. quote.css      ← configurator-specific styles
   4. checkout.css   ← checkout-specific styles
   ============================================================ */

/* ============================================================
   FONTS — Google Fonts
   Inter is primary. Montserrat as alt weight/style.
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@500;600;700&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES — The design token system.
   Never use raw values in component rules.
   Always reference a variable.
   ============================================================ */
:root {

  /* ----------------------------------------------------------
     BRAND COLORS — Official palette from BRAND_GUIDELINES.md
     ---------------------------------------------------------- */
  --color-primary:        #714D37;   /* Primary Brown — buttons, headings, CTAs */
  --color-primary-dark:   #5C3D2A;   /* Hover state for primary */
  --color-primary-light:  #8B6349;   /* Lighter tint for focus rings */
  --color-secondary:      #7A4D34;   /* Secondary Brown — accents */
  --color-accent:         #7A0013;   /* Accent Burgundy — use sparingly */
  --color-accent-light:   #9B0019;   /* Hover for accent */

  /* Neutrals */
  --color-ivory:          #F4F1EB;   /* Main backgrounds, hero sections */
  --color-sand:           #EAE3D8;   /* Cards, dividers, section backgrounds */
  --color-sand-dark:      #D9CFC2;   /* Border emphasis */
  --color-charcoal:       #2B2B2B;   /* Body text */
  --color-charcoal-soft:  #4A4A4A;   /* Secondary text, labels */
  --color-muted:          #7A7A7A;   /* Placeholder text, captions */
  --color-white:          #FFFFFF;
  --color-black:          #000000;

  /* Semantic colors */
  --color-success:        #2D6A4F;   /* Confirmation, checkmarks */
  --color-success-bg:     #D8F3DC;
  --color-warning:        #B5451B;   /* Warnings, attention */
  --color-warning-bg:     #FDEBD0;
  --color-error:          #9B1C1C;   /* Error states */
  --color-error-bg:       #FDE8E8;
  --color-info:           #1E4D78;   /* Informational */
  --color-info-bg:        #E1EFFE;

  /* ----------------------------------------------------------
     TYPOGRAPHY
     ---------------------------------------------------------- */
  --font-primary:   'Inter', 'Montserrat', Arial, sans-serif;
  --font-display:   'Montserrat', 'Inter', Arial, sans-serif;

  /* Scale — mobile base */
  --text-xs:    0.75rem;   /* 12px */
  --text-sm:    0.875rem;  /* 14px */
  --text-base:  1rem;      /* 16px */
  --text-lg:    1.125rem;  /* 18px */
  --text-xl:    1.25rem;   /* 20px */
  --text-2xl:   1.5rem;    /* 24px */
  --text-3xl:   1.875rem;  /* 30px */
  --text-4xl:   2.25rem;   /* 36px */
  --text-5xl:   3rem;      /* 48px */

  /* Line heights */
  --leading-tight:  1.25;
  --leading-snug:   1.375;
  --leading-normal: 1.5;
  --leading-relaxed:1.625;

  /* Font weights */
  --weight-light:    300;
  --weight-regular:  400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ----------------------------------------------------------
     SPACING — 4px base grid
     ---------------------------------------------------------- */
  --space-1:    0.25rem;   /* 4px  */
  --space-2:    0.5rem;    /* 8px  */
  --space-3:    0.75rem;   /* 12px */
  --space-4:    1rem;      /* 16px */
  --space-5:    1.25rem;   /* 20px */
  --space-6:    1.5rem;    /* 24px */
  --space-8:    2rem;      /* 32px */
  --space-10:   2.5rem;    /* 40px */
  --space-12:   3rem;      /* 48px */
  --space-16:   4rem;      /* 64px */
  --space-20:   5rem;      /* 80px */
  --space-24:   6rem;      /* 96px */

  /* ----------------------------------------------------------
     BORDERS & SHADOWS
     ---------------------------------------------------------- */
  --radius-sm:    8px;
  --radius-md:    12px;   /* Buttons */
  --radius-lg:    16px;   /* Cards */
  --radius-xl:    24px;   /* Large cards, modals */
  --radius-full:  9999px; /* Pills, badges */

  --border-thin:    1px solid var(--color-sand);
  --border-medium:  1.5px solid var(--color-sand-dark);
  --border-focus:   2px solid var(--color-primary);

  --shadow-xs:  0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm:  0 2px 8px 0 rgb(0 0 0 / 0.06);
  --shadow-md:  0 4px 16px 0 rgb(0 0 0 / 0.08);
  --shadow-lg:  0 8px 32px 0 rgb(0 0 0 / 0.10);
  --shadow-xl:  0 16px 48px 0 rgb(0 0 0 / 0.12);

  /* ----------------------------------------------------------
     MOTION — Microinteractions
     Use ONLY transform and opacity. No layout-affecting props.
     ---------------------------------------------------------- */
  --ease-out:   cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in:    cubic-bezier(0.4, 0.0, 1, 1);
  --ease-inout: cubic-bezier(0.4, 0.0, 0.2, 1);
  --ease-spring:cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast:   150ms;
  --duration-base:   250ms;
  --duration-slow:   400ms;
  --duration-slower: 600ms;

  /* ----------------------------------------------------------
     LAYOUT
     ---------------------------------------------------------- */
  --container-max:    1200px;
  --container-wide:   1400px;
  --container-narrow: 720px;
  --container-xs:     480px;

  /* Z-index layers */
  --z-base:     0;
  --z-raised:   10;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-overlay:  300;
  --z-modal:    400;
  --z-toast:    500;
  --z-tooltip:  600;
}

/* ============================================================
   RESET — Modern CSS reset
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-charcoal);
  background-color: var(--color-ivory);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Prevent horizontal overflow at all breakpoints */
  overflow-x: hidden;
  max-width: 100vw;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}

/* Images — always responsive */
img, video, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Links */
a {
  color: inherit;
  text-decoration: none;
}

/* Buttons — reset browser defaults */
button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

/* Inputs — reset browser defaults */
input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

/* Remove number input arrows */
input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type='number'] { -moz-appearance: textfield; appearance: textfield; }

/* ============================================================
   TYPOGRAPHY — Heading hierarchy
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-primary);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  color: var(--color-charcoal);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base); font-weight: var(--weight-medium); }
h6 { font-size: var(--text-sm);  font-weight: var(--weight-medium); }

p {
  line-height: var(--leading-relaxed);
}

/* ============================================================
   LAYOUT UTILITIES
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  /* 360px: 12px padding — prevents edge bleed on tiny screens */
  padding-inline: var(--space-3);
}

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

/* Flexbox helpers */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between{ justify-content: space-between; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1; }
.gap-2       { gap: var(--space-2); }
.gap-4       { gap: var(--space-4); }
.gap-6       { gap: var(--space-6); }
.gap-8       { gap: var(--space-8); }

/* Grid helpers */
.grid        { display: grid; }
.grid-2      { grid-template-columns: repeat(2, 1fr); }
.grid-3      { grid-template-columns: repeat(3, 1fr); }

/* ============================================================
   SPACING UTILITIES
   ============================================================ */
.mt-4  { margin-top:    var(--space-4); }
.mt-6  { margin-top:    var(--space-6); }
.mt-8  { margin-top:    var(--space-8); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.pt-4  { padding-top:    var(--space-4); }
.pt-8  { padding-top:    var(--space-8); }
.pb-8  { padding-bottom: var(--space-8); }
.py-4  { padding-block:  var(--space-4); }
.py-8  { padding-block:  var(--space-8); }
.px-4  { padding-inline: var(--space-4); }
.px-6  { padding-inline: var(--space-6); }

/* ============================================================
   TEXT UTILITIES
   ============================================================ */
.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }
.text-sm      { font-size: var(--text-sm); }
.text-lg      { font-size: var(--text-lg); }
.text-xl      { font-size: var(--text-xl); }
.text-muted   { color: var(--color-muted); }
.text-primary { color: var(--color-primary); }
.font-medium  { font-weight: var(--weight-medium); }
.font-bold    { font-weight: var(--weight-bold); }

/* ============================================================
   VISIBILITY UTILITIES
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

/* ============================================================
   GLOBAL HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-white);
  border-bottom: var(--border-thin);
  padding-block: var(--space-4);
  box-shadow: var(--shadow-xs);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-header__logo img {
  height: 36px;
  width: auto;
}

.site-header__nav {
  display: none; /* Mobile: hidden, revealed by hamburger */
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ============================================================
   GLOBAL FOOTER
   ============================================================ */
.site-footer {
  background-color: var(--color-charcoal);
  color: var(--color-white);
  padding-block: var(--space-16) var(--space-8);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

.site-footer__brand-name {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--color-white);
  margin-bottom: var(--space-3);
}

.site-footer__tagline {
  font-size: var(--text-sm);
  color: rgb(255 255 255 / 0.6);
  line-height: var(--leading-relaxed);
}

.site-footer__heading {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(255 255 255 / 0.5);
  margin-bottom: var(--space-4);
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.site-footer__link {
  font-size: var(--text-sm);
  color: rgb(255 255 255 / 0.75);
  transition: color var(--duration-fast) var(--ease-out);
}

.site-footer__link:hover {
  color: var(--color-white);
}

.site-footer__bottom {
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid rgb(255 255 255 / 0.1);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: center;
  text-align: center;
}

.site-footer__copyright {
  font-size: var(--text-xs);
  color: rgb(255 255 255 / 0.4);
}

/* jsadsAI signature — required per BRAND_GUIDELINES.md */
.site-footer__signature {
  font-size: 11px;
  opacity: 0.55;
  letter-spacing: 0.01em;
  color: rgb(255 255 255 / 0.55);
  line-height: 1.4;
}

.site-footer__signature a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgb(255 255 255 / 0.3);
}

.site-footer__signature a:hover {
  opacity: 0.85;
}

/* ============================================================
   LOADING & SKELETON STATES
   ============================================================ */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton {
  background-color: var(--color-sand);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s var(--ease-inout) infinite;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  background: var(--color-charcoal);
  color: var(--color-white);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 340px;
  transform: translateY(0);
  opacity: 1;
  transition:
    transform var(--duration-base) var(--ease-out),
    opacity var(--duration-base) var(--ease-out);
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error   { border-left: 3px solid var(--color-error); }
.toast--info    { border-left: 3px solid var(--color-primary); }

/* ============================================================
   RESPONSIVE — Mobile-first, scale up
   Breakpoints: 360 / 390 / 430 / 640 / 768 / 1024 / 1280 / 1440
   ============================================================ */

/* 390px — iPhone 15 Pro, Pixel 8 */
@media (min-width: 390px) {
  .container {
    padding-inline: var(--space-4);
  }
}

/* 430px — iPhone 15 Pro Max, large Android */
@media (min-width: 430px) {
  .container {
    padding-inline: var(--space-4);
  }
}

/* 640px — Large phones landscape, small tablets */
@media (min-width: 640px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }

  .container {
    padding-inline: var(--space-6);
  }

  /* Footer: 2 columns on tablet */
  .site-footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

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

/* 768px — iPad portrait */
@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-8);
  }

  /* Footer: 3 columns on landscape tablet */
  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr;
  }

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

/* 1024px — Desktop */
@media (min-width: 1024px) {
  h1 { font-size: var(--text-5xl); }

  .site-header__nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
  }

  /* Footer: full 4-column layout */
  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

/* 1280px — Wide desktop */
@media (min-width: 1280px) {
  .container {
    padding-inline: var(--space-10);
  }
}

/* 1440px — Ultra-wide / large monitor */
@media (min-width: 1440px) {
  .container {
    padding-inline: var(--space-12);
  }
}
