/* ============================================================
   TUL-ID Digital — Shared styles & motion system
   Dark luxury, cinematic, editorial. Derived from design.md.
   ============================================================ */

:root {
  --bg: #0d0d0d;
  --surface: #151515;
  --line: #2a2a2a;
  --text-primary: #f5f2ed;
  --text-secondary: #a3a3a3;
  --accent: #6674cc;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Material symbols sizing */
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  display: inline-block;
  line-height: 1;
  vertical-align: middle;
}

/* Premium custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: #262626;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #333;
}

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

/* ============================================================
   GLASS CARD
   ============================================================ */
.glass-card {
  background: rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: all 0.5s var(--ease);
}
.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(102, 116, 204, 0.4);
  box-shadow: 0 0 40px rgba(102, 116, 204, 0.08);
}

/* ============================================================
   MOTION SYSTEM
   ============================================================ */

/* Fade-up reveal (scroll triggered) */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
  will-change: transform, opacity;
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.stagger > .reveal {
  transition-delay: calc(var(--i, 0) * 90ms);
}

/* Word-by-word headline reveal */
.split-text {
  overflow: hidden;
  display: inline-block;
  vertical-align: baseline;
  padding: 0.12em 0 0.06em;
  line-height: 1.2;
}
.split-text .word {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.1s var(--ease);
  will-change: transform;
}
.reveal.active .split-text .word,
.active .split-text .word {
  transform: translateY(0);
}

/* Clip-path cinematic line reveal */
.reveal-clip {
  clip-path: polygon(0 0, 100% 0, 100% 0, 0 0);
  transition: clip-path 1.6s var(--ease);
}
.reveal-clip.active {
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

/* Floating */
@keyframes float {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-15px) rotate(0.4deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
.animate-float {
  animation: float 8s ease-in-out infinite;
}

@keyframes slowPan {
  0% { transform: scale(1.12) translateX(-2%); }
  100% { transform: scale(1.12) translateX(2%); }
}
.slow-pan {
  animation: slowPan 24s linear infinite alternate;
}

/* Soft glow hover */
.glow-hover {
  position: relative;
  overflow: hidden;
}
.glow-hover::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: radial-gradient(circle, rgba(102, 116, 204, 0.12) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.glow-hover:hover::after {
  opacity: 1;
}

.parallax-wrapper {
  perspective: 1000px;
}

/* Outlined ghost number for process */
.ghost-number {
  -webkit-text-stroke: 1px rgba(245, 242, 237, 0.18);
  color: transparent;
}

/* Nav hide on scroll-down */
#nav {
  transition: transform 0.5s var(--ease), background-color 0.4s ease;
}

/* Underline grow for nav links */
.nav-link {
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 1px;
  width: 0;
  background: var(--text-primary);
  transition: width 0.35s var(--ease);
}
.nav-link:hover::after,
.nav-link[aria-current="page"]::after {
  width: 100%;
}

/* Form focus */
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 116, 204, 0.18);
}

/* About page — protocol bento card backgrounds */
.protocol-card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: grayscale(100%);
  opacity: 0.4;
  transition:
    opacity 0.7s var(--ease),
    transform 1.2s var(--ease),
    filter 0.7s var(--ease);
}
.protocol-card:hover .protocol-card-bg {
  opacity: 0.55;
  filter: grayscale(40%);
  transform: scale(1.04);
}
.protocol-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    165deg,
    rgba(13, 13, 13, 0.72) 0%,
    rgba(13, 13, 13, 0.88) 55%,
    rgba(13, 13, 13, 0.96) 100%
  );
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .protocol-card-bg {
    transition: none !important;
  }
  .protocol-card:hover .protocol-card-bg {
    transform: none;
  }
}

/* Contact page — FAQ accordion slide */
.faq-acc > summary::-webkit-details-marker {
  display: none;
}
.faq-acc > summary::marker {
  content: "";
  display: none;
}
.faq-icon {
  transition: transform 0.4s var(--ease);
  flex-shrink: 0;
}
.faq-acc.faq-is-open .faq-icon {
  transform: rotate(45deg);
}
.faq-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease);
}
.faq-acc.faq-is-open .faq-panel {
  grid-template-rows: 1fr;
}
.faq-panel-inner {
  overflow: hidden;
}
.faq-panel-inner > * {
  padding-top: 0.75rem;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 0.35s var(--ease),
    transform 0.45s var(--ease);
}
.faq-acc.faq-is-open .faq-panel-inner > * {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.08s;
}

@media (prefers-reduced-motion: reduce) {
  .faq-panel,
  .faq-panel-inner > *,
  .faq-icon {
    transition: none !important;
  }
  .faq-panel-inner > * {
    opacity: 1;
    transform: none;
  }
}

/* Work page — project filters & pagination */
.projects-filter-btn {
  color: var(--text-secondary);
  border-color: var(--line);
  transition: color 0.25s var(--ease), background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.projects-filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
}
.projects-filter-btn.is-active {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}
.projects-filter-btn.is-active:hover {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}
.projects-page-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Legal pages — privacy & terms */
.legal-prose {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}
.legal-prose > p:first-child {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.legal-prose section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.legal-prose h2 {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.legal-prose p,
.legal-prose li {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text-secondary);
}
.legal-prose ul {
  list-style: disc;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.legal-prose a {
  color: var(--accent-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.25s var(--ease);
}
.legal-prose a:hover {
  color: var(--text-primary);
}

/* Mobile menu — sibling of #nav so fixed positioning isn't broken by nav scroll transform */
#mobile-menu {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
}
#mobile-menu.hidden-menu {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
#mobile-menu a {
  position: relative;
  z-index: 1;
  padding: 0.75rem 0;
}

/* Custom cursor (process page flavor, optional global) */
@media (hover: hover) and (pointer: fine) {
  .magnetic {
    transition: transform 0.3s var(--ease);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal,
  .reveal-clip,
  .split-text .word,
  .animate-float,
  .slow-pan,
  .glow-hover::after {
    transition: none !important;
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
    clip-path: none !important;
  }
}

/* Spin (rotating ring on services page) */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Contact form active timeline chip */
.timeline-btn.is-active {
  background: var(--text-primary);
  color: var(--bg);
  border-color: var(--text-primary);
}

/* ============================================================
   HERO PROJECT MARQUEE
   ============================================================ */
@keyframes hero-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.marquee-track {
  display: flex;
  gap: 1rem;
  width: max-content;
  align-items: flex-end;
  padding-bottom: 1rem;
  animation: hero-marquee 42s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* Responsive card sizes — 1 on mobile, 2 on tablet, 3 on desktop */
.marquee-card {
  flex-shrink: 0;
  /* mobile: single card, nearly full width */
  width: min(88vw, 340px);
  height: 200px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55);
}

@media (min-width: 640px) {
  .marquee-card {
    width: calc(50vw - 1.25rem); /* 2 visible */
    height: 100%;
  }
}

@media (min-width: 1024px) {
  .marquee-card {
    width: calc(33.33vw - 1.25rem); /* 3 visible */
    height: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
}

/* ============================================================
   CMS SKELETON LOADERS
   ============================================================ */
.cms-skeleton-block {
  background: var(--line);
}

.cms-skeleton {
  position: relative;
  overflow: hidden;
}

.cms-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.06),
    transparent
  );
  animation: cms-shimmer 1.6s ease-in-out infinite;
}

@keyframes cms-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cms-skeleton::after {
    animation: none;
    opacity: 0.35;
    transform: none;
  }
}

/* Contact page — client logo strip */
.client-logos-loaded {
  opacity: 0.5;
  filter: grayscale(100%);
  transition: opacity 0.5s var(--ease), filter 0.5s var(--ease);
}
.client-logos-loaded:hover {
  opacity: 1;
  filter: grayscale(0%);
}
