/**
 * Ender IT Solutions - Base CSS
 * Modern CSS Reset, layout foundations, tactile typography & paper styling.
 */

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

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

body {
  background-color: var(--bg-paper);
  color: var(--color-ink);
  font-family: var(--font-sans-body);
  font-size: var(--text-body);
  line-height: 1.6;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Very subtle paper texture overlay */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  background-image: url('../assets/grain.svg');
  opacity: 0.22;
  z-index: 999;
}

/* Vintage ink text selection */
::selection {
  background-color: var(--accent-brick);
  color: var(--bg-paper-light);
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif-display);
  font-weight: 700;
  line-height: 1.15;
  color: var(--color-ink);
  letter-spacing: -0.015em;
}

h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-h1); }
h3 { font-size: var(--text-h2); }
h4 { font-size: var(--text-h3); }

p {
  margin-bottom: 1.2em;
  color: var(--color-ink-muted);
}

p:last-child {
  margin-bottom: 0;
}

strong, b {
  font-weight: 600;
  color: var(--color-ink);
}

/* Links */
a {
  color: var(--color-ink);
  text-decoration: none;
  transition: color var(--trans-fast);
}

a:hover, a:focus-visible {
  color: var(--accent-brick);
}

/* Focus styles for keyboard accessibility */
:focus-visible {
  outline: 2px solid var(--accent-brick);
  outline-offset: 3px;
}

/* Layout Containers & Primitives */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-gutter);
  padding-right: var(--container-gutter);
}

.site-main {
  position: relative;
  z-index: 1;
}

/* Section Shell */
.section {
  padding-top: var(--space-2xl);
  padding-bottom: var(--space-2xl);
  position: relative;
}

.section-divider {
  border: 0;
  border-top: var(--border-ink-faint);
  margin: 0;
}

/* Hand-crafted Section Header */
.section-header {
  margin-bottom: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.section-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-family: var(--font-mono-meta);
  font-size: var(--text-meta);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-brick);
}

.section-number {
  font-weight: 700;
  padding: 2px 6px;
  border: 1px solid var(--accent-brick);
  background-color: var(--accent-brick-soft);
  color: var(--accent-brick);
  line-height: 1;
}

.section-label {
  letter-spacing: 0.12em;
  font-weight: 600;
}

.section-rule {
  flex: 1;
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--color-ink) 0,
    var(--color-ink) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.35;
}

.section-title {
  font-size: var(--text-h1);
  letter-spacing: -0.02em;
  max-width: 24ch;
}

.section-desc {
  font-size: var(--text-subhead);
  max-width: 48ch;
  line-height: 1.5;
  color: var(--color-ink-muted);
}

/* Screen reader 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: 0;
}

/* Scroll Reveal States */
.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 450ms var(--ease-retro), transform 450ms var(--ease-retro);
  will-change: opacity, transform;
}

.reveal-item.is-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Media Elements */
img, svg {
  max-width: 100%;
  display: block;
}

/* Reduced Motion Override */
@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;
  }
}
