body {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  background: #f3f1ec;
  color: #111;
  overflow-x: hidden;
}

/* HEADER */
.header {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  box-sizing: border-box;
  z-index: 1000;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

.header nav a {
  margin-left: 20px;
  text-decoration: none;
  color: #111;
}

/* GALLERY */
.gallery {
  margin-top: 110px;
  width: min(92vw, 980px);
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 120px;
}

.artwork {
  margin-bottom: 120px;

  --shift-x: 0px;
  --shift-y: 0px;
  --skew-x: 0deg;
  --skew-y: 0deg;
  --scale-x: 1;
  --scale-y: 1;

  --frame-shift-x: 0px;
  --frame-shift-y: 0px;
  --frame-skew: 0deg;
}

/* IMAGE WRAPPER */
.image-wrap {
  position: relative;
  overflow: visible;
  background: #ddd;
  isolation: isolate;
}

/* FRAME (independent glitch layer) */
.frame {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(0,0,0,0.11);
  pointer-events: none;
  z-index: 5;
  transform:
    translate(var(--frame-shift-x), var(--frame-shift-y))
    skewX(var(--frame-skew));
  transition: transform 90ms ease, border-color 90ms ease;
}

.artwork.glitching .frame {
  border-color: rgba(0,0,0,0.18);
}

/* IMAGE */
.glitch-img {
  width: 100%;
  display: block;
  position: relative;
  z-index: 1;
  transition: transform 100ms ease, filter 100ms ease;
  will-change: transform, filter;
}

/* GLITCH STATE (with temporary overscan) */
.artwork.glitching .glitch-img {
  transform:
    translateX(var(--shift-x))
    translateY(var(--shift-y))
    skewX(var(--skew-x))
    skewY(var(--skew-y))
    scaleX(var(--scale-x))
    scaleY(var(--scale-y));
}


/* TEARS */
.tear {
  position: absolute;
  left: 0;
  width: 100%;
  height: 18px;
  background-image: var(--img);
  background-size: cover;
  background-position: center;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  mix-blend-mode: normal;
  transition: opacity 70ms ease, transform 70ms ease;
}

.tear-1 {
  z-index: 3;
}

.tear-2 {
  z-index: 4;
  height: 14px;
}

.artwork.glitching .tear {
  opacity: 1;
}

/* CAPTION */
.caption {
  margin-top: 12px;
  opacity: 0.92;
  transition: transform 90ms ease, opacity 90ms ease;
}

.caption p {
  margin: 0.2rem 0;
}

.caption strong {
  font-weight: 600;
  transition: letter-spacing 70ms ease, transform 70ms ease, text-shadow 70ms ease;
}

/* TEXT GLITCH */
.artwork.glitching .caption strong {
  text-shadow:
    1px 0 rgba(255,0,0,0.28),
    -1px 0 rgba(0,120,255,0.24);
}

.artwork.glitching .caption p:last-child {
  opacity: 0.82;
}

/* SCANLINE OVERLAY */
body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0.022),
    rgba(0,0,0,0.022) 1px,
    transparent 1px,
    transparent 4px
  );
  opacity: 0.22;
  z-index: 2000;
}

/* SITE-WIDE LINKED BLOCKS */
.artwork {
  display: block;
  text-decoration: none;
  color: inherit;
}

.text-block .caption {
  max-width: 720px;
}

/* VIDEO EMBEDS */
.video-embed {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16 / 9;
  background: #111;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* CODE BLOCKS */
pre {
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  background: rgba(0,0,0,0.045);
  padding: 18px;
  overflow-x: auto;
}

/* WORK INDEX */
.work-index {
  max-width: 860px;
}

.work-index .artwork {
  cursor: pointer;
  margin-bottom: 96px;
}

.work-index .image-wrap {
  max-width: 680px;
}

.work-index .glitch-img {
  width: 100%;
  height: auto;
}

.work-index .caption {
  max-width: 680px;
}

.work-index .caption strong {
  font-size: 1.05rem;
}

/* Magenta activation overlay for Work index */
.work-index .image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 0, 120, 0);
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: multiply;
  transition: background 140ms ease;
}

.work-index .artwork:hover .image-wrap::after {
  background: rgba(255, 0, 120, 0.13);
}

/* Work index hover activation */
.work-index .artwork:hover .glitch-img {
  transform:
    scale(1.012)
    translateX(var(--hover-jitter-x, 0px))
    translateY(var(--hover-jitter-y, 0px));
}

.work-index .artwork:hover .caption {
  transform: translateX(-3px);
}

@media (max-width: 700px) {
  .header {
    position: static;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .gallery {
    margin-top: 42px;
    width: min(92vw, 980px);
  }

  .work-index .image-wrap,
  .work-index .caption {
    max-width: 100%;
  }

  .work-index .artwork {
    margin-bottom: 72px;
  }
}


/* ===== FIXES: HEADER + WORK INDEX THUMBNAILS ===== */

/* Smaller fixed header that does not cover page content */
.header {
  min-height: 56px;
  padding: 14px 28px;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.1;
  letter-spacing: 0.045em;
}

.header nav {
  display: flex;
  align-items: center;
}

.header nav a {
  margin-left: 18px;
  font-size: 0.92rem;
  line-height: 1.1;
}

/* Give all pages enough clearance under fixed header */
.gallery {
  margin-top: 92px;
}

/* Home page text should not sit under header */
.home-page {
  max-width: 760px;
}

.home-page .text-block {
  margin-top: 0;
}

.home-page .caption {
  font-size: 1rem;
  line-height: 1.5;
}

/* Work index should read as a project list, not one huge image at a time */
.work-index {
  width: min(92vw, 1120px);
  max-width: 1120px;
}

.work-index .artwork {
  display: grid;
  grid-template-columns: minmax(180px, 320px) 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 46px;
  padding-bottom: 46px;
  border-bottom: 1px solid rgba(0,0,0,0.11);
}

.work-index .image-wrap {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #ddd;
}

.work-index .glitch-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-index .caption {
  margin-top: 0;
  max-width: 620px;
}

.work-index .caption p {
  font-size: 0.98rem;
  line-height: 1.35;
}

.work-index .caption strong {
  font-size: 1.08rem;
}

/* Brighter, more saturated magenta activation overlay */
.work-index .image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 0, 190, 0);
  pointer-events: none;
  z-index: 6;
  mix-blend-mode: screen;
  transition: background 140ms ease, opacity 140ms ease;
}

.work-index .artwork:hover .image-wrap::after {
  background: rgba(255, 0, 190, 0.36);
}

/* Work index hover activation */
.work-index .artwork:hover .glitch-img {
  transform:
    scale(1.018)
    translateX(var(--hover-jitter-x, 0px))
    translateY(var(--hover-jitter-y, 0px));
}

.work-index .artwork:hover .caption {
  transform: translateX(-3px);
}

/* On project pages keep images large, but not on the Work index */
.project-page .image-wrap {
  max-width: 900px;
}

/* Mobile: keep thumbnails visible and compact, stacked under text */
@media (max-width: 760px) {
  .header {
    position: sticky;
    top: 0;
    padding: 14px 18px;
    min-height: auto;
  }

  .header nav a {
    margin-left: 14px;
  }

  .gallery {
    margin-top: 38px;
    width: min(92vw, 980px);
  }

  .work-index {
    width: min(92vw, 980px);
  }

  .work-index .artwork {
    display: block;
    margin-bottom: 58px;
    padding-bottom: 42px;
  }

  .work-index .caption {
    margin-bottom: 14px;
  }

  .work-index .image-wrap {
    max-width: 100%;
    aspect-ratio: 4 / 3;
  }
}


/* HEADER TITLE CAPS */
.header h1 {
  text-transform: uppercase;
}

/* HOME PAGE IMAGE */
.home-image {
  max-width: 760px;
  margin-bottom: 28px;
}

.home-image img {
  width: 100%;
  height: auto;
  display: block;
}

/* INSTAGRAM SECTION */
.instagram {
  margin-top: 60px;
  opacity: 0.9;
}


/* ===== HOMEPAGE DISTINCT LAYOUT ===== */

.home-page {
  width: min(92vw, 1120px);
  max-width: 1120px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 54px;
  align-items: start;
  margin-bottom: 72px;
}

.home-hero .home-image {
  max-width: none;
  margin: 0;
}

.home-hero .home-image .image-wrap {
  max-width: 100%;
  overflow: visible;
}

.home-hero .home-image img {
  width: 100%;
  height: auto;
  display: block;
}

.home-statement {
  margin: 0;
}

.home-statement .caption {
  margin-top: 0;
  max-width: 620px;
  font-size: 1.02rem;
  line-height: 1.55;
}

.home-statement .caption p:first-child {
  margin-top: 0;
}

/* HOME PAGE: keep Instagram below as secondary */
.home-page .instagram {
  max-width: 760px;
  margin-top: 80px;
  padding-top: 28px;
  border-top: 1px solid rgba(0,0,0,0.12);
}

/* ===== PROJECT IMAGE FITTING ===== */

/* On project pages, keep full images visible on desktop instead of taller than screen */
.project-page .image-wrap {
  width: fit-content;
  max-width: 100%;
}

.project-page .glitch-img {
  width: auto;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
}

/* Work index thumbnails should keep their crop behavior */
.work-index .image-wrap {
  width: 100%;
}

.work-index .glitch-img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
}

/* Home image should not inherit project image constraints */
.home-page .glitch-img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: initial;
}

@media (max-width: 760px) {
  .home-hero {
    display: block;
  }

  .home-hero .home-image {
    margin-bottom: 32px;
  }

  .home-statement .caption {
    max-width: 100%;
  }

  .project-page .image-wrap {
    width: 100%;
  }

  .project-page .glitch-img {
    width: 100%;
    max-height: none;
  }
}
