/* joelfaber.me v2 — full-width manuscript grid
   Paper/ink; accent sampled from Toronto waterfront (Harman Phoenix 200). */
:root {
  --paper: #faf7f0;
  --ink: #211e19;
  --graphite: #6a665c;
  --lake: #3d5a66;
  --phoenix: #e8c4c4;
  --rule: #e4ddcf;
  --frame: 1600px;
  --serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --utility: "Archivo", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.25rem; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lake); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--phoenix); text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--lake); outline-offset: 3px; }

.frame { max-width: var(--frame); margin: 0 auto; padding: 0 3rem; position: relative; }
main > .frame { padding-left: 3rem; }
body::before {
  content: ""; position: fixed; left: 8px; top: 0; bottom: 0;
  width: 6px; background: var(--lake); z-index: 10;
}
@media (max-width: 720px) { .frame { padding: 0 1.25rem; } }
@media (max-width: 720px) {
  main > .frame { padding-left: 1.25rem; }
}

/* ---- header ---- */
header.site { padding: 2rem 3rem 0; }
nav.site {
  display: flex; gap: 2.25rem; align-items: center;
  font-family: var(--utility); font-size: 0.78rem;
  letter-spacing: 0.14em; text-transform: uppercase;
}
nav.site .brand { margin-right: auto; display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); }
nav.site a { color: var(--ink); text-decoration: none; }
nav.site a:hover { color: var(--lake); }

/* logo: nameplate mark */
.logo {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--ink); line-height: 1;
  padding: 0.42rem calc(0.8rem - 0.28em) 0.42rem 0.8rem;
  font-family: var(--serif); font-size: 0.95rem; font-weight: 500;
  letter-spacing: 0.28em; text-transform: uppercase;
}
.logo span.glyphs { transform: translateY(0.05em); }
.logo .dot {
  color: var(--lake);
  display: inline-block;
  vertical-align: middle;
  transform: translateY(-0.12em);
}

/* ---- hero ---- */
.hero {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 3.5rem;
  align-items: center; padding: 4.5rem 0 4rem;
}
.hero h1 {
  font-weight: 500; font-size: clamp(1.7rem, 2.9vw, 2.6rem);
  line-height: 1.22; margin: 0 0 1.3rem; letter-spacing: -0.01em;
  max-width: 24ch;
}
.hero figure { display: flex; justify-content: flex-start; margin: 0; }
.hero figure img {
  max-height: 62vh; width: auto; max-width: 100%;
  border: 1px solid var(--rule); background: #fff; padding: 6px; border-radius: 5px;
}
.hero .locale {
  font-family: var(--utility); font-size: 0.78rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--graphite);
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 2rem; } }

/* ---- chapters: manuscript grid (rail + measure) ---- */
section.chapter {
  border-top: 1px solid var(--rule); padding: 3.5rem 0;
  display: grid; grid-template-columns: 220px minmax(0, 62ch); gap: 3.5rem;
}
.eyebrow {
  font-family: var(--utility); font-size: 0.74rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--graphite);
  margin: 0.4rem 0 0;
}
.chapter-body p { margin: 0 0 1.1rem; }
@media (max-width: 860px) {
  section.chapter { grid-template-columns: 1fr; gap: 1.25rem; }
}

.cta {
  display: inline-block; margin-top: 0.5rem;
  font-family: var(--utility); font-size: 0.82rem;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--lake); text-decoration: none;
  border-bottom: 1px solid var(--lake); padding-bottom: 2px;
}
.cta:hover { border-bottom-color: var(--phoenix); }
.chapter-body .cta + p { margin-top: 2.25rem; }

/* chapter with a right-hand figure */
section.chapter.has-figure { grid-template-columns: 220px minmax(0, 62ch) minmax(0, 1fr); align-items: start; }
.chapter-figure { margin: 0; }
.chapter-figure img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 6px; border-radius: 5px;
}
.chapter-figure.two-up { display: flex; gap: 0.75rem; align-items: stretch; justify-content: flex-end; }
.chapter-figure.two-up img { height: auto; width: calc(50% - 0.375rem); max-width: none; border-radius: 0; object-fit: contain; }
.chapter-figure figcaption {
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.5;
  font-style: italic; color: var(--graphite);
  text-transform: none; letter-spacing: normal; margin-top: 0.8rem;
}
@media (max-width: 1080px) {
  section.chapter.has-figure { grid-template-columns: 180px minmax(0, 1fr) minmax(0, 0.95fr); }
  .chapter-figure { grid-column: 3; max-width: 30rem; }
}
@media (max-width: 720px) {
  section.chapter.has-figure { grid-template-columns: 1fr; }
  .chapter-figure { grid-column: auto; margin-top: 2rem; max-width: 30rem; }
}

figcaption {
  font-family: var(--utility); font-size: 0.72rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--graphite); margin-top: 0.6rem;
}

/* ---- gallery (old-site design: paper ground, serif caption, thumb row) ---- */
.darkroom { border-top: 1px solid var(--rule); padding: 3.5rem 0 3rem; margin-top: 0rem; }
.darkroom .eyebrow { margin-bottom: 2rem; }
.darkroom .lede { max-width: 62ch; margin: -0.75rem 0 2.25rem; }

.stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 100%;
  align-items: center; gap: 1.5rem;
  height: min(60vh, 620px);
}
.stage .featured { height: 100%; min-width: 0; display: flex; align-items: center; justify-content: center; }
.stage .featured img {
  max-height: min(60vh, 620px); max-width: 100%; width: auto; height: auto;
  object-fit: contain; cursor: zoom-in;
  border: 1px solid var(--rule); background: #fff; padding: 6px;
  opacity: 1; transition: opacity 1s ease;
}
.stage .featured img.switching { opacity: 0; }

.arrow {
  background: none; border: 1px solid var(--rule); color: var(--ink);
  cursor: pointer; font-size: 1.4rem; line-height: 1;
  padding: 0.9rem 0.8rem; border-radius: 3px;
  font-family: var(--serif); transition: border-color 0.15s ease;
}
.arrow:hover { border-color: var(--graphite); }

.darkroom .cap {
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.5;
  color: var(--ink); margin-top: 1.2rem; text-align: center;
  text-transform: none; letter-spacing: normal; opacity: 1;
}

.thumb-row {
  display: flex; gap: 0.7rem; justify-content: safe center;
  overflow-x: auto; padding: 2rem 0 0.5rem;
}
.thumb-row button {
  flex: 0 0 auto; border: 1px solid transparent; background: none;
  padding: 0; cursor: pointer; opacity: 0.65; transition: opacity 1s ease;
  border-radius: 2px;
}
.thumb-row button:hover { opacity: 1; }
.thumb-row button[aria-current="true"] { opacity: 1; border-color: var(--graphite); }
.thumb-row img { width: 64px; height: 64px; object-fit: cover; display: block; border-radius: 2px; }

@media (max-width: 720px) {
  .stage { height: min(48vh, 420px); gap: 0.75rem; }
}

/* ---- lightbox ---- */
dialog.lightbox {
  border: 0; padding: 0; background: rgba(20,18,15,0.94);
  width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
  display: grid; place-items: center;
}
dialog.lightbox:not([open]) { display: none; }
dialog.lightbox img { max-width: 94vw; max-height: 86vh; }
dialog.lightbox .cap {
  font-family: var(--utility); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--paper); margin-top: 0.8rem; text-align: center;
}
dialog.lightbox button.close {
  position: absolute; top: 1rem; right: 1.5rem;
  background: none; border: 0; color: var(--paper);
  font-family: var(--utility); font-size: 0.8rem; letter-spacing: 0.12em;
  text-transform: uppercase; cursor: pointer;
}

/* ---- footer ---- */
footer.site {
  border-top: 1px solid var(--rule); padding: 2rem 0 3rem;
  font-family: var(--utility); font-size: 0.74rem;
  letter-spacing: 0.06em; color: var(--graphite);
}
footer.site .frame { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; }
footer.site a { color: var(--graphite); }

/* ---- editing page ---- */
.page-lede { padding: 4.5rem 0 3.5rem; }
.page-lede h1 {
  font-weight: 500; font-size: clamp(1.7rem, 2.9vw, 2.6rem);
  line-height: 1.24; margin: 0; letter-spacing: -0.01em; max-width: 30ch;
}

.stages { margin: 0; }
.stages > div { border-top: 1px solid var(--rule); padding: 1.6rem 0; }
.stages > div:first-child { border-top: 0; padding-top: 0.4rem; }
.stages dt {
  font-family: var(--serif); font-weight: 600; font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.stages .diagnosis { font-style: italic; color: var(--lake); }
.stages dd { margin: 0; }
.stages dd p { margin: 0 0 0.8rem; }
.stages dd p:last-child { margin-bottom: 0; }
.stages .note { font-size: 1.05rem; color: var(--graphite); }

.covers {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem;
  align-items: start; padding: 0.5rem 0 0;
}
.covers a { text-decoration: none; color: var(--ink); }
.covers img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 6px;
}
.covers .cover-cap {
  font-family: var(--serif); font-size: 0.98rem; line-height: 1.45;
  margin-top: 0.7rem; color: var(--ink);
}
.covers .cover-cap em { color: var(--graphite); font-style: normal; font-size: 0.9rem; }
@media (max-width: 860px) { .covers { grid-template-columns: repeat(2, 1fr); } }

.quotes { margin: 0; }
.quotes blockquote {
  margin: 0 0 2.5rem; padding-left: 1.5rem;
  border-left: 2px solid var(--rule);
}
.quotes blockquote:last-child { margin-bottom: 0; }
.quotes blockquote p {
  font-size: 1.15rem; line-height: 1.55; margin: 0 0 0.7rem;
}
.quotes cite {
  font-family: var(--utility); font-style: normal; font-size: 0.78rem;
  letter-spacing: 0.08em; color: var(--graphite);
}
.quotes cite strong { color: var(--ink); font-weight: 600; }

form.inquiry { display: grid; gap: 1.1rem; max-width: 46rem; }
form.inquiry label {
  font-family: var(--utility); font-size: 0.74rem;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--graphite);
  display: block; margin-bottom: 0.4rem;
}
form.inquiry input, form.inquiry textarea {
  width: 100%; border: 1px solid var(--rule); background: #fff;
  padding: 0.7rem 0.9rem; font-family: var(--serif); font-size: 1.05rem;
  color: var(--ink); border-radius: 3px;
}
form.inquiry input:focus-visible, form.inquiry textarea:focus-visible {
  outline: 2px solid var(--lake); outline-offset: 1px;
}
form.inquiry button {
  justify-self: start; background: var(--ink); color: var(--paper);
  border: 0; padding: 0.8rem 1.6rem; cursor: pointer;
  font-family: var(--utility); font-size: 0.8rem;
  letter-spacing: 0.12em; text-transform: uppercase; border-radius: 3px;
}
form.inquiry button:hover { background: var(--lake); }

/* ---- editing page: full-width and grid variants ---- */
/* chapter whose body runs to the right margin (no rail-limited measure) */
section.chapter.full { grid-template-columns: 220px minmax(0, 1fr); }
section.chapter.full .chapter-body { max-width: none; }
section.chapter.full .chapter-body p { max-width: 100ch; }

/* span variant: label sits above, content uses the whole band */
section.chapter.span { display: block; }
section.chapter.span .eyebrow { margin-bottom: 1.6rem; }
section.chapter.span .chapter-body { max-width: none; }
section.chapter.span .chapter-body > p { max-width: 100ch; }

/* stage cards 2x2 */
.stage-cards {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 2rem;
}
.stage-cards .card {
  border: 1px solid var(--rule); border-top: 3px solid var(--lake);
  padding: 1.5rem 1.6rem; background: #fffdf8;
}
.stage-cards dt {
  font-family: var(--serif); font-weight: 600; font-size: 1.18rem; margin: 0 0 0.6rem;
}
.stage-cards .diagnosis {
  font-style: italic; color: var(--lake); margin: 0 0 0.8rem; font-size: 1.06rem;
}
.stage-cards dd { margin: 0; }
.stage-cards dd p { margin: 0 0 0.7rem; font-size: 1.05rem; }
.stage-cards .note { color: var(--graphite); font-size: 0.98rem; margin-bottom: 0; }
@media (max-width: 860px) { .stage-cards { grid-template-columns: 1fr; } }

/* quotes 2x2 */
.quotes.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 2.5rem; }
.quotes.grid2 blockquote { margin: 0; }
@media (max-width: 860px) { .quotes.grid2 { grid-template-columns: 1fr; } }

/* portfolio covers: full-band spread, larger, equal height, bottom-aligned */
.covers.five { display: flex; justify-content: space-between; align-items: start; gap: 0.75rem; }
.covers.five a { flex: 0 1 auto; }
.covers.five img { height: 340px; width: auto; }
.covers.five .cover-cap { max-width: 14rem; }
@media (max-width: 1080px) { .covers.five { flex-wrap: wrap; justify-content: flex-start; gap: 1.5rem; } }

section.chapter.full#contact .chapter-body p { max-width: 46rem; }

/* lede epigraph */
.page-lede .lede-quote {
  margin: 1.6rem 0 0; max-width: 48ch;
  font-size: 1.2rem; line-height: 1.5; color: var(--ink);
  border-left: 3px solid var(--lake); padding-left: 1.1rem;
}
.page-lede .lede-quote .attrib {
  display: block; margin-top: 0.5rem;
  font-family: var(--utility); font-size: 0.74rem; letter-spacing: 0.08em;
  color: var(--graphite);
}

/* ---- What I edit: prose + 2x3 cover inset ---- */
section.chapter.what-edit {
  grid-template-columns: 220px minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 3rem;
}
.what-body { align-self: center; }
.what-body p { margin: 0 0 1.1rem; max-width: 46ch; }
.what-body .cta { margin-top: 0.5rem; }

.edit-covers {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 1.25rem;
  align-self: center;
}
.edit-covers a { text-decoration: none; color: var(--ink); }
.edit-covers img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 5px;
}
.edit-covers .cover-cap {
  display: block; font-family: var(--serif); font-size: 0.9rem;
  line-height: 1.4; margin-top: 0.5rem; color: var(--ink);
}
.edit-covers .cover-cap em { color: var(--graphite); font-style: normal; font-size: 0.82rem; }

@media (max-width: 1080px) {
  section.chapter.what-edit { grid-template-columns: 220px minmax(0, 1fr); }
  .edit-covers { grid-column: 2; margin-top: 2rem; }
}
@media (max-width: 860px) {
  section.chapter.what-edit { grid-template-columns: 1fr; }
  .edit-covers { grid-column: auto; }
}

/* ---- outer cover rail (editing page top sections) ---- */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 3.5rem; align-items: start; }
.rail-main { min-width: 0; }
.cover-rail { display: flex; flex-direction: column; gap: 1.75rem; padding-top: 5.5rem; }
.cover-rail a { text-decoration: none; color: var(--ink); display: block; }
.cover-rail img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 5px;
}
.cover-rail .cover-cap {
  display: block; font-family: var(--serif); font-size: 0.86rem;
  line-height: 1.38; margin-top: 0.45rem; color: var(--ink);
}
.cover-rail .cover-cap em { color: var(--graphite); font-style: normal; font-size: 0.78rem; }
@media (max-width: 960px) {
  .with-rail { grid-template-columns: 1fr; }
  .cover-rail {
    flex-direction: row; flex-wrap: wrap; padding-top: 2rem;
    gap: 1.25rem; border-top: 1px solid var(--rule);
  }
  .cover-rail a { flex: 0 0 auto; width: calc(33.333% - 0.84rem); }
}
@media (max-width: 620px) {
  .cover-rail a { width: calc(50% - 0.63rem); }
}

/* ---- writing page ---- */

/* twin-highlight top: one plate per genre */
.duet {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4rem;
  padding: 0 0 4.5rem; align-items: start;
}
.plate .eyebrow { margin: 0 0 1.5rem; }
.plate img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 6px;
}
.plate h2 {
  font-weight: 500; font-size: 1.55rem; letter-spacing: -0.01em;
  margin: 1.5rem 0 0.4rem;
}
.plate .source, .work-card .source {
  font-family: var(--utility); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite);
  margin: 0 0 0.9rem;
}
.plate .dek, .plate .excerpt { margin: 0 0 1rem; font-size: 1.1rem; line-height: 1.55; }
.plate .excerpt { white-space: pre-line; }
@media (max-width: 960px) { .duet { grid-template-columns: 1fr; gap: 3.5rem; } }

/* tags: quiet thematic index, cards and plates only */
.tags {
  font-family: var(--utility); font-size: 0.72rem;
  letter-spacing: 0.05em; color: var(--graphite);
  margin: 1rem 0 0;
}

/* cta as a button (poem overlays) */
button.cta {
  background: none; border: 0; border-bottom: 1px solid var(--lake);
  padding: 0 0 2px; cursor: pointer;
}

/* poems band */
.poem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 0.5rem; }
.poem-card {
  border: 1px solid var(--rule); background: #fffdf8;
  padding: 1.6rem 1.7rem 1.4rem;
  display: flex; flex-direction: column; align-items: flex-start;
}
.poem-card h3 { font-weight: 600; font-size: 1.18rem; margin: 0 0 0.8rem; }
.poem-card .excerpt {
  margin: 0 0 1.2rem; font-size: 1.02rem; line-height: 1.55;
  white-space: pre-line; flex-grow: 1;
}
.poem-card .tags { margin-top: 0.9rem; }
@media (max-width: 1080px) { .poem-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .poem-grid { grid-template-columns: 1fr; } }

/* essays band */
.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3rem 2.5rem; margin-top: 0.5rem; }
.work-card img {
  width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block;
  border: 1px solid var(--rule); background: #fff; padding: 6px;
}
.work-card h3 { font-weight: 600; font-size: 1.22rem; margin: 1.1rem 0 0.4rem; }
.work-card .dek { margin: 0 0 1rem; font-size: 1.02rem; line-height: 1.55; }
@media (max-width: 1080px) { .work-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .work-grid { grid-template-columns: 1fr; } }

/* folio overlay: a poem opens on paper, not slate */
dialog.lightbox.folio {
  display: block; background: var(--paper); color: var(--ink);
  width: min(46rem, 92vw); height: auto; max-height: 86vh;
  margin: auto; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 3rem 3.5rem 2.5rem;
}
dialog.lightbox.folio:not([open]) { display: none; }
dialog.lightbox.folio::backdrop { background: rgba(20, 18, 15, 0.55); }
dialog.lightbox.folio button.close {
  position: static; float: right; margin: -1.5rem -2rem 0 1.5rem;
  color: var(--graphite);
}
dialog.lightbox.folio button.close:hover { color: var(--ink); }
.folio h2 {
  font-weight: 500; font-size: 1.45rem; letter-spacing: -0.01em;
  margin: 0 0 1.6rem;
}
.folio .epigraph {
  font-style: italic; color: var(--graphite);
  font-size: 1.08rem; line-height: 1.5;
  margin: -0.8rem 0 1.8rem; max-width: 34rem;
}
.folio .poem-text {
  white-space: pre-wrap; tab-size: 6;
  font-size: 1.15rem; line-height: 1.5; max-width: 38rem;
}
.folio .poem-foot {
  margin-top: 2.4rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem;
  justify-content: space-between; align-items: baseline;
  font-family: var(--utility); font-size: 0.72rem;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--graphite);
}
.folio .poem-foot a { color: var(--lake); }
@media (max-width: 720px) {
  dialog.lightbox.folio { padding: 2.25rem 1.5rem 2rem; max-height: 92vh; }
  dialog.lightbox.folio button.close { margin: -1rem -0.5rem 0 1rem; }
}

/* spatial poems: fixed tab-stop columns, font-independent.
   A fragment lands on a column by giving the run before it a fixed em width
   (a "cell"), so the column holds regardless of the words' rendered widths.
   Own-line fragments use padding-left to the same column. Columns used in
   Salt Dream: 3 / 9.5 / 20 / 27.5 em. */
.folio .poem-text.spatial { white-space: normal; }
.folio .poem-text.spatial .st { margin: 0 0 1.45em; }
.folio .poem-text.spatial .st:last-child { margin-bottom: 0; }
.folio .poem-text.spatial .ln { display: block; }
.folio .poem-text.spatial .col { display: inline-block; white-space: nowrap; }
@media (max-width: 720px) { .folio .poem-text.spatial { overflow-x: auto; } }