/* lkon — public site
   Layout notes: the frame grid is a pure-CSS justified gallery. Each figure gets
   --r (its aspect ratio) inline; flex-grow and flex-basis are both proportional
   to --r, which makes every image in a row land on exactly the same height. */

:root {
  --paper:        #f4f1ec;
  --paper-raised: #fbfaf8;
  --paper-sunk:   #ebe7e0;
  --ink:          #1a181c;
  --ink-soft:     #55515b;
  --ink-faint:    #8c8794;
  --line:         rgba(26, 24, 28, 0.14);
  --line-soft:    rgba(26, 24, 28, 0.07);
  --accent:       #c2452d;
  --lighttable:   #141317;
  --shadow-sm:    0 1px 2px rgba(20, 18, 24, 0.06);
  --shadow-lg:    0 2px 4px rgba(20, 18, 24, 0.04), 0 18px 40px -24px rgba(20, 18, 24, 0.5);

  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;

  --gutter: clamp(20px, 5vw, 68px);
  --maxw: 1320px;
  --radius: 3px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #0e0d11;
    --paper-raised: #17161c;
    --paper-sunk:   #08080a;
    --ink:          #f1efea;
    --ink-soft:     #a8a3ae;
    --ink-faint:    #6f6a78;
    --line:         rgba(241, 239, 234, 0.15);
    --line-soft:    rgba(241, 239, 234, 0.07);
    --lighttable:   #060608;
    --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg:    0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.9);
  }
}

:root[data-theme="dark"] {
  --paper:        #0e0d11;
  --paper-raised: #17161c;
  --paper-sunk:   #08080a;
  --ink:          #f1efea;
  --ink-soft:     #a8a3ae;
  --ink-faint:    #6f6a78;
  --line:         rgba(241, 239, 234, 0.15);
  --line-soft:    rgba(241, 239, 234, 0.07);
  --lighttable:   #060608;
  --shadow-sm:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg:    0 2px 4px rgba(0, 0, 0, 0.3), 0 18px 40px -24px rgba(0, 0, 0, 0.9);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  z-index: 60;
  font-size: 13px;
}
.skip-link:focus { left: 8px; }

/* ------------------------------------------------------------------ header */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 16px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line-soft);
}

.wordmark {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.4vw, 28px);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.site-nav a { color: var(--ink-faint); transition: color 0.18s ease; }
.site-nav a:hover, .site-nav a.current { color: var(--ink); }

.theme-toggle {
  border: 1px solid var(--line);
  background: none;
  border-radius: 999px;
  padding: 5px;
  cursor: pointer;
  display: grid;
  place-items: center;
  line-height: 0;
}
.theme-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ink) 0 50%, transparent 50% 100%);
  border: 1px solid var(--ink);
  display: block;
}

/* -------------------------------------------------------------------- hero */

main { display: block; }

.hero {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(56px, 11vw, 132px) var(--gutter) clamp(32px, 5vw, 56px);
}

.hero-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 9vw, 5.6rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}

.hero-tagline {
  margin: 18px 0 0;
  max-width: 34ch;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--ink-soft);
}

/* the small contact-sheet style index under the hero */
.roll-index {
  margin-top: clamp(36px, 6vw, 64px);
  border-top: 1px solid var(--line);
}
.roll-index a {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 16px;
  align-items: baseline;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line-soft);
  transition: background-color 0.15s ease, padding-left 0.15s ease;
}
.roll-index a:hover { background: var(--paper-raised); padding-left: 10px; }
.idx-no {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.idx-title { color: var(--ink); font-size: 0.98rem; }
.idx-stock {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-align: right;
}

/* ------------------------------------------------------------------- rolls */

.rolls {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(60px, 10vw, 120px);
}
.rolls.single { padding-top: clamp(24px, 4vw, 40px); }

.crumb {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  margin: 0 0 28px;
}
.crumb a:hover { color: var(--ink); }

.roll {
  padding-top: clamp(40px, 6vw, 72px);
  margin-top: clamp(44px, 7vw, 88px);
  border-top: 1px solid var(--line);
}
.rolls > .roll:first-child, .rolls.single .roll { margin-top: 0; }
.rolls.single .roll { border-top: none; padding-top: 0; }

.roll-head { margin-bottom: clamp(24px, 3vw, 38px); }

.strapline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
}
.strapline .roll-no { color: var(--accent); }
.strapline .sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
}
.strapline .roll-date { margin-left: auto; }

.roll-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0;
}
.roll-title a { transition: color 0.18s ease; }
.roll-title a:hover { color: var(--accent); }

.draft-flag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 12px;
  padding: 3px 8px;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.roll-sub {
  display: flex;
  gap: 14px;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}

.roll-notes {
  margin: 18px 0 0;
  max-width: 58ch;
  color: var(--ink-soft);
}

.roll-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(240px, 23vw, 320px);
  gap: clamp(26px, 3.6vw, 60px);
  align-items: start;
}

/* --------------------------------------------------- justified frame grid */

.frames {
  --row-h: clamp(200px, 25vw, 330px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}
.frames::after { content: ""; flex-grow: 999; }

.frame {
  flex: var(--r, 1.5) 1 calc(var(--r, 1.5) * var(--row-h));
  min-width: 0;
  margin: 0;
}

.frame-open {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--paper-sunk);
  cursor: zoom-in;
  overflow: hidden;
  border-radius: var(--radius);
  line-height: 0;
}
.frame-open img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1), filter 0.3s ease;
}
.frame-open:hover img { transform: scale(1.02); }

.frame-no {
  position: absolute;
  left: 10px;
  bottom: 9px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 2px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  line-height: 1.5;
}
.frame-open:hover .frame-no, .frame-open:focus-visible .frame-no {
  opacity: 1;
  transform: none;
}

.frame figcaption {
  margin-top: 7px;
  font-size: 0.8rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

.roll-empty {
  font-family: var(--mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 34px;
  width: 100%;
  text-align: center;
  margin: 0;
}

.more-frames {
  flex: 1 0 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  width: fit-content;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.more-frames:hover { color: var(--accent); border-color: var(--accent); }
.more-frames .arrow { transition: transform 0.2s ease; }
.more-frames:hover .arrow { transform: translateX(4px); }

/* --------------------------------------------- the column with box + negs */

.roll-aside { position: relative; }
.aside-inner {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.aside-label {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 0.64rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}
.aside-label::after {
  content: "";
  display: block;
  height: 1px;
  background: var(--line);
  margin-top: 8px;
}

.boxshots, .negstrips { display: flex; flex-direction: column; gap: 14px; }

.boxshot, .negstrip { margin: 0; }

.boxshot button, .negstrip button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}

.boxshot img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: var(--shadow-lg);
  transform: rotate(-1.2deg);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.boxshot:hover img { transform: rotate(0deg) scale(1.01); }

.negstrip button {
  background: var(--lighttable);
  padding: 7px;
  border-radius: 2px;
  box-shadow: var(--shadow-sm), inset 0 0 22px rgba(0, 0, 0, 0.55);
}
.negstrip img {
  width: 100%;
  height: auto;
  display: block;
  filter: contrast(1.02);
}

.boxshot figcaption, .negstrip figcaption {
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--ink-faint);
  line-height: 1.45;
}

.specs { margin: 0; }
.spec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-soft);
}
.spec:first-child { border-top: 1px solid var(--line); }
.spec dt {
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.spec dd {
  margin: 0;
  text-align: right;
  font-size: 0.85rem;
  color: var(--ink);
}

/* ------------------------------------------------------------- roll pager */

.roll-pager {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(60px, 10vw, 120px);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.pager {
  flex: 1 1 260px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease;
}
.pager:hover { border-color: var(--accent); }
.pager.next { text-align: right; align-items: flex-end; }
.pager-dir {
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
}
.pager-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  color: var(--ink);
  line-height: 1.15;
}

/* -------------------------------------------------------- simple pages */

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(56px, 10vw, 120px) var(--gutter) clamp(60px, 10vw, 120px);
}
.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 28px;
}
.prose p { margin: 0 0 1.1em; font-size: 1.05rem; }
.page-stats {
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 36px;
}
.page-links { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 8px; }
.big-link {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.big-link:hover { color: var(--accent); border-color: var(--accent); }

.empty-state {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(80px, 12vw, 160px);
  text-align: center;
}
.empty-lead {
  font-family: var(--serif);
  font-size: 2rem;
  color: var(--ink);
  margin: 0 0 10px;
}
.empty-state a { color: var(--accent); border-bottom: 1px solid currentColor; }

/* ------------------------------------------------------------------ footer */

.site-foot {
  border-top: 1px solid var(--line);
  padding: 30px var(--gutter) 48px;
}
.foot-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px 28px;
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
}
.foot-mark { margin: 0; color: var(--ink); }
.foot-note { margin: 0; text-transform: none; letter-spacing: 0.02em; }
.foot-links { margin-left: auto; display: flex; gap: 18px; }
.foot-links a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- lightbox */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--paper-sunk) 97%, transparent);
  animation: lb-in 0.22s ease both;
}
.lightbox[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; } to { opacity: 1; } }

.lb-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(28px, 3.5vw, 56px) clamp(56px, 5vw, 84px) 8px;
  overflow: hidden;          /* a zoomed photo stays inside the stage */
  touch-action: none;        /* pinch and drag are ours to handle */
}
/* The fitted size is worked out in JS and written to width/height, because a
   percentage max-height resolves against an auto-sized grid row — which is to
   say, it does nothing — and max-* can only ever shrink a photo, never grow a
   small one to fill the window. */
.lb-img {
  /* Backstop only. Viewport units are always definite, unlike a percentage
     against the grid row, so even if a resize never reaches the script the
     photo cannot spill outside the window. JS normally fits it tighter than
     this, so these limits do not bind. */
  max-width: calc(100vw - 20px);
  max-height: calc(100vh - 88px);
  object-fit: contain;   /* belt and braces: never stretch, whatever the box */
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, 0.9);
  border-radius: 2px;
  transform-origin: center center;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
}
/* Only while a zoom settles — panning must follow the finger with no lag. */
.lb-img.animating {
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* Moving between frames: the photo leaves and arrives instead of cutting. */
.lb-img.sliding {
  transition: transform 0.22s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.22s ease;
}
.lightbox.zoomed .lb-img { cursor: grab; }
.lightbox.panning .lb-img { cursor: grabbing; transition: none; }

.lb-bar {
  display: flex;
  align-items: baseline;
  gap: 18px;
  justify-content: center;
  padding: 10px clamp(16px, 8vw, 96px) 26px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.lb-count {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
}
.lb-caption { margin: 0; max-width: 60ch; }

/* Doubles as the hint at fit size and the "back to fit" control when zoomed.
   Needs to opt out of the absolute positioning the viewer's other buttons use. */
.lightbox .lb-zoom {
  position: static;
  width: auto;
  height: auto;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.lightbox .lb-zoom:hover { border-color: var(--line); color: var(--ink); }
.lightbox.zoomed .lb-zoom { color: var(--ink); border-color: var(--line); }

.lightbox button {
  position: absolute;
  background: none;
  border: 1px solid transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}
.lightbox button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: color-mix(in srgb, var(--paper) 40%, transparent);
}
.lb-close { top: 16px; right: 16px; font-size: 1.1rem; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.lightbox button[disabled] { opacity: 0.25; pointer-events: none; }

/* Named apart from the .lb-open triggers on purpose: a shared name makes
   closest('.lb-open') match <body> from inside the viewer. */
body.lightbox-open { overflow: hidden; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1040px) {
  .roll-body { grid-template-columns: minmax(0, 1fr); }
  .aside-inner {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 22px 30px;
  }
  .aside-block { flex: 1 1 240px; }
  .aside-specs { flex-basis: 100%; }
  .specs { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 30px; }
}

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .site-head { padding: 12px var(--gutter); }
  .frames { --row-h: 260px; gap: 10px; }
  .frame { flex-basis: 100%; }
  .roll-index a { grid-template-columns: 3.4rem minmax(0, 1fr); }
  .idx-stock { display: none; }
  .strapline .roll-date { margin-left: 0; width: 100%; }
  .foot-links { margin-left: 0; }
  /* The arrows drop to the bottom on a phone, so the photo gets the full width. */
  .lb-stage { padding: 20px 12px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; }
  .lb-prev { left: 18px; }
  .lb-next { right: 18px; }
  .lb-bar { padding-bottom: 76px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-head, .site-foot, .lightbox, .more-frames { display: none; }
  .roll-body { display: block; }
}
