/* ===== My Rose · 手作裁縫工作室風格 ===== */

:root {
  --cream: #faf5ee;
  --cream-2: #f2eadd;
  --card: #fffdf9;
  --ink: #4a3f39;
  --ink-soft: #8d7d71;
  --rose: #c25e70;
  --rose-deep: #a3445a;
  --rose-soft: #f1d8dd;
  --rose-100: #f8ecef;
  --sage: #8fa382;
  --thread: #d9c9b6;
  --shadow: 0 1px 2px rgba(74, 63, 57, 0.08), 0 10px 24px -12px rgba(74, 63, 57, 0.25);
  --serif: 'Noto Serif TC', serif;
  --sans: 'Noto Sans TC', sans-serif;
  --latin: 'Fraunces', serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--cream);
  /* 亞麻織紋:細緻的經緯線 */
  background-image:
    repeating-linear-gradient(0deg, rgba(141, 125, 113, 0.05) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(141, 125, 113, 0.05) 0 1px, transparent 1px 4px),
    radial-gradient(120% 90% at 50% 0%, rgba(255, 253, 249, 0.9), transparent 70%);
  min-height: 100vh;
}

/* ---------- 縫線裝飾 ---------- */

.stitch {
  position: relative;
  max-width: 320px;
  margin: 2rem auto 0;
  border-top: 2px dashed var(--thread);
}

.stitch::before {
  content: '✂';
  position: absolute;
  left: -1.6rem;
  top: -0.85rem;
  color: var(--rose);
  font-size: 1.1rem;
  transform: rotate(-90deg);
}

/* ---------- 頁首 ---------- */

.hero {
  text-align: center;
  padding: 4.5rem 1.5rem 2.5rem;
}

.overline {
  font-family: var(--latin);
  font-size: 0.78rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--rose);
  margin: 0 0 1rem;
}

.wordmark {
  font-family: var(--latin);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(3rem, 8vw, 4.8rem);
  line-height: 1;
  margin: 0;
  color: var(--rose-deep);
}

.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  margin: 0.9rem 0 0;
}

.tagline {
  color: var(--ink-soft);
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  margin: 1rem 0 0;
}

/* ---------- 篩選工具列 ---------- */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px dashed var(--thread);
  padding: 1rem 1.5rem;
}

.toolbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 0.7rem;
}

.search-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.search {
  flex: 0 1 320px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px dashed var(--thread);
  padding: 0.4rem 0.2rem;
  outline: none;
  transition: border-color 0.25s;
}

.search:focus {
  border-bottom: 2px solid var(--rose);
}

.search::placeholder {
  color: var(--ink-soft);
}

.count {
  font-size: 0.85rem;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
}

.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.filter-label {
  flex: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--rose-deep);
  padding: 0.28em 0;
  letter-spacing: 0.2em;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  background: transparent;
  border: 1.5px dashed var(--thread);
  border-radius: 999px;
  padding: 0.28em 0.95em;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip:hover {
  border-color: var(--rose);
  color: var(--rose-deep);
}

.chip.active {
  background: var(--rose);
  border: 1.5px solid var(--rose);
  color: #fff;
  transform: rotate(-1.5deg);
  box-shadow: 0 3px 8px -3px rgba(163, 68, 90, 0.5);
}

/* ---------- 布料卡片 ---------- */

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2.8rem 1.5rem 4rem;
}

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

.card {
  --tilt: 0deg;
  position: relative;
  background: var(--card);
  border-radius: 4px;
  padding: 0.65rem 0.65rem 0;
  box-shadow: var(--shadow);
  transform: rotate(var(--tilt));
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: rise 0.55s both;
}

.card:nth-child(4n + 1) { --tilt: -1.1deg; }
.card:nth-child(4n + 2) { --tilt: 0.8deg; }
.card:nth-child(4n + 3) { --tilt: -0.5deg; }
.card:nth-child(4n + 4) { --tilt: 1.2deg; }

.card:hover {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 2px 4px rgba(74, 63, 57, 0.08), 0 18px 36px -14px rgba(74, 63, 57, 0.35);
}

/* 內框縫線 */
.card::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1.5px dashed var(--rose-soft);
  border-radius: 3px;
  pointer-events: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: rotate(var(--tilt)) translateY(18px);
  }
  to {
    opacity: 1;
    transform: rotate(var(--tilt)) translateY(0);
  }
}

/* 鈕扣裝飾 */
.button-deco {
  position: absolute;
  top: -13px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  filter: drop-shadow(0 2px 2px rgba(74, 63, 57, 0.25));
}

.card-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 2px;
  background: var(--cream-2);
  cursor: zoom-in;
  border: none;
  padding: 0;
}

.card-photo.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--ink-soft);
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  cursor: default;
}

.card-photo.placeholder::before {
  content: '🧵';
  font-size: 1.6rem;
}

.card-body {
  padding: 0.8rem 0.35rem 0.95rem;
  position: relative;
  z-index: 1;
}

.card-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 0.55rem;
  line-height: 1.4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  background: var(--rose-100);
  border-radius: 999px;
  padding: 0.2em 0.75em;
}

.tag-origin {
  background: var(--cream-2);
}

.tag-origin::before {
  content: '産';
  font-size: 0.7em;
  color: var(--sage);
  border: 1px solid currentColor;
  border-radius: 50%;
  padding: 0.1em 0.18em;
  line-height: 1;
}

.dot {
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: var(--dot, var(--thread));
  border: 1px solid rgba(74, 63, 57, 0.18);
}

.dot.rainbow {
  background: conic-gradient(#e8a3b4, #e9c46a, #8fa382, #6e8fb5, #9a7fb5, #e8a3b4);
}

/* ---------- 狀態文字 ---------- */

.status {
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--serif);
  letter-spacing: 0.2em;
  padding: 4rem 1rem;
  animation: pulse 1.6s ease-in-out infinite;
}

.status.hidden {
  display: none;
}

.status .sub {
  display: block;
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  margin-top: 0.6rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- 燈箱 ---------- */

.lightbox {
  border: none;
  border-radius: 6px;
  padding: 0.8rem;
  background: var(--card);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.45);
  max-width: min(86vw, 760px);
}

.lightbox::backdrop {
  background: rgba(74, 63, 57, 0.55);
  backdrop-filter: blur(4px);
}

.lightbox img {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  border-radius: 3px;
}

.lightbox-caption {
  font-family: var(--serif);
  text-align: center;
  margin: 0.7rem 0 0.2rem;
  letter-spacing: 0.15em;
}

.lightbox-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  border: none;
  background: var(--cream);
  color: var(--ink);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.9rem;
  z-index: 1;
}

/* ---------- 頁尾 ---------- */

.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  padding: 0 1.5rem 3rem;
}

.footer .stitch {
  margin-bottom: 1.6rem;
}

.footer-mark {
  font-family: var(--latin);
  font-style: italic;
  font-weight: 600;
  color: var(--rose-deep);
  font-size: 1.05em;
  margin-right: 0.3em;
}

/* ---------- 響應式 ---------- */

@media (max-width: 560px) {
  .hero {
    padding-top: 3rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2rem 1.1rem;
  }

  .filter-row {
    flex-direction: column;
    gap: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card {
    animation: none;
  }
}
