/* ==========================================================================
   Veykhler Portfolio — dark minimalist portfolio
   Plain CSS, mobile-first, no framework.
   ========================================================================== */

@font-face {
  font-family: "Public Sans";
  src: url("../fonts/public-sans-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #000000;
  --surface: #000000;
  --text: #fafafa;
  --text-soft: #a8a8a8;
  --text-dim: #808080;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #7aa2ff;
  --gutter: 6vw;
  --gap: 11px;
  --max-width: 3000px;
  --logo-h: 15px;
  --header-pad-y: calc(6vw + 11px);
  --header-h: calc(var(--logo-h) + 2 * var(--header-pad-y));
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (min-width: 768px) {
  :root {
    --gutter: 3vw;
    --logo-h: 20px;
    --header-pad-y: calc(1vw + 1.5px);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 300;
  line-height: 1.3;
  letter-spacing: -0.04em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.05em;
}

p {
  font-weight: 300;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}

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

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.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;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  z-index: 200;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: var(--bg);
  border-bottom: 1px solid transparent;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.wordmark img {
  display: block;
  height: var(--logo-h);
  width: auto;
}

.wordmark:hover {
  opacity: 0.75;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text);
  transition: opacity 0.25s var(--ease-out);
}

.icon-link:hover {
  opacity: 0.6;
}

.icon-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Hamburger */

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
}

.nav-toggle .bar {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  transition: transform 0.3s var(--ease-out), opacity 0.2s;
}

.nav-open .nav-toggle .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav-open .nav-toggle .bar:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Slide-down menu */

.site-nav {
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.97);
  border-bottom: 1px solid var(--line);
  padding: 12px var(--gutter) 28px;
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out), visibility 0s 0.3s;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.nav-open .site-nav {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav li + li {
  border-top: 1px solid var(--line);
}

.site-nav a {
  display: block;
  padding: 14px 0;
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--text-dim);
  transition: color 0.2s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* No-JS fallback: keep the menu reachable via :focus-within */

html.no-js .nav-toggle {
  display: none;
}

html.no-js .site-header:focus-within + .site-nav,
html.no-js .site-nav:focus-within {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.page {
  /* the gutter sits outside the content box, as in the original layout */
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main {
  min-height: 55vh;
}

/* --------------------------------------------------------------------------
   404
   -------------------------------------------------------------------------- */

.error-page {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - var(--header-h) - 240px);
  padding-top: 8vh;
  padding-bottom: 12vh;
}

.error-code {
  margin: 0;
  font-size: clamp(88px, 18vw, 260px);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: var(--text-dim);
}

.error-title {
  margin: 0.35em 0 0;
  font-size: clamp(28px, 4.4vw, 56px);
}

.error-text {
  margin: 18px 0 0;
  max-width: 46ch;
  color: var(--text-soft);
  font-size: clamp(15px, 1.3vw, 19px);
  line-height: 1.45;
}

.error-link {
  margin-top: 36px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  transition: border-color 0.35s var(--ease-out), color 0.35s var(--ease-out);
}

.error-link:hover {
  border-bottom-color: currentColor;
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   Home: project grid (mirrors the original fluid-engine layout)
   -------------------------------------------------------------------------- */

.work-grid {
  /* width the 24 columns are measured against, matching the original grid */
  --content-width: min(100vw - 2 * var(--gutter), var(--max-width));
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-auto-rows: 24px;
  gap: 0;
  padding: 0;
}

.work-grid .card {
  position: relative;
  display: block;
  overflow: hidden;
  grid-column: span 8;
  grid-row: span 6;
  background: var(--surface);
}

.work-grid .card.half {
  grid-column: span 4;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out), opacity 0.7s var(--ease-out);
}

.card:hover img,
.card:focus-visible img {
  transform: scale(1.03);
  opacity: 0.88;
}

/* hover caption: gradient scrim + project title, bottom-left */
.card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0) 100%);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
  pointer-events: none;
}

.card-caption {
  position: absolute;
  left: clamp(16px, 2vw, 28px);
  right: clamp(16px, 2vw, 28px);
  bottom: clamp(14px, 1.8vw, 24px);
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px clamp(12px, 1.5vw, 24px);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.45s var(--ease-out),
    transform 0.45s var(--ease-out);
  pointer-events: none;
}

.card-title {
  color: var(--text);
  font-size: clamp(1.05rem, 1.5vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.15;
  text-wrap: balance;
}

.card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.role {
  padding: 0.3em 0.75em;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.7rem, 0.8vw, 0.82rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.4;
  white-space: nowrap;
}

.card:hover::after,
.card:focus-visible::after,
.card:hover .card-caption,
.card:focus-visible .card-caption {
  opacity: 1;
}

.card:hover .card-caption,
.card:focus-visible .card-caption {
  transform: none;
}

/* half-width cards are too narrow for a title/roles row — stack them */
.work-grid .card.half .card-caption {
  flex-direction: column;
  align-items: flex-start;
}

/* touch devices have no hover — keep the caption permanently visible */
@media (hover: none) {
  .card::after,
  .card-caption {
    opacity: 1;
    transform: none;
  }

  /* no room for a third pill next to the title on a phone */
  .card-roles .role:nth-child(n + 3) {
    display: none;
  }
}

@media (max-width: 700px) {
  .card-caption {
    flex-direction: column;
    align-items: flex-start;
  }

  /* stacked caption is a row taller — extend the scrim to keep it legible */
  .card::after {
    height: 70%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card::after,
  .card-caption {
    transition: none;
    transform: none;
  }
}

.card .card-picture,
.card picture {
  display: block;
  height: 100%;
}

@media (min-width: 768px) {
  .work-grid {
    grid-template-columns: repeat(24, 1fr);
    /* row height scaling factor taken from the original fluid grid */
    grid-auto-rows: calc(var(--content-width) * 0.0215);
  }

  /* areas copied from the original 24-column fluid grid */
  .work-grid .card.card-rocket    { grid-area: 1 / 1 / 12 / 17; }
  .work-grid .card.card-teelio    { grid-area: 1 / 17 / 12 / 25; }
  .work-grid .card.card-moonboots { grid-area: 12 / 1 / 23 / 9; }
  .work-grid .card.card-424       { grid-area: 12 / 9 / 23 / 17; }
  .work-grid .card.card-product   { grid-area: 12 / 17 / 23 / 25; }
  .work-grid .card.card-fortnite  { grid-area: 23 / 1 / 34 / 13; }
  .work-grid .card.card-nike      { grid-area: 23 / 13 / 34 / 25; }
}

/* --------------------------------------------------------------------------
   Project pages
   -------------------------------------------------------------------------- */

.project-hero {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  overflow: hidden;
}

.project-hero img,
.project-hero video {
  width: 100%;
}

.project-header {
  padding: clamp(28px, 5vw, 56px) 0 8px;
  max-width: 1100px;
}

.project-header h1 {
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1.1;
  margin: 0 0 8px;
  color: var(--text-soft);
}

.project-meta {
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  padding: 20px 0 40px;
  margin-bottom: 40px;
}

@media (min-width: 768px) {
  .project-meta {
    grid-template-columns: 2fr 1fr 1fr;
  }

  .project-meta.cols-4 {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.project-meta h2 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 10px;
}

.project-meta p {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 0.98rem;
}

/* same pills as the card hover captions, listing every role on the project */
.role-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.client-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.client-logos img {
  max-height: 56px;
  width: auto;
  object-fit: contain;
}

/* Gallery */

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding-bottom: calc(var(--gap) * 2);
}

.gallery.gutter-0 {
  gap: 0;
}

.gallery.gutter-14 {
  gap: 14px;
}

/* same 100vw breakout as .project-hero */
.gallery.full-bleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* edge-to-edge gutterless bands stack seamlessly */
.gallery.full-bleed.gutter-0 {
  padding-bottom: 0;
}

@media (max-width: 767.98px) {
  .gallery.cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .gallery.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery.cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* overflow clips the blur-up scale(1.02) on full-bleed images */
.gallery figure {
  margin: 0;
  overflow: hidden;
  background: var(--surface);
}

.gallery a {
  display: block;
  cursor: zoom-in;
  transition: opacity 0.35s var(--ease-out);
}

.gallery a:hover {
  opacity: 0.9;
}

/* aspect crop, all widths */

.gallery[class*="ar-"] a,
.gallery[class*="ar-"] picture {
  display: block;
  height: 100%;
}

.gallery[class*="ar-"] img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery.ar-square figure {
  aspect-ratio: 1 / 1;
}

.gallery.ar-43 figure {
  aspect-ratio: 4 / 3;
}

.gallery.ar-169 figure {
  aspect-ratio: 16 / 9;
}

/* 2.4:1 — Squarespace's anamorphic-widescreen */
.gallery.ar-239 figure {
  aspect-ratio: 12 / 5;
}

.section-heading {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 48px 0 18px;
}

.video-block video {
  width: 100%;
  background: var(--surface);
}

/* Squarespace fluid grid: 14 of 24 cells, centered */
@media (min-width: 768px) {
  .video-block.narrow {
    width: 58.33%;
    margin-inline: auto;
  }
}

.process-block {
  padding: 40px 0 calc(var(--gap) * 2);
}

.block-caption {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin: 0 0 14px;
}

.video-cell video {
  width: 100%;
  background: var(--surface);
}

.video-row {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 1fr;
  align-items: end;
  padding-bottom: calc(var(--gap) * 2);
}

@media (min-width: 768px) {
  .video-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.back-link {
  display: inline-block;
  margin: 24px 0 64px;
  color: var(--text-dim);
  font-size: 0.95rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--text);
}

/* --------------------------------------------------------------------------
   Blur-up / LQIP
   -------------------------------------------------------------------------- */

.blur-up {
  background-size: cover;
  background-position: center;
}

html.js .blur-up {
  opacity: 0;
  filter: blur(14px);
  transform: scale(1.02);
  transition: opacity 0.6s var(--ease-out), filter 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

html.js .blur-up.loaded {
  opacity: 1;
  filter: blur(0);
  transform: none;
}

/* images with an alpha channel: the LQIP would show through the transparent
   pixels, so they fade in without one */
.blur-up.no-lqip {
  background-image: none;
}

html.js .blur-up.no-lqip:not(.loaded) {
  filter: none;
  transform: none;
}

/* keep card hover working after load */
html.js .card .blur-up.loaded {
  transition: transform 0.7s var(--ease-out), opacity 0.7s var(--ease-out), filter 0.8s var(--ease-out);
}

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  filter: blur(6px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out),
    filter 0.7s var(--ease-out);
  transition-delay: calc(var(--reveal-delay, 0) * 90ms);
  will-change: opacity, transform, filter;
}

html.js .reveal.revealed {
  opacity: 1;
  transform: none;
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  html.js .reveal {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }

  html.js .blur-up {
    opacity: 1;
    filter: none;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }

  .card img {
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Footer — blue→purple gradient (original Squarespace artwork as backdrop)
   -------------------------------------------------------------------------- */

.site-footer {
  /* original site artwork, focal point 50% / 80% like the Squarespace section;
     blue→purple gradient underneath as a fallback while it loads */
  background:
    url("../images/site/gradient-footer.webp") 50% 80% / cover no-repeat,
    linear-gradient(100deg, #1428c8 0%, #4b2bd6 45%, #7a30d8 75%, #a13ae0 100%);
  color: #fff;
}

.footer-inner {
  max-width: calc(var(--max-width) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) var(--gutter) clamp(28px, 4vw, 48px);
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (min-width: 768px) {
  .footer-top {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
  }
}

.footer-tagline {
  font-size: clamp(1.15rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  margin: 0;
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1rem;
}

.footer-contact a {
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  transition: border-color 0.2s;
}

.footer-contact a:hover {
  border-color: #fff;
}

.footer-contact .icon-link {
  color: #fff;
}

.footer-copyright {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.96);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.lightbox.open {
  display: flex;
}

.lightbox img {
  max-width: min(94vw, 1800px);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
}

.lightbox button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}

.lightbox button:hover {
  background: rgba(255, 255, 255, 0.16);
}

.lightbox .lb-close {
  top: 16px;
  right: 16px;
}

.lightbox .lb-prev {
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox .lb-next {
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox .lb-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

@media (max-width: 600px) {
  .lightbox .lb-prev,
  .lightbox .lb-next {
    display: none; /* swipe instead */
  }
}

body.lightbox-locked {
  overflow: hidden;
}
