/* css/base.css — reset, typography, utilities, layer-geometry contract */

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

html {
  scroll-behavior: auto;
  font-size: 16px;
  background-color: var(--bg);
}

body {
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

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

/* scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .18);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .28);
}

/* link & image defaults */
a {
  color: inherit;
  text-decoration: none;
}

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

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

ul, ol {
  list-style: none;
}

/* Accessibility skip link */
.skip {
  position: fixed;
  top: -100px;
  left: 20px;
  background: var(--red);
  color: #fff;
  padding: 10px 18px;
  font: 700 13px var(--f-ui);
  z-index: 10000;
  border-radius: 4px;
  transition: top .2s ease;
}
.skip:focus {
  top: 20px;
}

.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;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* utility classes */
.accent { color: var(--accent); }
.red { color: var(--red); }
.dim { opacity: .7; }
.line { display: block; }

/* typography classes */
.h-display {
  font-family: var(--f-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: -0.01em;
  font-size: clamp(44px, 6vw, 96px);
  color: #fff;
}
.h-display--sm {
  font-family: var(--f-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: -0.01em;
  font-size: clamp(32px, 3.4vw, 52px);
  color: #fff;
}
.h-display--xl {
  font-family: var(--f-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: -0.01em;
  font-size: clamp(56px, 7.5vw, 120px);
  color: #fff;
}

.h-bold {
  font-family: var(--f-body);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 1;
  font-size: clamp(40px, 5.2vw, 84px);
  color: #fff;
}
.h-bold--sm {
  font-family: var(--f-body);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-size: 20px;
  color: #fff;
}
.h-bold--one {
  font-family: var(--f-body);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 1;
  color: #fff;
}
@media (min-width: 1101px) {
  .h-bold--one {
    white-space: nowrap;
  }
}

.eyebrow {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
}
.eyebrow--red {
  font-family: var(--f-ui);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
}
.label-red {
  font-family: var(--f-ui);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--red);
}

/* Shared Buttons & Links */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  font: 700 13px var(--f-ui);
  color: #fff;
  border-radius: 2px;
  box-sizing: border-box;
  text-decoration: none;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.btn--primary {
  background: var(--btn);
  width: 190px;
  min-width: 190px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(255, 59, 48, 0.25);
  transition: background .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.btn--primary::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 50%;
  height: 200%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: rotate(25deg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.btn--primary:hover {
  background: #f7584e;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(255, 59, 48, 0.45);
}
.btn--primary:hover::after {
  opacity: 1;
  animation: btnShimmer 1.2s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.btn--primary:hover .btn__arrow {
  transform: translateY(5px);
  animation: arrowBounce 0.9s ease-in-out infinite alternate;
}
@keyframes btnShimmer {
  0% { transform: translateX(0) rotate(25deg); }
  100% { transform: translateX(500%) rotate(25deg); }
}
@keyframes arrowBounce {
  from { transform: translateY(2px); }
  to { transform: translateY(6px); }
}
.btn__label {
  display: inline-block;
}
.btn__arrow {
  display: inline-block;
  transition: transform .2s var(--ease);
}

.link-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 11px var(--f-ui);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text);
  transition: color .2s ease;
}
.link-all:hover {
  color: #fff;
}
.link-all:hover span:last-child {
  transform: translateX(4px);
}
.link-all span:last-child {
  display: inline-block;
  transition: transform .2s ease;
}

.link-red {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 700 11px var(--f-ui);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--red);
  transition: opacity .2s ease;
}
.link-red:hover {
  opacity: .85;
}
.link-red:hover span:last-child {
  transform: translateX(4px);
}
.link-red span:last-child {
  display: inline-block;
  transition: transform .2s ease;
}

/* Background Atmosphere */
.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .35));
  pointer-events: none;
  z-index: var(--z-grain, 40);
}

#grain {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  opacity: .06;
  pointer-events: none;
  z-index: var(--z-grain, 40);
}

/* Scroll Playhead */
#playhead {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: var(--z-playhead, 45);
  pointer-events: none;
}
#playheadFill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--red);
  transition: height .1s linear;
}
#playheadReadout {
  position: fixed;
  left: 18px;
  bottom: 24px;
  font: 700 10px/1 var(--f-ui);
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: rgba(16, 18, 22, .95);
  border: 1px solid rgba(255, 255, 255, .1);
  color: #fff;
  font: 500 12px/1 var(--f-ui);
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s var(--ease), opacity .3s ease;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0,0,0,.6);
  white-space: nowrap;
}
.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Site Cursor */
.cur-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  margin: -3px 0 0 -4px;
  pointer-events: none;
  z-index: var(--z-cursor, 95);
  display: none;
  filter: drop-shadow(0 0 1.5px var(--red, #ff3b30))
          drop-shadow(0 0 4.5px var(--red, #ff3b30));
  will-change: transform;
  transition: transform .06s ease-out, filter .2s ease;
}
.cur-arrow {
  width: 28px;
  height: 28px;
  overflow: visible;
  display: block;
}
.cur-glass {
  fill: rgba(15, 5, 8, 0.75);
}
.cur-tint {
  fill: var(--red, #ff3b30);
  fill-opacity: 0.32;
}
.cur-sheen {
  fill: rgba(255, 255, 255, 0.28);
}
.cur-bounce {
  fill: var(--red, #ff3b30);
  fill-opacity: 0.18;
}
.cur-tube {
  fill: none;
  stroke: var(--red, #ff3b30);
  stroke-width: 2.3;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.cur-core {
  fill: none;
  stroke: #ffffff;
  stroke-width: 0.85;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.cur-ring {
  display: none !important;
}
.cur-ring span {
  font: 700 9px/1 var(--f-mono);
  letter-spacing: .14em;
  color: #fff;
  text-shadow: 0 0 10px rgba(255, 59, 48, .8);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .15s ease;
}
html.has-cursor .cur-dot,
html.has-cursor .cur-ring {
  display: flex;
}
html.has-cursor,
html.has-cursor a,
html.has-cursor button {
  cursor: none !important;
}
html.has-cursor input,
html.has-cursor textarea {
  cursor: text !important;
}
@media (hover: none) {
  html.has-cursor .cur-dot,
  html.has-cursor .cur-ring {
    display: none !important;
  }
  html.has-cursor,
  html.has-cursor a,
  html.has-cursor button {
    cursor: auto !important;
  }
}

/* Fullscreen Mobile Menu */
.menu {
  position: fixed;
  inset: 0;
  background: rgba(7, 7, 10, .97);
  z-index: calc(var(--z-nav) + 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.menu.is-open {
  opacity: 1;
  pointer-events: auto;
}
.menu a {
  font: 400 clamp(48px, 12vw, 96px)/1 var(--f-display);
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  transition: color .2s ease, transform .2s var(--ease);
}
.menu a:hover {
  color: var(--red);
  transform: translateX(8px);
}

/* Section Container & Section Chrome */
section:not(.hero):not(.logos) {
  padding: clamp(96px, 12vw, 160px) var(--pad);
  border-top: 1px solid var(--line);
  max-width: none;
  padding-inline: max(var(--pad), calc((100vw - var(--maxw)) / 2 + var(--pad)));
}

.sec__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 36px;
  gap: 24px;
}

/* =======================================================================
   PART 4.2: THE LAYER-GEOMETRY CONTRACT (CRITICAL FOR SWARM ENGINE)
   ======================================================================= */
/* 1. Text/chip layers hug their text and are never display:inline (an inline box has no stable height to select) */
[data-layer="text"], [data-layer="chip"] {
  display: block;
  width: fit-content;
  max-width: 100%;
}
a > [data-layer="text"],
span[data-layer="text"],
b[data-layer="text"],
small[data-layer="text"] {
  display: block;
}

/* Inside flex rows where text must stay inline-level, use inline-block instead of block */
.nav__links a > span,
.nav__right [data-layer="text"],
.link-all [data-layer],
.link-red [data-layer],
.btn__label {
  display: inline-block;
}

/* 2. Layers are never display:none while the intro is running; collapsed content is simply not tagged */

/* 3. While building: nothing may move on its own */
html.is-building .hero__giant,
html.is-building .hero__photo,
html.is-building [data-parallax] {
  transform: none !important;
}
html.is-building .logos__row {
  animation: none !important;
  transform: none !important;
}
html.is-building * {
  scroll-behavior: auto !important;
}
html.is-building .card,
html.is-building .btn,
html.is-building a {
  transition: none !important;
}

/* Reduced motion override */
html[data-motion="off"] * {
  animation: none !important;
  transition: none !important;
}
html[data-motion="off"] #grain {
  display: none !important;
}
