/* ============================================================
   THE THIRD NARRATIVE — Design System & Styles
   Dark, minimal, retro-digital with glitch + transitions
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-accent: #161616;
  --bg-card: #1a1a1a;
  --text-primary: #f0f0f0;
  --text-secondary: #777777;
  --text-muted: #555555;
  --text-accent: #c8c8c8;
  --accent-navy: #1a2744;
  --accent-purple: #4a3d8f;
  --accent-glitch-red: #ff3333;
  --accent-glitch-cyan: #00ffff;
  --white: #ffffff;
  --border-subtle: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.12);
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 0.3s;
  --duration-mid: 0.6s;
  --duration-slow: 1.2s;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }

/* --- Skip Link (a11y) --- */
.skip-link {
  position: absolute; top: -100%; left: 16px;
  background: var(--white); color: var(--bg-primary);
  padding: 8px 16px; z-index: 10000; font-size: 14px;
  border-radius: 0 0 4px 4px; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* --- Custom Cursor (desktop) --- */
.cursor-dot, .cursor-ring {
  display: none; pointer-events: none; position: fixed;
  top: 0; left: 0; z-index: 9999; border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width var(--duration-fast), height var(--duration-fast), opacity var(--duration-fast);
}
@media (hover: hover) and (pointer: fine) {
  .cursor-dot { display: block; width: 6px; height: 6px; background: var(--white); }
  .cursor-ring { display: block; width: 36px; height: 36px; border: 1px solid rgba(255,255,255,0.4); }
  .cursor-ring.hover { width: 56px; height: 56px; border-color: rgba(255,255,255,0.7); }
  body { cursor: none; }
  a, button, [role="button"] { cursor: none; }
}

/* ============================================================
   INTRO OVERLAY — Mischief-style logo reveal
   ============================================================ */
#intro-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  transition: opacity 0.8s var(--ease-out-expo), visibility 0.8s;
}
#intro-overlay.done { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-logo-mark {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin-bottom: 32px; opacity: 0;
  animation: introFadeIn 0.3s var(--ease-out-expo) 0.15s forwards;
}
.intro-bar {
  height: 3px; background: var(--white); border-radius: 2px;
  transform: scaleX(0); transform-origin: left;
}
.intro-bar--thin { width: 40px; animation: barDraw 0.25s var(--ease-out-expo) 0.25s forwards; }
.intro-bar--mid { width: 52px; height: 5px; animation: barDraw 0.25s var(--ease-out-expo) 0.35s forwards; }
.intro-bar--thick { width: 64px; height: 8px; animation: barDraw 0.25s var(--ease-out-expo) 0.45s forwards; }

.intro-title {
  font-family: var(--font-display); font-size: clamp(28px, 5vw, 56px);
  font-weight: 300; letter-spacing: 0.15em; text-transform: uppercase;
  opacity: 0; animation: introGlitchIn 0.4s var(--ease-out-expo) 0.6s forwards;
  text-align: center;
}
.intro-tagline {
  font-family: var(--font-mono); font-size: clamp(10px, 1.2vw, 13px);
  letter-spacing: 0.3em; text-transform: uppercase; color: var(--text-secondary);
  opacity: 0; animation: introFadeIn 0.3s var(--ease-out-expo) 0.9s forwards;
  text-align: center;
  margin-top: 8px;
}
.intro-skip {
  position: absolute; bottom: 32px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-muted); opacity: 0;
  animation: introFadeIn 0.25s ease 1.1s forwards;
}
.intro-skip:hover { color: var(--text-primary); }

@keyframes barDraw { to { transform: scaleX(1); } }
@keyframes introFadeIn { to { opacity: 1; } }
@keyframes introGlitchIn {
  0% { opacity: 0; transform: translateX(-8px); filter: blur(4px); }
  30% { opacity: 1; transform: translateX(3px); filter: blur(0); }
  50% { transform: translateX(-2px); }
  70% { transform: translateX(1px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   SECTION SHARED
   ============================================================ */
section { padding: 100px 24px; position: relative; z-index: 2; background-color: var(--bg-primary); }
.container { max-width: 1280px; margin: 0 auto; }
.section-label {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.25em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 48px;
  display: flex; align-items: center; gap: 12px;
}
.section-label::before {
  content: ''; width: 24px; height: 1px; background: var(--text-muted);
}

/* Reveal animation base */
.reveal {
  opacity: 0; transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-out-expo),
              transform var(--duration-slow) var(--ease-out-expo);
}
.reveal.visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ============================================================
   1. HERO
   ============================================================ */
#hero {
  min-height: 100vh; padding: 0;
  display: flex; align-items: stretch; position: -webkit-sticky; position: sticky; top: 0; z-index: 1;
  overflow: hidden; background-color: #e5e5e5; width: 100%;
}
.hero-bg-text {
  position: absolute; top: 12%; left: 0; right: 0;
  z-index: 2; text-align: center;
  font-family: var(--font-display);
  font-size: clamp(40px, 8vw, 130px);
  font-weight: 300; font-style: italic;
  color: #d0d0d0;
  mix-blend-mode: difference;
  letter-spacing: 0.05em;
}
.hero-single {
  position: absolute; inset: 0; width: 100%; height: 100%;
  overflow: hidden; mix-blend-mode: multiply;
}
.hero-img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 60%;
  filter: grayscale(100%) contrast(1.2);
  transition: transform 8s linear;
  transform: scale(1.05);
  max-width: none;
}
.hero-single::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(10,10,10,0.35);
  mix-blend-mode: multiply;
}
/* Grain overlay */
.hero-single::before {
  content: ''; position: absolute; inset: 0; z-index: 2;
  opacity: 0.08; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.hero-content {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 48px; z-index: 3;
  background: linear-gradient(transparent, rgba(10,10,10,0.9));
}
.hero-title {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(42px, 7vw, 96px); line-height: 0.95;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-bottom: 16px;
}
.hero-title span { display: block; }
.hero-title .line-the { font-size: 0.45em; letter-spacing: 0.3em; color: var(--text-accent); margin-bottom: 8px; }
.hero-micro {
  position: absolute; top: 0; left: 0; right: 0;
  padding: 18px; z-index: 3;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.15em; color: #000000; font-weight: 700;
  display: flex; gap: 24px; flex-wrap: wrap;
}

.hero-vertical-text {
  position: absolute; top: 0; right: 24px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: clamp(20px, 3.5vh, 40px);
  text-transform: uppercase;
  color: #ffffff;
  mix-blend-mode: difference;
  z-index: 10;
  pointer-events: none;
}

/* Glitch effect on hero title */
.glitch-text {
  position: relative;
}
.glitch-text::before, .glitch-text::after {
  content: attr(data-text); position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; opacity: 0;
}
.glitch-text:hover::before {
  animation: glitch1 0.3s linear;
  color: var(--accent-glitch-cyan); z-index: -1;
}
.glitch-text:hover::after {
  animation: glitch2 0.3s linear;
  color: var(--accent-glitch-red); z-index: -1;
}
@keyframes glitch1 {
  0% { opacity: 0.7; transform: translate(-2px, -1px); clip-path: inset(20% 0 60% 0); }
  25% { clip-path: inset(50% 0 10% 0); }
  50% { clip-path: inset(10% 0 70% 0); transform: translate(2px, 1px); }
  75% { clip-path: inset(40% 0 30% 0); }
  100% { opacity: 0; transform: translate(0); }
}
@keyframes glitch2 {
  0% { opacity: 0.7; transform: translate(2px, 1px); clip-path: inset(60% 0 5% 0); }
  25% { clip-path: inset(15% 0 55% 0); }
  50% { clip-path: inset(45% 0 20% 0); transform: translate(-2px, -1px); }
  75% { clip-path: inset(5% 0 65% 0); }
  100% { opacity: 0; transform: translate(0); }
}

/* ============================================================
   2. ONE-LINER STATEMENT
   ============================================================ */
#statement {
  padding: 120px 24px; display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
  background-color: rgba(10, 10, 10, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.statement-text {
  font-family: var(--font-display); font-size: clamp(24px, 4vw, 52px);
  font-weight: 300; line-height: 1.4; text-align: center;
  max-width: 900px;
}
.statement-line {
  display: block; opacity: 0; transform: translateY(20px);
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}
.statement-line.visible { opacity: 1; transform: translateY(0); }
.statement-line:nth-child(2) { transition-delay: 0.2s; }
.statement-line:nth-child(3) { transition-delay: 0.4s; color: var(--white); font-weight: 400; }

/* ============================================================
   3. CAPABILITIES
   ============================================================ */
#capabilities { background: var(--bg-secondary); }
.capabilities-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1px; background: var(--border-subtle);
}
.capability-card {
  background: var(--bg-secondary); padding: 40px 32px;
  transition: background var(--duration-fast), transform var(--duration-fast);
  position: relative; overflow: hidden;
}
.capability-card::after {
  content: ''; position: absolute; bottom: 0; left: 0;
  width: 0; height: 2px; background: var(--white);
  transition: width var(--duration-mid) var(--ease-out-expo);
}
.capability-card:hover { background: var(--bg-card); }
.capability-card:hover::after { width: 100%; }
.section-title {
  font-family: var(--font-display); font-size: clamp(48px, 6vw, 80px);
  font-weight: 300; margin-bottom: 64px; text-transform: uppercase;
  color: var(--white); text-align: left;
}
.capability-card h3 {
  font-family: var(--font-display); font-size: 22px; font-weight: 400;
  margin-bottom: 8px; letter-spacing: 0.02em;
}
.capability-card p {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-secondary); letter-spacing: 0.05em;
}
.service-icons {
  display: flex; gap: 12px; margin-bottom: 32px;
}
.service-icons img {
  width: 32px; height: 32px; object-fit: contain; border-radius: 4px;
  filter: grayscale(100%); opacity: 0.8; transition: all var(--duration-fast);
}
.capability-card:hover .service-icons img {
  filter: grayscale(0%); opacity: 1; transform: scale(1.1);
}

/* ============================================================
   4. WORK / OUTPUT
   ============================================================ */
#work { padding-bottom: 60px; }
.work-header {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 48px; flex-wrap: wrap; gap: 16px;
  position: relative; z-index: 2;
}
.work-header .section-title {
  font-size: clamp(28px, 4vw, 48px);
  text-transform: none;
  line-height: 1.2;
  margin-bottom: 16px;
}
.work-title-rotator {
  font-family: var(--font-display); font-size: clamp(18px, 2.5vw, 30px);
  font-weight: 300; font-style: italic; color: var(--text-accent);
  position: relative; height: 1.5em; overflow: hidden; min-width: 280px;
  text-align: right; flex: 1;
}
.work-title-rotator span {
  position: absolute; left: 0; top: 0;
  opacity: 0; transform: translateY(100%);
  transition: opacity 0.5s, transform 0.5s var(--ease-out-expo);
  white-space: nowrap;
}
.work-title-rotator span.active { opacity: 1; transform: translateY(0); }

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto;
  gap: 16px;
}
.work-item {
  position: relative; overflow: hidden; border-radius: 2px;
  aspect-ratio: 4/3;
}
.work-item:nth-child(1) { grid-row: span 2; aspect-ratio: auto; }
.work-item img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(80%) contrast(1.1);
  transition: filter var(--duration-mid), transform var(--duration-slow);
}
.work-item:hover img {
  filter: grayscale(30%) contrast(1.15);
  transform: scale(1.04);
}

/* Text block for empty grid space */
/* Text block for empty grid space */
.work-text-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 48px;
  background: transparent;
  position: relative;
}
.work-text-block h3 {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 64px);
  font-weight: 600;
  font-style: italic;
  color: var(--white);
  margin-bottom: 24px;
  line-height: 1.1;
}
.work-text-block p {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 2.5vw, 32px);
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Custom text embedded on work images */
.work-item-msg {
  position: absolute;
  top: 8%; left: 6%;
  text-align: left;
  z-index: 1;
  pointer-events: none;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(20px, 3.5vw, 36px);
  color: #ffffff;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  letter-spacing: 0.02em;
  font-weight: 300;
  max-width: 80%;
  line-height: 1.25;
}
.work-item-msg.pos-3, .work-item-msg.pos-4 {
  top: auto; bottom: 8%;
  left: auto; right: 6%;
  text-align: right;
}
.work-item-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(transparent 40%, rgba(10,10,10,0.85));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px; opacity: 0;
  transition: opacity var(--duration-fast);
}
.work-item:hover .work-item-overlay { opacity: 1; }
.work-item-overlay h3 {
  font-family: var(--font-display); font-size: 20px; font-weight: 400;
}
.work-item-overlay p {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-secondary);
  margin-top: 4px; letter-spacing: 0.1em; text-transform: uppercase;
}

/* ============================================================
   5. CLIENTELE
   ============================================================ */
#clientele { background: var(--bg-secondary); padding: 80px 0; overflow: hidden; }
#clientele .container { max-width: 100%; padding: 0 24px; }
#clientele .section-label { max-width: 1280px; margin: 0 auto 48px auto; }

.marquee-container {
  display: flex;
  overflow: hidden;
  user-select: none;
  gap: 24px;
  /* fade edges slightly */
  mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
}
.marquee-track {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-around;
  gap: 24px;
  min-width: 100%;
  animation: scroll-left 40s linear infinite;
}
.marquee-reverse .marquee-track {
  animation-direction: reverse;
}
.marquee-container:hover .marquee-track {
  animation-play-state: paused;
}
@keyframes scroll-left {
  0% { transform: translateX(0); }
  100% { transform: translateX(calc(-100% - 24px)); }
}

.client-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 0 40px;
  min-width: 340px;
  cursor: default;
  /* Override any old cached text-stroke */
  -webkit-text-stroke: 0 !important;
  color: var(--text-muted);
}
.client-logo img {
  height: 120px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  filter: grayscale(100%) brightness(1.5);
  transition: filter var(--duration-fast), transform var(--duration-fast);
}
.client-logo.logo-wide img {
  max-width: 440px;
}
.client-logo:hover img {
  filter: grayscale(0%) brightness(1);
  transform: scale(1.05);
}
.client-name {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color var(--duration-fast);
  -webkit-text-stroke: 0 !important;
}
.client-logo:hover .client-name {
  color: var(--white);
}

/* ============================================================
   6. VISUAL BREAK
   ============================================================ */
#visual-break {
  min-height: 95vh; padding: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.visual-break-bg {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; filter: grayscale(100%) contrast(1.3);
  opacity: 0.5;
  transform: scale(0.95);
}
.visual-break-text {
  position: relative; z-index: 2; text-align: center;
  font-family: var(--font-display); font-size: clamp(26px, 4vw, 52px);
  font-weight: 300; letter-spacing: 0.04em;
  max-width: 700px; padding: 0 24px;
}
#visual-break::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(10,10,10,0.6);
}
.visual-break-text { z-index: 3; }

/* ============================================================
   7. APPROACH
   ============================================================ */
#approach { padding: 120px 24px; }
.approach-text {
  max-width: 640px;
  font-family: var(--font-display); font-size: clamp(24px, 3.5vw, 44px);
  font-weight: 300; line-height: 1.5;
}
.approach-text em {
  font-style: normal; color: var(--white); font-weight: 400;
}

/* ============================================================
   8. CTA / CONTACT
   ============================================================ */
#contact {
  padding: 120px 24px 80px;
  text-align: center; border-top: 1px solid var(--border-subtle);
}
.contact-headline {
  font-family: var(--font-display); font-size: clamp(22px, 3.5vw, 40px);
  font-weight: 300; color: var(--text-accent); margin-bottom: 40px;
  line-height: 1.4;
}
.cta-button {
  display: inline-block; padding: 16px 48px;
  font-family: var(--font-mono); font-size: 13px;
  letter-spacing: 0.2em; text-transform: uppercase;
  border: 1px solid var(--white); color: var(--white);
  position: relative; overflow: hidden;
  transition: color var(--duration-fast);
}
.cta-button::before {
  content: ''; position: absolute; inset: 0;
  background: var(--white); transform: translateY(100%);
  transition: transform var(--duration-fast) var(--ease-out-expo);
}
.cta-button:hover { color: var(--bg-primary); }
.cta-button:hover::before { transform: translateY(0); }
.cta-button span { position: relative; z-index: 1; }

.contact-links {
  margin-top: 48px; display: flex; justify-content: center;
  gap: 32px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 12px;
  letter-spacing: 0.1em; color: var(--text-secondary);
}
.contact-links a { transition: color var(--duration-fast); }
.contact-links a:hover { color: var(--white); }

/* Footer bar */
.footer-bar {
  padding: 24px; text-align: center;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.15em; color: var(--text-muted);
  border-top: 1px solid var(--border-subtle);
}

/* ============================================================
   FOCUS STYLES (a11y)
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--accent-glitch-cyan);
  outline-offset: 3px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .capabilities-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  section { padding: 80px 20px; }
  .hero-content { padding: 32px 20px; padding-bottom: 48px; }
  .capabilities-grid { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .work-item:nth-child(1) { grid-row: span 1; aspect-ratio: 4/3; }
  .client-logo { min-width: 200px; padding: 0 16px; gap: 16px; }
  .client-logo img { height: 80px; }
  .client-name { font-size: 16px; }
  .contact-links { flex-direction: column; align-items: center; gap: 16px; }
}
@media (max-width: 480px) {
  .hero-title { font-size: 32px; }
  .statement-text { font-size: 22px; }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .statement-line { opacity: 1; transform: none; }
  #intro-overlay { display: none; }
}
