/* ==========================================================
   O.P. — Art Gallery
   Style after mecha-xyz (see reference/mecha-xyz/REPORT.md)
   Flecha M -> Instrument Serif, Neue Haas Grotesk -> Inter
   ========================================================== */
:root {
  /* palette */
  --white: #ffffff;
  --ink: #262933;            /* graphite, all text */
  --ink-45: #26293373;       /* secondary text */
  --ink-60: #262933a3;       /* secondary text on small screens (better contrast) */
  --mist-100: #e9edef;       /* image backing */
  --mist-200: #d3dbde;       /* Grey Gallery background */
  --sand: #e9e7db;           /* About background */
  --maroon: #911a46;         /* the only accent */
  --stroke: #00000026;       /* 1px hairlines */

  /* type */
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --heading-l: 5rem;
  --heading-m: 3.75rem;
  --title-l: 3rem;
  --body-l: 1rem;
  --caption: .625rem;

  /* layout */
  --pad: 1.75rem;
  --col: 52rem;              /* text column width */

  /* motion */
  --ease-ui: cubic-bezier(.7, 0, .3, 1);
}

/* Fluid rem: the whole layout scales with the window (991→1440 = 11→16px) */
html { font-size: clamp(11px, 1.111vw, 21px); }
@media (max-width: 991px) { html { font-size: 16px; } }

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--body-l);
  line-height: 1.44;
  letter-spacing: .02em;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body.page-grey { background: var(--mist-200); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }

/* ---------- Type ---------- */
.heading-l, .heading-m {
  font-family: var(--serif); font-weight: 400;
  line-height: 1.05; letter-spacing: .01em;
  margin: 0;
}
.heading-l { font-size: var(--heading-l); }
.heading-m { font-size: var(--heading-m); }
.caption {
  font-size: var(--caption); line-height: 1.5; letter-spacing: .01em;
  text-transform: uppercase;
}

.nowrap { white-space: nowrap; }

/* ---------- Header ---------- */
/* logo and menu are fixed separately: the logo's blend mode only works
   when it is not inside a fixed parent */
.logo {
  position: fixed; top: var(--pad); left: var(--pad); z-index: 20;
  font-family: var(--sans); font-weight: 500; font-size: 1.5rem; letter-spacing: .02em; line-height: 1;
  color: #fff; mix-blend-mode: difference;   /* stays readable over text and images */
}
.topnav { position: fixed; top: var(--pad); right: var(--pad); z-index: 20; display: flex; }
.topnav a {
  font-size: var(--caption); text-transform: uppercase; letter-spacing: .01em; white-space: nowrap;
  padding: .55em .9em; border: 1px solid var(--ink); margin-left: -1px;
  background: var(--white);
  transition: background .5s var(--ease-ui), color .5s var(--ease-ui);
}
.page-grey .topnav a { background: var(--mist-200); }
.topnav a[aria-current="page"] { background: var(--ink); color: var(--white); }
@media (hover: hover) { .topnav a:hover { background: var(--ink); color: var(--white); } }
.logo, .topnav { transition: transform .6s var(--ease-ui); }

/* soft blurred band behind the fixed header (shown on small screens) */
.header-band {
  position: fixed; top: 0; left: 0; right: 0; z-index: 19; pointer-events: none;
  height: 5.25rem; display: none;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  -webkit-mask-image: linear-gradient(#000 55%, transparent);
          mask-image: linear-gradient(#000 55%, transparent);
  transition: transform .6s var(--ease-ui);
}

/* ---------- Background change layer ---------- */
.bg-layer {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--sand); opacity: 0;
}

/* ---------- Intro ---------- */
.intro {
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding: calc(var(--pad) * 4) var(--pad);
}
.intro__text {
  font-family: var(--serif); font-size: var(--title-l);
  line-height: 1.32; letter-spacing: .015em; word-spacing: .05em;
  max-width: var(--col);
}
.intro--grey { flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: calc(var(--pad) * 2); }
.intro--404 { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1.5rem; }
.notfound__code { color: var(--ink-45); }
.grey__title { width: 100%; padding-bottom: calc(var(--pad) * 1.5); border-bottom: 1px solid var(--stroke); }

/* ---------- Grey Gallery ---------- */
.grey { padding: 0 var(--pad); }
.piece {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: calc(var(--pad) * 2); align-items: end;
  padding: calc(var(--pad) * 3) 0 30vh;
  border-top: 1px solid var(--stroke);
}
.piece:last-child { padding-bottom: calc(var(--pad) * 5); }
/* every second piece mirrors: text left, image right */
.piece:nth-child(even) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); }
.piece:nth-child(even) .piece__media { order: 2; }
.piece__media { overflow: hidden; display: flex; justify-content: center; }
/* width + height attributes reserve the space before the lazy image loads */
.piece__media img { width: 100%; height: auto; max-height: 80vh; object-fit: contain; }
.piece__media--clear img { max-height: 70vh; }
/* objects collage: tall sticker photo left, two squares stacked right */
.piece__media--collage {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--pad); align-items: start;
}
.collage__item { margin: 0; overflow: hidden; }
.collage__item img { width: 100%; height: auto; max-height: none; display: block; }
.collage__item--tall { grid-row: span 2; }

/* credits: a quiet footnote, not a call to action */
.credits {
  margin-top: 1rem;
  font-size: .75rem; line-height: 1.5; letter-spacing: .01em;
  color: var(--ink-45);
}
.credits a {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
  text-decoration-color: currentColor;
}
/* video: 16:9, thin border, poster + Play overlay until the viewer starts it */
.piece--video .piece__media { display: block; }
.video { position: relative; aspect-ratio: 16 / 9; border: 1px solid var(--stroke); background: #1b1d24; }
.video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.video__play {
  position: absolute; left: 1rem; bottom: 1rem;
  display: inline-flex; align-items: center; gap: .7rem;
  padding: .7rem 1.1rem .7rem .9rem; min-height: 44px;
  font: inherit; color: var(--ink); background: var(--mist-100);
  border: 1px solid var(--ink); border-radius: 0; cursor: pointer;
  transition: background .5s var(--ease-ui), color .5s var(--ease-ui);
}
.video__icon {
  width: 0; height: 0;
  border-style: solid; border-width: .38rem 0 .38rem .62rem;
  border-color: transparent transparent transparent currentColor;
}
.video__time { color: var(--ink-60); margin-left: .35em; transition: color .5s var(--ease-ui); }
.video__play:active, .video__play:focus-visible { background: var(--ink); color: var(--mist-100); }
.video__play:active .video__time, .video__play:focus-visible .video__time { color: inherit; }
@media (hover: hover) {
  .video__play:hover { background: var(--ink); color: var(--mist-100); }
  .video__play:hover .video__time { color: inherit; }
}
.video.is-playing .video__play { opacity: 0; pointer-events: none; }

.piece__text { display: grid; gap: 1rem; max-width: 30rem; padding-bottom: .25rem; }
.piece__num { color: var(--ink-45); }
.piece__meta { color: var(--ink-45); }
.piece__desc { font-size: 1.125rem; line-height: 1.5; letter-spacing: .01em; margin-top: .5rem; }
.inline-link { border-bottom: 1px solid currentColor; transition: color .5s var(--ease-ui); }
.inline-link:hover { color: var(--maroon); }

/* ---------- Gallery ---------- */
.gallery { padding: 0 var(--pad); }
.gallery__title {
  padding: calc(var(--pad) * 2) 0 calc(var(--pad) * 3);
  border-top: 1px solid var(--stroke);
}
.work { padding-bottom: 50vh; }
.work:last-child { padding-bottom: calc(var(--pad) * 5); }
.work__media {
  background: var(--mist-100); overflow: hidden;
  display: flex; justify-content: center;
}
/* height is fixed so the space is reserved before the lazy image loads */
.work__media img { height: 88vh; width: auto; max-width: 100%; object-fit: contain; }
/* long horizontal canvases (photo cropped to the painting's format) */
.work--wide .work__media { background: transparent; }
.work--wide .work__media img { width: 100%; height: auto; max-height: 88vh; }
.work__caption {
  display: grid; grid-template-columns: 1fr auto; column-gap: var(--pad); row-gap: .6rem;
  align-items: end;
  padding-top: 1.25rem;
}
.work__caption .heading-m { grid-column: 1; }
.work__meta { grid-column: 1; color: var(--ink-45); }
.work__sold { grid-column: 2; grid-row: 1 / span 2; align-self: end; color: var(--ink); }

/* ---------- About ---------- */
.about {
  min-height: 80vh;
  padding: calc(var(--pad) * 3) var(--pad) calc(var(--pad) * 5);
  border-top: 1px solid var(--stroke);
}
.about__label { margin-bottom: 2rem; }
.about__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
  gap: calc(var(--pad) * 2); align-items: start;
}
.about__text {
  font-family: var(--serif); font-size: var(--title-l);
  line-height: 1.32; letter-spacing: .015em; word-spacing: .05em;
  max-width: var(--col);
}
.about__photo { background: var(--mist-100); overflow: hidden; }
.about__photo img { width: 100%; height: auto; }

/* ---------- Footer ---------- */
.footer { padding: var(--pad); border-top: 1px solid var(--stroke); overflow: hidden; }
.footer__links {
  display: flex; justify-content: space-between; align-items: baseline; gap: var(--pad); flex-wrap: wrap;
}
.footer__cta {
  font-family: var(--serif); font-size: var(--heading-m); line-height: 1;
  transition: color .5s var(--ease-ui);
}
@media (hover: hover) { .footer__cta:hover { color: var(--maroon); } }
.footer__cta:active { color: var(--maroon); }
.footer__links a.email { border-bottom: 1px solid currentColor; text-transform: none; }
.footer__name {
  font-family: var(--sans); font-weight: 500;
  font-size: 28vw; line-height: .8; letter-spacing: 0;
  opacity: .1; margin-top: 3rem; white-space: nowrap;
  /* decorative: the huge glyphs overflow upward over the footer link, so let clicks pass through */
  pointer-events: none; user-select: none;
}

/* ---------- Motion: initial states (JS only) ---------- */
.js [data-fade] { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .js [data-fade] { opacity: 1; }
}

/* ---------- Tablet / mobile ---------- */
@media (max-width: 991px) {
  :root { --heading-l: 3.75rem; --heading-m: 2.75rem; --title-l: 1.75rem; --caption: .6875rem; --pad: 1.25rem; }
}
@media (max-width: 767px) {
  :root { --heading-l: 2.5rem; --heading-m: 2.25rem; --title-l: 1.375rem; --caption: .75rem; }

  /* header: blurred band, bigger tap targets, hides while scrolling down */
  .header-band { display: block; background: #ffffffa6; }
  .page-grey .header-band { background: #d3dbdea6; }
  /* over the band a plain ink logo reads better than the difference blend */
  .logo { font-size: 1.25rem; top: 1.4rem; color: var(--ink); mix-blend-mode: normal; }
  .topnav { top: 1rem; }
  .topnav a { padding: .85em 1em; letter-spacing: .02em; }
  html.nav-hidden .logo,
  html.nav-hidden .topnav,
  html.nav-hidden .header-band { transform: translateY(-140%); }

  /* secondary text: a bit darker so 12px captions stay readable */
  .work__meta, .piece__meta, .piece__num { color: var(--ink-60); }

  /* intro screens */
  .intro { padding-top: 7rem; padding-bottom: 4rem; }
  .intro--grey { min-height: 0; padding-top: 9rem; }

  /* Main Gallery: paintings go edge to edge for maximum size */
  .work { padding-bottom: 22svh; }
  .work__media { margin: 0 calc(var(--pad) * -1); }
  .work__media img { height: auto; width: 100%; max-height: none; }
  .work__caption { grid-template-columns: 1fr; padding-top: 1rem; }
  .work__sold { grid-column: 1; grid-row: auto; }
  .gallery__title { padding: 2.5rem 0 2.5rem; }

  .about { min-height: 0; }
  .about__grid { grid-template-columns: 1fr; }

  /* Grey Gallery */
  .piece, .piece:nth-child(even) { grid-template-columns: 1fr; gap: var(--pad); padding: 2.5rem 0 16svh; }
  .piece:nth-child(even) .piece__media { order: 0; }
  .piece__media img, .piece__media--clear img { max-height: none; width: 100%; }
  .piece__media--clear img { width: 80%; }
  .piece__media--collage { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .collage__item--tall { grid-column: 1 / -1; grid-row: auto; }
  .piece__text { gap: .75rem; max-width: none; }
  .piece__desc { font-size: 1.0625rem; }
  .credits { font-size: .8125rem; color: var(--ink-60); }
  .video__play { left: .6rem; bottom: .6rem; padding: .5rem .85rem .5rem .75rem; gap: .55rem; }

  /* footer */
  .footer__links { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .footer__links .caption { font-size: .8125rem; }
  .footer__links a.email { display: inline-block; padding: .35rem 0; font-size: 1rem; }
  .footer__name { font-size: 46vw; margin-top: 2.5rem; }
}
