/* ==========================================================================
   Croxx Media — Global Layout & Section Architecture
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--oxblood);
  color: var(--ink-light);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  overflow-x: hidden;
  overflow-x: clip;
  background-color: var(--oxblood);
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Subtle architectural film grain */
.grain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  opacity: 0.03;
  background-image: radial-gradient(rgba(255, 255, 255, 0.7) 0.5px, transparent 0.5px);
  background-size: 4px 4px;
}

/* Smooth Gradient Scroll Progress Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  z-index: 150;
  pointer-events: none;
  background: rgba(207, 180, 132, 0.08);
}

.scroll-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  transition: width 0.08s linear;
}

/* ==========================================================================
   Preloader Curtain
   ========================================================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: radial-gradient(circle at 50% 42%, #18050d, #030206 78%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.55s var(--ease-out-expo), transform 0.7s var(--ease-out-expo), visibility 0.55s;
}

.preloader.is-done {
  opacity: 0;
  transform: translateY(-2%);
  visibility: hidden;
  pointer-events: none;
}

.preloader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.preloader__mark {
  width: 68px;
  height: 68px;
}

.preloader__path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 5;
  stroke-dasharray: 1600;
  stroke-dashoffset: 1600;
  animation: drawMark 1.1s var(--ease-out-expo) forwards;
}

.preloader__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-muted);
}

@keyframes drawMark {
  to {
    stroke-dashoffset: 0;
  }
}

/* ==========================================================================
   Site Header — Smart Light/Dark Section Adaptation
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 120;
  padding: 1.15rem 0;
  transition: background-color 0.45s var(--ease-out-quart), border-color 0.45s var(--ease-out-quart), padding 0.4s var(--ease-out-quart);
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  padding: 0.82rem 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.site-header[data-header-theme="dark"].is-scrolled {
  background-color: var(--oxblood-glass);
  border-bottom-color: var(--hairline-dark);
}

.site-header[data-header-surface="space"].is-scrolled {
  background-color: rgba(4, 3, 9, 0.84);
  border-bottom-color: rgba(207, 180, 132, 0.16);
}

.site-header[data-header-theme="light"] {
  color: var(--ink-dark);
}

.site-header[data-header-theme="light"].is-scrolled {
  background-color: var(--ivory-glass);
  border-bottom-color: var(--hairline-light);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  z-index: 2;
}

.brand-lockup__mark {
  width: 34px;
  height: 30px;
  transition: transform 0.5s var(--ease-out-expo);
}

.brand-lockup:hover .brand-lockup__mark {
  transform: scale(1.04);
}

.brand-lockup__divider {
  width: 1px;
  height: 24px;
  background-color: var(--gold-dark);
  opacity: 0.65;
}

.brand-lockup__wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-lockup__title {
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--ink-light);
  transition: color 0.35s ease;
}

.brand-lockup__sub {
  margin-top: 4px;
  font-size: 0.56rem;
  font-weight: 500;
  letter-spacing: 0.34em;
  color: var(--gold);
  transition: color 0.35s ease;
}

.site-header[data-header-theme="light"] .brand-lockup__title {
  color: var(--oxblood);
}

.site-header[data-header-theme="light"] .brand-lockup__sub {
  color: var(--gold-dark);
}

.brand-lockup__mark path {
  fill: var(--gold);
  transition: fill 0.35s ease;
}

.site-header[data-header-theme="light"] .brand-lockup__mark path {
  fill: var(--oxblood);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.site-nav__link {
  position: relative;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  opacity: 0.84;
  transition: opacity 0.25s ease;
}

.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 1px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out-expo);
}

.site-nav__link:hover,
.site-nav__link.is-active {
  opacity: 1;
}

.site-nav__link:hover::after,
.site-nav__link.is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid currentColor;
  border-radius: var(--radius-pill);
  padding: 0.48rem 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

/* Mobile Nav Drawer */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 115;
  background: var(--oxblood-deep);
  color: var(--ink-light);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem var(--gutter) 3rem;
  gap: 1.75rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-16px);
  transition: opacity 0.45s var(--ease-out-expo), transform 0.55s var(--ease-out-expo), visibility 0.45s;
}

.mobile-nav.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-nav__link {
  font-size: clamp(1.85rem, 7vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--hairline-dark);
  padding-bottom: 0.85rem;
}

/* ==========================================================================
   Section Themes & Shared Editorial Primitives
   ========================================================================== */
.section {
  position: relative;
  padding-block: var(--section-py);
}

.section[id] {
  scroll-margin-top: 78px;
}

#hero {
  scroll-margin-top: 0;
}

.section--dark {
  background-color: var(--oxblood);
  color: var(--ink-light);
}

.section--dark-deep {
  background-color: var(--oxblood-deep);
  color: var(--ink-light);
}

.section--ivory {
  background-color: var(--ivory);
  color: var(--ink-dark);
}

.section--sand {
  background-color: var(--sand);
  color: var(--ink-dark);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.section--ivory .eyebrow,
.section--sand .eyebrow {
  color: var(--gold-dark);
}

.eyebrow::before {
  content: "";
  width: 24px;
  height: 1px;
  background-color: currentColor;
}

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

.section-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: clamp(1.5rem, 2.8vw, 2.35rem);
}

.section-title {
  margin: 0.9rem 0 0;
  font-size: var(--text-3xl);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.03em;
  max-width: 18ch;
}

.section-lead {
  margin: 0;
  max-width: 42ch;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--caption-light);
}

.section--ivory .section-lead,
.section--sand .section-lead {
  color: var(--caption-dark);
}

/* ==========================================================================
   Hero — Sculptural 3D Oxblood Stage
   ========================================================================== */
.hero {
  position: relative;
  min-height: 560px;
  min-height: clamp(560px, 84svh, 740px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: clamp(5.5rem, 9vh, 7.25rem);
  padding-bottom: 1.5rem;
  background:
    radial-gradient(ellipse 56% 52% at 77% 46%, rgba(184, 61, 113, 0.16) 0%, rgba(72, 24, 96, 0.12) 42%, transparent 74%),
    radial-gradient(circle at 82% 82%, rgba(42, 184, 149, 0.08) 0%, transparent 48%),
    linear-gradient(180deg, #020205 0%, #05040a 72%, #130308 100%);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(2, 2, 5, 0.86) 0%,
    rgba(2, 2, 5, 0.68) 40%,
    rgba(2, 2, 5, 0.18) 64%,
    transparent 82%
  );
}

.hero__canvas-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;
}

.hero__canvas-wrap:active {
  cursor: grabbing;
}

#heroCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Soft colorful ambient cosmos halo behind 3D mark */
.hero__ambient-glow {
  position: absolute;
  top: 48%;
  right: 10%;
  width: min(48vw, 620px);
  height: min(48vw, 620px);
  transform: translateY(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 44% 44%, rgba(242, 180, 75, 0.17) 0%, rgba(232, 106, 74, 0.09) 36%, rgba(114, 54, 168, 0.08) 58%, transparent 74%);
  filter: blur(32px);
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.8s ease, background 0.8s ease;
}

/* ==========================================================================
   Smooth Kinetic Service Marquee Band
   ========================================================================== */
.marquee-band {
  position: relative;
  background: linear-gradient(90deg, #0d0308 0%, #160309 50%, #0d0308 100%);
  border-top: 1px solid rgba(207, 180, 132, 0.16);
  border-bottom: 1px solid rgba(207, 180, 132, 0.16);
  padding: 0.82rem 0;
  overflow: hidden;
  user-select: none;
}

.marquee-link {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
  transition: color 0.25s ease;
}

.marquee-link:hover {
  color: var(--gold-bright);
}

.marquee-track {
  display: flex;
  width: max-content;
  gap: 2.5rem;
  animation: marqueeGlide 32s linear infinite;
}

.marquee-band:hover .marquee-track,
.marquee-band:focus-within .marquee-track {
  animation-play-state: paused;
}

.marquee-item {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cream);
  white-space: nowrap;
}

.marquee-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

@keyframes marqueeGlide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.hero__content {
  position: relative;
  z-index: 3;
  pointer-events: none;
  margin-block: auto;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  align-items: center;
  gap: 2rem;
}

.hero__copy {
  pointer-events: auto;
  max-width: 590px;
}

.hero__title {
  margin: 1.25rem 0 1.45rem;
  font-size: var(--text-hero);
  font-weight: 500;
  line-height: 1.01;
  letter-spacing: -0.035em;
  color: #faf6ef;
  text-shadow: 0 2px 24px rgba(2, 2, 6, 0.9);
}

.hero__title .display-serif {
  color: #f0d7a7;
  font-size: 1.07em;
  font-weight: 500;
}

.hero__desc {
  margin: 0 0 2.1rem;
  max-width: 46ch;
  font-size: clamp(1rem, 1.25vw, 1.15rem);
  line-height: 1.68;
  color: #dfd5cc;
  text-shadow: 0 2px 16px rgba(2, 2, 6, 0.92);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.hero__stage-spacer {
  min-height: 290px;
  pointer-events: none;
}

.hero__footer {
  position: relative;
  z-index: 3;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(207, 180, 132, 0.15);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

/* ==========================================================================
   Thesis Section (Warm Ivory)
   ========================================================================== */
#studio {
  padding-top: clamp(2.25rem, 3.8vw, 3.25rem);
  padding-bottom: clamp(1.65rem, 2.8vw, 2.4rem);
}

.thesis__statement {
  font-size: clamp(1.5rem, 2.9vw, 2.55rem);
  font-weight: 400;
  line-height: 1.18;
  letter-spacing: -0.028em;
  max-width: 30ch;
  margin: 0.65rem 0 1.45rem;
  color: var(--oxblood);
}

.thesis__statement .display-serif {
  color: var(--gold-dark);
  font-size: 1.08em;
}

.thesis__columns {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 3.5vw, 3.25rem);
  align-items: start;
}

.thesis__prose {
  font-size: 1rem;
  line-height: 1.68;
  color: var(--caption-dark);
}

.thesis__prose p {
  margin: 0 0 1rem;
}

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

.thesis__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

/* ==========================================================================
   Selected Work Grid (Warm Ivory)
   ========================================================================== */
.work-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.35rem, 2.2vw, 1.9rem);
  align-items: start;
}

.work-grid.work-grid--filtered {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.work-grid:not(.work-grid--filtered) .work-card--featured {
  grid-column: 1 / span 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 1.5rem;
  align-items: center;
  background-color: var(--sand);
  border: 1px solid var(--hairline-light);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
}

#work .section-header {
  grid-template-columns: 1fr;
  gap: 1.15rem;
  margin-bottom: 1.5rem;
}

#work .section-title {
  max-width: 24ch;
}

.work-grid:not(.work-grid--filtered) .work-card--col3 {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--sand);
  border: 1px solid var(--hairline-light);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.work-animated-panel {
  grid-column: 1 / span 2;
  grid-row: 2;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--hairline-light);
  box-shadow: var(--shadow-editorial);
  min-height: 140px;
  max-height: 158px;
  height: 100%;
  align-self: stretch;
  background-color: var(--oxblood-deep);
}

.work-animated-panel.is-hidden {
  display: none !important;
}

#workFlowCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   Capabilities Split Stage (Deep Oxblood)
   ========================================================================== */
.capabilities__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(1.75rem, 3.5vw, 3.25rem);
  align-items: start;
}

.capabilities__list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--hairline-dark);
}

.capabilities__stage-wrap {
  position: sticky;
  top: 5.5rem;
}

/* ==========================================================================
   Process & Client Reflections (Warm Sand)
   ========================================================================== */
.process__rail {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.85rem;
}

.process__track {
  position: absolute;
  top: 22px;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--hairline-light);
  z-index: 0;
}

.process__track-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--oxblood));
  transition: width 0.25s linear;
}

.quotes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

/* ==========================================================================
   Contact Brief & Footer (Deep Oxblood)
   ========================================================================== */
.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 4.5vw, 4rem);
  align-items: start;
}

.site-footer {
  background-color: var(--oxblood-deep);
  color: var(--ink-light);
  border-top: 1px solid var(--hairline-dark);
  padding: 2.5rem 0 1.85rem;
}

.footer__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--hairline-dark);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
  font-size: 0.86rem;
  color: var(--caption-light);
}

.footer__links a:hover {
  color: var(--gold);
}

.footer__bottom {
  padding-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.78rem;
  color: var(--caption-light);
}

/* ==========================================================================
   Scroll Reveal Motion Utilities
   ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s var(--ease-out-expo), transform 0.95s var(--ease-out-expo);
}

[data-reveal].is-visible,
[data-reveal]:focus-within {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal-delay="1"] { transition-delay: 0.08s; }
[data-reveal-delay="2"] { transition-delay: 0.16s; }
[data-reveal-delay="3"] { transition-delay: 0.24s; }

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1024px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }

  .hero__stage-spacer {
    min-height: 220px;
  }

  .thesis__columns,
  .capabilities__layout,
  .contact__grid {
    grid-template-columns: 1fr;
  }

  .capabilities__stage-wrap {
    position: static;
    order: -1;
  }

  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-grid:not(.work-grid--filtered) .work-card--featured {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .work-grid:not(.work-grid--filtered) .work-card--col3 {
    grid-column: auto;
    grid-row: auto;
  }

  .work-animated-panel {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 175px;
  }

  .process__rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .process__track {
    display: none;
  }
}

@media (max-width: 820px) {
  .site-nav,
  .site-header__actions .btn {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
  }

  .section-header {
    grid-template-columns: 1fr;
  }

  .work-grid,
  .work-grid.work-grid--filtered,
  .quotes-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .work-grid:not(.work-grid--filtered) .work-card--featured {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .thesis__metrics {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .process__rail {
    grid-template-columns: 1fr;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .marquee-band {
    overflow-x: auto;
  }

  .marquee-track {
    animation: none;
  }

  .marquee-item[aria-hidden="true"] {
    display: none;
  }

  .preloader {
    transition: opacity 0.2s ease;
  }
}
