/**
 * KALPA Base Styles & Typography Hierarchy
 * Balanced ~10-15% reduction in oversized display typography and vertical spacing
 */

/* Box Sizing Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  position: relative;
  transition: background-color var(--transition-theme), color var(--transition-theme);
}

/* Metallic Texture & Ambient Light Layer */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.65;
  background: 
    radial-gradient(ellipse 70% 50% at 50% -10%, var(--warm-glow) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 85% 30%, var(--warm-glow) 0%, transparent 60%);
  transition: opacity var(--transition-theme);
}

[data-theme="light"] body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
  /* Micro-brushed titanium horizontal texture simulation */
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.25) 0px,
    rgba(255, 255, 255, 0.25) 1px,
    transparent 1px,
    transparent 3px
  );
}

/* Subtle Global Theme Transitions when toggling */
body.is-theme-transitioning,
body.is-theme-transitioning * {
  transition: background-color var(--transition-theme), 
              color var(--transition-theme), 
              border-color var(--transition-theme), 
              box-shadow var(--transition-theme) !important;
}

/* Accessible Focus States */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

/* Editorial Selection */
::selection {
  background-color: var(--text-primary);
  color: var(--text-inverse);
}

/* Media Resets */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Restrained Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-xs);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography Hierarchy (Space Grotesk: Headings/Display | Manrope: Body/UI Text) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.headline-hero {
  font-size: clamp(2.35rem, 5.8vw, 5.25rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  font-weight: 700;
}

.headline-statement {
  font-size: clamp(1.75rem, 4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  font-weight: 700;
}

.headline-section {
  font-size: clamp(1.5rem, 3.2vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  font-weight: 700;
}

.headline-card {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.22;
  letter-spacing: -0.018em;
  font-weight: 600;
}

p {
  font-family: var(--font-body);
  color: var(--text-secondary);
  font-size: clamp(0.9375rem, 1.05vw, 1.0625rem);
  line-height: 1.66;
}

.lead-text {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.2vw, 1.1875rem);
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Technical Label & Small Caps */
.meta-label {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.meta-label.has-slash::before {
  content: '//';
  color: var(--text-muted);
  opacity: 0.6;
}

/* Links & Buttons Reset */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}

/* Core Layout Utilities */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section-spacing {
  padding-block: clamp(3.75rem, 7.5vw, 6.75rem);
  position: relative;
}

.section-spacing-sm {
  padding-block: clamp(2.5rem, 5vw, 4.25rem);
  position: relative;
}

/* Structural Divider */
.structural-divider {
  width: 100%;
  height: 1px;
  background-color: var(--border-default);
  border: none;
}

/* Screen Reader Only Utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
