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

:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #a3e635;
  --border: #2a2a2a;
}

/* ── Skip Link ───────────────────────────────────────────── */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 2000;
  background: var(--accent);
  color: #000;
  padding: 0.5rem 1rem;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

#site-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  padding-top: max(2.5rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
}

#artist-name {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  text-shadow: 0 0 20px rgba(163, 230, 53, 0.3);
}

#artist-tagline {
  color: var(--text-muted);
  margin-top: 0.3rem;
  font-size: 0.9rem;
}

#category-nav {
  margin-top: 1.2rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cat-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  min-height: 44px;
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.cat-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.cat-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(163, 230, 53, 0.1);
}

/* ── Gallery Grid ────────────────────────────────────────── */

main {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.gallery-item {
  cursor: pointer;
  overflow: hidden;
  border-radius: 4px;
  background: var(--bg-card);
  transition: transform 0.2s;
}

.gallery-item:hover {
  transform: scale(1.02);
}

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

.art-container {
  position: relative;
  width: 100%;
}

.art-container img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.gallery-item .art-container {
  aspect-ratio: 1;
}

.gallery-item .art-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .art-container.contain-fit img {
  object-fit: contain;
}

.download-guard {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.gallery-item-info {
  padding: 0.6rem 0.8rem;
}

.gallery-item-info h3 {
  font-size: 0.85rem;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 80vw;
  max-height: 90vh;
}

.lb-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-image-wrap img {
  max-width: 80vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lb-info {
  text-align: center;
  padding: 1rem;
  max-width: 600px;
}

#lb-title {
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent);
}

#lb-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.lb-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  letter-spacing: 0.05em;
}

.lb-close, .lb-prev, .lb-next {
  position: fixed;
  z-index: 1001;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 2rem;
  padding: 0.75rem;
  min-width: 44px;
  min-height: 44px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  opacity: 1;
}

.lb-close {
  top: 1rem;
  right: 1rem;
  font-size: 2.5rem;
}

.lb-prev {
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}

.lb-next {
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 3rem;
}

/* ── Footer ──────────────────────────────────────────────── */

#site-footer {
  text-align: center;
  padding: 1.5rem 1rem;
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

#footer-bio {
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

#footer-contact {
  margin-top: 0.5rem;
}

#footer-contact a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Responsive ──────────────────────────────────────────── */

@media (max-width: 1199px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .lb-image-wrap img {
    max-width: 90vw;
    max-height: 85vh;
  }
  .lb-content {
    max-width: 90vw;
  }
}

@media (max-width: 767px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .lb-image-wrap img {
    max-width: 95vw;
    max-height: 90vh;
  }
  .lb-content {
    max-width: 95vw;
    touch-action: pan-y;
  }
  .lb-prev, .lb-next {
    font-size: 2rem;
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
  }
}

@media (max-width: 479px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .lb-image-wrap img {
    max-width: 100vw;
  }
  .lb-content {
    max-width: 100vw;
  }
}

/* ── Shop: Cart Button ──────────────────────────────────── */

.cart-btn {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background 0.2s;
}

.cart-btn:hover {
  background: var(--accent);
  color: #000;
}

.cart-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: #000;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Shop: Cart Panel ───────────────────────────────────── */

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 90vw);
  z-index: 1100;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
  box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

.cart-panel h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.cart-empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem 0;
}

.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

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

.cart-item-title {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.cart-qty {
  width: 50px;
  padding: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  text-align: center;
  font-size: 0.85rem;
}

.cart-item-price {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

.cart-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.25rem;
}

.cart-remove-btn:hover {
  color: #e05555;
}

.cart-subtotal {
  font-size: 1rem;
  font-weight: 600;
  text-align: right;
  padding: 1rem 0;
}

.cart-close-btn {
  display: block;
  width: 100%;
  padding: 0.6rem;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
}

/* ── Shop: Order Print Button ───────────────────────────── */

.shop-order-btn {
  display: inline-block;
  margin: 0.75rem 0;
  padding: 0.5rem 1.5rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.shop-order-btn:hover {
  opacity: 0.85;
}

/* ── Shop: Print Config Panel ───────────────────────────── */

.print-config-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1100;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: left;
  width: 90vw;
  max-width: 420px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.print-config-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1099;
  background: rgba(0, 0, 0, 0.5);
}

.print-config-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem 0.5rem;
}

.print-config-close:hover {
  color: var(--text);
}

.print-config-panel h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.shop-label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.shop-label select,
.shop-label input {
  display: block;
  width: 100%;
  margin-top: 0.2rem;
  padding: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 0.85rem;
}

.print-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  padding: 0.5rem 0;
}

.shop-add-cart-btn {
  display: block;
  width: 100%;
  padding: 0.6rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.shop-add-cart-btn:hover {
  opacity: 0.85;
}

.print-config-success {
  color: var(--accent);
  font-size: 0.8rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ── Shop: Checkout ─────────────────────────────────────── */

.checkout-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
}

.checkout-content {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  max-width: 550px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
}

.checkout-content h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.checkout-content h3 {
  font-size: 0.95rem;
  margin: 1rem 0 0.5rem;
  color: var(--text-muted);
}

.checkout-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.checkout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.shipping-option {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  cursor: pointer;
}

.shipping-option input {
  margin-right: 0.4rem;
}

.checkout-item {
  font-size: 0.85rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.checkout-total {
  font-size: 1rem;
  margin-top: 0.5rem;
}

.shop-checkout-btn,
.shop-pay-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-top: 1rem;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.shop-pay-btn {
  background: #635bff;
  color: #fff;
}

.shop-checkout-btn:hover { opacity: 0.85; }
.shop-pay-btn:hover { opacity: 0.85; }

/* ── Shop: Confirmation ─────────────────────────────────── */

.confirmation-view {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.confirmation-content h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.confirmation-content ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.confirmation-content li {
  font-size: 0.85rem;
  margin: 0.3rem 0;
}

.confirmation-note {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 1rem;
}

.shop-back-link {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--accent);
  text-decoration: none;
}

.shop-back-link:hover {
  text-decoration: underline;
}

#checkout-status.error,
.print-config-panel .error {
  color: #e05555;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}
