/* ========== RESET / BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: #111;
  background: #fff;
}

/* Invisible anchors/markers for truncation — zero-size, no line breaks */
.truncate-anchor,
.trunc-marker {
  display: inline;
  width: 0;
  height: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  line-height: 0;
  font-size: 0;
  border: 0;
  overflow: hidden;
  pointer-events: none;
}


/* ========== TOP BAR ========== */
.top-bar {
  background: #131921;
  color: #fff;
  display: grid;
  grid-template-columns: auto 1fr auto; /* logo | search | cart */
  align-items: center;
  column-gap: 14px;
  padding: 8px 12px;
}
.top-bar .logo { height: 50px; width: auto; display: block; }

.search-bar {
  display: flex; align-items: center; height: 40px;
  background: #fff; border-radius: 4px; overflow: hidden;
}
.search-category {
  background: #e6e6e6;
  color: #666;
  font-weight: 700;
  height: 100%;
  display: flex; align-items: center;
  padding: 0 10px;
}
.search-text {
  flex: 1 1 auto; padding: 0 10px;
  color: #6b6b6b;
  display: flex; align-items: center;
}
.search-button {
  background: #febd69; border: none;
  width: 44px; height: 40px; display: grid; place-items: center;
}
.search-button img { width: 20px; height: 20px; display: block; }

/* Cart: right padding + heart offset */
.cart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  justify-self: end;
  margin-right: 20px;
}
.cart-icon { position: relative; width: 41px; height: 28px; display: block; }
.cart-icon img { width: 41px; height: 28px; display: block; }
.cart-heart {
  position: absolute; top: 0; right: 0;
  transform: translate(-10px, 1px);
  color: #ffa41c; font-size: 14px; line-height: 1;
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif; /* text glyph, not emoji */
}
.cart-label { font-weight: 700; }

/* ========== BLUE NAV BAR ========== */
.nav-bar {
  background: #232f3e; color: #fff;
  padding: 8px 12px; font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 6px 12px;
}
.nav-bar a {
  color: #fff; text-decoration: none;
  padding: 4px 6px;
  border: 1px solid transparent; /* prevents hover jiggle */
  border-radius: 4px;
}
.nav-bar a:hover { border-color: #fff; }

/* ========== PRODUCT TOP ========== */
.product-top {
  display: grid;
  grid-template-columns: 480px 1fr 260px;
  gap: 24px;
  padding: 18px 16px;
  align-items: start;
}

/* Gallery */
.image-gallery {
  display: grid;
  grid-template-columns: 80px 1fr; /* desktop: thumbs column + main image */
  gap: 10px;
}
#photo-thumbs.thumbs-vertical { display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow-y: auto; }
.thumb { width: 64px; height: 64px; object-fit: cover; border: 2px solid transparent; cursor: pointer; background: #fff; }
.thumb.selected { border-color: #ffa41c; }

/* Slider */
.main-image { position: relative; }
.slider-viewport { overflow: hidden; border: 1px solid #ddd; background: #fff; position: relative; width: 100%; }
.slider-track { display: flex; will-change: transform; transition: transform 250ms ease-out; }
.slide { min-width: 100%; flex: 0 0 100%; user-select: none; touch-action: pan-y; display: block; }
.slide img, .slide { width: 100%; height: auto; display: block; }

.lightbox-link { margin-top: 8px; text-align: center; }
.lightbox-link a { font-size: 13px; color: #007185; text-decoration: none; }
.lightbox-link a:hover { text-decoration: underline; }

.mobile-dots {
  display: none; /* mobile will show */
  justify-content: center;
  gap: 8px;
  margin: 10px 0 0;
}
.mobile-dots .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #c7c7c7;
}
.mobile-dots .dot.active { background: #555; }

/* Product Info */
.product-info { max-width: 640px; }
.product-title { font-size: 24px; font-weight: 400; margin-bottom: 4px; }
.visit-link { display: inline-block; margin-bottom: 6px; color: #007185; text-decoration: none; }
.visit-link:hover { text-decoration: underline; }

.ratings { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
.average-rating { font-weight: 700; font-size: 14px; }
.rating-count { margin-left: 10px; color: #007185; font-size: 13px; }
.rating-count:hover { text-decoration: underline; }

.badge { background: #000; color: #fff; display: inline-block; padding: 2px 6px; font-size: 12px; border-radius: 3px; margin: 5px 0; }
.bought-stat { font-size: 14px; }
hr.subtle { border: none; border-top: 1px solid #d8d8d8; margin: 10px 0; }

/* PRICE -> black */
.price { font-size: 30px; color: #000; margin: 8px 0; }
.price sup { font-size: 14px; vertical-align: super; }

.style-options .label { font-weight: 700; margin-top: 14px; }
#style-buttons { margin-top: 6px; position: relative; }
.style-btn { margin: 6px 6px 0 0; padding: 6px 10px; border: 1px solid #ccc; background: #fff; cursor: pointer; border-radius: 4px; }
.style-btn.selected { border-color: #ffa41c; }
.style-btn.disabled { background: #eee; color: #888; cursor: not-allowed; }

.product-table { margin-top: 12px; margin-bottom: 16px; border-collapse: collapse; width: 100%; }
.product-table td { padding: 4px 10px 4px 0; vertical-align: top; }
.product-table td:first-child { font-weight: 700; width: 220px; }

/* About / FAQ formatting */
.about-heading { font-size: 20px; margin: 14px 0 8px; }
.section-heading { font-size: 16px; margin: 12px 0 6px; }
.indented { margin-left: 16px; }
.about-item { margin-left: 16px; }
.about-item li { margin: 0 0 6px 18px; }

/* Sidebar */
.sidebar { width: 260px; padding: 14px; border: 1px solid #d8d8d8; background: #f6f6f6; border-radius: 4px; }
.prime-box { border: 1px solid #d8d8d8; padding: 10px; margin-bottom: 10px; background: #fff; border-radius: 4px; }
.prime-box img { height: 24px; margin-bottom: 6px; display: block; }
.prime-box a { color: #007185; text-decoration: none; }
.prime-box a:hover { text-decoration: underline; }

.dropdown {
  width: 100%; margin: 8px 0; padding: 8px 40px 8px 12px; border-radius: 6px; border: 1px solid #ccc; color: #000;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background: #fff url("data:image/svg+xml;utf8,<svg width='18' height='18' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5' fill='none' stroke='%23222' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 12px center;
  background-size: 18px 18px;
}
.dropdown:focus { outline: 2px solid #febd69; outline-offset: 2px; }
.dropdown::-ms-expand { display: none; }

button.add-to-cart,
button.buy-now {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  font-weight: 400;
  background: #ffd814;
  border: 1px solid #fcd200;
  border-radius: 999px;
  cursor: pointer;
  color: #000;
}
button.buy-now { background: #ffa41c; }

.ships-from { margin-top: 10px; font-size: 12px; color: #555; font-weight: 700; }

.reviews-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 24px; padding: 20px 16px 40px; }
.reviews-left h2 { font-size: 22px; margin-bottom: 10px; }
.reviews-left .stars img { height: 18px; vertical-align: middle; }
.review-count { font-size: 14px; margin: 8px 0; }

/* ---- Reviews: star distribution bars ---- */
.bar-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 36px; /* label | track | % */
  align-items: center;
  column-gap: 10px;
  margin-bottom: 6px;
}
.bar-row > span:first-child { white-space: nowrap; }   /* "5 star" label */
.bar {
  flex: 0 0 auto !important;
  height: 12px;
  background: #ffa41c;
  border-radius: 2px;
  justify-self: start;
}
.bar[style="width: 0%;"],
.bar[style="width:0%;"] {
  width: 0 !important;
  visibility: hidden; /* invisible but column remains so % text stays aligned */
}
.percent { font-size: 12px; text-align: right; }

.footer-note {
  text-align: center;
  margin: 10px 0 20px;
}

.reviews-right h3 { font-size: 18px; margin-bottom: 10px; }
.detailed-reviews { display: grid; grid-template-columns: 1fr; gap: 16px; }
.review { display: grid; grid-template-columns: 96px 1fr; gap: 12px; border-top: 1px solid #ddd; padding-top: 12px; }
.review-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; cursor: zoom-in; }
.reviewer-name { font-weight: 700; margin-bottom: 4px; }
.verified { font-size: 12px; color: #007600; font-weight: 700; margin-left: 6px; }
.review-stars img { height: 16px; }
.review-text { margin-top: 6px; }

/* Tooltip bubble (mobile "Boring mode") */
.tooltip-bubble {
  position: fixed;
  z-index: 10000;
  background: #111;
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.3;
  max-width: 240px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}
.tooltip-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}
.tooltip-bubble[data-pos="top"]::after { bottom: -6px; border-top-color: #111; }
.tooltip-bubble[data-pos="bottom"]::after { top: -6px; border-bottom-color: #111; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 9999; display: grid; place-items: center; }
.modal-card { background: #fff; max-width: 90vw; max-height: 90vh; padding: 16px; border-radius: 8px; position: relative; }
.modal-card h4 { margin-bottom: 10px; }
.modal-card img { max-width: 80vw; max-height: 70vh; display: block; }
.modal-close { position: absolute; top: 8px; right: 10px; font-size: 22px; line-height: 1; cursor: pointer; user-select: none; }

footer { background: #232f3e; color: #fff; padding: 20px 16px; font-size: 13px; }
.back-to-top { display: block; text-align: center; background: #37475a; padding: 10px; margin: 0 auto 20px; width: 180px; color: #fff; text-decoration: none; border-radius: 4px; }
.footer-logo { text-align: center; }
.footer-logo img { height: 30px; }

/* ========== RESPONSIVE (TABLET) ========== */
@media (max-width: 1024px) {
  .product-top { grid-template-columns: 1fr; }
  .image-gallery { grid-template-columns: 80px 1fr; }
  .reviews-wrap { grid-template-columns: 1fr; }
}

/* ========== RESPONSIVE (MOBILE) ========== */
@media (max-width: 600px) {
  .top-bar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 8px;
    align-items: center;
  }
  .top-bar .logo { height: 35px; grid-column: 1 / 2; grid-row: 1 / 2; }
  .cart { grid-column: 2 / 3; grid-row: 1 / 2; margin-right: 0; }
  .search-bar { grid-column: 1 / 3; grid-row: 2 / 3; width: 100%; }

  .search-category { display: none; }
  .nav-bar { display: none; }

  .product-top {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 10px 10px 16px;
  }
  .product-info { order: 1; max-width: 100%; }

  .image-gallery { grid-template-columns: 1fr; }
  #photo-thumbs { display: none !important; }
  .mobile-dots { display: flex; }
  .lightbox-link { display: none; }

  .slider-viewport {
    border: none;
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
  }

  .product-info .price { display: none; }

  .style-btn { padding: 10px 14px; font-size: 15px; }

  .sidebar {
    order: 3;
    width: 100%;
    border-radius: 6px;
    font-size: 16px;
  }
  .sidebar .price { display: block !important; }

  .prime-box img { height: 48px; }
  .prime-box p { font-size: 16px; }
  .prime-box a.primary-link { font-size: 18px; color: #007185; }

  .stock-text { font-size: 18px; font-weight: 700; }

  .dropdown {
    font-size: 22px;
    padding: 10px 42px 10px 12px;
    color: #000;
    -webkit-text-fill-color: #000;
  }

  button.add-to-cart,
  button.buy-now {
    font-size: 22px;
    padding: 12px 16px;
    color: #000;
  }

  .ships-from { font-size: 16px; font-weight: 700; }

  /* Mobile accordion header look/feel */
  .about-heading {
    font-size: 18px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 40px 12px 12px;
    position: relative;
    margin: 12px 0 6px;
    cursor: pointer;
    user-select: none;
  }
  .about-heading::after {
    content: "⌄";
    position: absolute;
    right: 12px; top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.15s ease;
    font-size: 16px; color: #555;
  }
  .about-heading.is-open::after { transform: translateY(-50%) rotate(180deg); }

  .accordion-content {
    display: none;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 10px 12px;
    position: relative; /* needed for overlay veil positioning */
  }
  .accordion-content.open { display: block; }

  /* Product table: 1:2 columns exactly on mobile */
  .product-table td:first-child { width: auto; }
  .product-table col.col-left  { width: 33.333%; }
  .product-table col.col-right { width: 66.667%; }

  .reviews-wrap { padding: 12px 10px 24px; }

  /* ===== Mobile: in-section truncation (height clamp + overlay) ===== */
  .trunc-wrap {
    overflow: hidden;
    max-height: none;                 /* JS will set px height when truncated */
    transition: max-height 250ms ease;
  }
  .trunc-veil {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 36px 0 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #fff 62%);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: auto;
    border-radius: 0 0 6px 6px;
  }
  .trunc-more {
    appearance: none;
    border: none;
    background: none;
    color: #007185;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 6px;
  }
}

/* Utility */
.red { color: #b12704; }
