/* === VARIABLES === */
:root {
  
  --font-base: 16px;
  
  
  
  --fs-display: clamp(2.5rem, 5vw + 1rem, 4.5rem);
  
  
  --fs-h1: clamp(2rem, 4vw + 0.5rem, 3.5rem);
  --fs-h2: clamp(1.75rem, 3vw + 0.5rem, 2.75rem);
  --fs-h3: clamp(1.5rem, 2.5vw + 0.5rem, 2rem);
  --fs-h4: clamp(1.25rem, 2vw + 0.25rem, 1.5rem);
  --fs-h5: clamp(1.125rem, 1.5vw + 0.25rem, 1.25rem);
  --fs-h6: clamp(1rem, 1vw + 0.25rem, 1.125rem);
  
  
  --fs-body-lg: clamp(1.125rem, 1vw + 0.5rem, 1.25rem);
  --fs-body: clamp(1rem, 0.5vw + 0.75rem, 1.125rem);
  --fs-body-sm: clamp(0.875rem, 0.5vw + 0.5rem, 1rem);
  
  
  --fs-label: clamp(0.8125rem, 0.25vw + 0.5rem, 0.9375rem);
  --fs-caption: clamp(0.75rem, 0.25vw + 0.5rem, 0.875rem);
  --fs-tiny: clamp(0.6875rem, 0.25vw + 0.375rem, 0.75rem);
  
  
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-normal: 1.5;
  --lh-relaxed: 1.65;
  --lh-loose: 1.8;
  
  
  --ls-tight: -0.025em;
  --ls-normal: 0;
  --ls-wide: 0.025em;
  --ls-wider: 0.05em;
  --ls-widest: 0.1em;
  
  
  --space-3xs: clamp(0.25rem, 0.5vw, 0.375rem);
  --space-2xs: clamp(0.375rem, 0.75vw, 0.5rem);
  --space-xs: clamp(0.5rem, 1vw, 0.75rem);
  --space-sm: clamp(0.75rem, 1.5vw, 1rem);
  --space-md: clamp(1rem, 2vw, 1.5rem);
  --space-lg: clamp(1.5rem, 3vw, 2rem);
  --space-xl: clamp(2rem, 4vw, 3rem);
  --space-2xl: clamp(3rem, 6vw, 4rem);
  --space-3xl: clamp(4rem, 8vw, 6rem);
  --space-4xl: clamp(6rem, 10vw, 8rem);
  
  
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-2xl: 1400px;
  --container-full: 100%;
  
  
  --container-padding: clamp(1rem, 4vw, 2rem);
  
  
  --bp-xs: 375px;
  --bp-sm: 480px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1200px;
  --bp-2xl: 1400px;
}

/* === TYPOGRAPHY CLASSES === */
.fs-display { font-size: var(--fs-display); line-height: var(--lh-tight); }
.fs-h1 { font-size: var(--fs-h1); line-height: var(--lh-tight); }
.fs-h2 { font-size: var(--fs-h2); line-height: var(--lh-tight); }
.fs-h3 { font-size: var(--fs-h3); line-height: var(--lh-snug); }
.fs-h4 { font-size: var(--fs-h4); line-height: var(--lh-snug); }
.fs-h5 { font-size: var(--fs-h5); line-height: var(--lh-normal); }
.fs-h6 { font-size: var(--fs-h6); line-height: var(--lh-normal); }

.fs-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-relaxed); }
.fs-body { font-size: var(--fs-body); line-height: var(--lh-relaxed); }
.fs-body-sm { font-size: var(--fs-body-sm); line-height: var(--lh-relaxed); }
.fs-label { font-size: var(--fs-label); line-height: var(--lh-normal); }
.fs-caption { font-size: var(--fs-caption); line-height: var(--lh-normal); }
.fs-tiny { font-size: var(--fs-tiny); line-height: var(--lh-normal); }

/* === TEXT WRAPPING === */
h1, h2, h3, h4, h5, h6,
p, li, td, th, label, span {
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: auto;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

/* === TEXT UTILITIES === */
.text-break {
  word-break: break-word;
}

.text-nowrap {
  white-space: nowrap;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === CONTAINER UTILITIES === */
.resp-container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

.resp-container-sm { max-width: var(--container-sm); }
.resp-container-md { max-width: var(--container-md); }
.resp-container-lg { max-width: var(--container-lg); }
.resp-container-xl { max-width: var(--container-xl); }
.resp-container-2xl { max-width: var(--container-2xl); }
.resp-container-full { max-width: 100%; }

/* === RESPONSIVE GRID === */
.grid {
  display: grid;
  gap: var(--space-md);
}

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

.grid-auto-sm {
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
}

.grid-auto-md {
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
}

.grid-auto-lg {
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
}

/* === UTILITY CLASSES === */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.fs-display { font-size: var(--fs-display); }
.fs-h1 { font-size: var(--fs-h1); }
.fs-h2 { font-size: var(--fs-h2); }
.fs-h3 { font-size: var(--fs-h3); }
.fs-h4 { font-size: var(--fs-h4); }
.fs-h5 { font-size: var(--fs-h5); }
.fs-h6 { font-size: var(--fs-h6); }
.fs-body-lg { font-size: var(--fs-body-lg); }
.fs-body { font-size: var(--fs-body); }
.fs-body-sm { font-size: var(--fs-body-sm); }
.fs-label { font-size: var(--fs-label); }
.fs-caption { font-size: var(--fs-caption); }
.fs-tiny { font-size: var(--fs-tiny); }

.lh-tight { line-height: var(--lh-tight); }
.lh-snug { line-height: var(--lh-snug); }
.lh-normal { line-height: var(--lh-normal); }
.lh-relaxed { line-height: var(--lh-relaxed); }
.lh-loose { line-height: var(--lh-loose); }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.my-0 { margin-block: 0; }
.mx-0 { margin-inline: 0; }

.mt-sm { margin-top: var(--space-sm); }
.mb-sm { margin-bottom: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mb-md { margin-bottom: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-xl { margin-bottom: var(--space-xl); }

.pt-sm { padding-top: var(--space-sm); }
.pb-sm { padding-bottom: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pb-md { padding-bottom: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pb-lg { padding-bottom: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }
.pb-xl { padding-bottom: var(--space-xl); }

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

.px-sm { padding-inline: var(--space-sm); }
.px-md { padding-inline: var(--space-md); }
.px-lg { padding-inline: var(--space-lg); }
.py-sm { padding-block: var(--space-sm); }
.py-md { padding-block: var(--space-md); }
.py-lg { padding-block: var(--space-lg); }

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

/* === MOBILE BREAKPOINT === */
@media (max-width: 480px) {
  :root {
    --container-padding: 1rem;
  }
  
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
  
  
  .hide-mobile { display: none !important; }
  
  
  .text-center-mobile { text-align: center; }
  .text-left-mobile { text-align: left; }
}

/* === TABLET BREAKPOINT === */
@media (min-width: 481px) and (max-width: 768px) {
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  
  .hide-tablet { display: none !important; }
}

/* === DESKTOP BREAKPOINT === */
@media (min-width: 769px) and (max-width: 1024px) {
  .grid-cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === WIDE BREAKPOINT === */
@media (min-width: 1025px) {
  .hide-desktop { display: none !important; }
}

/* === ASPECT RATIOS === */
.aspect-square { aspect-ratio: 1; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-portrait { aspect-ratio: 3 / 4; }
.aspect-wide { aspect-ratio: 21 / 9; }

/* === FLEXBOX UTILITIES === */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.flex-1 { flex: 1; }
.flex-auto { flex: auto; }
.flex-none { flex: none; }

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

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

/* === TOUCH TARGETS === */
.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* === CARD SPACING === */
.resp-card {
  padding: var(--space-md);
  border-radius: clamp(0.5rem, 1vw, 1rem);
}

.resp-card-sm { padding: var(--space-sm); }
.resp-card-lg { padding: var(--space-lg); }

.resp-section {
  padding-block: var(--space-2xl);
}

.resp-section-sm { padding-block: var(--space-xl); }
.resp-section-lg { padding-block: var(--space-3xl); }

/* === IMAGE UTILITIES === */
.img-cover {
  object-fit: cover;
  width: 100%;
  height: 100%;
}

.img-contain {
  object-fit: contain;
  width: 100%;
  height: 100%;
}

.img-responsive {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === LIST UTILITIES === */
.list-spaced li {
  margin-bottom: var(--space-xs);
  line-height: var(--lh-relaxed);
}

.list-spaced li:last-child {
  margin-bottom: 0;
}

/* === TABLE UTILITIES === */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.resp-table {
  width: 100%;
  border-collapse: collapse;
}

.resp-table th,
.resp-table td {
  padding: var(--space-sm);
  text-align: left;
  vertical-align: top;
}

/* === FORM UTILITIES === */
.resp-input {
  font-size: var(--fs-body);
  padding: var(--space-sm) var(--space-md);
  line-height: var(--lh-normal);
}

.resp-label {
  font-size: var(--fs-label);
  margin-bottom: var(--space-xs);
  display: block;
}

/* === PRINT STYLES === */
@media print {
  :root {
    --font-base: 12pt;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }
  
  h1 { font-size: 24pt; }
  h2 { font-size: 20pt; }
  h3 { font-size: 16pt; }
  h4 { font-size: 14pt; }
  h5, h6 { font-size: 12pt; }
  
  .hide-print { display: none !important; }
}

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