:root {
  --bg: #070707;
  --bg-raised: #101010;
  --fg: #f3f1ec;
  --muted: #948f86;
  --line: rgba(243, 241, 236, 0.14);
  --line-strong: rgba(243, 241, 236, 0.3);
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --sans: 'Jost', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: rgba(7, 7, 7, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  letter-spacing: 3px;
  font-size: 13px;
  text-transform: uppercase;
}

.brand img { height: 34px; width: 34px; display: block; }

.site-nav {
  display: flex;
  align-items: center;
}

.site-nav a {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 28px;
  transition: color 0.2s ease;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--fg); }

.cart-toggle {
  position: relative;
  margin-left: 28px;
  background: none;
  border: none;
  color: var(--fg);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -8px;
  background: var(--fg);
  color: #0a0a0a;
  font-size: 10px;
  font-family: var(--sans);
  font-weight: 600;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

@media (max-width: 560px) {
  .site-header {
    padding: 16px 18px;
    flex-wrap: wrap;
    gap: 10px;
  }
  .brand span { font-size: 11px; }
  .brand img { height: 28px; width: 28px; }
  .site-nav a {
    margin-left: 0;
    margin-right: 16px;
    font-size: 10px;
  }
  .cart-toggle { margin-left: 0; }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 96px 24px 64px;
  border-bottom: 1px solid var(--line);
}

.hero img.hero-logo {
  width: 128px;
  height: 128px;
  margin-bottom: 32px;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 52px);
  margin: 0 0 18px;
  letter-spacing: 0.5px;
}

.hero p {
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto;
  font-size: 15px;
  letter-spacing: 0.4px;
  line-height: 1.7;
}

.hero .scroll-cue {
  margin-top: 56px;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}

/* ---------- The Piece ---------- */
.piece-section {
  padding: 88px 24px 96px;
  border-bottom: 1px solid var(--line);
}

.piece-eyebrow {
  text-align: center;
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 40px;
}

/* ---------- Archive grid ---------- */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

@media (max-width: 900px) {
  .archive-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
}
@media (max-width: 560px) {
  .archive-grid { grid-template-columns: 1fr; gap: 32px; }
}

.archive-card {
  cursor: pointer;
}

.archive-card .card-photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color .2s ease;
}

.archive-card:hover .card-photo-frame {
  border-color: var(--line-strong);
}

.archive-card .card-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.archive-card .no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
}

.archive-card .card-info {
  padding-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.archive-card .card-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 6px;
}

.archive-card .card-price {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.archive-card .add-to-cart-btn {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--fg);
  padding: 9px 16px;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--sans);
  transition: background .2s ease, color .2s ease;
  white-space: nowrap;
}
.archive-card .add-to-cart-btn:hover {
  background: var(--fg);
  color: #0a0a0a;
}
.archive-card .add-to-cart-btn.in-cart {
  background: var(--fg);
  color: #0a0a0a;
  border-color: var(--fg);
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
}

/* ---------- Shared piece detail (modal) ---------- */
.piece-meta {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  border-top: 1px solid var(--line);
}

.piece-meta li {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  letter-spacing: 0.5px;
}

.piece-meta li span:first-child {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
}

.piece-desc {
  color: #d8d5cd;
  line-height: 1.8;
  font-size: 15px;
  margin-bottom: 24px;
  white-space: pre-line;
}

/* ---------- Modal (item detail) ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 50;
  display: none;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 20px;
}
.modal-overlay.open { display: flex; }

.modal-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  max-width: 880px;
  width: 100%;
  padding: 40px;
  position: relative;
}

@media (max-width: 700px) {
  .modal-panel { padding: 24px; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  z-index: 2;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
}
@media (max-width: 700px) {
  .modal-grid { grid-template-columns: 1fr; gap: 28px; }
}

.modal-gallery .main-photo-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  overflow: hidden;
}
.modal-gallery .main-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-gallery .no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 13px;
}

.thumb-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.thumb-row img {
  width: 60px;
  height: 74px;
  object-fit: cover;
  border: 1px solid var(--line);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity .2s ease, border-color .2s ease;
}
.thumb-row img:hover, .thumb-row img.active {
  opacity: 1;
  border-color: var(--line-strong);
}

.modal-details h2 {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  margin: 0 0 8px;
}

.modal-price {
  font-size: 19px;
  letter-spacing: 1px;
  margin-bottom: 22px;
  color: var(--fg);
}

/* ---------- Cart drawer ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 60;
  display: none;
}
.drawer-overlay.open { display: block; }

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 400px;
  max-width: 92vw;
  background: var(--bg);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  /* The panel itself scrolls (not just the body) so that whatever grows
     inside the footer — like PayPal's expanded card-entry fields or the
     Apple Pay sheet trigger — is always reachable, never clipped off the
     bottom of a fixed-height section. */
  overflow-y: auto;
}

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-family: var(--serif);
  font-size: 18px;
  flex-shrink: 0;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--fg);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.drawer-body {
  padding: 12px 24px;
}

.drawer-footer {
  padding: 20px 24px 24px;
  border-top: 1px solid var(--line);
}

.cart-line {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.cart-line .line-photo {
  width: 56px;
  height: 70px;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.cart-line .line-info {
  flex: 1;
  min-width: 0;
}

.cart-line .line-title {
  font-size: 14px;
  margin-bottom: 4px;
}

.cart-line .line-price {
  font-size: 12px;
  color: var(--muted);
}

.cart-line .line-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  align-self: flex-start;
}
.cart-line .line-remove:hover { color: var(--fg); }

.cart-empty {
  color: var(--muted);
  text-align: center;
  padding: 60px 10px;
  font-family: var(--serif);
  font-size: 15px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.checkout-status {
  font-size: 13px;
  color: var(--muted);
  margin-top: 12px;
  min-height: 18px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--fg);
  color: #0a0a0a;
  padding: 12px 22px;
  font-size: 13px;
  letter-spacing: 0.5px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- How it works ---------- */
.how-section {
  padding: 88px 24px;
  border-bottom: 1px solid var(--line);
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  text-align: center;
}

@media (max-width: 700px) {
  .how-grid { grid-template-columns: 1fr; gap: 44px; }
}

.how-grid .num {
  font-family: var(--serif);
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 2px;
  margin-bottom: 14px;
}

.how-grid h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 12px;
}

.how-grid p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 48px 24px 60px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

.site-footer .foot-links a {
  margin: 0 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
}

.site-footer .foot-links { margin-bottom: 18px; }

/* ---------- Admin ---------- */
.admin-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 64px 24px 100px;
}

.admin-wrap.wide { max-width: 820px; }

.admin-list-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.admin-list-head .btn { flex-shrink: 0; }

.piece-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.piece-row .row-photo {
  width: 56px;
  height: 70px;
  object-fit: cover;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.piece-row .row-info {
  flex: 1;
  min-width: 0;
}

.piece-row .row-title {
  font-size: 15px;
  margin-bottom: 4px;
}

.piece-row .row-meta {
  font-size: 12px;
  color: var(--muted);
}

.piece-row .row-badge {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  margin-left: 8px;
}
.piece-row .row-badge.sold {
  color: #e2a3a3;
  border-color: #6b3a3a;
}

.piece-row .row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.piece-row .row-actions .btn {
  padding: 8px 14px;
  font-size: 11px;
}

.admin-wrap h1 {
  font-family: var(--serif);
  font-size: 28px;
  margin-bottom: 8px;
}

.admin-wrap .sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 40px;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.field input[type=text],
.field input[type=number],
.field input[type=password],
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 12px 14px;
  font-size: 14px;
  font-family: var(--sans);
}

.field textarea { min-height: 120px; resize: vertical; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn {
  display: inline-block;
  background: var(--fg);
  color: #0a0a0a;
  border: none;
  padding: 14px 26px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--sans);
  transition: opacity .2s ease;
}
.btn:hover { opacity: 0.85; }

.btn.secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--line-strong);
}

.btn.danger {
  background: transparent;
  color: #e2a3a3;
  border: 1px solid #6b3a3a;
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.admin-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.status-line {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
}

.status-line.error { color: #e2a3a3; }
.status-line.ok { color: #b7d9b9; }

.photo-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.photo-slot {
  aspect-ratio: 4/5;
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: var(--bg-raised);
  cursor: pointer;
}

.photo-slot img {
  width: 100%; height: 100%; object-fit: cover;
}

.photo-slot span {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  padding: 6px;
}

.photo-slot input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-slot .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  font-size: 13px;
  cursor: pointer;
  z-index: 2;
}

.login-panel {
  max-width: 360px;
  margin: 120px auto;
  padding: 0 24px;
  text-align: center;
}

.login-panel h1 {
  font-family: var(--serif);
  font-size: 26px;
  margin-bottom: 32px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 24px;
}

.toggle-row span { font-size: 13px; letter-spacing: 1px; }

.shipping-box {
  border: 1px solid #4b7a4e;
  background: rgba(75, 122, 78, 0.08);
  padding: 18px 20px;
  margin-bottom: 24px;
}

.shipping-box-title {
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #b7d9b9;
  margin-bottom: 10px;
}

.shipping-box .ship-line {
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
}

.shipping-box .ship-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

.row-meta .ship-hint {
  color: #b7d9b9;
}

.switch {
  position: relative;
  width: 42px;
  height: 22px;
  display: inline-block;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--line-strong);
  transition: .2s;
}
.slider:before {
  content: "";
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; top: 3px;
  background: var(--fg);
  transition: .2s;
}
input:checked + .slider { background: #4b7a4e; }
input:checked + .slider:before { transform: translateX(20px); }

hr.divider {
  border: none;
  border-top: 1px solid var(--line);
  margin: 40px 0;
}
