:root {
  --bg: #1a0fee;
  --line: #6d65ff;
  --muted: #dcd8ff;
  --accent: #6d65ff;
  --white: #ffffff;

  --rail-w: 40px;
  --pad-x: 32px;
  --nav-h: 116px;

  /* Side padding scales gradually with viewport width: ~32px at 1024, ~36px at
     1440, ~44px at 1920, reaching the 56px cap only on genuinely wide screens. */
  --side: clamp(24px, 1.34vw + 18px, 56px);

  /* Shared aspect ratio of all project media (screenshots + videos) */
  --media-ratio: 3268 / 2152;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  /* Fluid type: scales smoothly between mobile (~402px) and desktop (~1440px) */
  --fs-hero: clamp(2.875rem, 2.3rem + 2.4vw, 4.25rem);  /* 46px -> 68px */
  --fs-title: clamp(2rem, 1.61rem + 1.54vw, 3rem);      /* 32px -> 48px */

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--white);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Animated dot field behind all content (drawn on a canvas) */
.dotfield {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  display: block;
}

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

/* ---------------- Left rail ---------------- */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 32px 0;
  z-index: 30;
  background: var(--bg);
  transition: transform 0.45s var(--ease), opacity 0.35s var(--ease);
}

.rail__dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.rail__label {
  flex: 0 0 auto;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--line);
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* ---------------- Page wrapper ---------------- */
.page {
  margin-left: var(--rail-w);
  transition: margin-left 0.45s var(--ease);
}

/* ---------------- Nav (sticky) ---------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--side);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  transition: height 0.45s var(--ease), padding 0.45s var(--ease);
}

.nav__logo img { display: block; }

.nav__links {
  display: flex;
  gap: 40px;
  font-size: 14px;
  color: var(--muted);
}

.nav__links a {
  position: relative;
  transition: color 0.25s var(--ease);
}
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 1px;
  background: var(--muted);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav__links a:hover { color: var(--white); }
.nav__links a:hover::after { transform: scaleX(1); }

/* ---------------- Hero ---------------- */
.hero {
  padding: 96px var(--side);
  border-bottom: 1px solid var(--line);
  transition: padding 0.45s var(--ease);
}

.hero__text {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-hero);
  line-height: 1.15;
  color: var(--white);
  max-width: 1280px;
}

.hero__text em {
  font-style: italic;
}

/* Keep a name glued to its trailing punctuation so the comma/period never
   wraps to its own line (also survives SplitText word-splitting). */
.hero__text .nobreak {
  white-space: nowrap;
}

/* Force the heart to render as a text glyph (not the color emoji),
   sized to roughly match the x-height of the neighbouring letters */
.hero__text .heart {
  font-variant-emoji: text;
  font-style: normal;
  font-size: 0.6em;
  vertical-align: 0.04em;
}

/* Pencil: upright, tilted 30deg to the right, just taller than the "s" */
.hero__text .pencil {
  display: inline-block;
  font-variant-emoji: text;
  font-style: normal;
  font-size: 0.9em;
  margin: 0 -0.12em 0 -0.04em;
  transform: rotate(-60deg);
}

/* ---------------- Currently (status bar) ---------------- */
.currently {
  border-bottom: 1px solid var(--line);
}

/* Full-width container split into exactly three equal columns */
.currently__inner {
  display: flex;
}

.currently__col {
  flex: 1 0 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* Responsive inner padding, capped at 64px (matches the page side padding) */
  padding: 20px var(--side);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.3;
  text-transform: uppercase;
  overflow: hidden;
}
.currently__col:last-child { border-right: none; }

.currently__label {
  margin: 0;
  color: var(--accent);
}
.currently__value {
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Photo strip (marquee) ---------------- */
.strip {
  --strip-h: 200px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

/* Full-bleed viewport: photos span the entire available width and clip at the
   edges, with no side gaps (the marquee always fills the strip). */
.strip__viewport {
  height: var(--strip-h);
  overflow: hidden;
}

.strip__track {
  display: flex;
  height: 100%;
  width: max-content;
  will-change: transform;
}

.strip__item {
  height: 100%;
  flex: 0 0 auto;
  margin-right: 2px; /* 2px spacing between photos; duplicated set keeps it seamless */
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: block;
}

.strip__item img {
  height: 100%;
  width: auto;
  display: block;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}


/* ---------------- Work catalog header ---------------- */
.catalog-head {
  position: sticky;
  top: var(--nav-h);
  z-index: 15;
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 var(--side);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: 14px;
  color: var(--muted);
  transition: top 0.45s var(--ease), padding 0.45s var(--ease);
}
.catalog-head span { opacity: 0.7; }
.catalog-head__left { flex: 1; }
.catalog-head__center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.catalog-head__right { margin-left: auto; }

/* ---------------- Project rows ---------------- */
.projects {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project {
  position: relative;
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  min-height: 122px;
  padding: 0 var(--side);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.3s var(--ease), padding 0.45s var(--ease);
}

/* Invert fill sweep: a solid color panel wipes in from the left */
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.4s var(--ease);
  z-index: 0;
}
.project:hover::before,
.project:focus-visible::before { transform: scaleX(1); }

.project > * { position: relative; z-index: 1; }

.project__num {
  font-size: 14px;
  color: var(--accent);
  transition: color 0.3s var(--ease);
}

.project__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: var(--fs-title);
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--white);
  transition: transform 0.35s var(--ease), color 0.3s var(--ease);
}
.project:hover .project__title { transform: translateX(10px); }

.project__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 14px;
  color: var(--muted);
  text-align: right;
  white-space: nowrap;
  transition: color 0.3s var(--ease);
}

/* Text inverts to the background color over the swept panel */
.project:hover .project__num,
.project:focus-visible .project__num,
.project:hover .project__title,
.project:focus-visible .project__title,
.project:hover .project__meta,
.project:focus-visible .project__meta {
  color: var(--bg);
}

.project__desc { display: none; }

.project:focus-visible { outline: none; }

/* ---------------- Hover preview (cursor follow) ---------------- */
.preview {
  position: fixed;
  top: 0;
  left: 0;
  width: clamp(420px, 38vw, 640px);
  aspect-ratio: var(--media-ratio);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.94);
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
  z-index: 40;
  will-change: transform, opacity;
}
.preview.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.preview__inner {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.preview__inner img,
.preview__inner video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* placeholder shown when no media is attached yet */
.media-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--muted);
  background:
    repeating-linear-gradient(45deg, rgba(109,101,255,0.12) 0 12px, transparent 12px 24px);
}

/* ---------------- Lightbox (click modal) ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 4, 90, 0.82);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox__content {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vh, 26px);
  width: min(1480px, 94vw, calc(74vh * var(--media-ratio)));
  max-height: 94vh;
  overflow-y: auto;
  transform: scale(0.96);
  transition: transform 0.3s var(--ease);
}
.lightbox.is-open .lightbox__content { transform: scale(1); }

.lightbox__stage {
  flex: none;
  aspect-ratio: var(--media-ratio);
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}
.lightbox__stage img,
.lightbox__stage video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.lightbox__stage .media-placeholder {
  width: 100%;
  height: 100%;
}

.lightbox__info {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lightbox__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.lightbox__title {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 1.1rem + 0.8vw, 2rem);
  line-height: 1.1;
  color: var(--white);
}
.lightbox__meta {
  flex: none;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}
.lightbox__desc {
  margin: 0;
  max-width: 100%; /* small screens: same width as the video */
  font-family: var(--mono);
  font-size: clamp(0.6875rem, 0.66rem + 0.15vw, 0.8125rem);
  line-height: 1.6;
  text-transform: none;
  color: var(--muted);
  font-variant-emoji: text; /* keep ↗ etc. as text glyphs, not color emoji */
}
.lightbox__desc[hidden] { display: none; }
.lightbox__desc a {
  color: var(--white);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--white) 45%, transparent);
  white-space: nowrap;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}
.lightbox__desc a:hover { border-bottom-color: var(--white); opacity: 0.85; }

/* Larger screens: wider than before, but still narrower than the video */
@media (min-width: 769px) {
  .lightbox__desc { max-width: min(78%, 1100px); }
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--white);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.25s var(--ease);
}
.lightbox__close:hover { background: var(--line); }

/* ---------------- Photo strip lightbox ---------------- */
.photolb {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 4, 90, 0.88);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}
.photolb.is-open { opacity: 1; }
.photolb[hidden] { display: none; }

.photolb__figure {
  margin: 0;
  max-width: min(92vw, 1600px);
  max-height: 88vh;
  display: flex;
}
.photolb__img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 2px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
}

.photolb__close,
.photolb__nav {
  position: absolute;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
  cursor: pointer;
  border-radius: 50%;
  line-height: 1;
  transition: background-color 0.25s var(--ease);
}
.photolb__close {
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  font-size: 26px;
}
.photolb__nav {
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 30px;
}
.photolb__prev { left: 24px; }
.photolb__next { right: 24px; }
.photolb__close:hover,
.photolb__nav:hover { background: rgba(255, 255, 255, 0.16); }

@media (max-width: 768px) {
  .photolb__nav { width: 42px; height: 42px; font-size: 24px; }
  .photolb__prev { left: 10px; }
  .photolb__next { right: 10px; }
}

/* ---------------- Responsive: tablet / mobile ---------------- */
@media (max-width: 768px) {
  :root { --pad-x: 24px; --nav-h: 92px; --side: 24px; }

  .rail {
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
  }

  .page { margin-left: 0; }

  /* Hide the cursor-follow preview on touch / small screens; use lightbox instead */
  .preview { display: none; }

  /* Stack the "Currently" columns on small screens */
  .currently__inner { flex-direction: column; }
  .currently__col {
    flex: none; /* reset desktop equal-thirds flex so height sizes to content */
    padding: 16px var(--side);
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .currently__col:last-child { border-bottom: none; }

  /* Stack the footer on small screens with comfortable edge spacing.
     Uses .page prefix so it beats the base .footer rule that is defined
     later in the stylesheet. */
  .page .footer {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 12px;
    height: auto;
    padding: 32px var(--side);
  }
  .page .footer__credit { text-align: left; }

  /* Scale the photo strip down proportionally on small screens */
  .strip { --strip-h: 140px; }

  .catalog-head__center { left: auto; right: var(--pad-x); transform: none; }
  .catalog-head__right { display: none; }

  /* Stacked project rows: title over horizontal meta, no number */
  .project {
    grid-template-columns: 1fr;
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    padding: 24px var(--pad-x);
  }
  .project__num { display: none; }
  .project:hover .project__title { transform: none; }

  .project__meta {
    flex-direction: row;
    align-items: flex-start;
    gap: 16px;
    text-align: left;
  }

  /* Lightbox: stack project name above the meta */
  .lightbox__head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

@media (hover: none) {
  /* Touch devices never get the cursor preview */
  .preview { display: none; }
  .project:hover .project__title { transform: none; }
}

/* ---------------- Footer ---------------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 120px;
  padding: 0 var(--side);
  font-family: var(--mono);
  font-size: 14px;
  text-transform: uppercase;
}
.footer__email {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}
.footer__email-underline {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.footer__email:hover .footer__email-underline { text-decoration-thickness: 2px; }
.footer__credit {
  margin: 0;
  text-align: right;
  color: rgba(220, 216, 255, 0.5);
}
.footer__heart {
  font-variant-emoji: text; /* render the unicode heart as a glyph, not emoji */
  font-style: normal;
  color: inherit;
  font-size: 1.8em;
  line-height: 1;
  vertical-align: -0.1em;
}

/* ---------------- Custom cursor ---------------- */
/* Registered so the scale can be smoothly transitioned while it lives inside
   the same transform that JS updates for the spring-follow position. */
@property --cursor-scale {
  syntax: "<number>";
  inherits: false;
  initial-value: 1;
}

.cursor {
  position: fixed;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px; /* center on the pointer */
  border-radius: 50%;
  background: #ffdd2d;
  /* Blend with the page so content stays visible and shifts color underneath —
     a moving color filter rather than an opaque dot. */
  mix-blend-mode: difference;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  transform: translate3d(var(--cursor-x, 50vw), var(--cursor-y, 50vh), 0)
    scale(var(--cursor-scale));
  will-change: transform;
  transition: opacity 0.2s ease,
    --cursor-scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cursor.is-active { opacity: 1; }

/* Grow over interactive elements: 64 / 48 = 1.3333 */
.cursor.is-hover { --cursor-scale: 1.3333; }
/* Press: shrink, then spring back on release */
.cursor.is-down { --cursor-scale: 0.78; }
.cursor.is-hover.is-down { --cursor-scale: 1.05; }

/* Hide the native cursor only when the custom one is active */
html.has-custom-cursor,
html.has-custom-cursor * { cursor: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
