/* Responsive Typography with clamp() function */
:root {
  /* Base values for calculations */
  --fluid-min-width: 320;
  --fluid-max-width: 1200;
  --fluid-screen: 100vw;
  --fluid-bp: calc((var(--fluid-screen) - var(--fluid-min-width) / 16 * 1rem) / (var(--fluid-max-width) - var(--fluid-min-width)));

  /* Spacing Scale */
  --space-4xs: clamp(0.33rem, calc(-0.04vw + 0.34rem), 0.31rem);
  --space-3xs: clamp(0.41rem, calc(0.05vw + 0.4rem), 0.44rem);
  --space-2xs: clamp(0.51rem, calc(0.21vw + 0.47rem), 0.62rem);
  --space-xs: clamp(0.64rem, calc(0.46vw + 0.55rem), 0.88rem);
  --space-s: clamp(0.8rem, calc(0.85vw + 0.63rem), 1.24rem);
  --space-m: clamp(1rem, calc(1.46vw + 0.71rem), 1.75rem);
  --space-l: clamp(1.25rem, calc(2.39vw + 0.77rem), 2.47rem);
  --space-xl: clamp(1.56rem, calc(3.78vw + 0.81rem), 3.5rem);
  --space-2xl: clamp(1.95rem, calc(5.84vw + 0.78rem), 4.95rem);
  --space-3xl: clamp(2.44rem, calc(8.89vw + 0.66rem), 7rem);
  --space-4xl: clamp(3.05rem, calc(13.35vw + 0.38rem), 9.89rem);

  /* Typography Scale */
  --text-xs: clamp(0.79rem, calc(-0.14vw + 0.82rem), 0.72rem);
  --text-s: clamp(0.89rem, calc(0.02vw + 0.88rem), 0.9rem);
  --text-m: clamp(1rem, calc(0.24vw + 0.95rem), 1.13rem);
  --text-l: clamp(1.13rem, calc(0.55vw + 1.01rem), 1.41rem);
  --text-xl: clamp(1.27rem, calc(0.96vw + 1.07rem), 1.76rem);
  --text-2xl: clamp(1.42rem, calc(1.51vw + 1.12rem), 2.2rem);
  --text-3xl: clamp(1.6rem, calc(2.23vw + 1.16rem), 2.75rem);
  --text-4xl: clamp(1.8rem, calc(3.18vw + 1.17rem), 3.43rem);
}

/* Base Typography */
html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  /* Base font size: min 16px, preferred 16px + fluid scaling, max 18px */
  font-size: var(--text-m);
  line-height: 1.5;
  color: #f8f9fa;
}

/* Heading Typography */
h1, .h1 {
  /* min 28px, preferred fluid, max 52px */
  font-size: var(--text-4xl);
  line-height: 1.1;
  margin-bottom: 1rem;
  font-weight: 700;
}

h2, .h2 {
  /* min 28px, preferred fluid, max 48px */
  font-size: var(--text-3xl);
  line-height: 1.2;
  margin-bottom: 0.85rem;
  font-weight: 700;
}

h3, .h3 {
  /* min 24px, preferred fluid, max 36px */
  font-size: var(--text-2xl);
  line-height: 1.2;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

h4, .h4 {
  /* min 20px, preferred fluid, max 30px */
  font-size: var(--text-xl);
  line-height: 1.3;
  margin-bottom: 0.65rem;
  font-weight: 600;
}

h5, .h5 {
  /* min 18px, preferred fluid, max 24px */
  font-size: var(--text-l);
  line-height: 1.4;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

h6, .h6 {
  /* min 16px, preferred fluid, max 20px */
  font-size: var(--text-m);
  line-height: 1.6;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

/* Hero and large titles */
.hero-title {
  /* min 36px, preferred fluid, max 70px */
  font-size: var(--text-4xl);
  line-height: 1.1;
  font-weight: 800;
}

.hero-subtitle {
  /* min 20px, preferred fluid, max 32px */
  font-size: var(--text-m);
  line-height: 1.4;
  font-weight: 400;
}

/* Paragraph and content text */
p, .body-text {
  font-size: var(--text-m);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.lead {
  font-size: var(--text-l);
  line-height: 1.5;
  font-weight: 300;
}

.small-text {
  font-size: var(--text-s);
  line-height: 1.7;
}

.extra-small-text {
  font-size: var(--text-xs);
  line-height: 1.7;
}

/* Button text */
.btn {
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.5;
}

.btn-lg {
  font-size: var(--text-l);
}

.btn-sm {
  font-size: var(--text-s);
}

/* Utilities */
.text-xxl {
  font-size: var(--text-4xl) !important;
  line-height: 1.1 !important;
}

.text-xl {
  /* min 36px, preferred fluid, max 64px */
  font-size: var(--text-xl) !important;
  line-height: 1.2 !important;
}

.text-lg {
  font-size: var(--text-l) !important;
  line-height: 1.3 !important;
}

/* Card elements */
.card-title {
  font-size: var(--text-m);
  font-weight: 600;
  line-height: 1.4;
}

.card-subtitle {
  font-size: var(--text-m);
  font-weight: 400;
  line-height: 1.5;
}

/* Testimonials */
.testimonial-box p {
  font-style: italic;
  font-size: var(--text-m);
  line-height: 1.7;
}

/* Form elements */
.form-control, .form-select {
  font-size: var(--text-m);
  line-height: 1.5;
}

/* Navbar */
.navbar-brand {
  font-size: var(--text-m);
  font-weight: 700;
}

.nav-link {
  font-size: var(--text-m);
  font-weight: 500;
  line-height: 1.6;
}

/* Footer */
.footer-heading {
  font-size: var(--text-m);
  font-weight: 600;
  line-height: 1.4;
}

/* Additional dark theme styles */
body.bg-dark, .bg-dark {
  background-color: #0c0a09 !important;
}

.text-light {
  color: #f8f9fa !important;
}

/* Responsive spacing utilities */
.responsive-mt {
  margin-top: var(--space-l);
}

.responsive-mb {
  margin-bottom: var(--space-l);
}

.responsive-py {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
}

/* Example usage */
body {
  font-size: var(--text-m);
  line-height: 1.5;
}

h1 {
  font-size: var(--text-4xl);
  line-height: 1.1;
}

h2 {
  font-size: var(--text-3xl);
  line-height: 1.2;
}

h3 {
  font-size: var(--text-2xl);
  line-height: 1.2;
}

h4 {
  font-size: var(--text-xl);
  line-height: 1.3;
}

h5 {
  font-size: var(--text-l);
  line-height: 1.4;
}

small {
  font-size: var(--text-s);
}

.text-xs { font-size: var(--text-xs); }
.text-s { font-size: var(--text-s); }
.text-m { font-size: var(--text-m); }
.text-l { font-size: var(--text-l); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }
