/* =========================
   HEADING SYSTEM
========================= */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-family);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--color-text);
}

/* HERO / PRIMARY TITLE */
h1 {
  font-size: var(--fs-xxl);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.035em;
  margin-bottom: var(--space-3);
}

/* SECTION TITLE */
h2 {
  font-size: var(--fs-xl);
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-2);
}

/* SUBSECTION */
h3 {
  font-size: var(--fs-lg);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-2);
}

/* CARD / COMPONENT TITLE */
h4 {
  font-size: var(--fs-base);
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-1);
}

/* SMALL HEADING */
h5 {
  font-size: var(--fs-sm);
  line-height: 1.4;
  font-weight: 500;
  letter-spacing: 0;
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

/* MICRO LABEL */
h6 {
  font-size: var(--fs-xs);
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--space-1);
  color: var(--color-text-muted);
}

/* h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: var(--space-1);
  background: var(--color-blue);
  border-radius: var(--radius-pill);
} */

@media (min-width: 768px) {
  h1 {
    line-height: 1.1;
    letter-spacing: -0.03em;
  }

  h2 {
    line-height: 1.2;
  }

  h3 {
    line-height: 1.25;
  }
}

@media (min-width: 1024px) {
  h1 {
    font-size: clamp(2.8rem, 2rem + 2vw, 3.8rem);
    margin-bottom: var(--space-4);
  }

  h2 {
    font-size: clamp(2rem, 1.6rem + 1.2vw, 2.6rem);
    margin-bottom: var(--space-3);
  }

  h3 {
    font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.8rem);
  }
}

@media (min-width: 1920px) {
  h1 {
    max-width: 18ch;
  }

  h2 {
    /* max-width: 22ch; */
  }
}

/* =========================
   PARAGRAPH SYSTEM
========================= */

p {
  font-family: var(--font-family);
  font-size: var(--fs-base);
  line-height: 1.7;
  font-weight: 400;
  color: var(--color-text);

  margin: 0 0 var(--space-2) 0;

  /* Justification */
  text-align: justify;
  text-justify: inter-word;

  /* Better word flow */
  hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;

  /* Improve rendering */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p.muted {
  color: var(--color-text-muted);
}

/* Tablet */
@media (min-width: 768px) {
  p {
    line-height: 1.7;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  p {
    font-size: var(--fs-base);
    line-height: 1.65;
  }
}

p.muted {
  color: var(--color-text-muted);
}

p.lead {
  font-size: var(--fs-lg);
  line-height: 1.6;
  font-weight: 500;
  max-width: 60ch;
}

p.small {
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* =========================
   SECTION SYSTEM
========================= */

section {
  position: relative;
  width: 100%;

  padding-block: var(--space-5);
}

/* Mobile */
@media (max-width: 600px) {
  section {
    padding-block: var(--space-4);
  }
}

/* Tablet */
@media (min-width: 768px) {
  section {
    padding-block: var(--space-5);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  section {
    padding-block: var(--space-6);
  }
}

/* Light section */
.section-light {
  background: var(--color-surface);
}

/* Dark section */
.section-dark {
  background: #111827;
  color: #f9fafb;
}

/* Gradient section */
.section-gradient {
  background: linear-gradient(135deg, var(--color-blue), var(--color-green));
  color: #fff;
}

/* No padding (utility) */
.section-tight {
  padding-block: var(--space-3);
}

/* Centered content */
.section-center {
  text-align: center;
}

/* Flex center */
.section-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Generic block wrapper */
.div {
  display: block;
}

.flex {
  display: flex;
}

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

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

.flex-column {
  display: flex;
  flex-direction: column;
}

/* =========================
   CONTAINER SYSTEM
========================= */

.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-2);
}

/* Small devices */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }
}

/* Tablet */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-inline: var(--space-3);
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    max-width: 960px;
  }
}

/* Large Desktop */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Ultra Wide */
@media (min-width: 1440px) {
  .container {
    max-width: 1280px;
  }
}

@media (min-width: 1550px) {
  .container {
    max-width: 1500px;
  }
}

/* Full-width but controlled padding */
.container-fluid {
  width: 100%;
  padding-inline: clamp(16px, 4vw, 48px);
}

/* =========================
   BUTTON BASE
========================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-family: var(--font-family);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1;

  padding: 12px 22px;
  border-radius: var(--radius-pill);

  border: none;
  cursor: pointer;
  text-decoration: none;

  transition: var(--transition);
  box-shadow: var(--shadow-sm);

  position: relative;
  overflow: hidden;

  user-select: none;
  white-space: nowrap;
}

/* PRIMARY BUTTON */

.btn-primary {
  background: linear-gradient(270deg, var(--color-red), var(--color-yellow));
  background-size: 600% 600%;
  animation: slowGradient 10s ease infinite;

  color: #fff;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-md);
}

/* SECONDARY BUTTON */

.btn-secondary {
  background: linear-gradient(90deg, var(--color-blue), var(--color-green));
  color: #fff;
}

.btn-secondary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: var(--shadow-md);
}

/* ACTIVE (click feedback) */
.btn:active {
  transform: scale(0.97);
  box-shadow: var(--shadow-sm);
}

/* FOCUS (accessibility) */
.btn:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 3px;
}

/* DISABLED */
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  padding: 8px 16px;
  font-size: var(--fs-xs);
}

.btn-lg {
  padding: 14px 28px;
  font-size: var(--fs-base);
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border: 1px solid #e5e7eb;
}

.btn-outline:hover {
  background: #f3f4f6;
}

@keyframes slowGradient {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Mobile */
@media (max-width: 600px) {
  .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .btn {
    padding: 12px 24px;
  }
}

/* =========================
   IMAGE SYSTEM
========================= */

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

  border-radius: var(--radius-md);

  /* Prevent layout shift */
  object-fit: cover;

  /* Smooth rendering */
  image-rendering: auto;
}

/* Rounded */
.img-rounded {
  border-radius: var(--radius-lg);
}

/* Circle (avatars) */
.img-circle {
  border-radius: 50%;
}

/* Shadow */
.img-elevated {
  box-shadow: var(--shadow-md);
}

/* Hover zoom (cards) */
.img-hover {
  transition: transform 0.4s ease;
}

.img-hover:hover {
  transform: scale(1.05);
}

/* Aspect ratio control */
.img-wrapper {
  overflow: hidden;
  border-radius: var(--radius-lg);
}

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

/* =========================
   LINK SYSTEM
========================= */

a {
  color: var(--color-blue);
  text-decoration: none;
  font-weight: 500;

  transition: var(--transition);
  cursor: pointer;
}

/* Hover */
a:hover {
  color: var(--color-green);
}

/* Active */
a:active {
  opacity: 0.8;
}

/* Focus (accessibility) */
a:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Muted link */
.link-muted {
  color: var(--color-text-muted);
}

.link-muted:hover {
  color: var(--color-text);
}

/* Underline animation */
.link-animated {
  position: relative;
}

.link-animated::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;

  width: 0;
  height: 2px;
  background: currentColor;

  transition: width 0.3s ease;
}

.link-animated:hover::after {
  width: 100%;
}

p a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

p a:hover {
  text-decoration-thickness: 2px;
}

/* Card container */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-3);

  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

input,
textarea,
select {
  padding: 12px 14px;
  border-radius: var(--radius-md);

  border: 1px solid #e5e7eb;
  background: #fff;

  transition: var(--transition);
}

input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.15);
}

/* Tag */
.section-tag {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 14px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(66, 133, 244, 0.1);
  color: var(--color-blue);
  box-shadow: 0 2px 10px rgba(66, 133, 244, 0.1);
}

/* Heading */
.section-title {
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  font-weight: 800;
  color: var(--nex-dark);
  line-height: 1.1;
  margin-bottom: 24px;
  letter-spacing: -0.03em;
  background: linear-gradient(
    90deg,
    var(--color-text) 0%,
    var(--color-blue) 45%,
    var(--color-green) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-title span {
  background: linear-gradient(90deg, var(--color-yellow), var(--color-red));
  background-size: 300%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cycleColors 6s linear infinite;
}
