/* ---------- Site header: a torn paper strip taped across the top ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  display: flex;
  align-items: center;
  padding-top: 6px;
}

.site-header::before {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.site-header .header-tape {
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  z-index: 5;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.site-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  font-weight: 900;
  font-size: 1.4rem;
  letter-spacing: 0.3px;
  color: var(--text-dark) !important;
  transform: rotate(-1deg);
}

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

.site-nav a {
  color: var(--text-dark) !important;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.98rem;
  position: relative;
  padding: 4px 2px;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -3px;
  height: 2px;
  width: 0;
  background: var(--blue-mat);
  transition: width 0.25s ease;
}

.site-nav a:hover::after,
.site-nav a.is-active::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.cart-button {
  width: 48px;
  height: 48px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(2deg);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-button:hover {
  transform: scale(1.08) rotate(-4deg);
}

.cart-button svg {
  width: 22px;
  height: 22px;
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--accent-red);
  color: #fff;
  font-size: 0.7rem;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--blue-mat-dark);
  transform: scale(0);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cart-badge.is-visible {
  transform: scale(1);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-dark);
  font-size: 1.6rem;
  padding: 4px 8px;
}

/* ---------- Hero ---------- */
.hero-shop {
  text-align: center;
  max-width: 760px;
  margin: 10px auto 10px;
}

.hero-shop h1 {
  font-size: 2.4rem;
  margin: 0 0 10px;
  color: #fff;
}

.hero-shop p {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.9);
}

/* ---------- Landing hero (index.html) ---------- */
.landing-hero {
  text-align: center;
  max-width: 620px;
  margin: 10px auto 10px;
  padding: 46px 40px;
}

.landing-hero h1 {
  font-size: 2.5rem;
  margin: 0 0 14px;
  line-height: 1.15;
}

.landing-hero p {
  font-size: 1.1rem;
  margin-bottom: 26px;
  color: var(--text-dark);
}

.section-title {
  text-align: center;
  color: #fff;
  margin: 10px 0 26px;
}

.section-title h2 {
  font-size: 1.8rem;
  margin: 0 0 6px;
}

.section-title p {
  opacity: 0.85;
  margin: 0;
}

/* ---------- Moodboard (Pinterest-style pinboard on the cutting mat) ---------- */
.moodboard {
  columns: 2;
  column-gap: 26px;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 720px) {
  .moodboard {
    columns: 3;
  }
}

.pin-card {
  display: block;
  break-inside: avoid;
  margin: 0 0 26px;
  padding: 16px;
  text-decoration: none;
}

.pin-card {
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pin-card:hover {
  transform: rotate(0deg) scale(1.03) !important;
}

.pin-photo {
  padding: 9px;
  margin-bottom: 10px;
}

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

.pin-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--text-dark);
}

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin: 30px 0 50px;
  max-width: 1000px;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-pill {
  padding: 10px 20px;
  font-weight: bold;
  font-size: 0.95rem;
  white-space: nowrap;
  color: var(--text-dark) !important;
  border: none;
  background: none;
}

.filter-pill.is-active::before {
  background: var(--paper-accent);
}

.filter-pill:hover {
  transform: scale(1.05) rotate(0deg);
}

/* ---------- Product grid & cards ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 34px 28px;
  width: 100%;
  max-width: 1200px;
}

.product-card {
  padding: 18px 18px 22px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: fadeUp 0.5s ease both;
}

/* Slight vertical stagger so the grid reads like items pinned to the mat,
   not a rigid spreadsheet - row height still follows the tallest card. */
.product-card:nth-child(3n + 2) {
  margin-top: 22px;
}
.product-card:nth-child(3n + 3) {
  margin-top: -8px;
}

.product-card:hover {
  transform: rotate(0deg) scale(1.035) translateY(-6px) !important;
}

.product-card:hover::before {
  box-shadow: var(--shadow-hover);
}

.product-photo-frame {
  padding: 10px;
  margin-bottom: 14px;
}

.product-photo-frame img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-photo-frame img {
  transform: scale(1.06);
}

.product-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--text-dark);
  line-height: 1.3;
}

.price-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.price-tag {
  display: inline-block;
  font-weight: bold;
  color: var(--text-dark);
  background: var(--paper-accent);
  padding: 4px 12px;
  border-radius: 3px;
  transform: rotate(-2deg);
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.15);
}

.price-compare {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Stamp-style badges: double border like a rubber ink stamp, blended onto
   the photo mat so it reads as printed rather than pasted on top. */
.badge-soldout,
.badge-sale {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.15;
  background: transparent;
  border: 5px double currentColor;
  transform: rotate(-14deg);
  mix-blend-mode: multiply;
  opacity: 0.92;
}

.badge-soldout {
  color: var(--accent-red);
}

.badge-sale {
  color: var(--accent-green);
}

/* ---------- Product detail page ---------- */
.product-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 50px;
  max-width: 1100px;
  width: 95%;
  margin: 10px auto 40px;
  align-items: flex-start;
}

.product-gallery-main {
  padding: 16px;
}

.product-gallery-main img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.product-thumbs {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.product-thumb {
  width: 68px;
  height: 68px;
  background: var(--photo-mat);
  padding: 4px;
  box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.25);
  border: none;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumb:hover,
.product-thumb.is-active {
  transform: translateY(-4px) rotate(-2deg);
}

.product-info {
  padding: 36px;
}

.product-info h1 {
  margin: 0 0 14px;
  font-size: 2rem;
}

.product-price-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.product-price-block .price-tag {
  font-size: 1.3rem;
  transform: rotate(-1.5deg);
}

.product-description {
  line-height: 1.6;
  margin-bottom: 24px;
  color: var(--text-dark);
}

.option-group {
  margin-bottom: 20px;
}

.option-group > label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.option-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Color swatch = a little fabric sample "clipped" with a paperclip emoji */
.swatch-color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  padding: 6px 4px 2px;
  cursor: pointer;
}

.swatch-color .clip {
  font-size: 1.15rem;
  transform: rotate(-20deg);
  margin-bottom: -9px;
  filter: drop-shadow(1px 2px 1px rgba(0, 0, 0, 0.35));
  transition: transform 0.2s ease;
}

.swatch-color:nth-child(3n + 1) .clip {
  transform: rotate(-14deg);
}
.swatch-color:nth-child(3n + 2) .clip {
  transform: rotate(10deg);
}

.swatch-color .chip {
  width: 32px;
  height: 32px;
  border-radius: 2px;
  border: 3px solid #fff;
  box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.3);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.swatch-color .label {
  font-size: 0.62rem;
  font-weight: bold;
  color: var(--text-muted);
  max-width: 50px;
  text-align: center;
  line-height: 1.1;
}

.swatch-color:hover .chip {
  transform: scale(1.08) rotate(-3deg);
}

.swatch-color.is-selected .chip {
  transform: scale(1.1) rotate(-2deg);
  box-shadow: 0 0 0 3px var(--blue-mat), 1px 2px 5px rgba(0, 0, 0, 0.3);
}

.swatch-color.is-selected .clip {
  transform: rotate(-20deg) translateY(2px) scale(1.1);
}

/* Size option = a torn ticket stub with a punched hole */
.swatch-size {
  position: relative;
  padding: 10px 16px 10px 22px;
  background: var(--paper);
  border: none;
  font-weight: bold;
  font-size: 0.9rem;
  box-shadow: 1px 2px 5px rgba(0, 0, 0, 0.25);
  clip-path: polygon(14% 0%, 100% 0%, 100% 100%, 14% 100%, 14% 62%, 0% 50%, 14% 38%);
  transition: all 0.2s ease;
}

.swatch-size:nth-child(2n) {
  transform: rotate(-1.2deg);
}
.swatch-size:nth-child(2n + 1) {
  transform: rotate(1deg);
}

.swatch-size:hover {
  transform: translateY(-3px) rotate(0deg);
}

.swatch-size.is-selected {
  background: var(--paper-accent);
  box-shadow: 0 0 0 2px var(--blue-mat);
  transform: translateY(-2px) rotate(0deg);
}

.swatch-size:disabled {
  opacity: 0.4;
  text-decoration: line-through;
  cursor: not-allowed;
  transform: none;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 1px 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.qty-stepper button {
  background: none;
  border: none;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  font-weight: bold;
}

.qty-stepper button:hover {
  background: var(--paper-accent);
}

.qty-stepper input {
  width: 40px;
  text-align: center;
  border: none;
  background: none;
  font-weight: bold;
  font-size: 1rem;
}

.add-to-cart-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.stock-note {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.info-accordion {
  margin-top: 30px;
  border-top: 2px dashed rgba(0, 0, 0, 0.15);
}

.info-accordion details {
  border-bottom: 2px dashed rgba(0, 0, 0, 0.15);
  padding: 14px 0;
}

.info-accordion summary {
  font-weight: bold;
  cursor: pointer;
}

.info-accordion .body-html {
  margin-top: 10px;
  line-height: 1.55;
  color: var(--text-dark);
}

/* ---------- Cart drawer ---------- */
.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.cart-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  padding: 26px 24px;
}

.cart-drawer::before {
  box-shadow: -6px 0 24px rgba(0, 0, 0, 0.4);
  border-radius: 0;
}

.cart-drawer.is-open {
  transform: translateX(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 3px dashed rgba(0, 0, 0, 0.2);
  padding-bottom: 16px;
  margin-bottom: 10px;
}

.cart-drawer-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.cart-close {
  background: none;
  border: none;
  font-size: 1.6rem;
  line-height: 1;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 0;
  font-family: "Courier New", ui-monospace, monospace;
}

.cart-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.25);
}

.cart-item img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  background: var(--photo-mat);
  padding: 3px;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
}

.cart-item-info .name {
  font-weight: bold;
  font-size: 0.92rem;
  text-transform: uppercase;
}

.cart-item-info .attrs {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cart-item-remove {
  background: none;
  border: none;
  color: var(--accent-red);
  font-size: 0.8rem;
  text-decoration: underline;
  padding: 2px 0;
}

.receipt-tear {
  height: 16px;
  margin: 0 -24px;
  flex-shrink: 0;
  background: linear-gradient(-45deg, transparent 8px, rgba(0, 0, 0, 0.18) 8px) 0 0/16px 16px repeat-x,
    linear-gradient(45deg, transparent 8px, rgba(0, 0, 0, 0.18) 8px) 0 0/16px 16px repeat-x;
  background-position: bottom;
}

.cart-footer {
  padding-top: 16px;
}

.cart-subtotal {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 14px;
  font-family: "Courier New", ui-monospace, monospace;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  margin-top: 40px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(30px);
  background: var(--paper-accent);
  color: var(--text-dark);
  padding: 14px 22px;
  border-radius: 4px;
  box-shadow: var(--shadow-soft);
  font-weight: bold;
  z-index: 300;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Loading / empty states ---------- */
.skeleton-card {
  height: 320px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.6) 25%,
    rgba(255, 255, 255, 0.9) 37%,
    rgba(255, 255, 255, 0.6) 63%
  );
  background-size: 400px 100%;
  animation: shimmer 1.4s infinite linear;
}

.empty-state,
.error-state {
  text-align: center;
  padding: 60px 30px;
  max-width: 500px;
  margin: 0 auto;
}

.empty-state h2,
.error-state h2 {
  font-size: 1.6rem;
}

/* ---------- Footer: styled like the header, torn paper anchored at
   the bottom of the page ---------- */
.site-footer {
  width: 100%;
  max-width: 1100px;
  margin: 10px auto 0;
  padding: 30px 24px;
  text-align: center;
  color: var(--text-dark);
}

.footer-links {
  display: flex;
  gap: 18px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.footer-links a {
  color: var(--text-dark) !important;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.85rem;
  opacity: 0.85;
}

.footer-links a:hover {
  opacity: 1;
  text-decoration: underline;
}

.footer-note {
  font-size: 0.8rem;
  opacity: 0.75;
}

.footer-note a {
  color: var(--text-dark) !important;
  font-weight: bold;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .product-page {
    grid-template-columns: 1fr;
  }
  .product-info {
    padding: 26px 6px;
  }
}

@media (max-width: 700px) {
  .site-nav {
    position: fixed;
    /* Parked fully above the viewport - a percentage transform would be
       relative to the nav's own (small) height and could leave a sliver
       visible, so push it off-screen with an absolute distance instead. */
    top: -100vh;
    left: 0;
    right: 0;
    background: var(--paper-accent);
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 24px;
    gap: 16px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
    transition: top 0.3s ease;
    z-index: 90;
  }
  .site-nav.is-open {
    top: var(--header-h);
  }
  .nav-toggle {
    display: block;
  }
  .cart-drawer {
    width: 100%;
  }
}
