:root {
  --rose: #e0457b;
  --bg: #0b0c0f;
  --bg-2: #15161b;
  --fg: #f3f2ef;
  --dim: #93939c;
  --line: #25262d;
  --gap: 16px;
  --rowunit: 4px;
  --maxw: 1640px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }

/* ---------- house-style chrome ---------- */
.rose-strip {
  position: sticky; top: 0; z-index: 30;
  height: 6px; width: 100%;
  background: var(--rose);
}
.masthead {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.4rem, 6vw, 4.5rem) clamp(1rem, 4vw, 3rem) clamp(1.6rem, 4vw, 2.8rem);
}
.masthead h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5.4vw, 4.2rem);
  letter-spacing: -0.02em;
  line-height: 1.02;
}
.masthead .subhead {
  margin-top: 0.85rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: clamp(0.5rem, 2.2vw, 1.1rem);
  letter-spacing: 0.01em;
  color: var(--dim);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .masthead { padding: clamp(1.8rem, 7vw, 3rem) 14px 1.4rem; }
  .masthead .subhead {
    white-space: normal;
    font-size: 0.9rem;
    line-height: 1.45;
    max-width: 40ch;
  }
}

/* ---------- masonry grid ---------- */
.grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem) clamp(2rem, 6vw, 4rem);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: var(--rowunit);
  grid-auto-flow: row dense;
  gap: var(--gap);
}
@media (max-width: 1180px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    --gap: 10px;
    padding: 0 12px clamp(2rem, 6vw, 4rem);
  }
}
@media (max-width: 380px) {
  .grid { --gap: 8px; padding: 0 10px 2rem; }
}

.tile {
  position: relative;
  grid-column: span 1;
  border: 1px solid var(--line);
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  cursor: zoom-in;
  transition: transform .35s cubic-bezier(.2,.7,.2,1),
              box-shadow .35s ease, border-color .25s ease;
}
.tile.wide { grid-column: span 2; }

.tile:hover { border-color: color-mix(in srgb, var(--rose) 60%, var(--line)); }

.tile .layer {
  display: block; width: 100%; height: auto;
  transition: opacity .45s ease;
}
.tile .light {
  position: absolute; inset: 0; height: 100%;
  object-fit: cover; opacity: 0;
}
.tile:hover .light { opacity: 1; }
.tile.flip .light { opacity: 1; }

/* expanded — dominant tile, neighbours reflow via grid dense */
.tile.open {
  grid-column: 1 / -1;
  cursor: zoom-out;
  border-color: var(--rose);
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.75);
  z-index: 10;
}
@media (min-width: 781px) {
  .tile.open { grid-column: span 3; }
}
.tile.open {
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.tile.open .dark { width: auto; max-width: 100%; max-height: 84vh; }
.tile.open .light { object-fit: contain; background: var(--bg); }

.grid.has-open .tile:not(.open) { opacity: .42; }
.grid.has-open .tile:not(.open):hover { opacity: 1; }

/* ---------- colophon ---------- */
.colophon {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.4rem clamp(1rem, 4vw, 3rem) 3.4rem;
  display: flex; align-items: center; gap: 1.2rem;
}
.colophon .rule {
  flex: 1; height: 2px;
  background: linear-gradient(90deg, var(--rose), transparent);
}
.colophon p {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
}

@media (prefers-reduced-motion: reduce) {
  .tile, .tile .layer { transition: none; }
}
