/* wrossmorrowart.com
   The house style, kept from the 2022 site and made consistent:
   - white wall, black hairlines, highlighter yellow
   - brackets: hairline boxes left open on one side, alternating left/right
   - Courier for everything that is "chrome"
   - nested hairline frames around every work (sm / lg / sm), the middle band lights up yellow */

:root {
  --paper: #fff;
  --ink: #000;
  --ink-soft: #383b4b;
  --muted: #666;
  --rule: #8c92ac;
  --yellow: #ffff00;

  --mono: "Courier New", Courier, ui-monospace, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --gutter: clamp(12px, 3vw, 28px);

  /* frame ring radii (outer edge of each band), small tiles */
  --r1: 2px;
  --r2: 7px;
  --r3: 10px;
  --band: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  padding: 0 var(--gutter) 48px;
}

a { color: var(--ink); }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; background: var(--yellow); }

.hl {
  background: var(--yellow);
  padding: 0 4px;
}

.sep { color: var(--rule); padding: 0 2px; }

/* ---------- header / footer: the two L-brackets ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  margin: 0 var(--gutter) 28px 0;
  padding: 12px 18px 12px var(--gutter);
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  font-family: var(--mono);
}

.site-name {
  font-size: clamp(1.25rem, 3.6vw, 1.75rem);
  font-weight: bold;
  text-decoration: none;
  letter-spacing: -0.02em;
}

.site-nav { display: flex; gap: 4px 14px; flex-wrap: wrap; font-weight: bold; }

.site-nav a,
.site-footer a {
  text-decoration: none;
  padding: 0 4px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"],
.site-footer a:hover { background: var(--yellow); }

.site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }

.site-footer {
  margin: 0 var(--gutter) 0 0;
  padding: 12px 18px 14px var(--gutter);
  border-right: 1px solid var(--ink);
  border-top: 1px solid var(--ink);
  font-family: var(--mono);
  font-weight: bold;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: baseline;
}

.site-footer a::before { content: "| "; color: var(--rule); font-weight: normal; }

/* ---------- brackets ---------- */

.bracket {
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1.25;
  margin: 36px 0 14px;
  padding: 10px 26px 10px 12px;
  border: 1px solid var(--ink);
  border-right: 0;
  text-align: left;
}

.bracket.r {
  border-right: 1px solid var(--ink);
  border-left: 0;
  padding: 10px 12px 10px 26px;
  text-align: right;
}

.crumbs {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--muted);
}

.crumbs a { padding: 0 3px; }
.crumbs a:hover { background: var(--yellow); }

.crumbs + .bracket { margin-top: 8px; }

.series-meta {
  font-family: var(--mono);
  color: var(--muted);
  margin: -4px 0 18px 13px;
}

.blurb { max-width: 68ch; margin: 0 0 18px 13px; }

/* ---------- prose pages ---------- */

.intro { max-width: 68ch; font-size: 1.1rem; }
.intro p { margin: 0; }

.prose { max-width: 72ch; }
.page-sub { font-family: var(--mono); color: var(--muted); margin: -4px 0 22px 13px; }
.prose h2 {
  font-family: var(--mono);
  font-size: 1.15rem;
  margin: 32px 0 8px;
}
.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  margin: 18px 0 6px;
}
.prose .img-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.prose .img-row img { width: 100%; margin-bottom: 0; }
.img-caption { font-size: 0.88rem; color: var(--muted); margin-bottom: 18px; }

.intro a,
.prose a,
.blurb a,
.work-desc a {
  background: var(--yellow);
  font-style: italic;
  font-weight: bold;
  text-decoration: none;
  padding: 0 3px;
}
.intro a:hover,
.prose a:hover { text-decoration: underline; }

/* ---------- frames ---------- */

.frame {
  display: block;
  padding: calc(var(--r3) + 1px);
  line-height: 0;
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  background: #f3f3f3;
  border: 1px solid var(--ink-soft);
  box-shadow:
    0 0 0 var(--r1) var(--paper),
    0 0 0 calc(var(--r1) + 1px) var(--rule),
    0 0 0 var(--r2) var(--band),
    0 0 0 calc(var(--r2) + 1px) var(--rule),
    0 0 0 var(--r3) var(--paper),
    0 0 0 calc(var(--r3) + 1px) var(--rule);
  transition: box-shadow 0.15s ease;
}

.frame-lg { --r1: 3px; --r2: 11px; --r3: 14px; }

.frame.missing img { display: none; }
.frame.missing::after {
  content: "image to come";
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: var(--ar, 4 / 5);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.2;
  color: var(--muted);
  border: 1px dashed var(--rule);
  background: repeating-linear-gradient(-45deg, var(--paper) 0 9px, #f6f6f6 9px 10px);
}

/* ---------- tiles & grids ---------- */

.grid {
  display: grid;
  gap: 18px 14px;
  align-items: center;          /* hung on a common eye line */
  grid-template-columns: repeat(auto-fill, minmax(var(--min, 200px), 1fr));
}

.grid-tall     { --min: 170px; }
.grid-mixed    { --min: 230px; }
.grid-wide     { --min: 360px; }
.grid-featured { --min: 260px; }
.grid-strip    { --min: 120px; gap: 12px 8px; }

.tile {
  display: block;
  text-decoration: none;
  color: var(--ink);
  cursor: zoom-in;
}

.tile:hover .frame,
.tile:focus-visible .frame { --band: var(--yellow); }
.tile:focus-visible { outline: none; background: none; }

.tile-cap {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 0;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--muted);
}
.tile-name { color: var(--ink); font-weight: bold; }
.tile:hover .tile-name { background: var(--yellow); }

/* captions stay quiet on the wall: shown on hover/focus, always shown for featured */
.grid:not(.grid-featured) .tile-cap { visibility: hidden; }
.grid:not(.grid-featured) .tile:hover .tile-cap,
.grid:not(.grid-featured) .tile:focus-visible .tile-cap { visibility: visible; }
.grid-strip .tile-cap { display: none; }
.grid-strip .tile[aria-current="true"] .frame { --band: var(--ink); }

/* ---------- home: series as folders ---------- */

.folder > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 14px;
  user-select: none;
}
.folder > summary::-webkit-details-marker { display: none; }
.folder > summary::before {
  content: "[+]";
  font-weight: bold;
  flex: none;
}
.folder[open] > summary::before { content: "[\2013]"; }
.folder > summary.r { flex-direction: row-reverse; }
.folder > summary:hover { background: var(--yellow); }

.folder-count {
  font-size: 0.9rem;
  font-weight: normal;
  color: var(--muted);
}
.folder-count::after { content: " works"; }

.folder-more {
  font-family: var(--mono);
  font-weight: bold;
  margin: 14px 0 0;
}
.folder-more a { text-decoration: none; padding: 0 4px; }
.folder-more a:hover { background: var(--yellow); }
.folder > summary.r ~ .folder-more { text-align: right; }

.featured .bracket { margin-top: 28px; }

/* ---------- single work page ---------- */

.work-page {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr);
  gap: 24px 36px;
  align-items: center;
  margin-top: 8px;
}

.work-stage { display: flex; justify-content: center; }
.work-stage .frame { width: auto; max-width: 100%; }
.work-stage .frame img { width: auto; max-width: 100%; max-height: 74vh; }

.work-title {
  font-family: var(--mono);
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 0 0 6px;
}
.work-meta { font-family: var(--mono); color: var(--muted); margin: 0 0 14px; }
.work-desc { white-space: pre-line; }

.pager {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--mono);
  font-weight: bold;
  margin-top: 22px;
  padding: 8px 0 8px 12px;
  border: 1px solid var(--ink);
  border-right: 0;
}
.pager a { text-decoration: none; padding: 0 4px; }
.pager a:hover { background: var(--yellow); }
.pager-pos { color: var(--muted); font-weight: normal; }

.other-series ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 18px;
  font-family: var(--mono);
  font-weight: bold;
}
.other-series a { text-decoration: none; padding: 0 4px; }
.other-series a:hover { background: var(--yellow); }

/* ---------- viewer ---------- */

.viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0 var(--gutter) 16px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  overflow: hidden;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: rgba(255, 255, 255, 0.96); }

.viewer-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 12px calc(-1 * var(--gutter));
  padding: 12px 0 12px var(--gutter);
  border-bottom: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
  font-family: var(--mono);
  font-weight: bold;
}
.viewer-series { font-size: 1.1rem; }
.viewer-count { color: var(--muted); font-weight: normal; }
.viewer-close {
  margin-left: auto;
  margin-right: 12px;
  font: inherit;
  background: none;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
}
.viewer-close:hover { background: var(--yellow); }

.viewer-figure {
  flex: 1;
  min-height: 0;
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 8px;
}

.viewer-figure .frame {
  grid-column: 2;
  justify-self: center;
  min-height: 0;
  max-height: 100%;
  width: auto;
}
.viewer-img {
  width: auto !important;
  max-width: min(100%, 1200px);
  max-height: calc(100dvh - 210px);
  object-fit: contain;
  cursor: zoom-out;
}

.viewer-step {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: bold;
  background: none;
  border: 0;
  padding: 6px 10px;
  cursor: pointer;
}
.viewer-step:hover { background: var(--yellow); }
.viewer-prev { grid-column: 1; grid-row: 1; }
.viewer-next { grid-column: 3; grid-row: 1; }

.viewer-figure figcaption {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 14px;
  text-align: center;
}
.viewer-name { font-family: var(--mono); font-weight: bold; font-size: 1.1rem; }
.viewer-meta { font-family: var(--mono); color: var(--muted); }
.viewer-desc { flex-basis: 100%; max-width: 70ch; margin: 0 auto; font-size: 0.95rem; white-space: pre-line; }
.viewer-desc:empty { display: none; }
.viewer-desc a { background: var(--yellow); font-weight: bold; font-style: italic; text-decoration: none; padding: 0 3px; }
.viewer-link { font-family: var(--mono); font-size: 0.9rem; font-weight: bold; text-decoration: none; padding: 0 4px; }
.viewer-link:hover { background: var(--yellow); }

/* the old site's ellipsis navigation, kept: a sliding window of dots */
.viewer-dots {
  display: flex;
  justify-content: center;
  gap: 4px;
  padding-top: 10px;
}
.viewer-dots button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.viewer-dots button::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  transition: background 0.2s ease, transform 0.2s ease;
}
.viewer-dots button.edge::before { border-color: var(--rule); transform: scale(0.75); }
.viewer-dots button.on::before { background: var(--ink); }
.viewer-dots button:hover::before { background: var(--yellow); }

body.viewing { overflow: hidden; }

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  body { font-size: 16px; }
  .grid-tall     { --min: 140px; }
  .grid-mixed    { --min: 150px; }
  .grid-wide     { --min: 260px; }
  .grid-featured { --min: 150px; }
  .grid-strip    { --min: 84px; }
  .frame { --r1: 1px; --r2: 5px; --r3: 7px; }
  .frame-lg { --r1: 2px; --r2: 8px; --r3: 11px; }
  .tile-cap { font-size: 0.75rem; }
  .tile-year { display: none; }
  .grid:not(.grid-featured) .tile-cap { display: none; }
  .grid { gap: 10px 10px; }
  .folder-count::after { content: ""; }
  .folder > summary { gap: 10px; }
  .work-page { grid-template-columns: 1fr; }
  .work-stage .frame img { max-height: 64vh; }
  .bracket { font-size: 1.2rem; }
  .prose .img-row { grid-template-columns: 1fr; }
  .viewer-step { display: none; }
  .viewer-img { max-height: calc(100dvh - 240px); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
