/* ============================================================
   ALAN HAMAK — alanhamak.com
   pitch black · one light · quiet elegance
   ============================================================ */

:root {
  --black: #040305;
  --unlit: #17141c;            /* what text looks like before the light finds it */
  --violet: #8b6bb8;
  --violet-bright: #b39ddb;
  --violet-dim: #3d2c56;
  --bone: #e9e4f0;
  --grey: #837c8e;
  --serif: "Playfair Display", "Didot", Georgia, serif;
  --sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --ease-lux: cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* the left thread is the only scroll indicator — the native bar is hidden */
html { scrollbar-width: none; -ms-overflow-style: none; }
html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; width: 0; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--black);
  color: var(--bone);
  font-family: var(--sans);
  font-weight: 300;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

::selection { background: var(--violet-dim); color: var(--bone); }

/* ---------- atmosphere ---------- */

#dust {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 1; pointer-events: none;
}
/* grain exists ONLY inside the light — masked to the lit area by JS vars */
#grain {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 2; pointer-events: none;
  opacity: var(--gopacity, 0);
  mix-blend-mode: screen;
  /* the grain follows the light as a soft pool — except in Sessions,
     where JS eases --gr/--gf wide so the grain covers the whole room */
  -webkit-mask-image: radial-gradient(circle var(--gr, 46vmax) at var(--gx, 50%) var(--gy, 50%), #000 0%, transparent var(--gf, 68%));
  mask-image: radial-gradient(circle var(--gr, 46vmax) at var(--gx, 50%) var(--gy, 50%), #000 0%, transparent var(--gf, 68%));
}
.vignette {
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse 130% 100% at 50% 45%, transparent 60%, rgba(0,0,0,.5) 100%);
}

/* the invitation: after a long stillness at the top, a faint violet
   light breathes up from below the fold — no arrows, no words, just
   the suggestion that there is more beneath. sized in viewport units
   so it holds on any aspect ratio. */
.scroll-cue {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: min(26vh, 240px);
  transform-origin: 50% 100%;
  pointer-events: none; z-index: 3;
  opacity: 0; /* driven per-frame in JS — a continuous lerp, so it can
                 never snap: it only ever drifts toward where it is going */
  background: radial-gradient(ellipse 62% 110% at 50% 122%,
    rgba(196, 178, 224, .17),
    rgba(139, 107, 184, .055) 48%,
    transparent 72%);
}

main, .footer { position: relative; z-index: 4; }

/* ---------- scroll thread (left hairline that fills as you move) ---------- */

.thread {
  position: fixed; left: clamp(1.2rem, 3vw, 2.6rem); top: 50%;
  transform: translateY(-50%);
  width: 1px; height: 34vh;
  background: rgba(233, 228, 240, .07);
  z-index: 40;
  /* only exists while you move — fades away when the page is still */
  opacity: 0;
  transition: opacity 1.7s var(--ease-lux);
}
.thread.visible { opacity: 1; }
.thread-fill {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(to bottom, var(--violet), var(--violet-bright));
  transform-origin: top;
  transform: scaleY(0);
  box-shadow: 0 0 8px rgba(139, 107, 184, .5);
}
@keyframes thread-lucky {
  0%, 100% { box-shadow: 0 0 8px rgba(139, 107, 184, .5); }
  50%      { box-shadow: 0 0 22px rgba(179, 157, 219, .95); }
}
.thread-fill.lucky { animation: thread-lucky .7s ease-in-out 3; }
@media (max-width: 760px) { .thread { display: none; } }

/* ---------- nav ---------- */

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.8rem clamp(1.5rem, 5vw, 4rem);
  opacity: 0; transform: translateY(-10px);
  transition: opacity 2.1s var(--ease-lux) 3.5s, transform 2.1s var(--ease-lux) 3.5s;
}
body.loaded .nav { opacity: 1; transform: none; }

.logo { display: block; text-decoration: none; }
/* the signature — true transparency, sits straight on the dark */
.logo-mark {
  display: block; height: 2.4rem; width: auto;
  opacity: .85;
  transition: opacity .5s, filter .5s;
}
.logo:hover .logo-mark { opacity: 1; filter: drop-shadow(0 0 10px rgba(179, 157, 219, .45)); }

.nav-links { display: flex; gap: clamp(1.2rem, 3vw, 2.4rem); }
.nav-links a {
  color: var(--grey); text-decoration: none;
  font-size: .62rem; letter-spacing: .3em; text-transform: uppercase;
  position: relative; padding-bottom: .3em;
  transition: color .4s;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--violet);
  transform: scaleX(0); transform-origin: right;
  transition: transform .6s var(--ease-lux);
}
.nav-links a:hover { color: var(--bone); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- the light ----------
   every .lit section owns --lit (0..1), set by scroll position.
   glow, text brightness, and grain all obey it.            */

.lit { position: relative; }
.lit-glow {
  position: absolute; inset: -12% -20%;
  pointer-events: none;
  background: radial-gradient(ellipse 52% 42% at 50% 44%,
    rgba(122, 92, 175, .13) 0%, rgba(122, 92, 175, .095) 22%,
    rgba(122, 92, 175, .058) 40%, rgba(122, 92, 175, .03) 55%,
    rgba(122, 92, 175, .012) 66%, transparent 78%);
  opacity: var(--lit, 0);
  transition: opacity .2s linear;
}
/* each text block is its own spotlight subject: --lit is set PER ELEMENT
   by scroll distance to the viewport center, so the next section stays
   fully dark until the light actually reaches it */
.lit-text {
  opacity: calc(.045 + .955 * var(--lit, 0));
  text-shadow: 0 0 26px rgba(179, 157, 219, calc(var(--lit, 0) * .18));
}

/* entrance offsets (one-time), independent of the light */
.reveal {
  transform: translateY(1.6rem);
  transition: transform 1.4s var(--ease-lux) var(--d, 0s);
}
.reveal.in { transform: none; }

/* ---------- hero ---------- */

.hero {
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
}
.hero-glow {
  inset: 20% 10%;
  /* the eye: one wide rounded pool, centered — as it was */
  background: radial-gradient(ellipse 46% 38% at 50% 50%,
    rgba(122, 92, 175, .12) 0%, rgba(122, 92, 175, .085) 24%,
    rgba(122, 92, 175, .05) 42%, rgba(122, 92, 175, .025) 56%,
    rgba(122, 92, 175, .01) 67%, transparent 78%);
  animation: breathe 9s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
.hero-inner { display: flex; flex-direction: column; align-items: center; }

.hero-eyebrow {
  font-size: .58rem; letter-spacing: .52em; text-indent: .52em;
  text-transform: uppercase; color: var(--grey);
  margin-bottom: 1.6rem;
}
.hero-name {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  text-transform: uppercase;
  letter-spacing: .3em; text-indent: .3em;
  color: var(--bone);
  line-height: 1.2;
  position: relative;
}
/* the glimmer riding the FRONT of the glyphs — crisp, clipped to the
   type. the volumetric light itself lives on the canvas BEHIND the text */
.hero-name::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  color: transparent;
  background: linear-gradient(100deg,
    transparent 38%,
    rgba(179, 157, 219, .4)  44%,
    rgba(236, 229, 247, .95) 49%,
    rgba(255, 255, 255, 1)   50%,
    rgba(236, 229, 247, .95) 51%,
    rgba(179, 157, 219, .4)  56%,
    transparent 62%);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-position-x: var(--shine, -20%);
  -webkit-background-clip: text;
  background-clip: text;
  pointer-events: none;
}
.hero-name::after {
  filter: drop-shadow(0 0 8px rgba(214, 199, 236, .55));
}
/* the god-ray canvas: a real occluded light rendered behind the type.
   the letters are drawn into it as black obstacles, so the rays carry
   their shadows. the live text sits crisp above it. */
.hero-inner { position: relative; z-index: 2; }
.hero-tag {
  margin-top: 1.5rem;
  font-family: var(--serif);
  font-size: clamp(.92rem, 1.5vw, 1.08rem);
  color: var(--grey); letter-spacing: .06em;
}
.hero-tag em { font-style: italic; }

/* hero entrance: nothing moves — the name simply arrives.
   a pure slow fade while the letters settle into place */
.hero-anim {
  opacity: 0;
  animation: hero-in 2.6s var(--ease-lux) forwards;
  animation-delay: var(--d);
}
@keyframes hero-in { to { opacity: 1; } }
.hero-name.hero-anim {
  letter-spacing: .44em; text-indent: .44em;
  animation-name: hero-name-in;
  animation-duration: 3.2s;
}
@keyframes hero-name-in {
  to { opacity: 1; letter-spacing: .3em; text-indent: .3em; }
}

/* ---------- sections shared ---------- */

.section {
  max-width: 62rem; margin: 0 auto;
  padding: clamp(8rem, 18vh, 13rem) clamp(1.5rem, 6vw, 4rem);
}
/* ---------- sessions ---------- */

.sessions { text-align: center; }
/* the smoke is rendered LIVE on the GPU — fractal noise computed per
   pixel at 60fps. no footage, no frames, no loops, no boundaries: the
   fade is part of the field itself. it drifts on its own slow clock
   and the scroll pushes it. */
.sessions-smoke {
  position: absolute; top: -8%; bottom: -8%; left: 50%;
  width: 100vw; margin-left: -50vw;
  pointer-events: none;
  overflow: hidden;
}
.sessions-smoke canvas {
  display: block;
  width: 100%; height: 100%;
  opacity: calc(var(--lit, 0) * .44);
}
/* the room's own lamp stays LOW here — the smoke carries the air,
   the light shouldn't wash the whole section pale */
.sessions .lit-glow { opacity: calc(var(--lit, 0) * .4); }
.sessions-statement {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.7rem, 4.4vw, 3rem);
  line-height: 1.25; color: var(--bone);
  margin: 0 auto clamp(1.8rem, 4vh, 2.6rem);
  max-width: 22ch;
}
.sessions-statement em { font-style: italic; }
.sessions-body {
  font-size: clamp(.88rem, 1.3vw, .98rem);
  line-height: 2; color: var(--grey);
  max-width: 36rem; margin: 0 auto clamp(3.5rem, 8vh, 5.5rem);
}
.names {
  list-style: none;
}
/* names rest in the dark; when the light passes, each one flashes awake
   like a loose bulb, then sinks back into shadow */
.name {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
  line-height: 2.1;
  color: var(--bone);
  /* asleep = gone. they only exist in the instant the light finds them */
  opacity: calc(.015 + .1 * var(--nlit, 0));
  text-shadow: 0 0 32px rgba(179, 157, 219, calc(var(--nlit, 0) * .12));
}
@keyframes name-flash {
  0%   { opacity: .04; }
  12%  { opacity: .95; }
  26%  { opacity: .3; }
  42%  { opacity: .8; }
  100% { opacity: .115; }
}
.name.ignite { animation: name-flash 1.05s linear; }
.name-self {
  color: var(--violet-bright);
  opacity: calc(.04 + .22 * var(--nlit, 0));
}
.name-self::after {
  content: "";
  display: block; width: 3.2em; height: 1px;
  margin: -.35em auto 0;
  background: linear-gradient(to right, transparent, var(--violet), transparent);
  opacity: calc(var(--nlit, 0) * .5);
}

/* ---------- about ---------- */

.about-statement {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.7rem, 4.4vw, 3rem);
  line-height: 1.25; color: var(--bone);
  max-width: 20ch;
  margin-bottom: clamp(2.6rem, 6vh, 4rem);
}
.about-statement em { font-style: italic; }
/* each word is lit by scroll, one after another */
.about-statement .w, .tease-line .w {
  opacity: .08;
  transition: opacity .7s var(--ease-lux), text-shadow .7s;
}
.about-statement .w.lit-on, .tease-line .w.lit-on {
  opacity: 1;
  text-shadow: 0 0 34px rgba(179, 157, 219, .28);
}
.about-body {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: clamp(1.6rem, 4vw, 3.2rem);
  max-width: 54rem;
}
.about-body p {
  font-size: clamp(.88rem, 1.3vw, .98rem);
  line-height: 2; color: var(--grey);
}
.about-body p::first-letter { color: var(--bone); }

/* ---------- tease ---------- */

.tease {
  min-height: 80svh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; position: relative;
  padding: 4rem 1.5rem;
  overflow: hidden;
}
.tease .section-label { margin-bottom: 1.8rem; }
.tease-line {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2.7rem);
  color: var(--bone); letter-spacing: .03em;
}
.tease-line em { font-style: italic; }
/* super hidden, untouched by scroll — it only exists when it blinks */
.tease-ghost {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(12rem, 38vw, 30rem);
  color: transparent;
  -webkit-text-stroke: 1px rgba(139, 107, 184, .22);
  opacity: .22;
  pointer-events: none; user-select: none;
  white-space: nowrap;
}
@keyframes ghost-blink {
  0%   { opacity: .22; }
  8%   { opacity: .7; }
  15%  { opacity: .28; }
  26%  { opacity: .8; }
  38%  { opacity: .35; }
  52%  { opacity: .65; }
  100% { opacity: .22; }
}
.tease-ghost.blink { animation: ghost-blink 1.5s linear; }
/* 7 7 7 — the ghost loses it */
@keyframes ghost-rave {
  0%   { opacity: .22; }
  6%   { opacity: .95; }
  11%  { opacity: .25; }
  17%  { opacity: 1; }
  24%  { opacity: .3; }
  33%  { opacity: .9; }
  41%  { opacity: .2; }
  52%  { opacity: 1; }
  63%  { opacity: .35; }
  74%  { opacity: .85; }
  88%  { opacity: .3; }
  100% { opacity: .22; }
}
.tease-ghost.rave { animation: ghost-rave 2.8s linear; }

/* ---------- gallery ---------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1.4rem, 3.5vw, 2.6rem);
}
.frame { position: relative; }
/* the light-fade is UNCHANGED — same opacity curve, same feel — it just
   lives on the img and border instead of the whole figure, so the photo
   rectangle itself (.frame-inner, painted page-black) stays opaque.
   when two drifting frames cross, the lower one now occludes the one
   above (DOM paint order) instead of both ghosting through each other.
   the figure is never painted — grid-stretched figures are taller than
   their photo and would show as black bars. */
.gallery .frame.lit-text { opacity: 1; }
.gallery .frame.lit-text .frame-inner {
  background: #040305;
  border-color: rgba(139, 107, 184, calc((.08 + var(--lit, 0) * .12) * (.045 + .955 * var(--lit, 0))));
}
.gallery .frame.lit-text .frame-inner img {
  opacity: calc(.045 + .955 * var(--lit, 0));
}
.frame-link { display: block; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.frame:nth-child(even) { margin-top: clamp(2rem, 6vw, 4rem); }
/* the wide moments: one photograph owning the full row */
.frame-wide { grid-column: 1 / -1; margin-top: clamp(1rem, 3vw, 2rem) !important; }
.frame-wide .frame-inner { aspect-ratio: 16 / 10; }
.frame-inner {
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgba(139, 107, 184, calc(.08 + var(--lit, 0) * .12));
  position: relative;
  transition: border-color .6s;
}
.frame-inner img {
  width: 100%; height: 100%; object-fit: cover;
  filter: grayscale(.3) contrast(1.04) brightness(.92);
  transform: scale(1.05);
  transition: transform 1.6s var(--ease-lux), filter 1.6s var(--ease-lux);
}
.frame-inner:hover img { transform: scale(1); filter: grayscale(0) contrast(1.04) brightness(1); }
/* quiet empty frames, waiting for the real photographs */
.ph {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(61, 44, 86, .2), transparent 75%),
    #0a0810;
}

/* ---------- contact ---------- */

.contact { padding-bottom: clamp(6rem, 12vh, 9rem); }
.contact-email {
  display: inline-block;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.3rem, 3.6vw, 2.4rem);
  letter-spacing: .02em;
  color: var(--bone); text-decoration: none;
  position: relative;
  transition: color .5s;
}
.contact-email::after {
  content: ""; position: absolute; left: 0; bottom: -.14em;
  width: 100%; height: 1px;
  background: var(--violet);
  transform: scaleX(0); transform-origin: right;
  transition: transform .8s var(--ease-lux);
}
.contact-email:hover { color: var(--violet-bright); }
.contact-email:hover::after { transform: scaleX(1); transform-origin: left; }
.socials {
  list-style: none;
  display: flex; flex-wrap: wrap; gap: clamp(1.4rem, 4vw, 2.8rem);
  margin-top: clamp(2.2rem, 5vh, 3.2rem);
}
.socials a {
  color: var(--grey); text-decoration: none;
  font-size: .6rem; letter-spacing: .32em; text-transform: uppercase;
  position: relative; padding-bottom: .3em;
  transition: color .4s;
}
.socials a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: var(--violet);
  transform: scaleX(0); transform-origin: right;
  transition: transform .6s var(--ease-lux);
}
.socials a:hover { color: var(--bone); }
.socials a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- footer ---------- */

.footer {
  display: flex; align-items: center; justify-content: center; gap: 1.4rem;
  padding: 2.4rem 1.5rem 2.8rem;
  font-size: .56rem; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(131, 124, 142, .5);
  border-top: 1px solid rgba(139, 107, 184, .08);
}
.footer-sep {
  width: 3px; height: 3px; border-radius: 50%; background: var(--violet-dim);
  position: relative;
}
/* for whoever leans in close */
.footer-sep .xo {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--serif); font-style: italic; text-transform: lowercase;
  font-size: .6rem; letter-spacing: .12em;
  color: var(--violet);
  opacity: 0; transition: opacity 1.2s var(--ease-lux);
  pointer-events: none; white-space: nowrap;
}
.footer-sep:hover { background: transparent; }
.footer-sep:hover .xo { opacity: .75; }

/* ---------- responsive ---------- */

/* narrow screens: the glow can't stay proportional to a skinny column —
   it turns into a harsh compact pillar. widen it far past the section
   edges, feather it longer, and calm the grain down. */
@media (max-width: 1024px) {
  .lit-glow {
    inset: -14% -60%;
    background: radial-gradient(ellipse 58% 42% at 50% 44%,
      rgba(122, 92, 175, .095), rgba(122, 92, 175, .03) 46%,
      rgba(122, 92, 175, .012) 62%, transparent 80%);
  }
  .hero-glow {
    inset: 14% -50%;
    background: radial-gradient(ellipse 52% 38% at 50% 50%,
      rgba(122, 92, 175, .09), rgba(122, 92, 175, .022) 50%,
      rgba(122, 92, 175, .01) 64%, transparent 80%);
  }
  #grain {
    opacity: calc(var(--gopacity, 0) * .5);
    -webkit-mask-image: radial-gradient(circle 80vmax at var(--gx, 50%) var(--gy, 50%), #000 0%, transparent 80%);
    mask-image: radial-gradient(circle 80vmax at var(--gx, 50%) var(--gy, 50%), #000 0%, transparent 80%);
  }
}

@media (max-width: 640px) {
  /* the gallery keeps its two-across rhythm on phones — tighter gap,
     softer stagger, never a single lonely column */
  .gallery-grid { gap: .9rem; }
  .frame:nth-child(even) { margin-top: 1.4rem; }
  .frame-wide { margin-top: .9rem !important; }
  .about-body { grid-template-columns: 1fr; }
  .footer { flex-direction: column; gap: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-anim, .reveal { animation: none; transition: none; opacity: 1; filter: none; transform: none; }
  .lit-text, .about-statement .w, .tease-line .w, .name { opacity: 1; }
  .gallery .frame.lit-text .frame-inner img { opacity: 1; }
  .hero-glow { animation: none; }
  .sessions-smoke::before, .sessions-smoke::after { animation: none; }
  .hero-name::after { content: none; }
  #godrays { display: none; }
  .name.ignite, .tease-ghost.blink { animation: none; }
  #grain, #dust { display: none; }
}
