:root {
  --accent: #8a6a4f;
  --bg: #ffffff;
  --surface: #f6f4f0;
  --ink: #1f1d1a;
  --muted: #6f6a63;
  --line: #e6e2db;
  --error: #b3261e;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --row: 280px;
  --gap: 8px;
}
@media (max-width: 700px) { :root { --row: 150px; --gap: 4px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 300 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
body.locked { overflow: hidden; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin: 0; }
.error { color: var(--error); font-size: 14px; margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; margin: 0 0 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 26px; border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: 400 13px var(--sans); letter-spacing: .14em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; border-radius: 0; transition: opacity .2s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: progress; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.85); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.12); opacity: 1; }

/* ---------- hero ---------- */
.hero {
  position: relative; min-height: 88vh; display: grid; place-items: center; text-align: center;
  background: #2a2724 center / cover no-repeat; color: #fff;
}
.hero::before { content: ''; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.15), rgba(0,0,0,.45)); }
.hero-inner { position: relative; padding: 24px 16px; }
.hero h1 { font-size: clamp(40px, 7vw, 76px); }
.hero-sub { font-family: var(--serif); font-style: italic; font-size: 22px; margin: 8px 0 32px; }

/* ---------- toolbar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 3vw, 32px); background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.bar-title { font-family: var(--serif); font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-tools { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 0; background: none; color: var(--ink);
  font: 400 14px var(--sans); text-decoration: none; cursor: pointer; border-radius: 999px;
}
.tool:hover, .tool.on { background: var(--surface); }
.tool.on .ico svg { fill: var(--accent); stroke: var(--accent); }
.tool-accent { color: var(--accent); border: 1px solid var(--accent); }
.tool .count:not(:empty) { background: var(--accent); color: #fff; border-radius: 999px; min-width: 20px; padding: 0 6px; font-size: 12px; line-height: 20px; text-align: center; }
.ico, .lb-btn, .tile-heart { display: inline-grid; place-items: center; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 700px) {
  .bar-title { font-size: 18px; }
  .tool .label { display: none; }
  .tool-accent { font-size: 13px; padding: 6px 10px; }
}

/* ---------- justified grid (keeps photo order, fills each row edge to edge) ---------- */
.grid { display: flex; flex-wrap: wrap; gap: var(--gap); padding: var(--gap) clamp(var(--gap), 2vw, 24px) 48px; }
.grid::after { content: ''; flex-grow: 999999; }
.tile { position: relative; margin: 0; flex: var(--r) 1 calc(var(--r) * var(--row)); background: var(--surface); overflow: hidden; }
.tile-open { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; aspect-ratio: var(--r); }
.tile-open img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.tile:hover .tile-open img { transform: scale(1.02); }
.tile-heart {
  position: absolute; right: 6px; bottom: 6px; width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.28); color: #fff; cursor: pointer; opacity: 0; transition: opacity .2s;
}
.tile:hover .tile-heart, .tile-heart.on, .tile-heart:focus-visible { opacity: 1; }
.tile-heart.on svg, .lb-btn.on svg { fill: currentColor; }
.tile-heart.on { color: #fff; background: var(--accent); }
@media (hover: none) { .tile-heart { opacity: 1; background: rgba(0,0,0,.2); } }
.grid-notice { text-align: center; color: var(--muted); padding: 48px 16px; margin: 0; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #111; color: #eee; display: grid; grid-template: auto 1fr / 64px 1fr 64px; }
.lb-top { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; }
.lb-name { font-size: 13px; color: #aaa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-actions { display: flex; align-items: center; gap: 4px; }
.lb-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; text-decoration: none; }
.lb-btn:hover { background: rgba(127,127,127,.18); }
.lb-btn.on { color: #e7a0a0; }
.lb-buy { width: auto; padding: 0 16px; white-space: nowrap; border-radius: 999px; border: 1px solid currentColor; font: 400 13px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.lb-stage { grid-area: 2 / 2; display: grid; place-items: center; min-width: 0; min-height: 0; padding: 8px 0 24px; }
.lb-img { max-width: 100%; max-height: calc(100vh - 92px); max-height: calc(100dvh - 92px); object-fit: contain; user-select: none; }
.lb-nav { grid-row: 2; border: 0; background: none; color: #ccc; cursor: pointer; }
.lb-prev { grid-column: 1; }
.lb-next { grid-column: 3; }
.lb-nav svg { width: 32px; height: 32px; }
.lb-nav:hover { color: #fff; }
@media (max-width: 700px) {
  .lightbox { grid-template: auto 1fr / 0 1fr 0; }
  .lb-nav { display: none; }
  .lb-stage { padding: 0; }
}

/* ---------- dialogs ---------- */
.modal { width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 0; padding: 24px; background: var(--bg); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-cart { width: min(560px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(20,18,16,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal h2 { font-size: 30px; }
.stack { display: grid; gap: 14px; }
.stack p { margin: 0; }
label { display: grid; gap: 4px; font-size: 14px; }
input, textarea, select { font: 300 16px var(--sans); padding: 10px 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 0; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row label.row { display: flex; }
.qty-input { width: 72px; }
.buy-photo { display: flex; align-items: center; gap: 12px; }
.buy-photo img { width: 72px; height: 72px; object-fit: cover; }
.options { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.options legend { font-family: var(--serif); font-size: 20px; margin-bottom: 4px; }
.option { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); cursor: pointer; }
.option:has(input:checked) { border-color: var(--accent); background: var(--surface); }
.option input { width: auto; accent-color: var(--accent); }
.price { font-variant-numeric: tabular-nums; white-space: nowrap; }

.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line img { width: 64px; height: 64px; object-fit: cover; }
.cart-desc { display: grid; gap: 2px; font-size: 14px; min-width: 0; }
.cart-desc strong { font-weight: 400; }
.cart-desc .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.stepper { display: inline-flex; align-items: center; gap: 10px; margin-top: 4px; }
.stepper button { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 0; margin: 16px 0 8px; font-size: 15px; }
.totals dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 500; font-size: 17px; padding-top: 6px; border-top: 1px solid var(--line); }
.paypal-box { margin-top: 16px; min-height: 48px; }
.cart > .fine { margin-bottom: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 20px; font-size: 14px; max-width: calc(100vw - 32px);
  transition: opacity .5s, transform .5s;
}
.toast.out { opacity: 0; transform: translate(-50%, 8px); }

/* ---------- PIN gate, home, footer ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--surface); }
.gate-card { width: min(420px, 100%); background: var(--bg); padding: 40px 32px; display: grid; gap: 14px; text-align: center; }
.gate-card h1 { font-size: 40px; }
.gate-card p { margin: 0; }
.gate-card label { text-align: left; margin-top: 8px; }
.gate-card input { text-align: center; letter-spacing: .3em; font-size: 20px; }

.site-head { padding: 24px 16px; text-align: center; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-size: 26px; text-decoration: none; }
.home { max-width: 1200px; margin: 0 auto; padding: 40px 16px 64px; }
.home h1 { font-size: 44px; text-align: center; margin-bottom: 32px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px; }
.card { text-decoration: none; display: grid; gap: 6px; }
.card img { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; }
.card-title { font-family: var(--serif); font-size: 24px; }
.card-sub { font-size: 13px; color: var(--muted); }
.site-foot { text-align: center; padding: 32px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); }
.site-foot a { text-decoration: none; }

/* ---------- admin ---------- */
.admin-head { display: flex; align-items: center; justify-content: space-between; text-align: left; }
.admin { max-width: 1000px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 40px; }
.admin h2 { font-size: 34px; margin-bottom: 12px; }
.admin h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 16px 0 8px; }
.admin p { margin: 0 0 8px; }
.admin-msg { background: var(--surface); padding: 10px 14px; border-left: 3px solid var(--accent); }
.admin-card { border: 1px solid var(--line); padding: 16px; margin-bottom: 12px; display: grid; gap: 12px; }
.admin-card.status-new { border-left: 3px solid var(--accent); }
.admin-card.status-shipped, .admin-card.status-cancelled { opacity: .7; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.admin-row select { width: auto; padding: 6px 10px; font-size: 14px; }
.admin-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
@media (max-width: 700px) { .admin-cols { grid-template-columns: 1fr; } }
.admin .label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 8px 0 2px; }
.admin-items { margin: 0 0 8px; padding-left: 18px; font-size: 14px; }
.admin code { font-size: 13px; }
.admin .copy { font-size: 13px; font-family: ui-monospace, Menlo, monospace; background: var(--surface); cursor: copy; }
.admin .ok { color: #2e7d32; }
.admin .note { background: var(--surface); padding: 8px 12px; font-size: 14px; }
.admin-gallery { grid-template-columns: 160px 1fr; align-items: start; }
.admin-gallery img { width: 160px; aspect-ratio: 1; object-fit: cover; }
.admin-fields { display: grid; gap: 8px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.checks label { display: flex; align-items: center; gap: 6px; }
.checks input { width: auto; accent-color: var(--accent); }
.admin-fields .btn { justify-self: start; }
@media (max-width: 600px) { .admin-gallery { grid-template-columns: 1fr; } }
.admin-head { position: sticky; top: 0; z-index: 5; background: var(--bg); gap: 12px; flex-wrap: wrap; }
.admin-nav { display: flex; gap: 18px; font-size: 14px; }
.admin-nav a { text-decoration: none; color: var(--muted); }
.admin-nav a:hover { color: var(--ink); }
.admin section { scroll-margin-top: 90px; }

/* prices editor */
.price-head, .price-row { display: grid; grid-template-columns: 1fr 1.5fr 1.5fr 110px auto; gap: 8px; align-items: center; }
.price-head { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
#price-rows { display: grid; gap: 8px; }
.price-row input { padding: 8px 10px; font-size: 15px; }
.price-row label { gap: 2px; }
.m-label { display: none; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row-tools { display: flex; gap: 2px; }
.row-tools button { width: 32px; height: 36px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 15px; color: var(--muted); }
.row-tools button:hover { color: var(--ink); border-color: var(--muted); }
.row-tools [data-move=remove]:hover { color: var(--error); border-color: var(--error); }
.add-product { justify-self: start; }
.price-settings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.admin-card > .btn { justify-self: start; }
@media (max-width: 760px) {
  .price-head { display: none; }
  .price-row { grid-template-columns: 1fr 1fr; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
  .m-label { display: block; }
  .price-row .f-name, .price-row .f-whcc { grid-column: 1 / -1; }
  .row-tools { align-self: end; }
  .price-settings { grid-template-columns: 1fr; }
}
.pin-input { text-align: center; letter-spacing: .3em; font-size: 20px; }
