/* Freehold gallery — client-facing viewer */

:root {
  --accent: #8a7357;          /* overridden from config */
  --ink: #191919;
  --ink-soft: #6f6b66;
  --paper: #ffffff;
  --hair: #e8e5e1;
  --serif: "Cormorant Garamond", "Times New Roman", serif;
  --sans: "Karla", "Helvetica Neue", Arial, sans-serif;
  --lb-bg: #0e0d0c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.5;
}
img { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Cover ---------- */

.cover {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: height 0.7s cubic-bezier(0.7, 0, 0.2, 1);
}
.cover.is-collapsed { height: 72svh; min-height: 420px; }

.cover-media, .cover-media img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.cover-media img { transform: scale(1.04); transition: transform 6s ease-out; }
.cover.is-loaded .cover-media img { transform: scale(1); }

.cover-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(10,9,8,0.42), rgba(10,9,8,0.12) 34%, rgba(10,9,8,0.1) 62%, rgba(10,9,8,0.52));
}

.cover-content {
  position: relative;
  padding: 24px;
  max-width: 680px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease 0.2s, transform 0.9s ease 0.2s;
}
.cover.is-loaded .cover-content { opacity: 1; transform: none; }

.cover-studio {
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.9;
}
.cover-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 9vw, 88px);
  line-height: 1.04;
  margin: 18px 0 10px;
  text-shadow: 0 1px 24px rgba(0,0,0,0.18);
}
.cover-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(17px, 2.4vw, 21px);
  letter-spacing: 0.04em;
  opacity: 0.92;
}
.cover-date::before, .cover-date::after {
  content: "";
  display: inline-block;
  width: 26px; height: 1px;
  background: rgba(255,255,255,0.55);
  vertical-align: middle;
  margin: 0 12px;
}

/* Unlock form */
.unlock { margin-top: 40px; }
.unlock-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 14px;
}
.unlock-row {
  display: flex;
  width: min(320px, 78vw);
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 2px;
  backdrop-filter: blur(6px);
  background: rgba(20,18,16,0.25);
  transition: border-color 0.2s;
}
.unlock-row:focus-within { border-color: #fff; }
.unlock-row input {
  flex: 1;
  min-width: 0;
  background: none; border: 0; outline: none;
  color: #fff;
  padding: 13px 16px;
  font-size: 15px;
  letter-spacing: 0.06em;
}
.unlock-row input::placeholder { color: rgba(255,255,255,0.6); letter-spacing: 0.04em; }
.unlock-row button {
  padding: 0 16px;
  color: #fff;
  display: flex; align-items: center;
  opacity: 0.85;
}
.unlock-row button:hover { opacity: 1; }

.unlock.is-error .unlock-row { animation: shake 0.4s; border-color: #e58f7f; }
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
.unlock-error {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: #f4b7a9;
}

.open-btn {
  margin-top: 40px;
  padding: 13px 34px;
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 600;
  transition: background 0.25s, color 0.25s;
}
.open-btn:hover { background: #fff; color: var(--ink); }

.scroll-hint {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  animation: drift 2.2s ease-in-out infinite;
}
@keyframes drift { 50% { transform: translate(-50%, 7px); } }

/* ---------- Toolbar ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(14px, 3vw, 32px);
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hair);
}
.tb-studio {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-actions { display: flex; align-items: center; gap: 10px; }

.seg {
  display: flex;
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 2px;
  background: #fff;
}
.seg-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.seg-btn.is-active { background: var(--ink); color: #fff; }
.seg-btn .i-heart { fill: currentColor; }

.dl-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: filter 0.2s;
}
.dl-btn:hover { filter: brightness(1.08); }

/* ---------- Grid ---------- */

.grid {
  padding: clamp(4px, 0.8vw, 10px);
  max-width: 1560px;
  margin: 0 auto;
}
.g-row { display: flex; }
.g-item {
  position: relative;
  margin: clamp(2px, 0.4vw, 5px);
  overflow: hidden;
  background: #f2f0ed;
  cursor: zoom-in;
}
.g-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.g-item img.is-ready { opacity: 1; }
@media (hover: hover) {
  .g-item:hover img { transform: scale(1.025); }
}

.g-heart {
  position: absolute;
  right: 6px; bottom: 6px;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.2s, transform 0.2s;
}
.g-heart .i-heart { fill: none; stroke: currentColor; stroke-width: 1.8; width: 21px; height: 21px; }
.g-item:hover .g-heart, .g-heart.is-on, body.touch .g-heart { opacity: 1; transform: none; }
.g-heart.is-on .i-heart { fill: var(--accent); stroke: var(--accent); }
.g-heart.pop .i-heart { animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.6, 1); }
@keyframes pop { 40% { transform: scale(1.35); } }

.g-note-dot {
  position: absolute;
  left: 10px; bottom: 12px;
  color: #fff;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
  display: none;
}
.g-note-dot.is-on { display: block; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 90px 24px;
  font-size: 14px;
}

/* ---------- Footer ---------- */

.foot {
  text-align: center;
  padding: 64px 24px 48px;
  border-top: 1px solid var(--hair);
  margin-top: 24px;
}
.foot p:first-child {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
}
.foot-plug { margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }
.foot-plug a { color: var(--accent); text-decoration: none; border-bottom: 1px solid currentColor; }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed; inset: 0;
  z-index: 50;
  background: var(--lb-bg);
  touch-action: pan-y;
}
.lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.lb-stage img {
  max-width: 100vw;
  max-height: 100svh;
  object-fit: contain;
  user-select: none;
  transition: opacity 0.22s ease;
}
.lb-stage img.is-swapping { opacity: 0; }

.lb-top, .lb-bottom {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center;
  padding: 12px 14px;
  color: #fff;
  z-index: 2;
  transition: opacity 0.3s;
}
.lb-top { top: 0; justify-content: space-between; background: linear-gradient(rgba(0,0,0,0.35), transparent); }
.lb-bottom {
  bottom: 0; justify-content: center; gap: 22px;
  background: linear-gradient(transparent, rgba(0,0,0,0.4));
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.lightbox.is-zen .lb-top, .lightbox.is-zen .lb-bottom, .lightbox.is-zen .lb-nav { opacity: 0; pointer-events: none; }

.lb-counter { font-size: 12px; letter-spacing: 0.14em; opacity: 0.8; font-variant-numeric: tabular-nums; }
.lb-icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}
.lb-icon:hover { opacity: 1; }
.lb-heart .i-heart { fill: none; stroke: currentColor; stroke-width: 1.8; }
.lb-heart.is-on .i-heart { fill: var(--accent); stroke: var(--accent); }
.lb-heart.pop { animation: pop 0.35s cubic-bezier(0.3, 1.6, 0.6, 1); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 54px; height: 76px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.75);
  transition: color 0.2s, opacity 0.3s;
}
.lb-nav:hover { color: #fff; }
.lb-prev { left: 4px; }
.lb-next { right: 4px; }
@media (pointer: coarse) { .lb-nav { display: none; } }

.note-panel {
  position: absolute;
  left: 50%; bottom: 76px;
  transform: translateX(-50%);
  z-index: 3;
  width: min(420px, calc(100vw - 28px));
  background: rgba(28,26,24,0.96);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 6px;
  padding: 14px 16px;
  color: #fff;
  backdrop-filter: blur(8px);
}
.note-panel label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  opacity: 0.75;
  margin-bottom: 8px;
}
.note-panel textarea {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  resize: none;
  color: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}
.note-panel textarea::placeholder { color: rgba(255,255,255,0.45); }
.note-saved {
  font-size: 11px;
  color: #9fd6ae;
  text-align: right;
  opacity: 0;
  transition: opacity 0.3s;
}
.note-saved.is-visible { opacity: 1; }

/* ---------- Modal (download PIN) ---------- */

.modal {
  position: fixed; inset: 0;
  z-index: 60;
  background: rgba(20,18,16,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  width: min(400px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 34px 30px 30px;
  text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,0.3);
}
.modal-x { position: absolute; top: 10px; right: 10px; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; color: var(--ink-soft); }
.modal-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 27px;
  margin-bottom: 10px;
}
.modal-card > p { font-size: 13.5px; color: var(--ink-soft); }
#pinForm { display: flex; gap: 8px; margin-top: 20px; }
#pinForm input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--hair);
  border-radius: 4px;
  padding: 11px 14px;
  font-size: 16px;
  letter-spacing: 0.35em;
  text-align: center;
  outline-color: var(--accent);
}
#pinForm button {
  background: var(--ink);
  color: #fff;
  border-radius: 4px;
  padding: 11px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
#pinModal .unlock-error { color: #b3402a; }
.dl-ready-note { margin-top: 18px; font-size: 14px; }
.dl-ready-btn {
  display: block;
  margin-top: 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 13px 16px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.dl-ready-btn span { font-weight: 400; opacity: 0.85; margin-left: 6px; font-size: 12.5px; }

@media (max-width: 560px) {
  .tb-studio { display: none; }
  .toolbar { justify-content: space-between; }
  .tb-actions { width: 100%; justify-content: space-between; }
}

/* ---------- Motion & scrollbar ---------- */

body.no-scroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
