/*
 * Black Zine Fair: the neutral pages (home, archive, merch, FAQ, apply, links).
 * Same paper as sojourners4justice.press, inverted: brown paper, cream ink.
 * The year pages in /archive/ (2026, Reading Room, Detroit) keep their own styles.
 *
 * Inside the page, rules and boxes are thin solid lines; only the paper itself is drawn with dashes.
 *
 * Sections: 1 fonts and colors · 2 the paper · 3 letterhead · 4 page content
 *           5 cards (archive, merch) · 6 links page · 7 footer · 8 phones and Simple reading
 *           9 photos (home carousel, photos page)
 */

/* 1. fonts and colors ------------------------------------------------------ */
@font-face { font-family: "Hershey"; src: url("/paper/Hershey-Noailles-Futura-Simplex-Regular.woff2") format("woff2"), url("/paper/Hershey-Noailles-Futura-Simplex-Regular.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Hershey Bold"; src: url("/paper/Hershey-Noailles-Futura-Simplex-Bold.woff2") format("woff2"), url("/paper/Hershey-Noailles-Futura-Simplex-Bold.woff") format("woff"); font-display: swap; }
@font-face { font-family: "Hershey Times Bold"; src: url("/paper/Hershey-Noailles-Times-Simplex-Bold.woff2") format("woff2"), url("/paper/Hershey-Noailles-Times-Simplex-Bold.woff") format("woff"); font-display: swap; }
@font-face { font-family: "NotCourierSans"; src: url("/paper/NotCourierSans.woff2") format("woff2"), url("/paper/NotCourierSans.woff") format("woff"); font-display: swap; }

:root {
  --paper: #7a4a3e;   /* brown paper (a shade deeper than SJP's ink, so cream text stays easy to read) */
  --ink: #f6ede3;     /* cream, SJP's paper color */
  --focus: #f2cdcf;
  /* the paper lies landscape: 96 characters by 40 lines (wide), 80 by 40 (medium);
     a NotCourierSans character is .6em wide (so 96 → 57.6), and the paper fits the window both ways */
  --cols: 57.6; --rows: 40;
  --paper-size: min(22px, calc((100vw - 3rem) / var(--cols)), calc((100dvh - 3rem) / var(--rows)));
}
* { box-sizing: border-box; }
html, body { background: var(--paper); }
body { margin: 0; color: var(--ink); font: clamp(16px, 1.45vw, 19px)/1.5 "Hershey", system-ui, sans-serif; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .2em; }
a:hover { text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -100px; z-index: 10; background: var(--paper); padding: .5rem .75rem; }
.skip-link:focus { top: 12px; }
.ascii { margin: 0; font-family: "NotCourierSans", monospace; font-weight: 400; line-height: 1; letter-spacing: 0; white-space: pre; font-variant-ligatures: none; font-kerning: none; }

/* framed images: every picture (archive and merch cards, gallery, carousels) sits in a
   thin solid frame with a little space between the picture and the line */
:root { --frame-gap: .4rem; }
.card-image, .photo img, .carousel-slide img { border: 1px solid var(--ink); padding: var(--frame-gap); background-clip: content-box; }
.photo-grid { --frame-gap: .25rem; }

/* 2. the paper -------------------------------------------------------------- */
.desk { display: flex; justify-content: center; align-items: flex-start; min-height: 100dvh; padding: 1.5rem 1rem; }
.sheet { position: relative; width: max-content; transform: rotate(-.35deg); }
.ascii-frame { color: var(--ink); pointer-events: none; }
.ascii-frame .ascii { font-size: var(--paper-size); }
.ascii-medium, .ascii-narrow { display: none; }
.sheet-content {
  position: absolute; inset: 3.5% 2.5% 7.5% 2.5%;   /* a tiny margin inside the frame; room at the bottom for the footer */
  padding: 0 1rem;
  display: flex; flex-direction: column;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges;          /* room for the scrollbar on both sides keeps the text centered */
  scrollbar-width: thin; scrollbar-color: var(--ink) transparent;
  transform: rotate(.35deg);
}
@media (max-width: 1050px) { :root { --cols: 48; --rows: 40; } .ascii-wide { display: none; } .ascii-medium { display: block; } }

/* 3. letterhead ------------------------------------------------------------- */
/* same scale as sojourners4justice.press: the logo grows with the window up to 21px, the nav and name up to 15.2px */
.letterhead { display: flex; flex-direction: column; align-items: center; gap: 1.4rem; margin: 0 0 2.5rem; }
.letterhead-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem 1.15rem; font-size: clamp(12px, 1.05vw, 15.2px); }
.letterhead-nav a { text-decoration: none; }
.letterhead-nav a[aria-current="page"] { text-decoration: underline; }
.letterhead-logo { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-decoration: none; font-size: clamp(12.8px, 1.05vw, 15.2px); }
.letterhead-logo .ascii-logo { font-size: clamp(11px, 1.65vw, 21px); line-height: .84; letter-spacing: -.085em; }   /* same as the SJP logo */
.letterhead-mark { display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: clamp(12.8px, 1.05vw, 15.2px); }
.letterhead-by { font-size: clamp(11px, .85vw, 12.5px); text-decoration: none; }
.letterhead-by:hover { text-decoration: underline; }

/* 4. page content ----------------------------------------------------------- */
main { flex: 1 0 auto; width: 100%; }   /* every page fills the paper, with a tiny margin inside the frame */
h1, h2 { font-family: "Hershey Times Bold", serif; font-weight: 400; line-height: 1.2; }
h1 { font-size: 1.55rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
p { margin: 0 0 1rem; }
.lede, .intro p { font-size: 1.1em; }
.next-fair { border: 1px solid var(--ink); padding: .6rem .9rem; display: inline-block; }
.press { margin-top: 2.5rem; }
.press h2 { font-size: 1.55rem; margin-bottom: 1rem; }   /* “In the press”: same size as page titles */
.quote { margin: 0 0 1.75rem; padding-top: 1rem; border-top: 1px solid var(--ink); }
.quote blockquote { margin: 0; }
.quote p { margin: 0 0 .5rem; }
.quote figcaption { display: flex; gap: 1rem; font-size: .85em; }
.faq-item h2 { font-size: 1.35rem; margin-top: 2.25rem; }
.agreements { margin: 0; padding-left: 1.4rem; }
.agreements li { margin-bottom: .9rem; }
.agreements strong { font-family: "Hershey Bold", sans-serif; font-weight: 400; }
.button { display: inline-block; border: 1px solid var(--ink); padding: .5rem 1rem; text-decoration: none; }
.button:hover { background: var(--ink); color: var(--paper); }

/* 5. cards (archive, merch) ------------------------------------------------- */
.cards { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1.75rem 1.25rem; }
.card a { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; }
.card-image { display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-title { font-family: "Hershey Bold", sans-serif; }
.card-meta { font-size: .85em; }

/* 6. links page ------------------------------------------------------------- */
.links-section { text-align: center; margin: 0 auto 1.5rem; max-width: 26rem; }
.links-section h2 { margin: 0 0 .5rem; }
.links-section ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.links-section li { border-bottom: 1px solid var(--ink); }
.links-section li:last-child { border-bottom: 0; }
.links-section a { display: flex; flex-direction: column; padding: .6rem 0; text-decoration: none; }
.links-sub { font-size: .8em; }
.links-section a:hover .links-title { text-decoration: underline; }
.links-empty { padding: .6rem 0; font-size: .85em; }

/* 7. footer ----------------------------------------------------------------- */
/* Contact and Simple reading sit inside the paper, along its bottom edge, and stay put
   while the page content scrolls above them (like sojourners4justice.press). */
.site-footer { position: absolute; z-index: 3; left: 3.5%; right: 3.5%; bottom: 3.5%; display: flex; justify-content: space-between; align-items: center; font-size: .75rem; transform: rotate(.35deg); }
.site-footer-contact { position: relative; }
.site-footer-contact summary { list-style: none; cursor: pointer; }
.site-footer-contact summary::-webkit-details-marker { display: none; }
.site-footer-links { position: absolute; bottom: calc(100% + .6rem); left: 0; display: flex; flex-direction: column; gap: .3rem; padding: .6rem .8rem; background: var(--paper); border: 1px solid var(--ink); white-space: nowrap; }
.site-footer-links a::after { content: " ↗"; }

/* 8. phones and Simple reading ---------------------------------------------- */
/* Simple reading (and every phone): no drawn paper, one plain dashed sheet that grows with its content. */
@media (max-width: 700px) {
  .desk { padding: .75rem; }
  .sheet { width: 100%; transform: none; border: 1px dashed var(--ink); }
  .ascii-frame { display: none; }
  .sheet-content { position: static; overflow: visible; padding: 1.25rem 1rem; transform: none; min-height: calc(100dvh - 4.5rem); }
  .site-footer { position: static; transform: none; padding: 0 1rem 1rem; }
  .reading-toggle { display: none; } /* phones already get the simple layout */
}
html.reading-mode .desk { padding: 1.5rem 1rem; }
html.reading-mode .sheet { width: min(100%, 44rem); transform: none; border: 1px dashed var(--ink); }
html.reading-mode .ascii-frame { display: none; }
html.reading-mode .sheet-content { position: static; overflow: visible; padding: 2rem 2.25rem; transform: none; min-height: calc(100dvh - 6rem); }
html.reading-mode .site-footer { position: static; transform: none; padding: 0 2.25rem 1.5rem; }

/* 9. photos ----------------------------------------------------------------- */
.carousel { margin: 2rem 0 1rem; }
.page-home .carousel { max-width: 40rem; margin-inline: auto; }   /* the photos are small originals; any bigger and they look soft */
/* every photo keeps its own shape (portrait or landscape) and the frame hugs it; the slot stays one height so the arrows don't jump */
.carousel-slide { margin: 0; height: min(55dvh, 28rem); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; }
.carousel-slide[hidden] { display: none; }
/* without JavaScript, the random home carousel shows its first photo */
html:not(.js) .carousel[data-random] .carousel-slide:first-child { display: flex; }
.carousel-slide img { width: auto; height: auto; max-width: 100%; max-height: calc(100% - 1.6rem); }   /* room for the credit underneath */
.carousel-slide figcaption { font-size: .75rem; }
.carousel-controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .4rem 1rem; margin-top: .5rem; font-size: .85rem; }   /* arrows centered under the photo credit */
.carousel-controls button { font-size: 1.1rem; line-height: 1; padding: .15rem .35rem; }
.carousel-all { flex-basis: 100%; text-align: center; }   /* View gallery on its own line, centered */
.photo-grid { list-style: none; margin: 1.5rem 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); grid-auto-flow: dense; gap: .5rem; }
.photo-grid li { aspect-ratio: 1; }
.photo-grid li.is-zoomed { grid-column: span 3; grid-row: span 3; }
.photo { display: block; width: 100%; height: 100%; cursor: zoom-in; }
.photo[aria-pressed="true"] { cursor: zoom-out; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo-credits { font-size: .8rem; }
@media (max-width: 420px) { .photo-grid li.is-zoomed { grid-column: span 2; grid-row: span 2; } }

/* merch item pages */
.back { font-size: .85rem; margin-bottom: 1.25rem; }
.back a { text-decoration: none; }
h1 .subtitle { display: block; font-size: .7em; margin-top: .25rem; }
.merch-description { margin-top: 1.5rem; }
.merch-details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--ink); font-size: .9em; }
.merch-details dt { font-family: "Hershey Bold", sans-serif; }
.merch-details dd { margin: 0; }
/* tee photos keep their own shape, so the frame hugs each photo; the slot stays one height so the arrows don't jump */
.page-merch-item .carousel-slide { height: min(60dvh, 32rem); }
.page-merch-item .carousel-slide img { max-height: 100%; }

/* fair details pages (/archive/<slug>/): poster beside the words, then the photos */
.fair-detail { display: grid; grid-template-columns: minmax(0, 22rem) 1fr; gap: 1.5rem 2.5rem; align-items: start; margin: 1.5rem 0 1rem; }
.fair-poster { margin: 0; }
.fair-poster img { border: 1px solid var(--ink); padding: var(--frame-gap); background-clip: content-box; }
.fair-words > :first-child { margin-top: 0; }
@media (max-width: 760px) { .fair-detail { grid-template-columns: 1fr; } }
/* details-page photos keep their own shape (tall polaroids, wide photos), nothing cropped */
.photo-grid.is-natural { grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); align-items: start; }
.photo-grid.is-natural li { aspect-ratio: auto; }
.photo-grid.is-natural li.is-zoomed { grid-row: auto; }
.photo-grid.is-natural .photo, .photo-grid.is-natural .photo img { height: auto; }
/* with JavaScript: masonry (site.js sets how many 2px rows each photo spans), so the gaps fill in */
html.js .photo-grid.is-natural { grid-auto-rows: 2px; row-gap: 0; }
