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

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

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--red); color: var(--cream); }

/* Dotted paper texture (matches design) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.5;
}

main { position: relative; z-index: 1; }
header { position: relative; z-index: 100; }

/* Accessibility */
.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 9999;
  background: var(--ink);
  color: var(--cream);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 16px; }

:focus-visible {
  outline: 3px solid var(--sky);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Typography */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }

img, svg { display: block; max-width: 100%; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Section wrapper */
.section-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-md);
}

/* Shared section heading pattern (matches design) */
.sec-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sec-tag::before {
  content: '';
  width: 30px;
  height: 2px;
  background: var(--red);
}
.sec-head {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 50px;
}
.sec-head em { color: var(--red); font-style: normal; }

/* Reveal animation base */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* Loader */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s var(--ease-out), visibility 0.5s;
}
#loader.hidden { opacity: 0; visibility: hidden; }
#loader-box {
  font-size: 72px;
  animation: spin3d 1.4s var(--ease-bounce) infinite alternate;
}
#loader-bar-wrap {
  width: 200px;
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 99px;
  overflow: hidden;
}
#loader-bar {
  height: 100%;
  width: 0%;
  background: var(--red);
  border-radius: 99px;
  transition: width 0.3s var(--ease-out);
}
#loader-msg {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
}

@keyframes spin3d {
  from { transform: rotate3d(1, 1, 0, -20deg); }
  to   { transform: rotate3d(1, 1, 0,  20deg); }
}
