/* images.hizach.com — quiet PhotoShelter-style look (spec §2). */

:root {
  --bg: #f5f5f5;
  --text: #444;
  --muted: #888;
  --rule: #dcdcdc;
  --card-border: #d6d6d6;
  --link-hover: #000;
  --placeholder: #e6e6e6;
  --lb-bg: rgba(18, 18, 18, 0.97);
  --font-body: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  --font-wordmark: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --page-max: 1280px;
  --gutter-page: clamp(16px, 4vw, 48px);
}

body.theme-dark {
  --bg: #161616;
  --text: #cfcfcf;
  --muted: #8a8a8a;
  --rule: #333;
  --card-border: #3a3a3a;
  --link-hover: #fff;
  --placeholder: #262626;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; width: 100%; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--link-hover); }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

img { max-width: 100%; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: #fff; color: #000; padding: 8px 12px; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  text-align: center;
  padding: 40px var(--gutter-page) 0;
}

.wordmark {
  display: inline-block;
  font-family: var(--font-wordmark);
  font-weight: 900;
  font-size: clamp(26px, 4.2vw, 40px);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--text);
}

.ig-link {
  display: block;
  width: 16px;
  margin: 14px auto 0;
  color: var(--text);
}
.ig-link svg { display: block; }

.main-nav {
  position: relative;
  max-width: var(--page-max);
  margin: 18px auto 0;
}
.main-nav ul, .sub-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 32px;
}
.main-nav a, .sub-nav a {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.nav-plus { display: inline-block; width: 0.8em; text-align: left; }

.nav-search {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}
.nav-search svg { display: block; }
@media (min-width: 760px) { .nav-search { display: block; } }

.sub-nav {
  display: none;
  max-width: var(--page-max);
  margin: 14px auto 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.sub-nav.is-open { display: block; }
.sub-nav ul { gap: 4px 0; }
.sub-nav li + li::before {
  content: '·';
  padding: 0 12px;
  color: var(--muted);
}
.sub-nav a { font-weight: 400; color: var(--muted); }
.sub-nav a:hover { color: var(--link-hover); }

/* ── Page scaffolding ───────────────────────────────────────────────────── */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 32px var(--gutter-page) 64px;
}

.page-title {
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0.02em;
  margin: 8px 0 24px;
  text-align: center;
}

.breadcrumbs ol {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.breadcrumbs li + li::before { content: '/'; padding: 0 8px; opacity: 0.6; }
.breadcrumbs a:hover { color: var(--link-hover); }

.description {
  max-width: 680px;
  margin: -8px auto 24px;
  text-align: center;
}
.description a { text-decoration: underline; text-underline-offset: 2px; }

.empty, .muted { color: var(--muted); text-align: center; }

/* ── Cards (All Galleries / folders) ────────────────────────────────────── */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 20px;
}
@media (min-width: 700px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; } }
@media (min-width: 1080px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { display: block; text-align: center; }
.card-cover {
  display: block;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--card-border);
  padding: 6px;
  background: var(--bg);
}
.card-cover img, .card-placeholder {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--placeholder);
}
.card-placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.card:hover .card-cover { border-color: var(--muted); }
.card-title {
  display: block;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.card-count {
  display: block;
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}

/* ── Gallery header ─────────────────────────────────────────────────────── */

.gallery-header { text-align: center; margin-bottom: 24px; }
.gallery-header .page-title { margin-bottom: 4px; }
.gallery-date, .gallery-count {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
}
.gallery-header .description { margin: 12px auto; }

/* ── Justified grid ─────────────────────────────────────────────────────────
   Pure CSS, no layout shift: each tile's flex-basis is row-height × aspect
   ratio and it grows in proportion to its aspect ratio, so every row fills
   the width at (roughly) equal heights. The ::after filler stops the last
   row from stretching. */

.jg {
  --row-h: 260px;
  --gutter: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gutter);
}
.jg::after { content: ''; flex-grow: 999999; }
@media (max-width: 600px) { .jg { --row-h: 150px !important; --gutter: 4px !important; } }

.jg-item {
  position: relative;
  display: block;
  flex-grow: var(--ar);
  flex-basis: calc(var(--row-h) * var(--ar));
  background: var(--placeholder);
  overflow: hidden;
}
.jg-item > i { display: block; }
.jg-item > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.jg-item:hover > img { opacity: 0.88; }
.jg-caption {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 16px 8px 6px;
  font-size: 12px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

/* Light-touch save deterrent (not a security measure). */
.jg-item img, .card-cover img, .lb-img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */

.lb {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--lb-bg);
  color: #ddd;
  display: none;
  align-items: center;
  justify-content: center;
}
.lb.is-open { display: flex; }
html.lb-lock, html.lb-lock body { overflow: hidden; }

.lb-stage {
  margin: 0;
  width: 100%;
  height: 100%;
  padding: 56px 64px 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: pan-y pinch-zoom;
}
.lb-img {
  display: block;
  max-width: 100%;
  max-height: calc(100% - 8px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.lb-caption {
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  padding: 0 72px;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
}
.lb-caption strong { display: block; font-weight: 700; color: #fff; }
.lb-counter {
  position: absolute;
  top: 14px; left: 18px;
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: #999;
}
.lb-btn {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  font-size: 40px;
  line-height: 1;
  color: #bbb;
  background: none;
  border: 0;
  cursor: pointer;
}
.lb-btn:hover { color: #fff; }
.lb-btn[hidden] { display: none; }
.lb-close { top: 4px; right: 6px; font-size: 34px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .lb-stage { padding: 52px 0 72px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .lb-caption { padding: 0 60px; }
}

/* ── Messages / footer ──────────────────────────────────────────────────── */

.page-message .message { text-align: center; padding: 48px 0; }
.page-message .message svg { color: var(--muted); }
.page-message .message a { text-decoration: underline; }

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 24px;
  padding: 28px var(--gutter-page) 36px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.footer-links {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  letter-spacing: 0.06em;
}
.footer-links a:hover { color: var(--link-hover); }
.footer-copy { margin: 0; }

/* ── Password form / shared photo ───────────────────────────────────────── */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.password-form {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 20px auto 0;
  max-width: 360px;
}
.password-form input[type='password'] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 0;
}
.password-form button {
  padding: 10px 18px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  background: #444;
  border: 0;
  cursor: pointer;
}
.password-form button:hover { background: #222; }
.form-error { color: #a33; margin-top: 12px; }

.shared-photo { margin: 0; text-align: center; }
.shared-photo img {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-height: 80vh;
}
.shared-photo figcaption { margin-top: 12px; font-size: 13px; }
.shared-photo figcaption strong { display: block; }

/* ── Layout styles (spec §7) ────────────────────────────────────────────── */

.tile { display: block; position: relative; }
.tile img { display: block; }
.tile-text { display: block; padding: 6px 2px 0; font-size: 12px; line-height: 1.4; }
.tile-caption { display: block; }
.tile-filename { display: block; color: var(--muted); font-size: 11px; word-break: break-all; }

/* Grid: uniform cells, square-cropped or letterboxed. */
.grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--tile), 45vw), 1fr));
  gap: var(--gutter);
}
.grid-layout .tile-frame { display: block; aspect-ratio: 1 / 1; background: var(--placeholder); }
.grid-layout .tile-frame img { width: 100%; height: 100%; object-fit: contain; }
.grid-layout.is-square .tile-frame img { object-fit: cover; }

/* Masonry: columns of natural-aspect images. */
.masonry-layout { column-width: min(var(--tile), 42vw); column-gap: var(--gutter); }
.masonry-layout .tile { break-inside: avoid; margin-bottom: var(--gutter); }
.masonry-layout img { width: 100%; height: auto; }

/* Journal: one large image per row with captions. */
.journal-layout { max-width: 1000px; margin: 0 auto; }
.journal-item { margin: 0 0 48px; }
.journal-item img { width: 100%; height: auto; }
.journal-item figcaption { padding-top: 10px; font-size: 14px; }
.journal-item figcaption strong { display: block; font-weight: 700; }
.journal-item figcaption span { display: block; }

/* Slideshow: one at a time. */
.slideshow-layout { max-width: 1280px; margin: 0 auto; }
.ss-stage { position: relative; display: flex; justify-content: center; align-items: center; min-height: 40vh; }
.ss-slide { display: none; }
.ss-slide.is-active { display: block; }
.ss-slide img { max-width: 100%; max-height: 75vh; width: auto; height: auto; margin: 0 auto; }
.ss-controls { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 14px 0; }
.ss-controls button {
  font: inherit; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase;
  background: none; border: 0; color: var(--text); cursor: pointer; padding: 6px 10px;
}
.ss-controls .ss-prev, .ss-controls .ss-next { font-size: 30px; line-height: 1; }
.ss-counter { font-size: 12px; color: var(--muted); }

/* Hero header: cover image above the title. */
.gallery-hero { margin: 4px 0 24px; aspect-ratio: 21 / 9; overflow: hidden; background: var(--placeholder); }
.gallery-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lb-exif { display: block; margin-top: 4px; font-size: 11px; color: #999; letter-spacing: 0.02em; }

/* ── Landing page ───────────────────────────────────────────────────────── */

.page-landing { padding-top: 20px; }
.feature-filter ul {
  list-style: none; margin: 0 auto 28px; padding: 0; max-width: 980px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 0;
}
.feature-filter li + li::before { content: '·'; padding: 0 12px; color: var(--muted); }
.feature-filter a {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.feature-filter a:hover, .feature-filter a.is-active { color: var(--text); }
.feature-filter a.is-active { text-decoration: underline; text-underline-offset: 5px; }

.landing-grid { columns: 2; column-gap: 6px; }
@media (min-width: 700px) { .landing-grid { columns: 3; } }
@media (min-width: 1100px) { .landing-grid { columns: 4; } }
.landing-tile { display: block; break-inside: avoid; margin-bottom: 6px; background: var(--placeholder); }
.landing-tile img { display: block; width: 100%; height: auto; }
.landing-tile:hover img { opacity: 0.9; }
#landing-grid { transition: opacity 0.15s; }
#landing-grid.is-loading { opacity: 0.4; }
.landing-more { text-align: center; margin: 24px 0 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.landing-more a { text-decoration: underline; text-underline-offset: 3px; }

/* ── Share ──────────────────────────────────────────────────────────────── */

.page-actions { text-align: center; margin: 10px 0 0; }
.share-button {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text); background: none; border: 1px solid var(--card-border); padding: 6px 14px; cursor: pointer;
}
.share-button:hover { border-color: var(--text); }
.share-button[hidden] { display: none; }
.lb-share { position: absolute; top: 12px; right: 64px; color: #ccc; border-color: #555; }
.lb-share:hover { color: #fff; border-color: #aaa; }

/* ── Video ──────────────────────────────────────────────────────────────── */

.tile-play {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.45); border: 2px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
}
.tile-play::after {
  content: ''; position: absolute; left: 17px; top: 12px;
  border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff;
}
.tile-duration {
  position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; border-radius: 3px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: #fff; background: rgba(0, 0, 0, 0.65);
  pointer-events: none;
}
.landing-tile { position: relative; }
.grid-layout .tile-frame { position: relative; }

.lb-player { position: absolute; inset: 56px 64px 72px; display: flex; align-items: center; justify-content: center; }
.lb-player[hidden] { display: none; }
.lb-video { width: 100%; height: 100%; border: 0; background: #000; }
.lb-play {
  width: 84px; height: 84px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, 0.5);
  color: #fff; font-size: 30px; cursor: pointer;
}
.lb-loading { color: #aaa; font-size: 13px; }
@media (max-width: 600px) { .lb-player { inset: 52px 0 72px; } }

/* ── Downloads & selling ────────────────────────────────────────────────── */

.lb-buy {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: #eee; border: 1px solid #777; padding: 6px 14px; white-space: nowrap;
}
.lb-buy:hover { color: #fff; border-color: #ccc; }
.lb-buy[hidden] { display: none; }
.lb-panel {
  position: absolute; top: 56px; right: 12px; z-index: 2;
  width: min(380px, calc(100% - 24px)); max-height: calc(100% - 140px); overflow: auto;
  background: #fafafa; color: #333; padding: 18px 20px; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  --text: #333; --muted: #777; --rule: #ddd; --card-border: #ccc;
}
.lb-panel[hidden] { display: none; }
@media (max-width: 600px) {
  .lb-panel { top: auto; bottom: 0; right: 0; width: 100%; max-height: 75%; }
  .lb-buy { left: 64px; transform: none; padding: 6px 10px; }
}

.buy-panel { position: relative; text-align: left; font-size: 14px; }
.buy-close {
  position: absolute; top: -10px; right: -8px; font-size: 26px; line-height: 1;
  background: none; border: 0; color: #777; cursor: pointer; padding: 4px 8px;
}
.buy-title { margin: 0 0 2px; font-size: 13px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.buy-item { margin: 0 0 14px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.buy-section { border-top: 1px solid var(--rule); padding-top: 12px; margin-top: 12px; }
.buy-section h3 { margin: 0 0 8px; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.buy-sizes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.buy-sizes a { text-decoration: underline; text-underline-offset: 3px; }
.buy-sizes a::before { content: '↓ '; text-decoration: none; display: inline-block; margin-right: 2px; }
.buy-note { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.buy-offers { list-style: none; margin: 0; padding: 0; }
.offer { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.offer:last-child { border-bottom: 0; }
.offer-what { flex: 1; min-width: 0; }
.offer-what small, .cart-what small { display: block; color: var(--muted); font-size: 12px; }
.offer-price { font-weight: 700; white-space: nowrap; }
.offer-form { margin: 0; }
.offer-add, .checkout-button {
  font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #fff; background: #333; border: 0; padding: 8px 12px; cursor: pointer; white-space: nowrap;
}
.offer-add:hover, .checkout-button:hover { background: #000; }
.offer-add:disabled { background: #999; cursor: default; }
.buy-license { margin-top: 10px; font-size: 12px; color: var(--muted); }
.buy-license summary { cursor: pointer; }
.buy-license dt { font-weight: 700; color: var(--text); margin-top: 6px; }
.buy-license dd { margin: 0; }
.buy-cart-link, .buy-added { margin: 12px 0 0; font-size: 13px; }
.buy-cart-link a, .buy-added a { text-decoration: underline; }

.page-buy .buy-back { margin: 0 0 16px; font-size: 13px; }
.page-buy .buy-back a { text-decoration: underline; }
.buy-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); max-width: 980px; margin: 0 auto; }
@media (min-width: 800px) { .buy-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: start; } }
.buy-preview { width: 100%; height: auto; display: block; background: var(--placeholder); }

.bundle-actions { max-width: 420px; margin: 14px auto 0; text-align: left; }
.bundle-download {
  display: block; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  border: 1px solid var(--card-border); padding: 8px 14px;
}
.bundle-download:hover { border-color: var(--text); }
.bundle-offers { margin-top: 8px; }

.page-cart, .page-order { max-width: 760px; margin: 0 auto; }
.notice { text-align: center; color: var(--muted); }
.cart-lines, .order-lines { list-style: none; margin: 0 0 16px; padding: 0; }
.cart-line { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.cart-thumb { width: 72px; height: 72px; flex: none; background: var(--placeholder); }
.cart-thumb img, .cart-thumb .card-placeholder { width: 100%; height: 100%; object-fit: cover; display: block; }
.cart-what { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cart-what a { text-decoration: underline; text-underline-offset: 2px; }
.link-button { font: inherit; font-size: 12px; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.cart-total { display: flex; justify-content: space-between; font-size: 16px; padding: 12px 0; border-top: 2px solid var(--text); }
.checkout-form { text-align: right; margin-top: 16px; }
.checkout-button { font-size: 13px; padding: 12px 28px; }
.order-intro { text-align: center; max-width: 560px; margin: 0 auto 24px; }
.order-intro a { text-decoration: underline; }
.order-line { padding: 14px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
.order-line .buy-sizes, .order-line .buy-note { grid-column: 1 / -1; }
.bundle-parts { align-items: center; margin-top: 16px; }
.buy-owner { background: #fff6dd; border: 1px solid #eedc9a; padding: 8px 10px; font-size: 12px; margin-bottom: 4px; }
.buy-owner p { margin: 0 0 4px; }
.buy-owner ul { margin: 0; padding-left: 18px; }
.order-line .order-pick { grid-column: 1 / -1; margin: 4px 0 0; }
