/* =============================================================
   nickprojects.dev — showcase stylesheet
   ============================================================= */
:root {
  --ink: #08080b;
  --ink-1: #0d0d12;
  --ink-2: #14141b;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .17);
  --fg: #fff;
  --muted: rgba(255, 255, 255, .60);
  --faint: rgba(255, 255, 255, .38);
  --accent: #ee1b2e;
  --r: 18px;
  --r-lg: 26px;
  --gut: clamp(20px, 4.5vw, 84px);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font-family: var(--sans);
  font-size: clamp(15.5px, .4vw + 14.5px, 17px);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid #ffc531; outline-offset: 4px; border-radius: 4px; }
::selection { background: var(--accent); color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* the native cursor is used throughout — nothing to hide */

/* ---------- preloader ----------
   The wordmark fills left-to-right with real progress, then the whole screen
   splits into vertical bands that lift away to reveal the page. All transform
   and clip work, so it stays on the compositor.                            */
.pre {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.pre.is-gone { display: none; }

.pre__bands {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
}
.pre__bands i {
  display: block;
  background: var(--ink);
  transform: translateY(0);
  transition: transform .85s cubic-bezier(.76, 0, .24, 1);
  will-change: transform;
}
/* stagger from the middle outward */
.pre.is-done .pre__bands i { transform: translateY(-101%); }
.pre.is-done .pre__bands i:nth-child(1) { transition-delay: .10s; }
.pre.is-done .pre__bands i:nth-child(2) { transition-delay: .05s; }
.pre.is-done .pre__bands i:nth-child(3) { transition-delay: 0s; }
.pre.is-done .pre__bands i:nth-child(4) { transition-delay: 0s; }
.pre.is-done .pre__bands i:nth-child(5) { transition-delay: .05s; }
.pre.is-done .pre__bands i:nth-child(6) { transition-delay: .10s; }

.pre__body {
  position: relative;
  z-index: 2;
  width: 100%;
  padding-inline: var(--gut);
  text-align: center;
  transition: opacity .3s ease, transform .5s var(--ease);
}
.pre.is-done .pre__body { opacity: 0; transform: translateY(-14px); }

.pre__word {
  position: relative;
  display: inline-block;
  margin: 0 0 18px;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 118%;
  letter-spacing: -.05em;
  line-height: 1;
  font-size: clamp(2rem, 9vw, 7rem);
  color: rgba(255, 255, 255, .13);
  white-space: nowrap;
}
/* the coloured copy is revealed by width, driven by --p from JS */
.pre__fill {
  position: absolute;
  inset: 0;
  width: var(--p, 0%);
  overflow: hidden;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(100deg, var(--accent), #ff6b78 45%, #8b5cf6 80%, #3fd8f0);
  -webkit-background-clip: text;
  background-clip: text;
  background-size: 100vw 100%;
  will-change: width;
}

.pre__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--faint);
}
.pre__num { font-variant-numeric: tabular-nums; color: #fff; }

/* ---------- scroll rail ---------- */
.rail {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 900;
  background: rgba(255, 255, 255, .06);
}
.rail__fill {
  display: block;
  height: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, var(--accent), #8b5cf6 60%, #3fd8f0);
}

/* ---------- grain ---------- */
/* Static, viewport-sized. Animating a full-screen blend layer meant the
   compositor repainted the whole page every frame, which is what made the
   cursor stutter. Held still it costs one paint and looks the same. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 850;
  pointer-events: none;
  opacity: .22;
  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='.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  contain: strict;
}

/* ---------- custom cursor ---------- */
/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(18px, 2.4vw, 30px) var(--gut);
  mix-blend-mode: difference;
}
.topbar__mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -.02em;
  font-size: 1.05rem;
}
.topbar__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}
.topbar__nav { display: flex; gap: clamp(14px, 2vw, 30px); font-size: .9rem; font-weight: 500; }
.topbar__nav a { color: rgba(255,255,255,.8); transition: color .2s; }
.topbar__nav a:hover { color: #fff; }
@media (max-width: 560px) { .topbar__nav a:not(:last-child) { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 140px var(--gut) clamp(28px, 4vw, 44px);
  overflow: hidden;
  isolation: isolate;
}
#gl {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}
html.gl-on.ready #gl { opacity: 1; }
/* fallback background if WebGL is unavailable */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(70% 60% at 20% 85%, rgba(238,27,46,.35), transparent 60%),
    radial-gradient(60% 55% at 85% 20%, rgba(139,92,246,.28), transparent 62%),
    var(--ink);
}
.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(8,8,11,.55) 0%, transparent 30%, rgba(8,8,11,.55) 72%, var(--ink) 100%);
}

.hero__in { max-width: 1500px; width: 100%; margin-inline: auto; }

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(255,255,255,.82);
}
.ping {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #39d353;
  box-shadow: 0 0 0 0 rgba(57,211,83,.7);
  animation: ping 2.4s infinite;
}
@keyframes ping {
  70% { box-shadow: 0 0 0 10px rgba(57,211,83,0); }
  100% { box-shadow: 0 0 0 0 rgba(57,211,83,0); }
}

.hero__h {
  margin: 0 0 26px;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 118%;
  letter-spacing: -.045em;
  line-height: .93;
  font-size: clamp(2.6rem, 8.2vw, 8.4rem);
  text-wrap: balance;
}
.hero__h em {
  font-style: normal;
  color: transparent;
  background: linear-gradient(100deg, var(--accent), #ff6b78 40%, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero__sub { margin: 0 0 34px; max-width: 46ch; color: rgba(255,255,255,.74); font-size: clamp(1rem, 1.3vw, 1.2rem); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero__meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px clamp(20px, 3vw, 46px);
  max-width: 1500px;
  width: 100%;
  margin: clamp(44px, 7vw, 84px) auto 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  color: var(--faint);
}
.hero__meta b { color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.05rem; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 28px;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0a0a0e;
  font-size: .95rem;
  font-weight: 700;
  transition: transform .3s var(--ease), background-color .25s, color .25s;
  will-change: transform;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { background: var(--accent); color: #fff; }
.btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid var(--line-2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.4); }

/* ---------- sections ---------- */
.sect { padding: clamp(84px, 12vw, 180px) var(--gut); max-width: 1500px; margin-inline: auto; }
.sect__head { margin-bottom: clamp(36px, 5vw, 66px); }
.tag {
  display: inline-block;
  margin-bottom: 18px;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
}
.sect__h {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 115%;
  letter-spacing: -.04em;
  line-height: .96;
  font-size: clamp(2rem, 5.4vw, 4.6rem);
}

/* ---------- projects page: a drawer of folders ---------- */
.page .hero { display: none; }

.finder { max-width: 1500px; margin-inline: auto; padding: clamp(110px, 14vw, 170px) var(--gut) clamp(60px, 8vw, 110px); }
.finder__head { margin-bottom: clamp(40px, 6vw, 70px); }
.finder__h {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 118%;
  letter-spacing: -.045em;
  line-height: .96;
  font-size: clamp(2.2rem, 7vw, 5.4rem);
}
.finder__note { margin: 0; max-width: 54ch; color: var(--muted); }

.drawer { margin-bottom: clamp(40px, 6vw, 72px); }
.drawer__label {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: clamp(20px, 2.6vw, 32px);
}
.drawer__label span {
  flex: none;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--faint);
}
.drawer__label i { flex: 1; height: 1px; background: var(--line); }

.folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: clamp(16px, 2.2vw, 30px);
}
@media (min-width: 700px) {
  .folders { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

.folder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 12px 20px;
  border-radius: var(--r);
  border: 1px solid transparent;
  text-align: center;
  transition: background-color .3s ease, border-color .3s ease, transform .4s var(--ease);
}
.folder:hover { background: rgba(255, 255, 255, .04); border-color: var(--line); transform: translateY(-4px); }

/* the folder itself, built from three stacked panels */
.folder__icon {
  position: relative;
  width: clamp(88px, 11vw, 118px);
  aspect-ratio: 5 / 4;
  transform-style: preserve-3d;
}
/* back panel + its tab */
.folder__back {
  position: absolute;
  inset: 14% 0 0;
  border-radius: 8px 10px 10px 10px;
  background: color-mix(in srgb, var(--accent) 55%, #16161d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}
.folder__back::before {
  content: "";
  position: absolute;
  left: 0; top: -13%;
  width: 46%;
  height: 16%;
  border-radius: 8px 12px 0 0;
  background: inherit;
}
/* the sheet inside, peeks up on hover */
.folder__paper {
  position: absolute;
  left: 9%; right: 9%;
  top: 22%;
  height: 62%;
  border-radius: 4px;
  background: linear-gradient(180deg, #f5f5f7, #c9c9d2);
  transform: translateY(6%);
  transition: transform .45s var(--ease);
}
.folder:hover .folder__paper { transform: translateY(-16%); }
/* front panel */
.folder__front {
  position: absolute;
  inset: 30% 0 0;
  border-radius: 9px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff 8%), color-mix(in srgb, var(--accent) 62%, #000 38%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 10px 22px -14px #000;
  transform-origin: 50% 100%;
  transition: transform .45s var(--ease);
}
.folder:hover .folder__front { transform: rotateX(-16deg); }

/* padlock badge for locked projects */
.folder__lock {
  position: absolute;
  right: -6px;
  bottom: -6px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #14141b;
  border: 1px solid var(--line-2);
  color: #ffc531;
}
.folder__lock svg { width: 14px; height: 14px; }
.folder__lock--live { color: #39d353; }

.folder__name {
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.3;
  color: #fff;
  overflow-wrap: anywhere;
}
.folder__meta {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}
.folder__link { position: absolute; inset: 0; z-index: 4; border-radius: var(--r); }

.folders__empty {
  grid-column: 1 / -1;
  padding: clamp(26px, 3.4vw, 42px);
  border: 1px dashed var(--line-2);
  border-radius: var(--r);
  color: var(--faint);
  text-align: center;
  font-size: .92rem;
}

/* ---------- project cards ---------- */
.cards { display: grid; gap: clamp(14px, 1.6vw, 22px); }
@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  /* a lone project shouldn't sit in half the page looking abandoned */
  .cards > .card:only-child { grid-column: 1 / -1; min-height: clamp(340px, 40vw, 520px); }
}

.card {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  background: var(--ink-1);
  min-height: clamp(280px, 34vw, 420px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s var(--ease), border-color .4s ease;
  transform-style: preserve-3d;
}
.card:hover { border-color: var(--line-2); }

.card__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(.42) contrast(1.05);
  transform: scale(1.02);
  transition: filter .7s var(--ease), transform 1.1s var(--ease);
}
.card:hover .card__img { filter: grayscale(0) brightness(.62); transform: scale(1.07); }

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(8,8,11,.15), rgba(8,8,11,.86) 78%),
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 40%, transparent), transparent 55%);
}
/* light that follows the pointer */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity .45s ease;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.16), transparent 60%);
}
.card:hover::after { opacity: 1; }

.card__body {
  padding: clamp(24px, 3vw, 40px);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}
.card__name {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 112%;
  letter-spacing: -.035em;
  line-height: 1;
  font-size: clamp(1.5rem, 2.8vw, 2.6rem);
}
.card__state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(0,0,0,.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.86);
}
.card__state svg { width: 12px; height: 12px; }
.card__state--live { color: #39d353; border-color: rgba(57,211,83,.4); }

.card__link { position: absolute; inset: 0; z-index: 3; }

.card__bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  z-index: 2;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .6s var(--ease);
}
.card:hover .card__bar { transform: scaleX(1); }

.cards__empty {
  grid-column: 1 / -1;
  padding: clamp(30px, 4vw, 50px);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
  color: var(--faint);
  text-align: center;
}

/* ---------- closing CTA ---------- */
.cta {
  padding: clamp(90px, 14vw, 200px) var(--gut);
  max-width: 1500px;
  margin-inline: auto;
  text-align: center;
  border-top: 1px solid var(--line);
}
.cta__h {
  margin: 0 0 34px;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 118%;
  letter-spacing: -.045em;
  line-height: .95;
  font-size: clamp(2.2rem, 7vw, 6rem);
}
.cta__mail {
  display: inline-block;
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 105%;
  font-size: clamp(1rem, 2.2vw, 1.8rem);
  letter-spacing: -.02em;
  color: var(--accent);
  border-bottom: 2px solid currentColor;
  padding-bottom: 4px;
  will-change: transform;
  transition: color .25s;
}
.cta__mail:hover { color: #fff; }

/* ---------- footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  padding: 26px var(--gut) 34px;
  border-top: 1px solid var(--line);
  font-size: .84rem;
  color: var(--faint);
}

/* ---------- reveals ---------- */
.line { display: block; overflow: hidden; }
.line > span {
  display: block;
  transform: translateY(110%);
  transition: transform 1s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
[data-split].in .line > span { transform: none; }

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}
[data-reveal].in { opacity: 1; transform: none; }

.card { opacity: 0; transform: perspective(1100px) translateY(28px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), border-color .4s; }
.card.in { opacity: 1; transform: perspective(1100px) rotateX(var(--rx,0deg)) rotateY(var(--ry,0deg)); }

/* ---------- unlock page ---------- */
.unlock { min-height: 100svh; display: grid; place-items: center; padding: 24px; }
.unlock__card {
  width: min(440px, 100%);
  padding: clamp(30px, 5vw, 46px);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
  box-shadow: 0 50px 120px -60px #000;
  text-align: center;
}
.unlock__eyebrow {
  margin: 0 0 16px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #ffc531;
}
.unlock__title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 900;
  font-stretch: 112%;
  letter-spacing: -.035em;
  line-height: 1.02;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
}
.unlock__note { margin: 0 0 28px; color: var(--muted); font-size: .93rem; }
.unlock__input {
  width: 100%;
  min-height: 54px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(255,255,255,.05);
  color: #fff;
  font: inherit;
  text-align: center;
  letter-spacing: .08em;
}
.unlock__input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(238,27,46,.2); }
.unlock__btn {
  width: 100%;
  min-height: 54px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .25s var(--ease), opacity .2s;
}
.unlock__btn:hover:not(:disabled) { transform: translateY(-2px); }
.unlock__btn:disabled { opacity: .55; }
.unlock__err { margin: 16px 0 0; color: #ff6b78; font-size: .9rem; font-weight: 600; }
.unlock__back { display: inline-block; margin-top: 24px; color: var(--faint); font-size: .88rem; }
.unlock__back:hover { color: #fff; }

/* ---------- motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .grain { animation: none; }
  [data-reveal], .card { opacity: 1; transform: none; }
  .line > span { transform: none; }
}
