/* ==========================================================
   site.css - shared styles for David Trautrimas' work pages
   Load the four OpenSans stylesheets in each page's <head>,
   then this file.
   ========================================================== */

:root {
  --text: #000;
  --muted: #000;   /* all type is black; set a grey here to soften secondary text */
  --bg: #fff;
  --gap: 2.25rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 40px 40px 60px 60px;
  background: var(--bg);
  color: var(--text);
  font-family: "OpenSans Regular", "Open Sans", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
}

a { color: var(--muted); text-decoration: none; }
a:hover, a:focus-visible { color: var(--text); text-decoration: underline; }

/* ---------- Header / nav ---------- */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 3rem;
  margin-bottom: 3rem;
}
.site-name { color: var(--muted); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.5rem 3rem; }
.site-nav a { font-family: "OpenSans Light", "Open Sans", Arial, sans-serif; }

/* ---------- Work page ---------- */
.work-page { max-width: var(--page-w, 1100px); }

.work-title {
  margin: 0;
  font-size: 14px;
  font-weight: normal;
  color: var(--muted);
}

.work-meta {
  margin: 0 0 2.5rem;
  font-family: "OpenSans Light", "Open Sans", Arial, sans-serif;
  color: var(--muted);
}

/* One figure = one row of images plus a shared caption */
.row { margin: 0 0 3rem; }
.row.half { max-width: calc(50% - var(--gap) / 2); }

.row-images {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
}

/* --ar (width / height) is set per image so that images in the
   same row come out the same height */
.row-images a {
  display: block;
  flex: var(--ar, 1) 1 0%;
  min-width: 0;
  cursor: zoom-in;
}

.row-images img {
  display: block;
  width: 100%;
  height: auto;
}

.row figcaption {
  margin-top: 0.6rem;
  font-family: "OpenSans Light", "Open Sans", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

a.zoom:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.statement {
  max-width: 38rem;
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.supporters { margin-top: 2.5rem; color: var(--muted); }
.supporters p { margin: 0 0 0.5rem; }
.supporters img { display: block; max-width: 100%; height: auto; }

@media (max-width: 600px) {
  body { padding: 24px 20px 40px; }
  .row-images { flex-direction: column; gap: 1rem; }
  .row-images a { flex: none; width: 100%; }
  .row.half { max-width: 100%; }
}

/* ---------- CV page ---------- */
.cv-name {
  margin: 0 0 0.25rem;
  font-family: "OpenSans Semibold", "Open Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: normal;
}
.cv-section { margin: 0 0 2.5rem; }
.cv-section h2 {
  margin: 0 0 0.5rem;
  font-family: "OpenSans Semibold", "Open Sans", Arial, sans-serif;
  font-size: 14px;
  font-weight: normal;
}
.cv-list { margin: 0; padding: 0; list-style: none; }
.cv-list li { margin: 0 0 0.2rem; }
.logos img { display: block; max-width: 100%; height: auto; margin: 0 0 1.25rem; }

/* ---------- Extra work-page pieces ---------- */
.work-divider { width: 3rem; margin: 4rem 0 3rem; border: 0; border-top: 1px solid var(--text); }

/* Small thumbnails that open full size (e.g. a grid of individual prints) */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, 70px);
  gap: 0.4rem;
  margin-top: 1.25rem;
}
.thumbs a { display: block; cursor: zoom-in; }
.thumbs img { display: block; width: 70px; height: 70px; }

/* A tight, single row of equal images */
.strip { display: flex; max-width: 1080px; margin-top: 1rem; }
.strip a { display: block; flex: 1 1 0%; min-width: 0; cursor: zoom-in; }
.strip img { display: block; width: 100%; height: auto; }

.logo-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem; }
.logo-row img { display: block; max-width: 100%; height: auto; }

/* ---------- Compact layouts ---------- */
/* Tighter gaps for pages that show many images in a grid */
.work-page.tight { --gap: 1.5rem; }
.work-page.tight .row { margin-bottom: 1.5rem; }

/* One tall image beside two stacked images */
.feature-grid {
  display: grid;
  grid-template-columns: var(--cols, 1fr 1fr);
  gap: 0 var(--gap);
  align-items: start;
}
.feature-grid a { display: block; cursor: zoom-in; }
.feature-grid img { display: block; width: 100%; height: auto; }
.feature-grid .tall { grid-column: 1; grid-row: 1 / span 2; }
.feature-grid .top { grid-column: 2; grid-row: 1; align-self: start; }
.feature-grid .bottom { grid-column: 2; grid-row: 2; align-self: end; }

/* Grid pages with a title on hover (each link carries a data-caption and a .cap span) */
.hover-caps a.zoom { position: relative; overflow: hidden; }
.hover-caps a.zoom:hover { text-decoration: none; }
.hover-caps .cap {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  text-align: center;
  font-family: "OpenSans Light", "Open Sans", Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.hover-caps a.zoom:hover .cap,
.hover-caps a.zoom:focus-visible .cap { opacity: 1; }
@media (hover: none) { .hover-caps .cap { display: none; } }   /* touch: the title shows in the viewer instead */
@media (prefers-reduced-motion: reduce) { .hover-caps .cap { transition: none; } }

/* A visible pause between groups of images (e.g. installation views, then the artworks) */
.grid-break { height: 2.5rem; }

/* A single image the same size as one cell of a four-across row */
.row.cell { max-width: calc((100% - 3 * var(--gap)) / 4); }

@media (max-width: 600px) {
  /* grid pages: two across on phones instead of one */
  .work-page.tight .row-images { flex-direction: row; flex-wrap: wrap; gap: 0.75rem; }
  .work-page.tight .row-images a { flex: 1 1 calc(50% - 0.5rem); width: auto; }
  .work-page.tight .row { margin-bottom: 0.75rem; }
  .work-page.tight .row.cell { max-width: calc(50% - 0.375rem); }
  .grid-break { height: 1.25rem; }

  .feature-grid { grid-template-columns: 1fr; gap: var(--gap); }
  .feature-grid .tall, .feature-grid .top, .feature-grid .bottom { grid-column: 1; grid-row: auto; align-self: auto; }
}

/* ---------- Lightbox ---------- */
html:has(dialog.lightbox[open]) { overflow: hidden; }

dialog.lightbox {
  --lb-pad: 4.5rem;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #fff;
  color: var(--text);
}
dialog.lightbox[open] { display: flex; flex-direction: column; }
dialog.lightbox::backdrop { background: #fff; }

.lb-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: auto;
  padding: 2.5rem var(--lb-pad) 0;
}

.lb-img {
  display: block;
  margin: auto;              /* centres when small, scrolls when large */
  max-width: calc(100vw - 2 * var(--lb-pad));
  max-height: calc(100dvh - 7rem);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.lb-img.ready { opacity: 1; }
.lightbox.can-zoom .lb-img { cursor: zoom-in; }

/* Zoomed: show the image at its full pixel size, scroll to pan */
.lightbox.zoomed .lb-img {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lb-caption {
  white-space: pre-line;      /* keeps line breaks from the page caption */
  margin: 0;
  padding: 1rem var(--lb-pad) 1.25rem;
  min-height: 4.5rem;
  text-align: center;
  font-family: "OpenSans Light", "Open Sans", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.lb-count {
  position: absolute;
  top: 1rem;
  left: 1.5rem;
  font-family: "OpenSans Light", "Open Sans", Arial, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.lb-btn {
  position: absolute;
  padding: 0.5rem 1rem;
  border: 0;
  background: none;
  font-size: 2.25rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}
.lb-btn:hover, .lb-btn:focus-visible { color: var(--text); text-decoration: none; opacity: 0.6; }
.lb-close { top: 0.5rem; right: 0.75rem; }
.lb-prev  { left: 0.5rem;  top: calc(50% - 2rem); }
.lb-next  { right: 0.5rem; top: calc(50% - 2rem); }

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

@media (prefers-reduced-motion: reduce) {
  .lb-img { transition: none; }
}
