:root {
  --flws-hero-bg: #0e0e0f;
  --flws-hero-text: #f5f5f7;
  --flws-hero-muted: #c8c8cc;
  --flws-hero-accent: #d9b48f;

  --flws-card-w: 360px; /* กว้างของการ์ดกลาง */
  --flws-card-h: 520px; /* สูงของการ์ดกลาง */
  --flws-spread: 260px; /* ระยะห่างระหว่างการ์ดในแกน X */
  --flws-tilt: 9deg; /* องศาเอียงซ้าย-ขวา */
  --flws-scale-step: 0.08; /* สเกลลดต่อข้าง */
  --flws-depth: 1200px; /* perspective stage */

  --flws-grid-line: rgba(255, 255, 255, 0.12);
  --flws-grid-line-strong: rgba(255, 255, 255, 0.22);
  --fbw-accent: #c7a17b;
  --fbw-accent-2: rgb(240, 198, 166);
}

/* ===== Header ===== */
.fbw-works__wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.fbw-works__head {
  text-align: center;
  margin-bottom: 38px;
  margin-top: 45px;
}
.fbw-works__title {
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: clamp(28px, 4vw, 48px);
  margin: 0 0 40px;
}
.fbw-works__desc {
  color: var(--fbw-muted);
  max-width: 780px;
  margin: 0 auto;
}
.fbw-works__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 50px;
}
.fbw-works__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
}

/* ปุ่มพื้นฐาน */
.fbw-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  text-decoration: none;
  font-size: 1rem;
  border-radius: 999px;
  padding: 0.8rem 1.8rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

/* ปุ่มหลัก */
.fbw-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-decoration: none;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
}

/* --- ปุ่มสีทองแบบ solid --- */
.fbw-btn--solid {
  background: linear-gradient(
    135deg,
    var(--fbw-accent) 0%,
    var(--fbw-accent-2) 100%
  );
  color: var(--fbw-solid-text);
  box-shadow: 0 8px 24px var(--fbw-solid-glow);
  border: 0;
}
.fbw-btn--solid::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0)
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
}
.fbw-btn--solid:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 28px rgba(210, 173, 130, 0.55);
  filter: brightness(1.08);
}
.fbw-btn--solid:hover::before {
  left: 125%;
}
.fbw-btn--solid:active {
  transform: translateY(0) scale(0.99);
}

/* --- ปุ่มโปร่งแบบ ghost --- */
.fbw-btn--ghost {
  border: 1px solid rgba(255, 128, 0, 0.25);
  color: #cea682;
  /* background:rgba(255,255,255,.6); */
  backdrop-filter: blur(6px);
}
.fbw-btn--ghost::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.45),
    rgba(255, 255, 255, 0)
  );
  transform: skewX(-25deg);
  transition: left 0.6s ease;
}
.fbw-btn--ghost:hover {
  transform: translateY(-2px) scale(1.03);
  /* background:rgba(255,255,255,.8); */
  border: 1px solid rgba(255, 128, 0, 0.25);
  color: rgb(168, 127, 91) 2;
}
.fbw-btn--ghost:hover::before {
  left: 125%;
}
.fbw-btn--ghost:active {
  transform: translateY(0) scale(0.98);
}

/* ไอคอนลูกศร */
.fbw-arrow {
  font-size: 16px;
  display: inline-block;
  transition: transform 0.3s ease;
}
.fbw-btn:hover .fbw-arrow {
  transform: translateX(3px) rotate(8deg);
}

/* ===== Stage ===== */
.fbw-stage {
  position: relative;
  perspective: 1600px;
  height: 590px;
}
.fbw-cards {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}

/*
=============================================
  [--- สไตล์การ์ดใหม่ (โครงสร้างใหม่ + ธีมสว่าง) ---]
=============================================
*/

/* (1) .fbw-card (ตัวการ์ดหลัก) */
.fbw-card {
  position: absolute;
  left: 50%;
  top: 48%;
  width: min(340px, 66vw);
  height: min(480px, 90vh);
  transform: translate3d(-50%, -50%, 0);
  border-radius: 38px;
  overflow: hidden; /* [สำคัญ] ต้องมีเพื่อตัดขอบมน */

  background: #ffffff; /* พื้นหลังสีขาว */
  color: #333333; /* ตัวหนังสือสีเข้ม */
  border: 1px solid #f0f0f0; /* เส้นขอบสีเทาอ่อน */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); /* เงาแบบนุ่ม */

  will-change: transform, filter, opacity;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.1, 1), filter 0.3s ease,
    opacity 0.3s ease;
  backface-visibility: hidden;
  cursor: pointer;

  /* จัดโครงสร้างเป็น บน-ล่าง */
  display: flex;
  flex-direction: column;
}

/* (2) .fbw-card__media (กรอบรูป) */
.fbw-card__media {
  width: 100%;
  height: 65%; /* 65% ของการ์ดสำหรับรูป */
  padding: 12px;
  box-sizing: border-box;
  transition: all 0.35s ease-out;
}

.fbw-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 18px; /* ขอบมนสำหรับรูปภาพ */
  transition: transform 0.35s ease-out;
}

/* (3) .fbw-card__meta (กรอบข้อความด้านล่าง) */
.fbw-card__meta {
  position: static;
  width: 100%;
  height: 35%;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px; /* [แก้] ปรับระยะห่าง */
  padding: 12px 16px 16px 16px; /* [แก้] เพิ่ม padding บนให้สมดุล */
  box-sizing: border-box;

  background: none;
  backdrop-filter: none;
  pointer-events: none;
}

/* (4) สไตล์ข้อความและองค์ประกอบภายใน meta */
.fbw-card__header {
  display: none;
}
.fbw-card__title {
  font-size: 17px;
  font-weight: 700;
  color: #222222;
  line-height: 1.3;
  margin: 0;
  /* [แก้] ไม่ใช้ ellipsis แล้ว เพื่อให้ชื่อแสดงครบ ถ้ามีหลายบรรทัด */
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2; /* แสดง 2 บรรทัด */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis; /* สำหรับ Browser เก่าๆ */

  height: 42px; /* [เพิ่ม] กำหนดความสูง เพื่อไม่ให้ layout กระโดด */
}

/* [แก้] ตำแหน่ง Views, Details */
.fbw-card__sub-details {
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* [แก้] จัดชิดบน */
  margin-top: 8px; /* ระยะห่างจากชื่อ */
  flex-wrap: wrap; /* ให้ Details ลงบรรทัดใหม่ได้ถ้าไม่พอ */
  gap: 8px; /* ระยะห่างระหว่าง Details กับ Views */
}

.fbw-card__price {
  font-size: 30px;
  font-weight: 900;
  color: var(--fbw-accent, #c7a17b);
  opacity: 1;
  margin-top: 4px; /* ระยะห่างจากชื่อ */
  line-height: 1; /* ลด line height */
}

.fbw-card__details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px; /* [แก้] ปรับ gap */
  order: 1; /* จัดลำดับให้มาก่อน views */
}

.fbw-card__detail-item {
  font-size: 12px;
  color: #888;
  background: #f4f4f4;
  padding: 3px 8px;
  border-radius: 4px;
  line-height: 1; /* ลด line height */
}

.fbw-card__detail-item i {
  margin-right: 3px;
  opacity: 0.7;
}

.fbw-card__swatches {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  margin-bottom: 0; /* ไม่มี footer แล้ว */
}

.fbw-card__swatch {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* ยอดวิว ย้ายเข้ามาใน sub-details */
.fbw-card__views {
  font-size: 13px;
  font-weight: 700;
  color: #777777;
  order: 2; /* จัดลำดับให้มาทีหลัง details */
  white-space: nowrap; /* ไม่ให้หักบรรทัด */
  margin-left: auto; /* [ใหม่] ดันไปขวา */
}
.fbw-card__views i {
  color: var(--fbw-accent, #c7a17b); /* [แก้] เปลี่ยนสีไอคอนไฟให้เข้าธีม */
  animation: fbw-fire-flicker 1.5s infinite alternate;
}
@keyframes fbw-fire-flicker {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
    text-shadow: 0 0 2px rgba(199, 161, 123, 0.3); /* [แก้] เงาสีทอง */
  }
}

/* (5) ปุ่มลอย "Place Bid" (สไตล์ "ดูสินค้า") */
.fbw-card__button_hover {
  position: absolute;
  bottom: 38%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);

  background: var(--fbw-accent, #c7a17b);
  color: #fff;

  font-size: 15px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 99px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);

  opacity: 0;
  transition: all 0.3s cubic-bezier(0.2, 0.7, 0.1, 1);
  pointer-events: none;
  z-index: 5;
}

/* (6) เอฟเฟกต์ Hover */
.fbw-card:hover .fbw-card__button_hover {
  transform: translateX(-50%) scale(1);
  opacity: 1;
}

/* (แถม) ซูมรูปตอน Hover */
.fbw-card:hover .fbw-card__media img {
  transform: scale(1.05);
}

/* (7) ป้าย Badge และ ไอคอนหัวใจ (ปรับสีสำหรับ Light Mode) */
.fbw-card-badge {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 4;
  background: var(--fbw-accent, #c7a17b);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.fbw-card-icon-heart {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 4;
  font-size: 18px;
  color: #555;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(0, 0, 0, 0.05);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  pointer-events: auto;
}
.fbw-card-icon-heart:hover {
  background: var(--fbw-accent, #c7a17b);
  color: #fff;
}

/* --- จบส่วนสไตล์ใหม่ --- */

/* ===== Nav (แก้เป็นธีมสีทอง) ===== */
.fbw-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;

  background: var(--fbw-accent, #c7a17b);
  color: #fff;
  border: 0;
  box-shadow: 0 8px 24px rgba(199, 161, 123, 0.3);

  display: grid;
  place-items: center;
  z-index: 200;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.fbw-nav:hover {
  transform: translateY(-50%) scale(1.04);
  box-shadow: 0 10px 28px rgba(199, 161, 123, 0.45);
  filter: brightness(1.05);
}
.fbw-nav--prev {
  left: 22px;
}
.fbw-nav--next {
  right: 22px;
}

/* ===== Dots ===== */
.fbw-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.fbw-dots button {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d7c9bb;
  border: 0;
  opacity: 0.65;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.fbw-dots button.is-active {
  background: #a06c3a;
  transform: scale(1.35);
  opacity: 1;
}

:root {
  --flws-grid-step: 110px;
  --flws-grid-strong: rgba(0, 0, 0, 0.212);
  --flws-grid-accent: rgba(0, 0, 0, 0.281);
  --flws-grid-speed: 5s;
}

/* คอนเทนเนอร์กริด */
.tp-grid {
  position: absolute;
  inset: 60% -10vw -30px -10vw;
  transform: translateY(-10%) perspective(1600px) rotateX(58deg);
  z-index: -1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(
    to top,
    transparent,
    #000 25%,
    #000 70%,
    transparent
  );
  mask-image: linear-gradient(
    to top,
    transparent,
    #000 25%,
    #000 70%,
    transparent
  );
  opacity: 0.9;
  overflow: hidden;
  will-change: background-position, transform;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.tp-grid::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  background: repeating-linear-gradient(
      to right,
      transparent 0 calc(var(--flws-grid-step) - 2px),
      var(--flws-grid-accent) calc(var(--flws-grid-step) - 2px)
        var(--flws-grid-step)
    ),
    repeating-linear-gradient(
      to bottom,
      var(--flws-grid-strong) 0 1px,
      transparent 1px var(--flws-grid-step)
    );
  background-size: var(--flws-grid-step) 100%, 100% var(--flws-grid-step);
  background-position: 0 0, 0 0;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  will-change: background-position;
  animation: flws-grid-bg-slide var(--flws-grid-speed) linear infinite;
}

@keyframes flws-grid-bg-slide {
  to {
    background-position: 0 calc(-1 * var(--flws-grid-step)),
      0 calc(-1 * var(--flws-grid-step));
  }
}

/* === Mobile fit & safety (additive) === */
@media (max-width: 768px) {
  .fbw-works__wrap {
    padding: 0 12px;
  }
  .fbw-works__head {
    margin-top: 50px;
    margin-bottom: 50px;
  }
  .fbw-stage {
    height: 70vh;
    max-height: 920px;
  }
  .fbw-card {
    width: min(92vw, 420px);
    aspect-ratio: 3 / 4;
    height: auto;
    border-width: 1.5px;
    box-shadow: 0 0 4px rgba(255, 255, 255, 0.95);
  }
  .fbw-card__media {
    padding: 16px;
  }
  .fbw-card__meta {
    padding: 0 20px 12px 20px;
  }

  .fbw-card__title {
    font-size: 24px;
    height: 38px; /* ปรับความสูงสำหรับมือถือ */
  }
  .fbw-card__price {
    font-size: clamp(33px, 2.5vw, 28px);
  }
  .fbw-card__button_hover {
    font-size: 16px;
    padding: 10px 40px;
    bottom: 38%;
  }

  /* ปรับขนาดไอเท็มในมือถือ */
  .fbw-card__detail-item {
    font-size: 16px;
    padding: 2px 6px;
  }
  .fbw-card__swatch {
    width: 23px;
    height: 23px;
  }
  .fbw-card__views {
    font-size: 18px;
  }

  .fbw-card-badge {
    top: 20px;
    left: 20px;
    font-size: 12px;
    padding: 3px 8px;
  }
  .fbw-card-icon-heart {
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .fbw-nav {
    width: 40px;
    height: 40px;
  }
  .fbw-nav--prev {
    left: 10px;
  }
  .fbw-nav--next {
    right: 10px;
  }
  .fbw-dots {
    bottom: 12px;
    gap: 6px;
  }
  .fbw-dots button {
    width: 7px;
    height: 7px;
  }
  .tp-grid {
    inset: 62% -6vw -24px -6vw;
    transform: translateY(-8%) perspective(1400px) rotateX(56deg);
    opacity: 0.8;
  }
  html,
  body {
    overflow-x: hidden;
  }
}
.scroll-down-flws {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.scroll-down-flws i {
  font-size: 22px;
  color: #7a5c43;
  animation: bounceDown 1.6s infinite;
}

@keyframes bounceDown {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(6px);
  }
  60% {
    transform: translateY(3px);
  }
}
