/* Process Journal — archive
   Palette: light and dark tokens from colour-palette.md (dark by default; the switch
   top right sets data-theme on <html>). No hex values outside the theme blocks.
   Layout: 30px page margin (20px mobile); 3-column grid for header, editions,
   credits and footer; 6-column grid for spreads and photos. */

@font-face {
  font-family: "GT America";
  src: url("../assets/fonts/GT-America-Standard-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "GT America";
  src: url("../assets/fonts/GT-America-Standard-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg:               #111111;
  --sidebar-bg:       #212121;
  --surface-raised:   #2E2E2E;
  --card-1:           #212121;
  --nav-glass:        rgb(27 27 27 / 0.6);
  --icon:             #EEEBE6;
  --icon-muted:       #8E8A84;
  --foreground:       #EEEBE6;
  --muted-foreground: #A39F99;
  --note:             #5A5651;
  --copy:             var(--muted-foreground);
  --copy-accent:      var(--foreground);
  --border:           #262626;
  --ring:             #6B6762;

  --margin: 30px;
  --gutter: 20px;
  --font: "GT America", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(.22, .61, .36, 1);   /* same curve as thomaswilliams.co */
}

[data-theme="light"] {
  color-scheme: light;
  --bg:               #ECEAE6;
  --sidebar-bg:       #F4F2EE;
  --surface-raised:   #DEDBD5;
  --card-1:           #E3E0DB;
  --nav-glass:        rgb(221 217 212 / 0.6);
  --icon:             #231F20;
  --icon-muted:       #9A958E;
  --foreground:       #231F20;
  --muted-foreground: #57524D;
  --note:             #B3AEA7;
  --copy:             #231F20;
  --copy-accent:      #57524D;
  --border:           #D9D5CF;
  --ring:             #9A958E;
}

@media (max-width: 760px) {
  :root { --margin: 20px; --gutter: 12px; }
}

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--foreground);
  font-family: var(--font);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .4s, color .4s, border-color .4s;
}

a { color: inherit; text-decoration: none; transition: color .2s; }
a:hover { color: var(--muted-foreground); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
img { display: block; max-width: 100%; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 400; font-size: inherit; }

.page {
  padding: var(--margin) var(--margin) 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Grids ---------- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
}
.grid-6 {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gutter);
}

/* ---------- Header ---------- */
.site-header {
  font-size: 20px;
  align-items: start;
}
/* Edition pages: header stays pinned to the top on a solid bar.
   The bar runs edge to edge (negative margins cancel the page padding). */
.site-header--bar {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: calc(-1 * var(--margin)) calc(-1 * var(--margin)) 0;
  padding: var(--margin) var(--margin) 20px;
  background: var(--bg);
}
/* Anything scrolled into view (e.g. the thumb focused when the viewer closes) clears the bar */
html:has(.site-header--bar) { scroll-padding-top: 100px; }
.site-title { font-weight: 400; }
/* Lucide book-open beside the title, sized to the type */
.site-title a { display: inline-flex; align-items: center; gap: calc(.35em + 4px); }
/* Close to the cap height so it reads at the same optical size as the type;
   a slightly heavier stroke keeps it from looking thinner than the letters */
.title-icon { width: .95em; height: .95em; flex: none; stroke-width: 1.75; }
/* Index intro: starts on column 2 and runs half the page width. It sits outside
   the pinned header, pulled up level with the title (one 20px line + the bar's
   20px bottom padding), so it scrolls away underneath the bar. */
.intro-row { font-size: 22px; margin-top: calc(-1.3em - 21px); }   /* first line shares the title's baseline */
.intro {
  grid-column: 2 / span 2;
  width: calc((100vw - 2 * var(--margin)) / 2);
  max-width: 100%;
}
/* Index: the bar is see-through at the very top so the intro shows beside the title;
   it turns solid once the page scrolls */
.site-header--bar { transition: background-color .3s ease; pointer-events: none; }
.site-header--bar a { pointer-events: auto; }
.site-header--bar.is-top { background-color: transparent; }
/* "Index" rolls up into column 2 once the intro has scrolled away; it returns to the top */
.header-index {
  grid-column: 2;
  grid-row: 1;
  overflow: hidden;
  visibility: hidden;
  transition: visibility 0s linear .5s;
}
.header-index span {
  display: block;
  transform: translateY(110%);
  transition: transform .5s var(--ease-out);
}
.show-index .header-index { visibility: visible; transition: visibility 0s; }
.show-index .header-index span { transform: none; }
/* Contact with About stacked beneath, right-aligned in column 3 */
.header-contact {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
}
/* Light / dark switch (Lucide eclipse), at the right margin, sized like the title icon */
.theme-toggle {
  display: inline-flex;
  padding: 0;
  border: 0;
  background: none;
  color: var(--icon);
  font: inherit;
  cursor: pointer;
  pointer-events: auto;
  transition: color .2s;
}
.theme-toggle svg { width: .95em; height: .95em; stroke-width: 1.75; }
.theme-toggle:hover { color: var(--muted-foreground); }

/* Index: 13 square tiles starting in column 2 → rows of 2–3–3–3–2 */
.editions { margin-top: 120px; row-gap: 68px; }
.editions > .edition:first-of-type { grid-column-start: 2; }
/* Each edition: square cover, then title and date underneath */
.edition { display: block; }
.edition-caption { display: block; margin-top: 12px; text-align: left; font-size: 20px; }   /* header size */
.edition-date { display: block; color: var(--muted-foreground); }
.edition:hover .edition-caption { color: var(--foreground); }
.tile {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--card-1);
  overflow: hidden;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Index covers sit in black and white and fade to colour on hover;
   edition-page images (.thumb) are always in colour */
.tile img {
  filter: grayscale(1);
  transition: filter .6s ease, transform 1.8s var(--ease-out);
}
.thumb img { transition: transform 1.8s var(--ease-out); }
.edition:hover .tile img,
.edition:focus-visible .tile img { filter: grayscale(0); }

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; padding-top: 120px; }
.site-footer--edition { padding-top: 160px; }   /* edition pages sit 40px further below the credits */
.masthead {
  width: 100%;
  aspect-ratio: 984 / 112;
  background-color: var(--foreground);
  -webkit-mask: url("../assets/masthead.svg") no-repeat center / contain;
          mask: url("../assets/masthead.svg") no-repeat center / contain;
}
/* Footer text sits 80px below the logo */
.footer-meta {
  margin: 80px 0 var(--margin);
  color: var(--muted-foreground);
}
.footer-meta a:hover { color: var(--foreground); }
.name-short { display: none; }
.footer-meta > a:last-child { justify-self: end; }   /* Contact, right-aligned like the header */

/* ---------- Edition page ---------- */
/* Equal space above (from header) and below (to spreads) */
.edition-title {
  margin-top: 100px;   /* + the header bar's 20px = 120px */
  font-size: clamp(56px, 9vw, 144px);
  line-height: .95;
  letter-spacing: -0.045em;
}
.section { margin-top: 120px; }
.section:first-of-type { margin-top: 120px; }
.section-label {
  font-size: 20px;   /* matches the header */
  color: var(--muted-foreground);
  margin-bottom: 16px;
}

.thumb {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  cursor: zoom-in;
  display: block;
  width: 100%;
  overflow: hidden;
}
.thumb img {
  width: 100%;
  height: 100%;
  background: var(--card-1);
}
.thumb img.is-loaded { background: transparent; }

.spreads .thumb { aspect-ratio: 5150 / 3543; }
.spreads .thumb img { object-fit: contain; }
/* Label sits in column 1, level with the top of the first row; images start in column 2 */
.gallery > .section-label,
.editions > .section-label { grid-column: 1; grid-row: 1; margin: 0; line-height: 1; }
.gallery > .thumb:first-of-type { grid-column-start: 2; }
.photos .thumb { aspect-ratio: 4 / 3; }
.photos .thumb img { object-fit: cover; }

/* About this edition: set like the index header — name in column 1,
   paragraph from column 2 at half the page width */
.edition-about { font-size: 20px; align-items: start; }
.edition-about-label { grid-column: 1; color: var(--muted-foreground); }
.edition-about-text {
  grid-column: 2 / span 2;
  width: calc((100vw - 2 * var(--margin)) / 2);
  max-width: 100%;
}

/* Disclaimer page: sections set like the Features text, closer together */
.legal { margin-top: 64px; }
.legal.legal--first { margin-top: 120px; }
.legal p + p { margin-top: 1em; }
.legal a { text-decoration: underline; text-underline-offset: .15em; text-decoration-thickness: 1px; }

/* Credits */
.credits { font-size: 17px; line-height: 1.4; row-gap: 0; }
.credit-col > div + div { margin-top: 1.4em; }
.credit-label { color: var(--muted-foreground); }
.credit-value { color: var(--foreground); }
.credit-value em { font-style: italic; }

/* ---------- Viewer (full screen) ---------- */
body.is-locked { overflow: hidden; }

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity .45s var(--ease-out);
}
/* Off the page entirely while closed (see js/edition.js for why), then faded in */
.viewer.is-shown { display: flex; }
.viewer.is-open { opacity: 1; }

/* Navigation strip across the top, clear of the image */
.viewer-bar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gutter);
  align-items: center;
  padding: 14px var(--margin);
  font-size: 18px;
}
.viewer-title { font-weight: 400; }
.viewer-count { font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
.viewer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}
.viewer-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--icon-muted);
  cursor: pointer;
  transition: color .2s;
}
.viewer-btn:hover { color: var(--icon); }
/* No focus square on the icons; keyboard focus shows as the brighter icon colour instead */
.viewer-btn { -webkit-tap-highlight-color: transparent; }
.viewer-btn:focus,
.viewer-btn:focus-visible { outline: none; }
.viewer-btn:focus-visible { color: var(--icon); }
.viewer-btn svg { width: 24px; height: 24px; stroke-width: 1.5; }
.viewer-close { margin-left: 16px; }

.viewer-body {
  position: relative;
  flex: 1;
  min-height: 0;
}
.viewer-stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  overscroll-behavior: contain;
  display: flex;
}
/* Spread at 100% width; the stage scrolls vertically when it's taller than the screen. */
.viewer-img {
  display: block;
  margin: auto 0;
  width: 100%;
  height: auto;
  /* Added once its file has fully downloaded, then faded in (see js/edition.js) */
  animation: viewer-img-in .4s var(--ease-out) both;
}
@keyframes viewer-img-in { from { opacity: 0; } }

/* ---------- Scroll reveal (matches thomaswilliams.co) ----------
   html.reveal is set in <head> only when motion is allowed; js/reveal.js
   adds .is-revealed as each element scrolls into view, staggered 90ms. */
html.reveal [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 1.1s var(--ease-out), transform 1.4s var(--ease-out);
}
html.reveal [data-reveal].is-revealed { opacity: 1; transform: none; }
html.reveal :is(.edition, .thumb)[data-reveal] img { transform: scale(1.03); transition-delay: inherit; }
html.reveal :is(.edition, .thumb).is-revealed img { transform: none; }

@media (prefers-reduced-motion: reduce) {
  html.reveal [data-reveal] { opacity: 1; transform: none; transition: none; }
  .viewer { transition: none; }
  .viewer-img { animation: none; }
}

/* ---------- Responsive ---------- */
@media (min-width: 761px) and (max-width: 1100px) {
  .grid-6 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .site-header, .section-label, .edition-caption { font-size: 18px; }
  /* Phones: title takes the free space, Index and Contact sit together at the right */
  .site-header--bar { grid-template-columns: 1fr auto auto; column-gap: 12px; align-items: center; }   /* one row: links and the switch share a centre line; 12px matches the Contact-to-switch gap */
  /* Phones: one link at the right, before the theme switch: Contact on the index, Index on edition pages */
  .header-index, .site-header--bar:not([data-index-header]) .header-contact a { display: none; }
  .site-header--bar:not([data-index-header]) > a { grid-column: 2; justify-self: end; }
  .site-title { white-space: nowrap; }
  /* Phones: below the title, with the first line's capitals level with the top of the edition title on edition pages */
  .intro-row { font-size: 18px; margin-top: 46px; }   /* same size as the header text */
  .intro { grid-column: 1 / -1; width: auto; }
  /* Phones: one tile per row; the label is hidden visually but still names the list for screen readers */
  .editions { margin-top: 64px; grid-template-columns: 1fr; row-gap: 56px; }
  .editions > .edition:first-of-type { grid-column-start: 1; }
  .editions > .section-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  /* Label stays top-left in column 1; the first tile/thumb starts in column 2 at normal size */
  .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits { grid-template-columns: 1fr; row-gap: 1.4em; }
  .edition-about { font-size: 18px; grid-template-columns: 1fr; row-gap: 24px; }
  .edition-about-text { grid-column: 1; width: auto; }
  .edition-title { margin-top: 44px; }
  .section, .section:first-of-type { margin-top: 64px; }
  .legal { margin-top: 48px; }
  .legal.legal--first { margin-top: 64px; }
  .site-footer { padding-top: 96px; }
  .site-footer--edition { padding-top: 136px; }
  /* Phones: footer text sits just under the logo, one page margin below */
  /* Phones: one row, "Process Journal 2010–2017" left and "TW © 2026" right; no Contact link */
  .footer-meta { grid-template-columns: 1fr auto; font-size: 17px; margin-top: 32px; }   /* font size matches the credits */
  .footer-meta > a:last-child { display: none; }   /* phones: credit left, Disclaimer & Privacy right */
  .footer-meta > a { justify-self: end; }
  .name-full { display: none; }
  .name-short { display: inline; }
  .viewer-bar { font-size: 16px; grid-template-columns: auto 1fr auto; }
  .viewer-title { display: none; }
  .viewer-actions { gap: 8px; }
  .viewer-close { margin-left: 8px; }
}
