/* ============================================================
   DHAR.DEV — made of light
   ============================================================ */

:root {
  --bg: #05060c;
  --ink: #f2f1ec;
  --dim: rgba(242, 241, 236, 0.55);
  --faint: rgba(242, 241, 236, 0.32);
  --hair: rgba(242, 241, 236, 0.14);
  --glass: rgba(10, 12, 22, 0.38);
  --mono: 'Space Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Syne', system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }
body { background: transparent; }

body {
  font-family: var(--sans);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(140, 160, 255, 0.35); color: #fff; }

body.fine-pointer, body.fine-pointer a, body.fine-pointer button { cursor: none; }

/* ---------- fixed layers ---------- */
#fluid {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: -2; display: block;
}
body.no-webgl #fluid { display: none; }
body.no-webgl::before {
  content: ''; position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(60% 80% at 20% 10%, rgba(45, 80, 160, 0.35), transparent 60%),
    radial-gradient(50% 70% at 85% 80%, rgba(120, 45, 130, 0.28), transparent 60%),
    var(--bg);
}

.veil {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(5, 6, 12, 0.36) 0%, rgba(5, 6, 12, 0.58) 60%, rgba(5, 6, 12, 0.85) 100%);
}

.grain {
  position: fixed; inset: -100%; z-index: 90; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  animation: grain 0.7s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -2%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* viewfinder frame */
.hud { position: fixed; inset: 0; z-index: 80; pointer-events: none; font-family: var(--mono); }
.hud .corner { position: absolute; width: 18px; height: 18px; opacity: 0.4; }
.hud .corner::before, .hud .corner::after { content: ''; position: absolute; background: var(--ink); }
.hud .corner::before { width: 100%; height: 1px; }
.hud .corner::after { width: 1px; height: 100%; }
.hud .c-tl { top: 18px; left: 18px; }
.hud .c-tr { top: 18px; right: 18px; transform: scaleX(-1); }
.hud .c-bl { bottom: 18px; left: 18px; transform: scaleY(-1); }
.hud .c-br { bottom: 18px; right: 18px; transform: scale(-1); }
.hud .readout {
  position: absolute; font-size: 0.62rem; letter-spacing: 0.22em;
  color: var(--faint); text-transform: uppercase; white-space: nowrap;
}
.hud .r-coords { left: 44px; bottom: 22px; }
.hud .r-clock { right: 44px; bottom: 22px; }
@media (max-width: 768px) { .hud { display: none; } }

/* ---------- cursor ---------- */
.cur-dot, .cur-ring { position: fixed; top: 0; left: 0; z-index: 999; pointer-events: none; will-change: transform; }
.cur-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--ink);
  transform: translate(-50%, -50%);
}
.cur-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(242, 241, 236, 0.65);
  transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out),
              border-radius 0.35s var(--ease-out), border-color 0.3s, background 0.3s, opacity 0.3s;
  display: flex; align-items: center; justify-content: center;
}
.cur-ring svg { position: absolute; width: 76px; height: 76px; opacity: 0; transition: opacity 0.3s; animation: spin 9s linear infinite; }
.cur-ring svg text { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.35em; fill: var(--ink); text-transform: uppercase; }
@keyframes spin { to { transform: rotate(360deg); } }
.cur-ring.is-view { width: 84px; height: 84px; border-color: rgba(242, 241, 236, 0.18); background: rgba(5, 6, 12, 0.18); backdrop-filter: blur(2px); }
.cur-ring.is-view svg { opacity: 0.9; }
.cur-ring.is-hidden, .cur-dot.is-hidden { opacity: 0; }
body:not(.fine-pointer) .cur-dot, body:not(.fine-pointer) .cur-ring { display: none; }

/* ---------- iris intro ---------- */
.iris { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; }
.iris svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.iris .f-stop {
  position: relative; z-index: 2; font-family: var(--mono); font-size: 0.7rem;
  letter-spacing: 0.3em; color: var(--dim);
}
.iris.is-done { display: none; }

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 26px 44px;
}
.nav-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.nav-logo svg { width: 22px; height: 22px; animation: spin 14s linear infinite; }
.nav-logo span { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.34em; }
.nav-links { display: flex; gap: 8px; list-style: none; }
.nav-links a {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--dim); text-decoration: none; padding: 10px 16px; border-radius: 100px;
  border: 1px solid transparent; transition: color 0.3s, border-color 0.3s, background 0.3s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--ink); border-color: var(--hair); background: var(--glass); backdrop-filter: blur(12px); }
@media (max-width: 768px) {
  .nav { padding: 20px 14px; }
  .nav-links a { letter-spacing: 0.16em; padding: 10px 10px; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; height: 100svh; min-height: 600px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.pre-wrap, .name-wrap, .title-wrap { position: relative; }
.pre-wrap { margin-bottom: -1vw; }
.t-under {
  position: absolute; inset: 0; display: block;
  mix-blend-mode: normal !important;
  color: rgba(242, 241, 236, 0.17) !important;
  pointer-events: none; user-select: none;
}
.hero-pre {
  display: block;
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.5rem, 3.4vw, 2.9rem); color: var(--ink);
  mix-blend-mode: overlay;
}
.hero-name.under-name { position: absolute; inset: 0; }
.under-name .ltr { mix-blend-mode: normal; --lo: 0.3; color: var(--ink); }
.hero-name {
  font-family: var(--sans); font-weight: 800; text-transform: uppercase;
  font-size: clamp(4.4rem, 19.5vw, 23rem); line-height: 0.86; letter-spacing: -0.015em;
  display: flex; user-select: none;
}
.hero-name .ltr {
  display: inline-block; color: #fff; mix-blend-mode: overlay;
  will-change: transform;
}
.hero-name .ltr + .ltr { margin-left: -0.01em; }
.hero-sub {
  margin-top: 4.5vh; display: flex; align-items: center; gap: 18px;
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--dim);
}
.hero-sub::before, .hero-sub::after { content: ''; width: 56px; height: 1px; background: var(--hair); }
.hero-chips { margin-top: 4vh; display: flex; gap: 14px; }
.chip {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--dim); text-decoration: none; padding: 12px 22px; border-radius: 100px;
  border: 1px solid var(--hair); background: var(--glass); backdrop-filter: blur(14px);
  transition: color 0.3s, border-color 0.3s, transform 0.2s;
  will-change: transform;
}
.chip:hover { color: var(--ink); border-color: rgba(242, 241, 236, 0.4); }
.chip b { font-weight: 400; color: var(--faint); margin-right: 8px; }
.hero-scroll {
  position: absolute; bottom: 34px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.hero-scroll span { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--faint); }
.hero-scroll .line { width: 1px; height: 52px; background: linear-gradient(var(--ink), transparent); animation: scrollLine 2.2s var(--ease-out) infinite; transform-origin: top; }
@keyframes scrollLine { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* letter intro animation */
.hero .ltr, .hero-pre, .hero-sub, .hero-chips, .hero-scroll { opacity: 0; }
.is-loaded .hero-pre { animation: riseIn 1.1s var(--ease-out) 0.25s forwards; }
.is-loaded .hero .ltr { animation: letterIn 1.15s var(--ease-out) forwards; animation-delay: calc(0.38s + var(--i) * 0.07s); }
.is-loaded .hero-sub { animation: riseIn 1.1s var(--ease-out) 1s forwards; }
.is-loaded .hero-chips { animation: riseIn 1.1s var(--ease-out) 1.15s forwards; }
.is-loaded .hero-scroll { animation: fadeIn 1.4s ease 1.6s forwards; }
@keyframes letterIn {
  from { opacity: 0; transform: translateY(60%) scaleY(1.4); filter: blur(14px); }
  to { opacity: var(--lo, 1); transform: translateY(0) scaleY(1); filter: blur(0); }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(28px); filter: blur(8px); }
  to { opacity: var(--lo, 1); transform: translateY(0); filter: blur(0); }
}
@keyframes fadeIn { to { opacity: 1; } }

/* ---------- sections ---------- */
.story { position: relative; padding: 16vh 0 8vh; }
.wrap { max-width: 1560px; margin: 0 auto; padding: 0 5vw; }

.story-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 7vh; flex-wrap: wrap; }
.story-kicker { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 14px; }
.story-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(3.4rem, 8.5vw, 8.5rem); line-height: 0.95;
  color: #fff; mix-blend-mode: overlay;
}
.story-stats { display: flex; gap: 34px; padding-bottom: 12px; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .k { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--faint); }
.stat .v { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.12em; color: var(--dim); }

/* featured image */
.feature {
  position: relative; overflow: hidden; border-radius: 6px;
  aspect-ratio: 21 / 9; margin-bottom: 3.5vh;
  clip-path: inset(12% 8% 12% 8% round 6px);
  transition: clip-path 1.3s var(--ease-out);
}
.feature.in-view { clip-path: inset(0 0 0 0 round 6px); }
.feature img {
  width: 100%; height: 118%; object-fit: cover; display: block;
  transform: translateY(var(--py, 0)) scale(1.12);
  will-change: transform;
}
.feature .cap {
  position: absolute; left: 22px; bottom: 18px; z-index: 2;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.24em; color: rgba(255,255,255,0.75);
  text-transform: uppercase; text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}
@media (max-width: 768px) { .feature { aspect-ratio: 4 / 3; } }

/* editorial grid */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(14px, 2vw, 28px); }
.ph { position: relative; border-radius: 6px; overflow: hidden; transform: translateY(var(--py, 0)); will-change: transform; background: rgba(242, 241, 236, 0.04); }
.ph .frame { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 0.35s; }
.ph .frame i { position: absolute; width: 14px; height: 14px; border: 1px solid rgba(255,255,255,0.85); }
.ph .frame .tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.ph .frame .tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.ph .frame .bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.ph .frame .br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.ph .idx {
  position: absolute; top: 12px; left: 16px; z-index: 3;
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em; color: rgba(255,255,255,0.8);
  opacity: 0; transform: translateY(4px); transition: opacity 0.35s, transform 0.35s;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
.ph:hover .frame, .ph:hover .idx { opacity: 1; transform: translateY(0); }
.ph .tilt { width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; transition: transform 0.18s ease-out; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.8s ease, transform 0.9s var(--ease-out); opacity: 0; }
.ph img.is-ready { opacity: 1; }
.ph:hover img { transform: scale(1.045); }
.ph .glare {
  position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255,255,255,0.16), transparent 55%);
}
.ph:hover .glare { opacity: 1; }
.g-a { grid-column: 1 / span 7; aspect-ratio: 4 / 3; }
.g-b { grid-column: 8 / span 5; aspect-ratio: 4 / 5; margin-top: 14vh; }
.g-c { grid-column: 2 / span 5; aspect-ratio: 1; margin-top: -8vh; }
.g-d { grid-column: 7 / span 6; aspect-ratio: 16 / 10; margin-top: 6vh; }
@media (max-width: 768px) {
  .g-a, .g-b, .g-c, .g-d { grid-column: 1 / -1; margin-top: 0; }
  .g-b { margin-left: 12vw; } .g-c { margin-right: 12vw; }
}

/* ---------- journey ---------- */
.journey { position: relative; height: 56vh; min-height: 380px; display: grid; place-items: center; }
.journey svg { width: min(1100px, 92vw); height: 100%; overflow: visible; }
.journey .path { fill: none; stroke: rgba(242, 241, 236, 0.4); stroke-width: 1.2; stroke-dasharray: 6 9; }
.journey .dot { fill: var(--ink); }
.journey .pin { fill: none; stroke: rgba(242, 241, 236, 0.5); stroke-width: 1; }
.journey text { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; fill: var(--faint); text-transform: uppercase; }

/* ---------- filmstrip (lisbon) ---------- */
.strip-scene { position: relative; }
.strip-sticky { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; justify-content: center; gap: clamp(14px, 2.5vh, 30px); overflow: hidden; }
.strip-row { display: flex; gap: clamp(14px, 1.6vw, 26px); width: max-content; will-change: transform; }
.strip-row .ph { flex: 0 0 auto; width: clamp(240px, 26vw, 430px); aspect-ratio: 4 / 3; transform: none; }
.strip-row .ph.tall { aspect-ratio: 3 / 4; width: clamp(190px, 19vw, 320px); }
.strip-progress {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.26em; color: var(--dim);
}
.strip-progress .bar { width: 180px; height: 1px; background: var(--hair); position: relative; }
.strip-progress .bar i { position: absolute; left: 0; top: 0; height: 100%; width: 0%; background: var(--ink); }
@media (max-width: 768px) {
  .strip-scene { height: auto !important; }
  .strip-sticky { position: static; height: auto; overflow: visible; padding: 0 6vw; }
  .strip-row { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 12px; }
  .strip-row .ph, .strip-row .ph.tall { width: 100%; aspect-ratio: 4 / 5; }
  .strip-row + .strip-row { margin-top: 12px; }
  .strip-progress { display: none; }
}

/* ---------- contact ---------- */
.contact {
  position: relative; min-height: 92svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6vh;
  text-align: center; padding: 12vh 6vw;
}
.contact-title {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(3.6rem, 10vw, 10rem); line-height: 1;
  color: #fff; mix-blend-mode: overlay;
}
.contact-links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.btn {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: 18px 34px; border-radius: 100px;
  border: 1px solid var(--hair); background: var(--glass); backdrop-filter: blur(16px);
  transition: border-color 0.3s, background 0.3s; will-change: transform;
}
.btn:hover { border-color: rgba(242, 241, 236, 0.5); background: rgba(20, 24, 40, 0.5); }
.btn svg { width: 15px; height: 15px; }

/* ---------- footer ---------- */
.footer {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  padding: 26px 44px; border-top: 1px solid var(--hair);
  font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint);
}
@media (max-width: 768px) { .footer { padding: 20px 22px; flex-direction: column; gap: 8px; } }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 1000; display: none; }
.lb.active { display: block; }
.lb-bg { position: absolute; inset: 0; background: rgba(3, 4, 8, 0.88); opacity: 0; transition: opacity 0.4s; }
.lb.is-in .lb-bg { opacity: 1; }
.lb-ambient {
  position: absolute; inset: -10%; object-fit: cover; width: 120%; height: 120%;
  filter: blur(80px) brightness(0.36) saturate(1.3); opacity: 0; transition: opacity 0.8s;
}
.lb.is-in .lb-ambient { opacity: 0.85; }
.lb-stage { position: absolute; inset: 0; display: grid; place-items: center; padding: 5vmin; }
.lb-img {
  max-width: 92vw; max-height: 86vh; object-fit: contain; border-radius: 4px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  will-change: transform; transform-origin: top left;
}
.lb button {
  position: absolute; z-index: 5; background: rgba(8, 10, 18, 0.4); backdrop-filter: blur(10px);
  border: 1px solid var(--hair); color: var(--ink); border-radius: 50%;
  width: 52px; height: 52px; font-size: 19px; display: grid; place-items: center;
  transition: border-color 0.3s, background 0.3s;
}
.lb button:hover { border-color: rgba(242, 241, 236, 0.5); }
.lb-close { top: 26px; right: 26px; }
.lb-prev { left: 26px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 26px; top: 50%; transform: translateY(-50%); }
.lb-count {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.3em; color: var(--dim);
}
@media (max-width: 768px) {
  .lb-prev, .lb-next { display: none; }
  .lb-close { top: 16px; right: 16px; }
}

/* ---------- reveal ---------- */
.rv { opacity: 0; transform: translateY(46px); filter: blur(10px); transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out), filter 1.1s var(--ease-out); }
.rv.in-view { opacity: 1; transform: none; filter: none; }
.rv.d1 { transition-delay: 0.12s; }
.rv.d2 { transition-delay: 0.24s; }

/* ---------- liquid distort hook ---------- */
.distort-target { will-change: transform; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
  .grain { display: none; }
  .hero .ltr, .hero-pre, .hero-sub, .hero-chips, .hero-scroll { opacity: 1; }
  .rv { opacity: 1; transform: none; filter: none; }
  html { scroll-behavior: auto; }
}

noscript { position: relative; z-index: 5; display: block; padding: 40px; font-family: var(--mono); color: var(--dim); text-align: center; }
