/* ============================================================
   ToyoRoofing — base.css  v2.0
   Design tokens · Reset · Typography · Layout utilities
   ============================================================ */

/* --- Variables --- */
:root {
  /* Brand palette — source: Elementor global kit post-14.css */
  --toyo-red:       #940000;   /* primary / accent — exact brand color */
  --red-dark:       #6B0000;   /* hover / darker state */
  --red-light:      #B50000;   /* lighter hover for text */
  --toyo-black:     #212327;   /* body text & dark backgrounds */
  --toyo-charcoal:  #2C2C2C;   /* slightly lighter dark sections */
  --toyo-dark-gray: #4A4A4A;   /* services section bg */
  --gray-mid:       #6C6E76;   /* secondary text */
  --warm-off-white: #FFF8F2;   /* warm light section bg */
  --light-gray:     #EFEDED;   /* very light gray bg */
  --border:         #D7D7D7;   /* borders */
  --white:          #FFFFFF;

  /* Semantic surface tokens */
  --cream:          #FFF8F2;   /* warm off-white sections */

  /* Legacy aliases for component refs */
  --toyo-orange:    #940000;
  --orange-dark:    #6B0000;
  --orange-tint:    #FFF0F0;
  --linen:          #FFF8F2;
  --ash:            #6C6E76;

  /* Typography */
  --font-display:   'Montserrat', system-ui, sans-serif;
  --font-sans:      'Josefin Sans', system-ui, sans-serif;
  --font-serif:     'Montserrat', system-ui, sans-serif;  /* kept for legacy refs */

  /* Spacing scale */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-7:  1.75rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --max-width:   1290px;   /* matches Elementor container: 1290px */
  --section-gap: clamp(4rem, 7vw, 6rem);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Border radius */
  --radius-sm:   4px;
  --radius-base: 8px;
  --radius-md:   8px;
  --radius-lg:   16px;
  --radius-xl:   24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.08);
  --shadow-red: 0 4px 20px rgba(192,22,26,.30);
}

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

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

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--toyo-black);
  background-color: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

ul, ol { list-style: none; }

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

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.15;
  color: var(--toyo-black);
}

h1 { font-size: clamp(2.25rem, 5vw, 4rem);   font-weight: 800; }
h2 { font-size: clamp(1.75rem, 3.5vw, 2.75rem); font-weight: 700; }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.625rem); font-weight: 700; }
h4 { font-size: 1.125rem;  font-weight: 700; }

p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ash);
}

.lead {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--toyo-black);
}

strong { font-weight: 700; }

/* --- Layout utilities --- */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2rem);
}

.section {
  padding-block: var(--section-gap);
}

.section--linen    { background-color: var(--linen); }
.section--dark     { background-color: var(--toyo-black);    color: var(--white); }
.section--charcoal { background-color: var(--toyo-charcoal); color: var(--white); }
.section--red      { background-color: var(--toyo-red);      color: var(--white); }
.section--orange   { background-color: var(--toyo-red);      color: var(--white); }

/* Grid helpers */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-6);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Text utilities */
.text-center  { text-align: center; }
.text-red     { color: var(--toyo-red); }
.text-orange  { color: var(--toyo-red); }
.text-white   { color: var(--white); }
.text-ash     { color: var(--ash); }

/* --- Animations --- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fade-up {
  animation: fade-up 320ms ease-out both;
}

.animate-fade-in {
  animation: fade-in 260ms ease-out both;
}

.delay-1 { animation-delay: 80ms; }
.delay-2 { animation-delay: 160ms; }
.delay-3 { animation-delay: 240ms; }
.delay-4 { animation-delay: 320ms; }

@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;
  }
}

/* --- Scroll reveal --- */
/* No-JS fallback: elements are visible by default; JS adds the hidden state */
[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

[data-animate].is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* If JS hasn't run (e.g. blocked), ensure content is still readable */
@media (prefers-reduced-motion: reduce) {
  [data-animate] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* No-JS fallback: JS adds .js-ready to <html>; without it, show all animated elements */
html:not(.js-ready) [data-animate] {
  opacity: 1;
  transform: none;
}

/* --- Accessibility --- */
.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;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--toyo-red);
  color: var(--white);
  font-weight: 700;
  border-radius: var(--radius-sm);
  transition: top var(--transition-fast);
}

.skip-link:focus { top: 1rem; }

.divider {
  height: 1px;
  background-color: var(--border);
  border: none;
  margin-block: var(--space-8);
}
