/* IGNACIO VALDES — painting portfolio
   Design lives here. Layout: masthead + nav on the left, content on the right. */

:root {
  --ink:        #111111;
  --ink-soft:   #555555;
  --ink-faint:  #8a8a8a;
  --paper:      #ffffff;
  --rule:       #e4e4e4;
  --accent:     #111111;

  --nav:   "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body:  "Helvetica Neue", Helvetica, Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;

  --sidebar: 15.5rem;
  --gutter:  clamp(1.25rem, 4vw, 3.5rem);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ededed; --ink-soft: #b0b0b0; --ink-faint: #7d7d7d;
    --paper: #0d0d0d; --rule: #262626; --accent: #ededed;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--body);
  letter-spacing: 0.01em;
}

a { color: inherit; }
a:hover { color: var(--ink-soft); }

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

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  gap: var(--gutter);
  max-width: 78rem;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4.5rem) var(--gutter) 6rem;
  align-items: start;
}

/* ---------- masthead + nav ---------- */

.masthead {
  grid-column: 1;
  position: sticky;
  top: clamp(2rem, 5vw, 4.5rem);
}

.sitename {
  margin: 0 0 2.25rem;
  font: 700 1.375rem/1.15 var(--nav);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sitename a { text-decoration: none; }

.nav { font: 400 0.75rem/1 var(--nav); letter-spacing: 0.11em; text-transform: uppercase; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav > ul > li { margin-bottom: 1rem; }

.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  display: inline-block;
  padding: 0.15rem 0;
  border-bottom: 1px solid transparent;
  transition: color 120ms ease, border-color 120ms ease;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 700; }

.nav .sub { margin: 0.65rem 0 0 0; padding-left: 0.9rem; border-left: 1px solid var(--rule); }
.nav .sub li { margin-bottom: 0.6rem; }
.nav .sub a {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--ink-faint);
}
.nav .sub a[aria-current="page"] { color: var(--ink); }

/* ---------- content ---------- */

.content { grid-column: 2; min-width: 0; }

/* section heading: sentence case, set in the ink rather than shouted in caps */
.page-title {
  margin: 0 0 2rem;
  font: 700 0.85rem/1.3 var(--nav);
  letter-spacing: 0.02em;
  color: var(--ink);
}

.prose { max-width: var(--measure); font-size: 0.95rem; line-height: 1.75; }
.prose.essay { font-family: var(--serif); font-size: 1.02rem; line-height: 1.8; max-width: 38rem; }
.prose + .prose { margin-top: 1.5rem; }
.prose strong { font-weight: 700; }
.prose a { text-decoration: underline; text-underline-offset: 0.15em; }

.block + .block { margin-top: 3rem; }

.note { margin: 2.5rem 0 0; font: italic 400 0.85rem/1.5 var(--nav); color: var(--ink-faint); }

/* ---------- galleries ----------
   Every cell is the same height and the image is contained inside it, so mixed
   crops line up on a shared baseline instead of stepping up and down. */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 2rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gallery li { margin: 0; }

.gallery button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}
.gallery .frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--rule);
}
.gallery img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  transition: opacity 140ms ease;
}
.gallery button:hover img { opacity: 0.82; }

/* the works index runs at a larger plate with a fuller caption */
.gallery.works { grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 3rem 1.5rem; }
.gallery.works .frame { aspect-ratio: 5 / 4; }
.gallery.featured { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); }
.gallery.featured .frame { aspect-ratio: 1 / 1; }

.single { margin: 0; }
.single img { width: 100%; max-width: 44rem; }
.single figcaption,
.caption {
  margin: 0.6rem 0 0;
  font: 400 0.72rem/1.5 var(--nav);
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.caption strong { color: var(--ink); font-weight: 400; }

/* ---------- video ---------- */

.embed {
  position: relative;
  width: 100%;
  max-width: 48rem;
  aspect-ratio: 16 / 9;
  background: #000;
}
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* the film is the first thing on the home page, so it runs the full column */
.hero .embed { max-width: none; }

/* ---------- record lists (exhibitions, texts, CV) ---------- */

.record-list { list-style: none; margin: 0; padding: 0; }
.record-list li { border-top: 1px solid var(--rule); }
.record-list li:last-child { border-bottom: 1px solid var(--rule); }
.record-list a,
.record-list .row {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 1rem 0;
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.5;
}
.record-list .year { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.record-list .place { color: var(--ink-faint); }

.record-list.texts a { grid-template-columns: minmax(0, 1fr) minmax(0, 11rem) 3rem; }
.record-list.texts .by { color: var(--ink-faint); font-size: 0.72rem; letter-spacing: 0.04em; }
.record-list.texts .year { text-align: right; font-size: 0.72rem; }

/* CV: a year rail instead of a wall of line breaks */
.cv { margin-top: 3rem; }
.cv h3 {
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  font: 700 0.85rem/1.3 var(--nav);
  letter-spacing: 0.02em;
}
.cv ul { list-style: none; margin: 0; padding: 0; }
.cv li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.5;
}
.cv .year { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.cv .place { color: var(--ink-faint); }

.cv.collections ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 0.5rem 1.5rem;
}
.cv.collections li { display: block; padding: 0; }

/* ---------- index cards (section landing pages) ---------- */

.child-list { list-style: none; margin: 2.5rem 0 0; padding: 0; }
.child-list li { border-top: 1px solid var(--rule); }
.child-list li:last-child { border-bottom: 1px solid var(--rule); }
.child-list a {
  display: block;
  padding: 1rem 0;
  text-decoration: none;
  font-size: 0.9rem;
  color: var(--ink);
}
.child-list a:hover { color: var(--ink-soft); }

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  place-items: center;
  /* override the UA's fit-content sizing on <dialog> so the sheet fills the viewport */
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 2rem;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.92); }
.lightbox img { max-width: min(94vw, 1400px); max-height: 88vh; width: auto; }
.lightbox figcaption {
  margin-top: 0.9rem;
  text-align: center;
  color: #cfcfcf;
  font: 400 0.75rem/1.5 var(--nav);
  letter-spacing: 0.05em;
}
.lightbox .close,
.lightbox .prev,
.lightbox .next {
  position: fixed;
  background: none;
  border: 0;
  color: #fff;
  font: 400 2rem/1 var(--nav);
  cursor: pointer;
  padding: 1rem;
  opacity: 0.65;
}
.lightbox .close:hover,
.lightbox .prev:hover,
.lightbox .next:hover { opacity: 1; }
.lightbox .close { top: 0.5rem; right: 0.5rem; }
.lightbox .prev { left: 0.5rem; top: 50%; transform: translateY(-50%); }
.lightbox .next { right: 0.5rem; top: 50%; transform: translateY(-50%); }

/* ---------- responsive ---------- */

@media (max-width: 60rem) {
  .shell { grid-template-columns: 1fr; gap: 2.5rem; padding-bottom: 4rem; }
  .masthead, .content { grid-column: 1; position: static; }
  .sitename { margin-bottom: 1.25rem; }
  .nav > ul { display: flex; flex-wrap: wrap; gap: 0 1.5rem; }
  .nav > ul > li { margin-bottom: 0.5rem; }
  .nav .sub { display: none; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1.5rem 1rem; }
  .gallery.works { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 2rem 1rem; }
  .record-list.texts a { grid-template-columns: minmax(0, 1fr) 3rem; }
  .record-list.texts .by { display: none; }
  .cv li { grid-template-columns: 4.5rem minmax(0, 1fr); gap: 0.75rem; }
}
