/* =============================================
   DESIGN TOKENS & RESET
   ============================================= */

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400&family=Marcellus&family=Inter:wght@300;400;500;600;700&display=swap');
/* Devanagari digits only (≈2 KB subset) for the project card numerals */
@import url('https://fonts.googleapis.com/css2?family=Tiro+Devanagari+Hindi&text=%E0%A5%A6%E0%A5%A7%E0%A5%A8%E0%A5%A9%E0%A5%AA%E0%A5%AB%E0%A5%AC%E0%A5%AD%E0%A5%AE%E0%A5%AF&display=swap');

/* ── Tokens ── */
:root {
  /* Dark Base Palette */
  --ink: #0E0F11;
  --slate: #17191E;
  --ash: #8E93A2;
  --chalk: #ECEFF5;

  /* Traditional Nepali Refined Palette */
  --signal: #B33A3A;        /* Deep temple-red */
  --signal-hover: #9E2F2F;  /* Deeper crimson */
  --gold: #C08A2E;          /* Antique-gold accent */
  --gold-hover: #D49D3B;    /* Warm luminous gold */

  /* Alpha variants */
  --ash-10: rgba(142, 147, 162, 0.10);
  --ash-15: rgba(142, 147, 162, 0.15);
  --ash-20: rgba(142, 147, 162, 0.20);

  --signal-10: rgba(179, 58, 58, 0.10);
  --signal-15: rgba(179, 58, 58, 0.15);

  --gold-10: rgba(192, 138, 46, 0.10);
  --gold-15: rgba(192, 138, 46, 0.15);
  --gold-30: rgba(192, 138, 46, 0.30);

  /* Typography */
  --font-display: 'Fraunces', 'Marcellus', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-6xl: 4rem;
  --text-7xl: 5rem;

  /* Spacing (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-24: 96px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --r-xl: 12px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --max-width: 1120px;
  --nav-h: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background: var(--ink);
  color: var(--chalk);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  counter-reset: section;
}

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

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

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

ul {
  list-style: none;
}

/* ── Global dot-grid texture ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(138, 143, 160, 0.11) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ── 3D interactive body (WebGL canvas behind all content) ──
   z-index -1 keeps it above the body background but under every section.
   100lvh stops mobile URL-bar show/hide from resizing the GL buffer. */
.body3d {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
}

.body3d.is-ready {
  opacity: 1;
}

html.is-spinning,
html.is-spinning * {
  cursor: grabbing !important;
  user-select: none;
}

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Scroll progress */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--signal) 0%, var(--gold) 100%);
  z-index: 9999;
  transition: width 0.1s linear;
}

/* Shared container & section layout */
.section {
  padding: var(--sp-24) 0;
  position: relative;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

.section-header {
  margin-bottom: var(--sp-12);
}

.section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp-3);
  display: block;
}

.section-label-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.section-label-row .icon {
  color: var(--gold);
}

/* Editorial section index: "01 | ◇ Selected work" (counter reset on body) */
.section-header .section-label::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  font-variant-numeric: tabular-nums;
  color: var(--ash);
  letter-spacing: 0.08em;
  padding-right: var(--sp-3);
  margin-right: var(--sp-1);
  border-right: 1px solid var(--gold-30);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, var(--text-4xl));
  font-weight: 500;
  color: var(--chalk);
  letter-spacing: -0.01em;
  line-height: 1.2;
  position: relative;
  display: inline-block;
  padding-bottom: var(--sp-3);
}

/* ── Shiny Text Gradient Sweep (AnimMasterLib style) ── */
.shiny-text {
  background: linear-gradient(
    110deg,
    #ECEFF5 0%,
    #ECEFF5 30%,
    #F4E2BB 45%,
    #C08A2E 55%,
    #ECEFF5 70%,
    #ECEFF5 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shine-sweep 7s ease-in-out infinite;
}

@keyframes shine-sweep {
  0%, 20% {
    background-position: 100% 0;
  }
  60%, 100% {
    background-position: -100% 0;
  }
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--signal) 0%, var(--gold-30) 60%, transparent 100%);
  transform-origin: left;
}

/* ── Traditional Nepali Dhaka Weave Section Divider ── */
.dhaka-divider {
  width: 100%;
  height: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='4' viewBox='0 0 16 4'%3E%3Cpath d='M0 2 L4 0 L8 2 L4 4 Z M8 2 L12 0 L16 2 L12 4 Z' fill='none' stroke='%23B33A3A' stroke-width='0.75' opacity='0.35'/%3E%3Ccircle cx='4' cy='2' r='0.5' fill='%23C08A2E' opacity='0.45'/%3E%3Ccircle cx='12' cy='2' r='0.5' fill='%23C08A2E' opacity='0.45'/%3E%3C/svg%3E");
  background-repeat: repeat-x;
  background-position: center;
  background-size: 16px 4px;
  border: none;
  opacity: 0.85;
}

/* Scroll reveals (IntersectionObserver controlled) */
.reveal,
.reveal-x {
  will-change: transform, opacity;
}

/* Icons */
.icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.icon-sm {
  width: 12px;
  height: 12px;
}

/* Buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: color 0.18s ease, transform 0.18s var(--ease-out);
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-101%);
  transition: transform 0.2s var(--ease-out);
  border-radius: inherit;
}

.btn:hover::before {
  transform: translateX(0);
}

.btn-primary {
  background: var(--signal);
  color: var(--chalk);
  border: 1px solid rgba(192, 138, 46, 0.25);
  box-shadow: 0 4px 18px -4px rgba(179, 58, 58, 0.4);
}

.btn-primary::before {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(192, 138, 46, 0.2));
}

.btn-primary:hover {
  background: var(--signal-hover);
  border-color: var(--gold);
  box-shadow: 0 6px 22px -2px rgba(179, 58, 58, 0.55), 0 0 12px rgba(192, 138, 46, 0.2);
}

.btn-primary svg {
  transition: transform 0.25s var(--ease-out);
  color: var(--chalk);
}

.btn-primary:hover svg {
  transform: translateX(3px);
  color: var(--gold-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--ash);
  border: 1px solid var(--ash-20);
}

.btn-ghost::before {
  background: var(--gold-10);
}

.btn-ghost:hover {
  color: var(--chalk);
  border-color: var(--gold);
  box-shadow: 0 4px 14px -2px rgba(192, 138, 46, 0.18);
}

.btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.btn span,
.btn > :not(svg) {
  position: relative;
  z-index: 1;
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
