/* gkparishphilp.com — public tier.
   One stylesheet, served as a static asset so it never wakes the Worker.
   Reading is the job: a narrow measure, real line height, restrained colour. */

:root {
  --bg:      #fbfaf8;
  --fg:      #1a1917;
  --muted:   #6b6862;
  --rule:    #e3ded6;
  --accent:  #8a5a2b;
  --measure: 34rem;

  --serif: Iowan Old Style, Palatino, "Palatino Linotype", Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #14140f;
    --fg:     #e8e4dc;
    --muted:  #9a958c;
    --rule:   #2e2c27;
    --accent: #d3a26a;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1.0625rem/1.65 var(--serif);
  -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }

/* --- frame ------------------------------------------------------------- */

header.site, footer.site, main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

header.site {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 2.5rem;
  padding-bottom: 1.75rem;
}

.brand {
  font: 600 1rem/1 var(--sans);
  letter-spacing: 0.01em;
  text-decoration: none;
}

header.site nav {
  font: 0.9375rem/1 var(--sans);
  color: var(--muted);
  display: flex;
  gap: 1rem;
}

footer.site {
  margin-top: 4rem;
  padding-top: 1.25rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--rule);
  font: 0.875rem/1.5 var(--sans);
  color: var(--muted);
}
footer.site p { margin: 0; }

/* Gallery pages run wider than the reading measure. The frame has to widen
   with them, otherwise the brand and the page heading start at different
   left edges. */
main.wide { max-width: 52rem; }
body.wide header.site, body.wide footer.site { max-width: 52rem; }

/* --- headings ---------------------------------------------------------- */

h1 {
  font: 600 1.75rem/1.25 var(--sans);
  letter-spacing: -0.015em;
  margin: 0 0 1.5rem;
}

.intro { margin-bottom: 3rem; }
.intro h1 { margin-bottom: 0.5rem; }
.intro p { color: var(--muted); margin: 0; }

/* --- post lists -------------------------------------------------------- */

.row {
  padding: 1.5rem 0;
  border-top: 1px solid var(--rule);
}
.row:first-of-type { border-top: none; padding-top: 0; }

/* With a cover, the row becomes two columns: thumbnail, then text. Without
   one it stays a single block, so a coverless post does not sit beside an
   empty gap. */
.row.has-cover {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1.15rem;
  align-items: start;
}

.thumb { display: block; }
.thumb img {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  object-fit: cover;          /* covers are every aspect ratio; crop to square */
  border-radius: 3px;
  background: var(--rule);    /* something to look at while it loads */
}

.row h2 {
  font: 600 1.1875rem/1.35 var(--sans);
  margin: 0 0 0.3rem;
}
.row h2 a { text-decoration: none; }
.row h2 a:hover { text-decoration: underline; }

.row p { margin: 0.5rem 0 0; color: var(--muted); }

time {
  display: block;
  font: 0.8125rem/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--muted);
}

.more { font: 0.9375rem/1 var(--sans); margin-top: 2.5rem; }
.empty { color: var(--muted); font-style: italic; }

/* --- a single post ----------------------------------------------------- */

.post h1 { margin-bottom: 0.5rem; }
.post > time { margin-bottom: 2rem; }

/* The cover runs the full measure, above the body. */
.post .cover {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 0 2.5rem;
  border-radius: 3px;
}

.post .body > :first-child { margin-top: 0; }
.post .body p { margin: 0 0 1.4em; }
.post .body h2 { font: 600 1.3125rem/1.3 var(--sans); margin: 2.5rem 0 0.75rem; }
.post .body h3 { font: 600 1.0625rem/1.3 var(--sans); margin: 2rem 0 0.6rem; }

.post .body blockquote {
  margin: 1.75rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

/* Imported Squarespace posts are full of images; none of them know how wide
   this column is. */
.post .body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2rem auto;
  border-radius: 3px;
}

.post .body figure { margin: 2rem 0; }
.post .body figcaption {
  font: 0.8125rem/1.5 var(--sans);
  color: var(--muted);
  text-align: center;
  margin-top: 0.6rem;
}

.post .body hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.post .body pre {
  overflow-x: auto;               /* code scrolls, the page never does */
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.875rem;
  line-height: 1.5;
}
.post .body code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
.post .body pre code { font-size: inherit; }

.tags {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font: 0.875rem/1.6 var(--sans);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* --- gallery ----------------------------------------------------------- */

.crumb { font: 0.875rem/1 var(--sans); color: var(--muted); margin: 0 0 1.25rem; }
.lede  { color: var(--muted); margin: -0.75rem 0 2rem; }

/* auto-fill rather than a fixed column count, so the grid adapts from phone to
   desktop without a breakpoint per size. */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
}

.tile { display: block; position: relative; text-decoration: none; }

.tile img {
  display: block;
  width: 100%;
  height: auto;               /* without this, an <img height> attribute wins as
                                 a presentational hint and aspect-ratio is
                                 ignored -- tiles stretch to the full photo. */
  aspect-ratio: 3 / 2;        /* uniform tiles; the photo itself is crop-fitted */
  object-fit: cover;
  border-radius: 3px;
  background: var(--rule);
}

/* Album titles sit on the image; photos have no label at all. */
.tile span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 2.25rem 0.75rem 0.6rem;
  font: 600 0.9375rem/1.25 var(--sans);
  color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
  border-radius: 0 0 3px 3px;
}

.albums .tile img { aspect-ratio: 4 / 3; }
.tile:hover img { opacity: 0.9; }

/* --- music ------------------------------------------------------------- */

.track {
  padding: 1.75rem 0;
  border-top: 1px solid var(--rule);
}
.track:first-of-type { border-top: none; padding-top: 0; }

.track h2 { font: 600 1.1875rem/1.35 var(--sans); margin: 0 0 0.3rem; }
.track p  { margin: 0.6rem 0 0; color: var(--muted); }

.track audio { display: block; width: 100%; margin-top: 1rem; }

/* Spotify renders its player at a fixed height inside whatever box it is
   given and top-aligns it, so an oversized iframe shows as dead space rather
   than a bigger player. 152px is its compact height, which is what a
   single-track release gets -- every Pagan Mantis release is one. A
   multi-track album wants 352px; give those a modifier when one exists. */
.track iframe { display: block; width: 100%; height: 152px; margin-top: 1rem; border-radius: 12px; }
.track iframe.album { height: 352px; }

/* --- videos ------------------------------------------------------------- */

.vgroup { margin-bottom: 3rem; }
.vgroup h2 {
  font: 600 1.125rem/1.3 var(--sans);
  margin: 0 0 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}

.videolist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 2rem 1.5rem;
}

.video h2 { font: 600 1.0625rem/1.35 var(--sans); margin: 0.7rem 0 0.25rem; }
.video h2 a { text-decoration: none; }
.video h2 a:hover { text-decoration: underline; }
.video p { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9375rem; }

.vthumb {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: var(--rule);
}
.vthumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vplaceholder { display: block; width: 100%; height: 100%; }

.vplay {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 3.5rem; height: 3.5rem;
  display: grid;
  place-items: center;
  padding-left: 0.2rem;          /* optically centre the triangle */
  border-radius: 50%;
  background: rgba(10, 10, 9, 0.62);
  color: #fff;
  font-size: 1.25rem;
  transition: background 0.15s ease;
}
.vthumb:hover .vplay { background: rgba(10, 10, 9, 0.82); }

/* The iframe replaces the thumbnail in place, so it inherits its box. */
.vframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 4px;
}

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

/* A <dialog> is display:none until opened, so none of this affects a page
   whose script never ran. */
.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(10, 10, 9, 0.94); }

.lb-stage {
  margin: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 3.5rem 4.5rem;
  pointer-events: none;        /* clicks fall through to the dialog = close */
}

.lb-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;         /* never crop in the viewer; this is the photo */
  border-radius: 2px;
  pointer-events: auto;        /* ...except on the photo itself */
  transition: opacity 0.15s ease;
}
.lightbox.is-loading .lb-stage img { opacity: 0.25; }

.lb-stage figcaption {
  font: 0.875rem/1.5 var(--sans);
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  pointer-events: auto;
}

.lightbox button {
  position: absolute;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem 0.9rem;
  font-family: var(--sans);
}
.lightbox button:hover  { color: #fff; }
.lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 3px; }

.lb-close { top: 0.6rem; right: 0.9rem; font-size: 2rem; }

.lb-nav { top: 50%; transform: translateY(-50%); font-size: 3rem; }
.lb-prev { left: 0.4rem; }
.lb-next { right: 0.4rem; }

.lb-count {
  position: absolute;
  bottom: 0.9rem; left: 0; right: 0;
  margin: 0;
  text-align: center;
  font: 0.8125rem/1 var(--sans);
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
}

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

@media (max-width: 34rem) {
  header.site { padding-top: 1.75rem; }
  h1 { font-size: 1.5rem; }

  .row.has-cover { grid-template-columns: 4.25rem 1fr; gap: 0.9rem; }
  .thumb img { width: 4.25rem; height: 4.25rem; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: 0.5rem; }

  /* Arrows would eat a phone screen's width; swipe covers it. */
  .lb-stage { padding: 3.25rem 0.75rem 2.75rem; }
  .lb-nav { display: none; }
}
