/* ═══════════════════════════════════════════════
   SAMAN SALOUR — MIDNIGHT & GOLD · MMXXVI
   ═══════════════════════════════════════════════ */

:root {
  --hi:         #2e406f;
  --bg:         #1b2a4d;
  --bg-deep:    #0c1330;
  --sepia:      #aeb9d8;
  --sepia-2:    #c6cde0;
  --ink:        #F2ECDB;
  --gold:       #C6A24A;
  --gold-bright:#E0BC63;
  --muted:      #8a93b0;
  --rule:       rgba(198,162,74,.14);
  --sp:         clamp(80px, 10vw, 130px);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--sepia-2);
  font-family: 'Cormorant Garamond', serif;
  overflow-x: hidden;
}
/* Fixed gradient layer — reliable on iOS where background-attachment:fixed is not */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(140% 120% at 28% 6%, var(--hi) 0%, var(--bg) 44%, var(--bg-deep) 100%);
}
/* Custom cursor only where a real pointer exists */
@media (pointer: fine) { body { cursor: none; } }
@media (pointer: coarse), (hover: none) { .cursor, .c-trail { display: none !important; } }

/* ── Overlays ───────────────────────────────── */
.grain {
  position: fixed; inset: 0; z-index: 999; pointer-events: none;
  opacity: var(--grain-opacity, .055); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  box-shadow: inset 0 0 200px 28px rgba(2,4,10,.4);
}

/* ── Custom cursor ──────────────────────────── */
.cursor {
  position: fixed; pointer-events: none; z-index: 9999;
  border-radius: 50%; transform: translate(-50%,-50%);
}
.cursor.ring {
  width: 36px; height: 36px;
  border: 1px solid var(--gold); opacity: .7;
  transition: width .22s, height .22s, opacity .3s;
}
.cursor.dot {
  width: 5px; height: 5px;
  background: var(--gold-bright);
}
body:has(a:hover) .cursor.ring,
body:has(button:hover) .cursor.ring { width: 52px; height: 52px; opacity: .35; }

/* ── Nav ────────────────────────────────────── */
.nav {
  position: fixed; top: 0; inset-inline: 0; z-index: 200;
  display: flex; justify-content: space-between; align-items: center;
  padding: 28px 56px;
  transition: padding .4s, background .4s, backdrop-filter .4s;
}
.nav.scrolled {
  padding: 16px 56px;
  background: rgba(12,19,48,.76);
  backdrop-filter: blur(14px);
}
.nav .brand {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .42em; color: var(--ink);
  text-decoration: none;
}
.nav-links { display: flex; gap: 38px; }
.nav-links a {
  font-family: 'Cinzel', serif; font-size: 10.5px;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  transition: color .25s;
}
.nav-links a:hover { color: var(--gold); }

/* ── Section shell ─────────────────────────── */
.section-inner { max-width: 1160px; margin: 0 auto; padding: 0 56px; }

.eyebrow {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .46em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 32px;
  display: flex; align-items: center; gap: 0;
}

h2 {
  font-family: 'Cinzel', serif; font-weight: 500;
  font-size: clamp(30px, 3.8vw, 56px);
  color: var(--ink); line-height: 1.12; margin-bottom: 52px;
}
h2 em {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic; font-weight: 500;
  color: var(--gold-bright);
}
.h2-outline {
  color: transparent;
  -webkit-text-stroke: 1px var(--ink);
}

/* ── Reveal ─────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(20px);
  transition: opacity .95s cubic-bezier(.2,.7,.3,1),
              transform .95s cubic-bezier(.2,.7,.3,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }
.d1 { transition-delay: .10s; }
.d2 { transition-delay: .22s; }
.d3 { transition-delay: .34s; }
.d4 { transition-delay: .48s; }
.d5 { transition-delay: .62s; }
.d6 { transition-delay: .78s; }

/* ════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════ */
.hero {
  min-height: 100vh; min-height: 100svh; position: relative;
  display: flex; flex-direction: column;
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  align-items: center; gap: 40px;
  padding: 108px 56px 80px; flex: 1;
}
.hero-left { display: flex; flex-direction: column; }

.folio {
  font-family: 'Cinzel', serif; font-size: 10.5px;
  letter-spacing: .5em; color: var(--gold);
  margin-bottom: 28px; display: flex; align-items: center; gap: 14px;
}
.folio::before { content: ''; width: 40px; height: 1px; background: var(--gold); }

h1 {
  font-family: 'Cinzel', serif; font-weight: 500;
  font-size: clamp(50px, 6vw, 96px);
  line-height: 1.02; letter-spacing: .01em;
}
.h1-first { display: block; color: var(--ink); }
.h1-last  {
  display: block;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold) 55%, #8c6d29);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}

.hero-rule {
  width: 88px; height: 1px; margin: 30px 0 22px;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.hero-tag {
  font-style: italic; color: var(--sepia-2);
  font-size: clamp(17px, 1.75vw, 24px);
  max-width: 36ch; line-height: 1.58;
}

/* Discipline index */
.discipline-index {
  margin-top: 40px;
  display: grid; grid-template-columns: repeat(2, auto);
  gap: 8px 52px; width: fit-content;
}
.di-row { display: flex; align-items: baseline; gap: 12px; }
.di-n {
  font-family: 'Cinzel', serif; font-size: 10.5px;
  letter-spacing: .12em; color: var(--gold); min-width: 22px;
}
.di-t {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(16px, 1.6vw, 20px);
  color: var(--ink); font-variant: small-caps; letter-spacing: .07em;
}

/* SVG codex */
.hero-right { display: flex; justify-content: center; align-items: center; }
.codex-svg  { width: min(44vw, 520px); height: auto; overflow: visible; }

.geo {
  fill: none; stroke: var(--sepia); stroke-width: 1;
  vector-effect: non-scaling-stroke; opacity: .78;
  stroke-dasharray: var(--len,1600);
  stroke-dashoffset: var(--len,1600);
  animation: geoDrawOn 2.6s cubic-bezier(.4,.05,.2,1) forwards;
}
.geo.faint  { opacity: .38; stroke-width: .7; }
.geo.accent { stroke: var(--gold-bright); opacity: .76; }
.geo.d2 { animation-delay: .45s; }
.geo.d3 { animation-delay: .9s;  }

.geo-spin {
  transform-box: fill-box; transform-origin: center;
  animation: geoBreathe 24s ease-in-out infinite;
}
.geo-node {
  fill: var(--gold-bright); r: 4;
  opacity: 0; animation: geoFade .6s ease forwards;
  animation-delay: var(--nd, 2s);
}
.geo-lab {
  font-family: 'Cormorant Garamond', serif; font-style: italic;
  font-size: 16px; fill: var(--sepia-2);
  opacity: 0; animation: geoFade .7s ease forwards;
  animation-delay: var(--nd, 2s);
}
.geo-meas {
  font-family: 'Cinzel', serif; font-size: 9px; letter-spacing: .2em;
  fill: var(--gold); opacity: 0; animation: geoFade .7s ease forwards;
  animation-delay: var(--nd, 2s);
}

/* Scroll hint */
.scroll-hint {
  position: absolute; bottom: 36px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .4em; color: var(--muted);
}
.scroll-bar {
  width: 1px; height: 44px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: scrollPulse 2.2s ease-in-out infinite;
}

/* ════════════════════════════════════════════════
   ABOUT
   ════════════════════════════════════════════════ */
.about {
  padding: var(--sp) 0;
  border-top: 1px solid rgba(198,162,74,.08);
  position: relative; overflow: hidden;
}
.bg-geo-wrap {
  position: absolute; inset: 0;
  display: flex; justify-content: flex-end; align-items: center;
  pointer-events: none; padding-right: 6%;
}
.bg-geo { width: min(56vw,580px); height: auto; opacity: .05; }
.bg-geo circle, .bg-geo line {
  fill: none; stroke: var(--gold); stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.about-grid {
  display: grid; grid-template-columns: 1.5fr 1fr;
  gap: 64px; align-items: start;
}
.about-bio p {
  font-size: clamp(16px,1.65vw,21px); color: var(--sepia-2);
  line-height: 1.74; margin-bottom: 22px;
}
.about-bio strong { color: var(--ink); font-weight: 600; }

.traits { display: flex; flex-direction: column; gap: 20px; padding-top: 4px; }
.trait  {
  display: flex; align-items: baseline; gap: 14px;
  font-family: 'Cinzel', serif;
  font-size: clamp(20px,2.2vw,30px); color: var(--ink);
}
.trait-n { font-size: 11px; letter-spacing: .1em; color: var(--gold); min-width: 22px; }

/* ════════════════════════════════════════════════
   WORK
   ════════════════════════════════════════════════ */
.work {
  padding: var(--sp) 0;
  border-top: 1px solid var(--rule);
}
.work-list { display: flex; flex-direction: column; }
.work-item {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  align-items: center; gap: 28px;
  padding: 26px 0;
  border-bottom: 1px solid rgba(174,185,216,.1);
  text-decoration: none; color: inherit;
  position: relative;
  transition: padding-left .3s ease;
}
.work-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--gold);
  transform: scaleY(0); transform-origin: bottom;
  transition: transform .32s ease;
}
.work-item:hover { padding-left: 14px; }
.work-item:hover::before { transform: scaleY(1); }

.wi-num {
  font-family: 'Cinzel', serif; font-size: 12px;
  letter-spacing: .14em; color: var(--gold); text-align: right;
}
.wi-body  { display: flex; flex-direction: column; gap: 6px; }
.wi-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(15px,1.55vw,21px);
  color: var(--ink); letter-spacing: .02em;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px;
}
.wi-role {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic; font-size: .78em;
  color: var(--muted); font-weight: 400;
}
.wi-desc {
  font-size: clamp(14px,1.35vw,17px);
  color: var(--sepia); line-height: 1.52;
}
.wi-tag {
  font-family: 'Cinzel', serif; font-size: 9.5px;
  letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(198,162,74,.35);
  border-radius: 2px; padding: 5px 12px; white-space: nowrap;
}
.wi-go {
  font-family: 'Cinzel', serif; font-size: 11px;
  letter-spacing: .22em; color: var(--ink);
  white-space: nowrap; transition: color .25s;
}
.work-item:hover .wi-go  { color: var(--gold-bright); }
.wi-arr { display: inline-block; transition: transform .25s; }
.work-item:hover .wi-arr { transform: translate(3px,-3px); }

/* ════════════════════════════════════════════════
   CONTACT
   ════════════════════════════════════════════════ */
.contact {
  padding: var(--sp) 0 80px;
  border-top: 1px solid var(--rule);
}
.contact-grid {
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 56px; align-items: center;
  margin-bottom: 72px;
}
.build-3d {
  width: 100%; max-width: 440px;
  aspect-ratio: 1 / 1;
  justify-self: center;
  position: relative;
}
.build-3d canvas { display: block; }

.contact-links { display: flex; flex-direction: column; gap: 22px; }
.contact-link {
  font-size: clamp(18px,2.2vw,30px);
  color: var(--sepia-2); text-decoration: none;
  display: flex; align-items: center; gap: 16px;
  transition: color .25s; width: fit-content;
}
.contact-link:hover { color: var(--ink); }
.cl-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); flex-shrink: 0;
  transition: transform .25s;
}
.contact-link:hover .cl-dot { transform: scale(1.7); }

.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px 24px;
  padding-top: 36px;
  border-top: 1px solid rgba(174,185,216,.1);
  font-family: 'Cinzel', serif; font-size: 10px;
  letter-spacing: .3em; text-transform: uppercase;
  color: var(--muted);
}
.site-footer .powered a {
  color: var(--gold); text-decoration: none;
  border-bottom: 1px solid rgba(198,162,74,.35);
  padding-bottom: 1px;
  transition: color .25s, border-color .25s;
}
.site-footer .powered a:hover {
  color: var(--gold-bright); border-color: var(--gold-bright);
}

/* ════════════════════════════════════════════════
   KEYFRAMES
   ════════════════════════════════════════════════ */
@keyframes geoDrawOn  { to { stroke-dashoffset: 0; } }
@keyframes geoBreathe { 0%,100%{transform:rotate(0deg)} 50%{transform:rotate(2.5deg)} }
@keyframes geoFade    { to { opacity: 1; } }
@keyframes scrollPulse{ 0%,100%{opacity:.35} 50%{opacity:.9} }

/* ── Reduced motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .reveal { transition: none; opacity: 1; transform: none; }
  .geo, .geo-spin, .scroll-bar { animation: none; stroke-dashoffset: 0; }
  .geo-node,.geo-lab,.geo-meas { animation: none; opacity: 1; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 960px) {
  .hero-grid  { grid-template-columns: 1fr; padding: 110px 32px 80px; gap: 52px; }
  .hero-right { justify-content: center; }
  .codex-svg  { width: min(86vw,420px); }
  .codex-3d   { width: min(86vw, 420px); }
  .about-grid { grid-template-columns: 1fr; gap: 44px; }
  .contact-grid { grid-template-columns: 1fr; gap: 24px; }
  .build-3d { max-width: 340px; }
  .work-item  { grid-template-columns: 30px 1fr; }
  .wi-tag,.wi-go { display: none; }
  .nav { padding: 22px 32px; }
  .nav.scrolled { padding: 14px 32px; }
  .section-inner { padding: 0 32px; }
  .site-footer { flex-direction: column; gap: 10px; text-align: center; }
  .discipline-index { gap: 6px 32px; }
}

@media (max-width: 600px) {
  .hero-grid  { padding: 96px 22px 64px; gap: 40px; }
  .section-inner { padding: 0 22px; }
  .nav { padding: 18px 22px; }
  .nav.scrolled { padding: 12px 22px; }
  .nav-links { gap: 22px; }
  .nav-links a { font-size: 9.5px; letter-spacing: .22em; }
  .brand { font-size: 10px; letter-spacing: .32em; }
  .codex-3d   { width: min(92vw, 380px); }
  .discipline-index { grid-template-columns: 1fr; gap: 6px; }
  .work-item  { gap: 16px; }
  .contact-links { gap: 16px; }
  .contact-link { font-size: 18px; min-height: 44px; }
  .ticker-track { animation-duration: 18s; }
  h2 { margin-bottom: 36px; }
  .scroll-hint { display: none; }
  .site-footer { justify-content: center; text-align: center; }
}

@media (max-width: 400px) {
  .nav .brand { display: none; }
  .nav { justify-content: flex-end; }
}
