:root {
  --accent: #1c6dd9;
  --accent-dark: #1458b3;
  --ink: #141414;
  --ink-soft: #3a3a3a;
  --muted: #6b6b6b;
  --paper: #faf7f2;
  --card: #ffffff;
  --line: #e8e2d8;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
}
/* Faint One Piece backdrop (~10% opacity), fixed behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("assets/bg.jpg") center top / cover no-repeat;
  opacity: 0.2;
  pointer-events: none;
  z-index: -1;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
a { color: var(--accent); }

/* Header */
.site-header {
  background: var(--ink);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(255,255,255,0.25);
}
.brand-text { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.5px; }
.brand-text em { font-style: normal; color: var(--accent); filter: brightness(1.6); }
.header-nav { display: flex; align-items: center; gap: 16px; }
.header-nav a { color: #ddd; text-decoration: none; font-size: 0.95rem; }
.header-nav a:hover { color: #fff; }
.cart-btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 8px 16px; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.cart-btn:hover { background: var(--accent-dark); }
.cart-count {
  display: inline-block; min-width: 20px; text-align: center;
  background: #fff; color: var(--accent); border-radius: 999px;
  font-size: 0.8rem; font-weight: 800; margin-left: 6px; padding: 1px 5px;
}

/* Social icons (header + footer) */
.social-icons { display: inline-flex; align-items: center; gap: 2px; }
.social-icons a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 50%;
  color: #ddd; transition: color .15s ease, background .15s ease;
}
.social-icons a:hover { color: #fff; background: rgba(255,255,255,0.12); }
.social-icons svg { width: 19px; height: 19px; display: block; }
.footer-social { margin: 10px 0; }

/* Banners */
.demo-banner, .notice-banner { text-align: center; padding: 10px 16px; font-size: 0.9rem; }
.demo-banner { background: #fff3cd; color: #664d03; }
.notice-banner { background: #d1e7dd; color: #0f5132; }

/* Hero */
.hero { padding: 40px 0 8px; }
.hero h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -0.5px; }
.hero p { margin: 0; color: var(--ink-soft); max-width: 640px; }
.hero { text-shadow: 0 1px 10px rgba(255,255,255,0.7); }
.hero-ship { font-weight: 700; font-size: 1.05rem; margin-bottom: 8px !important; }


/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 20px 0; }
.toolbar input[type="search"] {
  flex: 1; max-width: 420px; padding: 10px 14px; font-size: 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
}
.result-count { color: var(--muted); font-size: 0.9rem; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; padding-bottom: 48px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.10); }
.card-img { aspect-ratio: 3 / 4; background: #1c1c1c; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-placeholder {
  color: #fff; font-weight: 800; font-size: 2rem; letter-spacing: 2px;
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #232323 0%, #3d0f0f 60%, var(--accent-dark) 100%);
}
.card-body { padding: 12px 14px 14px; }
.card-title { margin: 0 0 6px; font-size: 0.95rem; font-weight: 600; line-height: 1.35; }
.price { color: var(--accent); font-weight: 800; font-size: 1.05rem; margin: 0; }
.empty-state { text-align: center; color: var(--muted); padding: 40px 0; }

/* Modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 90;
}
.modal {
  position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 14px; max-width: 720px; width: calc(100% - 40px);
  max-height: 90vh; max-height: 90dvh; overflow: auto; padding: 0;
}
.modal-close {
  position: absolute; top: 8px; right: 12px; border: 0; background: none;
  font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted); z-index: 2;
}
.modal-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.modal-img { background: #1c1c1c; min-height: 320px; display: flex; align-items: center; justify-content: center; }
.modal-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.modal-info { padding: 28px; }
.modal-info h2 { margin: 0 0 10px; font-size: 1.25rem; }
.modal-info .price { font-size: 1.4rem; margin-bottom: 12px; }
.modal-info .btn { margin-top: 16px; }

/* Cart drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%);
  background: #fff; z-index: 100; display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.18);
}
.drawer[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); position: relative; }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.cart-items { flex: 1; overflow: auto; padding: 12px 20px; }
.cart-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-item:last-child { border-bottom: 0; }
.cart-item img, .cart-item .thumb {
  width: 52px; height: 70px; object-fit: cover; border-radius: 6px; background: #222; flex-shrink: 0;
}
.cart-item .thumb { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 0.8rem; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-info p { margin: 0; font-size: 0.85rem; line-height: 1.3; }
.cart-item-info .price { font-size: 0.9rem; }
.cart-remove { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.2rem; }
.cart-remove:hover { color: var(--accent); }
.cart-empty { color: var(--muted); text-align: center; padding: 32px 0; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; font-size: 1.1rem; margin-bottom: 8px; }

/* Buttons */
.btn {
  border: 0; border-radius: var(--radius); padding: 12px 20px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #c9c2b8; cursor: not-allowed; }
.btn-block { width: 100%; }

/* Footer */
.site-footer { background: var(--ink); color: #ddd; padding: 32px 0; margin-top: 24px; }
.site-footer p { margin: 6px 0; }
.footer-inner { font-size: 0.95rem; }

@media (max-width: 640px) {
  .modal {
    width: calc(100% - 24px);
    max-height: 86vh; max-height: 86dvh;
  }
  /* Close button floats over the image: dark circle, white X, no layout gap */
  .modal-close {
    position: sticky;
    top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin: 8px 8px -52px auto;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 1.6rem;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    z-index: 2;
  }
  .modal-body { grid-template-columns: 1fr; }
  /* Compact image so title/price/Add to cart are visible without scrolling */
  .modal-img { min-height: 0; max-height: 40vh; max-height: 40dvh; }
  .modal-img img { max-height: 40vh; max-height: 40dvh; }
  .modal-info { padding: 14px 18px 18px; }
  .modal-info h2 { font-size: 1.1rem; margin-bottom: 6px; }
  .modal-info .price { margin-bottom: 8px; }
  .modal-actions { margin-top: 12px; }
  .hero { padding: 28px 0 4px; }
  .hero h1 { font-size: 1.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-title { font-size: 0.82rem; }
  .price { font-size: 0.95rem; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar input[type="search"] { max-width: none; }
  .brand-text { font-size: 0.95rem; }
  .header-nav { gap: 10px; }
  .header-nav .social-icons { display: none; }
  .drawer { width: 100%; }
  .modal-info { padding: 20px; }
}

/* Skeleton placeholders while inventory loads */
.card.skeleton { pointer-events: none; }
.skel-img, .skel-line {
  background: linear-gradient(90deg, #e8e2d8 25%, #f4efe6 50%, #e8e2d8 75%);
  background-size: 200% 100%;
  animation: skel-shimmer 1.2s infinite linear;
}
.skel-img { aspect-ratio: 3 / 4; width: 100%; }
.skel-line { height: 14px; margin: 10px 14px 0; border-radius: 4px; }
.skel-line.short { width: 45%; margin-bottom: 14px; }
@keyframes skel-shimmer { to { background-position: -200% 0; } }

/* Share button next to Add to cart in the card modal */
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions .btn { margin-top: 0; }
.modal-actions #modalAdd { flex: 1; }
.btn-share {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  white-space: nowrap;
}
.btn-share:hover { border-color: var(--accent); color: var(--accent); }
.btn-share svg { width: 18px; height: 18px; }
