/* pjtookit — public site styles.
   Light "contact sheet" home, dark "dark room" for albums and photos.
   Phone layout below 760px; desktop above. */

:root {
  --bg: #ffffff; --fg: #1f2124; --muted: #5f646b; --line: #e7e8ea;
  --sans: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gap: 12px; --rh: 300px; --pad: 32px;
}
[data-theme="dark"] { --bg: #141413; --fg: #edebe6; --muted: #b5b3aa; --line: #3a3a37; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--muted); }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; }
.label { margin: 0; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* ---------- Home ---------- */
.home-wrap { max-width: 1440px; margin: 0 auto; padding: 56px var(--pad) 80px; display: flex; gap: 72px; align-items: flex-start; }
.side { flex: 0 0 200px; position: sticky; top: 56px; display: flex; flex-direction: column; gap: 40px; }
.brand { font-size: 18px; font-weight: 600; line-height: 1.3; display: flex; flex-direction: column; }
.brand-sub { font-weight: 400; color: var(--muted); }
.side-nav { display: none; }
.side-albums, .albums-list { display: flex; flex-direction: column; gap: 12px; }
.side-albums ul, .albums-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 15px; }
.count { color: var(--muted); margin-left: 4px; }
.sheet-wrap { flex: 1; min-width: 0; }

/* Justified rows: each tile grows in proportion to its aspect ratio (--r),
   so every row has one height and photos keep their real shape. */
.sheet { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--gap); }
.sheet::after { content: ""; flex-grow: 999999; }
.tile { position: relative; flex-grow: calc(var(--r) * 100); flex-basis: calc(var(--r) * var(--rh)); }
.tile > a { display: block; aspect-ratio: var(--r); background: #f1f2f3; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.tile > a:hover img { opacity: .88; }
.album-chip { position: absolute; left: 12px; bottom: 12px; max-width: calc(100% - 24px); display: flex; flex-direction: column; gap: 2px; background: #141413; color: #edebe6; padding: 10px 12px; }
.album-chip-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-chip-meta { color: #b5b3aa; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.tile-album > a:hover { color: inherit; }
.foot { margin: 32px 0 0; color: var(--muted); }
.empty { color: var(--muted); padding: 80px 0; }
.notfound { max-width: 640px; margin: 0 auto; padding: 120px var(--pad); }
.notfound h1 { font-weight: 500; font-size: 32px; margin: 12px 0 24px; }

/* ---------- Dark pages (album + photo) ---------- */
.dark-wrap, .photo-wrap { max-width: 1320px; margin: 0 auto; padding: 24px var(--pad) 64px; display: flex; flex-direction: column; gap: 24px; }
.dark-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.back { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 12px; }
.back:hover { color: var(--fg); }
.brand-small { font-weight: 600; }
.album-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 48px; }
.album-head h1 { margin: 0; font-size: 34px; font-weight: 500; letter-spacing: -0.015em; line-height: 1.15; }
.album-desc { margin: 10px 0 0; max-width: 640px; color: var(--muted); white-space: pre-line; }
.album-meta { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.viewer-fig, .photo-fig { margin: 0; display: flex; flex-direction: column; gap: 18px; }
.viewer-stage { position: relative; display: flex; justify-content: center; align-items: center; height: clamp(360px, calc(100vh - 400px), 1000px); }
.viewer-img, .photo-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.photo-img { max-height: calc(100vh - 200px); margin: 0 auto; }
.stage-hit { position: absolute; top: 0; bottom: 0; width: 35%; border: 0; background: transparent; padding: 0; }
.stage-prev { left: 0; cursor: w-resize; } .stage-next { right: 0; cursor: e-resize; }
.viewer-cap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.viewer-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cap-title { font-size: 17px; font-weight: 400; margin: 0; }
.cap-text { color: var(--muted); margin: 0; white-space: pre-line; }
.viewer-ctrl { display: flex; align-items: center; gap: 8px; }
.round { width: 44px; height: 44px; border: 1px solid var(--line); background: transparent; border-radius: 22px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); }
.round:hover { border-color: var(--fg); color: var(--fg); }
.round.is-off { opacity: .3; cursor: default; }
.counter { min-width: 64px; text-align: center; color: var(--muted); font-size: 12px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px; scrollbar-width: thin; }
.thumb { flex: 0 0 auto; height: 80px; opacity: .5; transition: opacity .15s; }
.thumb img { height: 100%; width: auto; }
.thumb:hover, .thumb[aria-current="true"] { opacity: 1; }
.thumb[aria-current="true"] { outline: 1px solid var(--fg); outline-offset: 3px; }
.feed { display: none; }
.dark-foot { margin-top: 24px; }

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  :root { --gap: 6px; --rh: 150px; --pad: 16px; }

  /* Home: compact top bar with an Albums drop-down instead of a sidebar */
  .home-wrap { flex-direction: column; gap: 20px; padding-top: 20px; }
  .side { position: sticky; top: 0; z-index: 5; width: calc(100% + 2 * var(--pad)); margin: 0 calc(-1 * var(--pad)); padding: 10px var(--pad); background: var(--bg); flex-direction: row; justify-content: space-between; align-items: center; gap: 16px; flex-basis: auto; }
  .brand { flex-direction: row; gap: 8px; align-items: baseline; font-size: 17px; }
  .brand-sub { font-size: 14px; }
  .side-nav { position: relative; }
  .side-albums { display: none; }
  .side-nav { display: block; }
  .albums-menu summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 4px; cursor: pointer; list-style: none; font-size: 15px; }
  .albums-menu summary::-webkit-details-marker { display: none; }
  .albums-menu[open] summary svg { transform: rotate(180deg); }
  .albums-menu .albums-list { display: none; }
  .albums-menu[open] .albums-list { display: flex; position: absolute; right: 0; top: 100%; min-width: 220px; background: var(--bg); border: 1px solid var(--line); padding: 16px; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
  .albums-list a { display: block; padding: 6px 0; }
  .album-chip { left: 6px; bottom: 6px; max-width: calc(100% - 12px); padding: 6px 8px; }
  .album-chip-title { font-size: 12px; }
  .album-chip-meta { font-size: 9px; }

  /* Album: a simple vertical scroll of every photo instead of the viewer */
  .dark-wrap { gap: 20px; padding-top: 12px; }
  .album-head h1 { font-size: 30px; }
  .viewer { display: none; }
  .feed { display: flex; flex-direction: column; gap: 36px; list-style: none; margin: 8px calc(-1 * var(--pad)) 0; padding: 0; }
  .feed-item img { width: 100%; height: auto; }
  .feed-cap { display: flex; flex-direction: column; gap: 4px; padding: 12px var(--pad) 0; }

  /* Photo page: image edge to edge, swipe to move */
  .photo-wrap { padding-top: 12px; gap: 16px; min-height: 100svh; }
  .photo-fig { margin: 0 calc(-1 * var(--pad)); }
  .photo-img { max-height: 75svh; }
  .photo-fig .viewer-cap { padding: 0 var(--pad); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
