.cha3-body {
  --cha3-ink: #1c1917;
  --cha3-link: #5c2a2a;
  --cha3-link-hover: #8a3a2a;
  --cha3-link-visited: #4a3540;
  --cha3-page-width: 75rem; /* 1200px — matches quote art */
  --cha3-page-gutter: 1rem;
  --cha3-wall: #e4dac8;
  --cha3-mat: #fbf8f2;
  --cha3-silk: #e6d7bd;
  --bs-link-color: var(--cha3-link);
  --bs-link-hover-color: var(--cha3-link-hover);
  --bs-link-color-rgb: 92, 42, 42;
  --bs-link-hover-color-rgb: 138, 58, 42;
  /* Gallery wall: warmer, slightly darker than the content mat + soft linen grain */
  background-color: var(--cha3-wall);
  background-image:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(251, 248, 242, 0.55), transparent 70%),
    radial-gradient(ellipse 70% 45% at 100% 80%, rgba(91, 58, 34, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 60%, rgba(61, 38, 20, 0.06), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.26 0 0 0 0 0.14 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--cha3-ink);
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  /* Keep wall art (z-index: -1) above the body background without forcing
     .cha3-mat into its own stacking context (that trapped Bootstrap modals
     under the backdrop). */
  isolation: isolate;
}

/* Tea-mountain landscape painted on the wall. Fixed to the viewport's lower
   corners so the peaks stay in view while scrolling; the mat (z-index 2)
   covers whatever falls under it. Hidden when the wall is too narrow to show it. */
.cha3-body::before,
.cha3-body::after {
  content: "";
  position: fixed;
  bottom: 0;
  z-index: -1;
  width: 240px;
  height: min(780px, 92vh);
  background-repeat: no-repeat;
  background-size: auto 100%;
  pointer-events: none;
}

.cha3-body::before {
  left: 0;
  background-image: url("../brand/wall/tea-mountains-left.svg");
  background-position: left bottom;
}

.cha3-body::after {
  right: 0;
  background-image: url("../brand/wall/tea-mountains-right.svg");
  background-position: right bottom;
}

@media (max-width: 79.99rem) {
  .cha3-body::before,
  .cha3-body::after {
    display: none;
  }

  /* Too narrow for the wall art: a strip of the same hills tops the mat instead. */
  .cha3-mat::before {
    content: "";
    display: block;
    height: 36px;
    background: url("../brand/wall/tea-mountains-band.svg") repeat-x left bottom;
    border-bottom: 1px solid rgba(91, 58, 34, 0.1);
    pointer-events: none;
  }
}

/* Content mat: lighter paper plane over the wall.
   Do not set z-index here — a stacking context on the mat traps Bootstrap
   review modals under the body-level .modal-backdrop. */
.cha3-mat {
  position: relative;
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--cha3-page-width);
  margin-left: auto;
  margin-right: auto;
  background: var(--cha3-mat);
  border: 1px solid rgba(91, 58, 34, 0.14);
  border-top: 0;
  border-bottom: 0;
  box-shadow:
    0 0 0 1px rgba(230, 215, 189, 0.9),
    0 12px 40px rgba(61, 38, 20, 0.08),
    0 2px 8px rgba(61, 38, 20, 0.04);
}

/* One content width for header, main, quote, and footer (no Bootstrap steps). */
.cha3-body .container,
.cha3-shell {
  width: 100%;
  max-width: var(--cha3-page-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--cha3-page-gutter);
  padding-right: var(--cha3-page-gutter);
}

.cha3-body a {
  color: var(--cha3-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.cha3-body a:visited {
  color: var(--cha3-link-visited);
}

.cha3-body a:hover,
.cha3-body a:focus-visible {
  color: var(--cha3-link-hover);
}

.cha3-ink {
  font-family: Palatino, "Palatino Linotype", "Songti SC", serif;
  letter-spacing: 0.02em;
  color: var(--cha3-ink);
}

.cha3-main > h1.cha3-ink {
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.cha3-header {
  position: relative;
  z-index: 3;
  border-bottom: 1px solid #cfc3ad;
  background: linear-gradient(180deg, #fbf4e6, #f3e9d6);
  box-shadow:
    0 1px 0 rgba(251, 248, 242, 0.8),
    0 6px 18px rgba(61, 38, 20, 0.05);
}

.cha3-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
}

.cha3-brand:hover,
.cha3-brand:focus-visible {
  text-decoration: none;
}

.cha3-brand-mark {
  display: block;
  width: 2.625rem;
  height: 2.625rem;
  object-fit: contain;
}

.cha3-brand-logo {
  display: block;
  height: 6.375rem;
  width: auto;
  max-width: min(33rem, 70vw);
  object-fit: contain;
}

.cha3-header a {
  color: var(--cha3-link);
  text-decoration: none;
}

.cha3-header a:visited {
  color: var(--cha3-link);
}

.cha3-header a:focus-visible,
.cha3-header a:hover {
  color: var(--cha3-link-hover);
  text-decoration: underline;
  outline: none;
}

.cha3-header a:focus-visible {
  outline: 2px solid var(--cha3-link);
  outline-offset: 3px;
}

/* Footer / other chrome still use this class; header nav uses aria-current + .hd-link. */
.cha3-nav-current {
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hd-link {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px 9px;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
}

.cha3-header .hd-link {
  color: var(--cha3-link);
}

.cha3-header .hd-link:hover,
.cha3-header .hd-link:focus-visible {
  color: var(--sc-class-hong);
  text-decoration: none;
}

.cha3-header .hd-link[aria-current] {
  color: var(--sc-ink);
  font-weight: 600;
}

.hd-zh {
  font-family: var(--sc-cjk);
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: var(--sc-muted);
  font-weight: 500;
}

.hd-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 1px;
  background: var(--sc-class-hong);
  transform: scaleX(0);
  transition: transform 180ms ease;
}

.hd-link:hover::after,
.hd-link:focus-visible::after,
.hd-link[aria-current]::after {
  transform: scaleX(1);
}

.cha3-header .hd-link:focus-visible {
  outline: 2px solid var(--sc-class-hong);
  outline-offset: 3px;
}

/* Signed in: green dot before the label; caption reads 已登入 (signed in). */
.hd-link--signed-in > span:first-child::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--sc-class-lv);
  vertical-align: 1px;
}

.cha3-header .hd-link--signed-in .hd-zh {
  color: var(--sc-class-lv);
}

.hd-ribbon {
  display: flex;
  gap: 2px;
  height: 4px;
}

.hd-ribbon span {
  flex: 1;
}

@media (prefers-reduced-motion: reduce) {
  .hd-link::after {
    transition: none;
  }
}

.cha3-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: none;
  margin: 0;
  padding-top: 1.5rem;
  padding-bottom: 3rem;
  padding-left: var(--cha3-page-gutter);
  padding-right: var(--cha3-page-gutter);
}

.cha3-quote {
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  margin: 0;
  aspect-ratio: 1200 / 160;
  position: relative;
  padding: 0 var(--cha3-page-gutter) 0.5rem;
  box-sizing: border-box;
}

.cha3-quote-img {
  position: absolute;
  left: var(--cha3-page-gutter);
  right: var(--cha3-page-gutter);
  top: 0;
  bottom: 0.5rem;
  width: auto;
  height: auto;
  max-width: none;
  object-fit: contain;
  opacity: 0;
  transition: opacity 900ms ease;
  pointer-events: none;
}

.cha3-quote-img.is-on {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cha3-quote-img {
    transition: none;
  }
}

.cha3-footer {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  border-top: 1px solid #cfc3ad;
  background: #f6efe2;
  width: 100%;
  box-shadow: 0 -6px 18px rgba(61, 38, 20, 0.04);
}

.cha3-footer a {
  color: var(--cha3-link);
  text-decoration: none;
}

.cha3-footer a:visited {
  color: var(--cha3-link);
}

.cha3-footer a:hover,
.cha3-footer a:focus-visible {
  color: var(--cha3-link-hover);
  text-decoration: underline;
  outline: none;
}

.cha3-footer a:focus-visible {
  outline: 2px solid var(--cha3-link);
  outline-offset: 3px;
}

.cha3-lead {
  max-width: 40rem;
  color: #4a453e;
  margin-bottom: 1.75rem;
}

.cha3-faq-section {
  max-width: 42rem;
  margin-bottom: 2.25rem;
}

.cha3-faq-section h2 {
  font-size: 1.35rem;
  margin-bottom: 0.75rem;
}

.cha3-faq-section p {
  margin-bottom: 0.85rem;
}

.cha3-icon-legend {
  display: grid;
  gap: 1.1rem;
  margin-top: 1rem;
}

.cha3-icon-legend-item {
  display: grid;
  grid-template-columns: 1.75rem 1fr;
  gap: 0.85rem;
  align-items: start;
}

.cha3-icon-legend-item strong {
  display: block;
  margin-bottom: 0.2rem;
}

.cha3-icon-legend-item p {
  color: #4a453e;
  font-size: 0.95rem;
}

.cha3-card {
  background: #fffdf8;
  border: 1px solid #d9ceb8;
  box-shadow: none;
}

.cha3-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.cha3-card-grid-single {
  grid-template-columns: minmax(11rem, 14rem);
}

.cha3-card-grid > .cha3-card,
.cha3-card-grid > .col-tea {
  flex: none;
  width: auto;
  max-width: none;
  margin: 0;
}

.cha3-card-paged-out {
  display: none !important;
}

.cha3-show-more-wrap {
  margin-top: 1.75rem;
}

.col-tea {
  flex: 0 0 100%;
  max-width: 100%;
}

@media (min-width: 992px) {
  .col-tea {
    flex: 0 0 20%;
    max-width: 20%;
  }
}

.cha3-card-compact .card-body {
  position: relative;
  padding: 0.65rem 0.75rem;
  padding-top: 1.35rem;
}

.cha3-card-drag-handle {
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #7a6f5f;
  cursor: grab;
  line-height: 1;
  padding: 0.15rem 0.35rem;
  font-size: 0.85rem;
  letter-spacing: -0.08em;
  border-radius: 0.25rem;
}

.cha3-card-drag-handle:hover,
.cha3-card-drag-handle:focus-visible {
  color: var(--cha3-link);
  background: #efe6d6;
  outline: none;
}

.cha3-card-drag-handle:active {
  cursor: grabbing;
}

.cha3-card-dragging {
  opacity: 0.55;
}

.cha3-card-drag-over {
  outline: 2px dashed var(--cha3-link);
  outline-offset: 2px;
}

.cha3-card-grid-single .cha3-card-drag-handle {
  display: none;
}

.cha3-card-product-image {
  display: block;
  width: 100%;
  max-height: 5.5rem;
  object-fit: cover;
}

.cha3-card-title {
  margin-bottom: 0.15rem;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cha3-card-title-link {
  color: var(--cha3-ink);
  text-decoration: none;
}

.cha3-card-title-link:visited {
  color: var(--cha3-ink);
}

.cha3-card-title-link:hover,
.cha3-card-title-link:focus-visible {
  color: var(--cha3-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

.cha3-card-meta,
.cha3-card-price,
.cha3-card-note {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.cha3-card-dealer-link {
  color: inherit;
  text-decoration: none;
}

.cha3-card-dealer-link:visited {
  color: inherit;
}

.cha3-card-dealer-link:hover,
.cha3-card-dealer-link:focus-visible {
  color: var(--cha3-link);
  text-decoration: none;
}

.cha3-metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.4rem;
}

.cha3-metric-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: block;
  flex: 0 0 auto;
}

/* Explicit layer above Bootstrap's backdrop (1050) once the dialog is free
   of the mat stacking context / reparented to body. */
.cha3-reviews-modal {
  z-index: 1055;
}

.cha3-reviews-modal .modal-content {
  background: #fbf8f2;
  color: var(--cha3-ink);
  border-color: rgba(91, 58, 34, 0.2);
}

.cha3-reviews-modal .modal-header {
  border-bottom-color: rgba(91, 58, 34, 0.15);
}

.cha3-reviews-modal .modal-title {
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-weight: 600;
  color: var(--cha3-ink);
}

.cha3-muted {
  color: #4a453e;
}

.cha3-accent {
  color: var(--cha3-link-hover);
}

.cha3-status {
  color: #4a453e;
  margin-bottom: 1rem;
}

/* Account sign-in / register: silk mount column (stacked fields). */
.cha3-account-panel {
  width: 100%;
  max-width: 22.5rem;
  margin: 0.25rem 0 1.5rem;
  padding: 1.25rem 1.35rem 1.35rem;
  background:
    linear-gradient(180deg, rgba(251, 248, 242, 0.55), transparent 42%),
    var(--cha3-silk);
  border: 1px solid rgba(91, 58, 34, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(251, 248, 242, 0.55),
    0 10px 28px rgba(61, 38, 20, 0.08);
}

.cha3-account-title {
  font-family: "EB Garamond", Garamond, "Times New Roman", serif;
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--cha3-ink);
  margin: 0 0 1rem;
}

.cha3-account-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cha3-account-field .form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #4a453e;
  margin-bottom: 0.3rem;
}

.cha3-account-field .form-control {
  border-radius: 0;
  border-color: rgba(91, 58, 34, 0.28);
  background-color: var(--cha3-mat);
  color: var(--cha3-ink);
}

.cha3-account-field .form-control:focus {
  border-color: var(--cha3-link);
  background-color: #fffdf8;
}

.cha3-account-actions {
  margin-top: 0.25rem;
}

.cha3-account-submit {
  width: 100%;
  border-radius: 0;
  border: 1px solid var(--cha3-ink);
  background: var(--cha3-ink);
  color: #fbf8f2;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
}

.cha3-account-submit:hover,
.cha3-account-submit:focus-visible {
  background: var(--cha3-link);
  border-color: var(--cha3-link);
  color: #fbf8f2;
}

.cha3-account-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 1rem 0 0;
  font-size: 0.9375rem;
}

.cha3-empty-art {
  display: block;
  max-width: 12rem;
  height: auto;
  margin: 0.5rem 0 1rem;
}

.cha3-search-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.cha3-search-input {
  flex: 1 1 auto;
  min-width: 0;
}

.cha3-search-input::placeholder {
  color: #8a8378;
  opacity: 1;
}

.cha3-search-submit {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Compact text-style toolbar selects (minimal chrome, ChaBazaar palette). */
.cha3-card-toolbar .form-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #4a453e;
  margin-bottom: 0.2rem;
}

.cha3-toolbar-field {
  flex: 0 0 auto;
}

.cha3-select,
.cha3-card-toolbar .form-select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 3rem;
  max-width: 12rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--cha3-ink);
  background-color: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid #cfc3ad;
  box-shadow: none;
  padding: 0.15rem 1.35rem 0.2rem 0;
  min-height: 1.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%234a453e' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.1rem center;
  background-size: 0.55rem 0.35rem;
  cursor: pointer;
}

.cha3-select:hover,
.cha3-card-toolbar .form-select:hover {
  border-bottom-color: var(--cha3-link);
  color: var(--cha3-link);
}

.cha3-select:focus,
.cha3-card-toolbar .form-select:focus {
  border-bottom-color: var(--cha3-link);
  outline: none;
  box-shadow: none;
}

.cha3-toolbar-field-sort .cha3-select {
  max-width: 13.5rem;
}

.btn:focus-visible,
.form-control:focus,
.form-check-input:focus {
  outline: 2px solid var(--cha3-link);
  outline-offset: 2px;
  box-shadow: none;
}
