/* PP Gallery stylesheet. Written from scratch for Powerful Photography (not derived from Backlight).
   Design: black stage, quiet type, thin framed photos, centred navigation. */
:root {
  --bg: #000;
  --panel: #0d0d0d;
  --fg: #bababa;
  --fg-strong: #f7f7f7;
  --muted: #8c8c8c;
  --line: #4d4d4d;
  --line-hover: #bababa;
  --accent: #0c71c3;
  --accent-hover: #2e8fe0;
  --focus: #7bbcf5;
  --danger: #e5776f;
  --ok: #7fc98f;
  --gap: 24px;
  --maxw: 1280px;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

/* header, navigation, basket badge */
.site-header { position: relative; padding: 16px 16px 6px; text-align: center; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 26px; }
.site-nav a { color: var(--fg); text-transform: uppercase; letter-spacing: .06em; font-size: 15px; padding: 6px 2px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg-strong); }
.nav-break { display: none; }
.social a { display: inline-flex; padding: 4px; color: var(--fg); }
.social svg { width: 20px; height: 20px; display: block; }
.basket-link { position: absolute; right: 16px; top: 12px; display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; padding: 6px 10px; border-radius: 2px; font-size: 13px; font-weight: 600; }
.basket-link:hover { background: var(--accent-hover); color: #fff; }
.basket-link svg { width: 18px; height: 18px; }
.basket-link [data-basket-count] { min-width: 1.2em; text-align: center; }

.crumbs { font-size: 14px; text-align: center; margin: 14px 0 24px; color: var(--muted); }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.crumbs li + li::before { content: "\203A"; margin-right: 8px; color: var(--muted); }
.crumbs [aria-current] { color: var(--fg); }

main { flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gap) 48px; }
h1.page { font-weight: 400; color: var(--fg-strong); font-size: clamp(22px, 3.2vw, 30px); text-align: center; margin: 0 0 6px; letter-spacing: .02em; }
.lede { text-align: center; color: var(--muted); margin: 0 auto 26px; max-width: 62ch; }
.page-copy { max-width: 62ch; margin: 0 auto 26px; text-align: center; color: var(--muted); }
.page-copy p { margin: 0 0 10px; }
.page-copy a { text-decoration: underline; }
.demo-note { text-align: center; color: #d6b25e; font-size: 13px; border: 1px dashed #5b4a1e; padding: 6px 10px; margin: 0 auto 22px; max-width: 70ch; }

/* collection cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: var(--gap); }
.card { display: grid; grid-template-columns: 112px 1fr; gap: 18px; border: 1px solid var(--line); padding: 12px; color: var(--fg); align-items: start; }
.card:hover, .card:focus-visible { border-color: var(--line-hover); color: var(--fg-strong); }
.card .thumb { width: 112px; aspect-ratio: 4 / 5; background: #111; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #555; font-size: 12px; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card h2 { margin: 4px 0 2px; font-size: 17px; font-weight: 600; color: inherit; }
.card p { margin: 0; font-size: 14px; color: var(--muted); }
.lock { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }

/* photo grid (columns keep each photo's natural shape) */
.grid { column-gap: var(--gap); columns: 5 200px; }
.grid figure { margin: 0 0 var(--gap); break-inside: avoid; }
.grid a { display: block; border: 1px solid var(--line); line-height: 0; background: #0b0b0b; }
.grid a:hover, .grid a:focus-visible { border-color: var(--line-hover); }
.grid img { width: 100%; height: auto; display: block; }
.album-actions { text-align: center; margin: 0 0 22px; }

/* single photo */
.stage { max-width: 960px; margin: 0 auto; }
.stage-bar { display: flex; justify-content: space-between; align-items: center; margin: 0 0 12px; }
.stage-bar .nav { display: flex; gap: 10px; }
.iconbtn { display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; color: var(--fg-strong); border: 1px solid transparent; border-radius: 2px; }
.iconbtn:hover { border-color: var(--line); color: #fff; }
.iconbtn svg { width: 18px; height: 18px; }
.stage figure { margin: 0; text-align: center; }
.stage figure img { max-width: 100%; max-height: calc(100vh - 180px); width: auto; height: auto; margin: 0 auto; display: block; }
.stage figcaption { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.copyright { text-align: center; font-size: 14px; margin: 26px 0 0; }

/* order panel on a photo */
.buy { margin: 28px auto 0; max-width: 640px; border: 1px solid var(--line); padding: 16px 18px; }
.buy h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; color: var(--fg-strong); }
.row { display: grid; grid-template-columns: 1fr 96px; gap: 0 12px; align-items: end; }
.row .product { grid-column: 1 / -1; }  /* product on its own line, so long size names are never cut off */
.field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; }
.field label { font-size: 13px; font-weight: 600; color: var(--fg); }
input, select, textarea { font: inherit; line-height: 1.3; color: #111; background: #fff; border: 1px solid #999; border-radius: 2px; padding: 9px 10px; width: 100%; }
input, select { height: 44px; }
textarea { min-height: 90px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; background: var(--accent); color: #fff; border: 0; border-radius: 2px; padding: 10px 18px; cursor: pointer; }
.btn:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--fg); }
.btn.ghost:hover { border-color: var(--line-hover); color: var(--fg-strong); }
.btn.small { padding: 6px 12px; font-size: 14px; }
.price { font-size: 20px; color: var(--fg-strong); margin: 4px 0 12px; }
.msg { margin: 10px 0 0; font-size: 14px; }
.msg:empty { margin: 0; }
.msg.ok { color: var(--ok); }
.msg.err { color: var(--danger); }

/* protected album login */
.login { max-width: 420px; margin: 40px auto; }
.login p { margin: 0 0 22px; }
.login .btn { margin-top: 6px; }
.login .demo-note { margin-top: 28px; }

/* order basket page */
table.basket { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 15px; }
table.basket th, table.basket td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #222; vertical-align: middle; }
table.basket th { color: var(--muted); font-weight: 600; font-size: 13px; }
table.basket img { width: 54px; height: auto; display: block; border: 1px solid var(--line); }
table.basket td.num, table.basket th.num { text-align: right; }
.total { text-align: right; font-size: 22px; color: var(--fg-strong); margin: 0 0 24px; }
.total-note { text-align: right; font-size: 14px; color: var(--muted); margin: -16px 0 24px; }
.hp { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.panel { border: 1px solid var(--line); padding: 18px; max-width: 760px; margin: 0 auto; }
.panel h2 { margin: 0 0 10px; font-size: 20px; font-weight: 600; color: var(--fg-strong); }
.panel[data-done] { margin-top: 26px; }
.stale { text-align: center; margin: 0 0 18px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.site-footer { text-align: center; font-size: 13px; padding: 22px 16px 26px; color: var(--muted); }
.site-footer a { color: var(--muted); }

@media (max-width: 640px) {
  :root { --gap: 14px; }
  .grid { columns: 2 140px; }
  .card { grid-template-columns: 84px 1fr; }
  .card .thumb { width: 84px; }
  .site-nav ul { gap: 2px 22px; }
  .nav-break { display: block; flex-basis: 100%; height: 0; }
  .crumbs li:not(:nth-last-child(-n+2)) { display: none; }
  .crumbs li:nth-last-child(2)::before { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .basket-link { position: static; margin: 8px auto 0; }
  /* basket lines become small cards on a phone: photo on the left, details stacked on the right */
  table.basket, table.basket tbody { display: block; }
  table.basket thead { display: none; }
  table.basket tr { display: grid; grid-template-columns: 54px 1fr auto; grid-template-areas: "thumb title title" "thumb prod prod" "thumb qty price" "thumb rm rm"; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid #222; }
  table.basket td { display: block; padding: 0; border: 0; text-align: left; }
  table.basket td.c-thumb { grid-area: thumb; }
  table.basket td.c-title { grid-area: title; color: var(--fg-strong); }
  table.basket td.c-prod { grid-area: prod; }
  table.basket td.c-qty { grid-area: qty; }
  table.basket td.c-qty::before { content: "Qty "; color: var(--muted); }
  table.basket td.c-price { grid-area: price; text-align: right; color: var(--fg-strong); }
  table.basket td.c-rm { grid-area: rm; margin-top: 6px; }
}
@media (prefers-reduced-motion: no-preference) {
  .grid a, .card { transition: border-color .15s ease; }
}
