/* ============================================================
   AP-AI · main.css
   Editorial, index-driven design language.
   ============================================================ */

:root {
  --bone: #F4F2ED;
  --ink: #141412;
  --accent: #2B3AEE;
  --muted: rgba(20, 20, 18, 0.58);
  --muted-light: rgba(244, 242, 237, 0.6);
  --hairline: rgba(20, 20, 18, 0.14);
  --hairline-light: rgba(244, 242, 237, 0.18);
  --font-display: "Clash Display", "Satoshi", sans-serif;
  --font-body: "Satoshi", "Helvetica Neue", sans-serif;
  --font-serif: "EB Garamond", Georgia, serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;
  --pad-x: clamp(1.25rem, 4vw, 4rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  background: var(--bone);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bone); }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font: inherit; }

.mono {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.accent { color: var(--accent); font-style: normal; }

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

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

/* Hidden scrollbar; scrolling still works everywhere */
html { scrollbar-width: none; -ms-overflow-style: none; }
::-webkit-scrollbar { display: none; }

/* ---------- Film grain ---------- */
.grain {
  position: fixed;
  inset: -100%;
  z-index: 2000;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(4) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, 3%); }
  50% { transform: translate(3%, -2%); }
  75% { transform: translate(-3%, -3%); }
  100% { transform: translate(2%, 2%); }
}

/* ---------- Custom cursor ---------- */
/* Hide the native cursor wherever the custom one runs */
@media (hover: hover) and (pointer: fine) {
  * { cursor: none !important; }
}
.cursor {
  position: fixed;
  top: 0; left: 0;
  z-index: 3000;
  pointer-events: none;
  will-change: transform;
  mix-blend-mode: difference; /* dot inverts against any section color */
}
.cursor-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  transition: transform 0.35s var(--ease-out), opacity 0.3s;
}
.cursor-label {
  position: fixed;
  top: 0; left: 0;
  z-index: 3001;
  pointer-events: none;
  will-change: transform;
}
.cursor-bubble {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.45s var(--ease-out);
}
.cursor.is-active .cursor-dot { transform: translate(-50%, -50%) scale(2.6); }
.cursor.is-visit .cursor-dot { opacity: 0; }
.cursor-label.is-visit .cursor-bubble { transform: translate(-50%, -50%) scale(1); }

@media (hover: none), (pointer: coarse) {
  .cursor, .cursor-label { display: none; }
}

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: var(--ink);
  color: var(--bone);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.preloader-mark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.5rem);
  letter-spacing: -0.02em;
}
.preloader-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted-light);
}
.preloader-count span::after { content: " / 100"; opacity: 0.4; }
.preloader-curtain { display: none; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.4rem var(--pad-x);
  transition: padding 0.5s var(--ease-out), background-color 0.5s, backdrop-filter 0.5s, border-color 0.5s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  padding: 0.8rem var(--pad-x);
  background: rgba(244, 242, 237, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom-color: var(--hairline);
}
.nav-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.nav-links {
  display: flex;
  gap: 2rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  position: relative;
  padding: 0.2rem 0;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease-out);
}
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  transition: color 0.3s, border-color 0.3s;
}
.nav-status:hover { color: var(--ink); border-color: var(--ink); }

.pulse {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex: none;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(43, 58, 238, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(43, 58, 238, 0); }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 var(--pad-x) clamp(2rem, 5vh, 4rem);
}
.hero-eyebrow {
  color: var(--muted);
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(3rem, 11.5vw, 10.5rem);
  line-height: 0.96;
  letter-spacing: -0.035em;
  text-transform: none;
  max-width: 100%;
  overflow-wrap: break-word;
}
.hero-title .line,
.contact-title .line {
  display: block;
  overflow: hidden; /* animation mask only; JS sets overflow:visible after reveal */
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.hero-title .line-inner,
.contact-title .line-inner {
  display: inline-block;
  will-change: transform;
}
.hero-title .serif { font-size: 1.04em; }
.hero-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  margin-top: clamp(2rem, 5vh, 3.5rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline);
}
.hero-sub {
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  color: var(--muted);
  max-width: 46ch;
}
.hero-meta { color: var(--muted); flex: none; }

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  overflow: hidden;
  padding: 1.1rem 0;
  background: var(--bone);
}
/* Marquee motion is driven by JS (main.js): a pixel-exact tween of one
   span width per cycle. No CSS keyframes; percentage loops visibly jump
   whenever the track is re-measured. */
.marquee-track {
  display: flex;
  width: max-content;
  will-change: transform;
}
.marquee-track span {
  flex: none;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1rem, 2vw, 1.4rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.marquee-track i { color: var(--accent); font-style: normal; }

/* ---------- Shared section chrome ---------- */
.section-label {
  color: var(--muted);
  padding-top: clamp(4rem, 10vh, 7rem);
  margin-bottom: clamp(2rem, 5vh, 3.5rem);
}
.section-label.light { color: var(--muted-light); }

/* ---------- Manifesto ---------- */
.manifesto {
  padding: 0 var(--pad-x) clamp(4rem, 10vh, 7rem);
}
.manifesto-text {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3.6vw, 3.1rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  max-width: 26ch;
}
.manifesto-text .w { opacity: 0.14; }
.manifesto-meta {
  display: flex;
  gap: 2.5rem;
  flex-wrap: wrap;
  margin-top: clamp(2rem, 5vh, 3rem);
  color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--bone);
  color: var(--ink);
  border-radius: 999px;
  padding: 1rem 1.6rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background-color 0.35s, color 0.35s;
  will-change: transform;
}
.btn .btn-arrow { transition: transform 0.4s var(--ease-out); }
.btn:hover { background: var(--accent); color: var(--bone); }
.btn:hover .btn-arrow { transform: translate(3px, -3px); }
.btn-light { background: var(--bone); color: var(--ink); }

/* ---------- Studio list ---------- */
.studio { padding: 0 var(--pad-x) clamp(4rem, 10vh, 7rem); }
.studio-list { border-bottom: 1px solid var(--hairline); }
.studio-item {
  display: grid;
  grid-template-columns: 3rem 1fr auto;
  align-items: baseline;
  gap: 2rem;
  padding: clamp(1.4rem, 3.5vh, 2.2rem) 0;
  border-top: 1px solid var(--hairline);
}
.studio-idx { color: var(--accent); }
.studio-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 3rem);
  letter-spacing: -0.025em;
  line-height: 1.05;
  transition: transform 0.55s var(--ease-out);
}
.studio-item:hover .studio-name { transform: translateX(1rem); }
.studio-note {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: right;
}

/* ---------- Contact / footer (dark) ---------- */
.contact {
  background: var(--ink);
  color: var(--bone);
  padding: 0 var(--pad-x) 2rem;
  min-height: 90svh;
  display: flex;
  flex-direction: column;
}
.contact-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 8.5vw, 7.5rem);
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin-bottom: clamp(2.5rem, 6vh, 4rem);
}
.contact-title .serif { font-size: 1.04em; }
.contact-inline {
  position: relative;
  white-space: nowrap;
}
.contact-inline::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0.04em;
  width: 100%; height: 2px;
  background: var(--bone);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}
.contact-inline:hover::after { transform: scaleX(1); transform-origin: left; }
.contact-cta { margin-top: auto; }
.contact-meta {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: clamp(3rem, 8vh, 6rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--hairline-light);
  color: var(--muted-light);
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .nav-status { display: none; }
  .nav-links { position: static; transform: none; gap: 1.2rem; }
  .hero { min-height: 92svh; }
  .hero-foot { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .br-desktop { display: none; }

  .studio-item { grid-template-columns: 2rem 1fr; }
  .studio-note { display: none; }
}

@media (max-width: 560px) {
  .hero-title { font-size: clamp(2.4rem, 10.5vw, 4rem); }
  .nav-links { gap: 0.9rem; }
  .nav-links a { font-size: 0.66rem; }
  .manifesto-meta { gap: 1.2rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .grain, .pulse { animation: none; }
  .manifesto-text .w { opacity: 1; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
