/* ==========================================================================
   RT CHOCOS — BEAN TO BAR MASTER COMPONENT (bean-to-bar.css)
   The Spine · Nine Stages of Chocolate Craftsmanship
   Botanical Forest & Burnished Gold Aesthetic
   ========================================================================== */

/* --- SECTION CONTAINER --- */
.bean-to-bar-band {
  background: linear-gradient(180deg, #07170E 0%, #0A1E14 45%, #08170F 100%);
  border-top: 1px solid rgba(44, 92, 65, 0.45);
  border-bottom: 1px solid rgba(44, 92, 65, 0.45);
  padding: clamp(64px, 8vw, 110px) 0;
  position: relative;
  z-index: 5;
  color: #EFE7D6;
  font-family: 'Inter', sans-serif;
}

.bean-to-bar-band .wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

/* --- SECTION HEADER --- */
.bean-to-bar-band .sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: clamp(36px, 5vw, 64px);
  gap: 24px;
  flex-wrap: wrap;
}

.bean-to-bar-band .sec-head .left {
  max-width: 720px;
}

.bean-to-bar-band .eyebrow {
  font-family: 'IBM Plex Mono', 'Inter', monospace;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #C6A24C;
  font-weight: 600;
  display: inline-block;
  margin-bottom: 10px;
}

.bean-to-bar-band .h-lg {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 500;
  font-size: clamp(32px, 4.4vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  color: #ffffff;
  margin-bottom: 14px;
}

.bean-to-bar-band .ital {
  font-style: italic;
  color: #C6A24C;
}

.bean-to-bar-band .lede {
  font-size: clamp(15.5px, 1.4vw, 18px);
  color: #C6BCA6;
  max-width: 64ch;
  font-weight: 300;
  line-height: 1.65;
}

.bean-to-bar-band .right-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.bean-to-bar-band .mono-note {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7C9C88;
  text-transform: uppercase;
  background: rgba(44, 92, 65, 0.25);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid rgba(44, 92, 65, 0.45);
}

.bean-to-bar-band .b2b-workbench-link {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: #C6A24C;
  text-decoration: none;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  padding: 4px 8px;
}

.bean-to-bar-band .b2b-workbench-link:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

/* --- SCROLL REVEAL ANIMATION --- */
.rv {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s cubic-bezier(0.22, 0.68, 0.24, 1), transform 0.8s cubic-bezier(0.22, 0.68, 0.24, 1);
}

.rv.in {
  opacity: 1;
  transform: none;
}

/* --- THE SPINE LAYOUT --- */
.spine-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 0;
}

.spine {
  position: relative;
}

.spine-line {
  position: absolute;
  left: 26px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: rgba(44, 92, 65, 0.45);
  border-radius: 2px;
}

.spine-fill {
  position: absolute;
  left: 26px;
  top: 14px;
  width: 2px;
  height: 0;
  background: linear-gradient(180deg, #E4DBC2 0%, #C6A24C 45%, #7E4527 80%, #3A2013 100%);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(198, 162, 76, 0.6);
  transition: height 0.16s linear;
}

/* --- STAGES ACCORDION LIST --- */
.stages {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: start;
  padding: 26px 16px 26px 0;
  border-top: 1px solid rgba(44, 92, 65, 0.28);
  cursor: pointer;
  transition: background 0.35s ease, border-color 0.35s ease;
  border-radius: 8px;
  outline: none;
}

.stage:first-child {
  border-top: none;
}

.stage:hover {
  background: rgba(23, 64, 44, 0.28);
}

.stage:focus-visible {
  outline: 2px solid #C6A24C;
  outline-offset: -2px;
}

/* Stage number & circle node */
.stage-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #7C9C88;
  letter-spacing: 0.14em;
  padding-top: 7px;
  position: relative;
  z-index: 2;
  transition: color 0.35s ease;
}

.stage-num::before {
  content: "";
  position: absolute;
  left: -52px;
  top: 10px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #08170F;
  border: 1.5px solid #2C5C41;
  transition: 0.4s cubic-bezier(0.22, 0.68, 0.24, 1);
  box-sizing: border-box;
}

/* Active Stage */
.stage.on .stage-num::before {
  background: #C6A24C;
  border-color: #C6A24C;
  box-shadow: 0 0 0 5px rgba(198, 162, 76, 0.2), 0 0 14px rgba(198, 162, 76, 0.6);
}

.stage.on .stage-num {
  color: #C6A24C;
  font-weight: 600;
}

/* Stage Main Content */
.stage-main h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(21px, 2.3vw, 28px);
  font-weight: 500;
  color: #C6BCA6;
  transition: color 0.35s ease;
  margin-bottom: 2px;
  line-height: 1.2;
}

.stage.on .stage-main h4 {
  color: #ffffff;
}

.stage-key {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #7C9C88;
  text-transform: uppercase;
  margin-top: 5px;
  font-weight: 500;
}

.stage-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.65s cubic-bezier(0.22, 0.68, 0.24, 1), opacity 0.45s ease, margin-top 0.45s ease;
  opacity: 0;
}

.stage.on .stage-body {
  max-height: 480px;
  opacity: 1;
  margin-top: 16px;
}

.stage-body p {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: #D6CCA6;
  max-width: 68ch;
  line-height: 1.7;
  font-weight: 300;
  margin-bottom: 16px;
}

/* Stage Spec Badges */
.stage-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.spec {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 6px 12px;
  border: 1px solid rgba(198, 162, 76, 0.35);
  border-radius: 4px;
  color: #C6A24C;
  background: rgba(198, 162, 76, 0.06);
  transition: all 0.2s ease;
}

.spec:hover {
  border-color: #C6A24C;
  background: rgba(198, 162, 76, 0.14);
}

.spec b {
  color: #ffffff;
  font-weight: 600;
}

/* ==========================================================================
   INTERACTIVE BEAN-TO-BAR GUIDE MODAL VIEWER
   ========================================================================== */
.modal-beantobar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 8, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.modal-beantobar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-beantobar-box {
  background: linear-gradient(165deg, #0e271a 0%, #07170f 65%, #050f0a 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  border-radius: 26px;
  width: 100%;
  max-width: 860px;
  max-height: 88vh;
  box-sizing: border-box;
  color: #ffffff;
  position: relative;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.75),
    0 0 45px rgba(212, 175, 55, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  transform: translateY(22px) scale(0.95);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-beantobar-backdrop.active .modal-beantobar-box {
  transform: translateY(0) scale(1);
}

.modal-beantobar-close {
  position: absolute;
  top: 18px;
  right: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.85);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-beantobar-close:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: #d4af37;
  color: #ffffff;
  transform: rotate(90deg);
}

/* Modal Header */
.modal-beantobar-header {
  padding: 32px 36px 20px;
  border-bottom: 1px solid rgba(44, 92, 65, 0.35);
  position: relative;
  background: rgba(10, 28, 18, 0.45);
}

.modal-beantobar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #d4af37;
  font-weight: 700;
  margin-bottom: 8px;
}

.modal-beantobar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 500;
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.2;
}

.modal-beantobar-title .ital {
  font-style: italic;
  color: #d4af37;
}

.modal-beantobar-lede {
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  color: rgba(243, 237, 215, 0.82);
  line-height: 1.6;
  max-width: 66ch;
  margin-bottom: 14px;
}

.modal-beantobar-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.modal-beantobar-meta-strip .meta-item {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: #7C9C88;
  letter-spacing: 0.08em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-beantobar-meta-strip .meta-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C6A24C;
}

/* Modal Scroll Body */
.modal-beantobar-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 36px 36px;
  scroll-behavior: smooth;
}

/* Modal Spine Wrap */
.modal-spine-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 0;
}

.modal-spine {
  position: relative;
}

.modal-spine-line {
  position: absolute;
  left: 26px;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: rgba(44, 92, 65, 0.45);
  border-radius: 2px;
}

.modal-spine-fill {
  position: absolute;
  left: 26px;
  top: 14px;
  width: 2px;
  height: 0;
  background: linear-gradient(180deg, #E4DBC2 0%, #C6A24C 45%, #7E4527 80%, #3A2013 100%);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(198, 162, 76, 0.6);
  transition: height 0.15s linear;
}

.modal-stages {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-stage {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: start;
  padding: 22px 14px 22px 0;
  border-top: 1px solid rgba(44, 92, 65, 0.28);
  cursor: pointer;
  transition: background 0.3s ease;
  border-radius: 8px;
  outline: none;
}

.modal-stage:first-child {
  border-top: none;
}

.modal-stage:hover {
  background: rgba(23, 64, 44, 0.28);
}

.modal-stage-num {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #7C9C88;
  letter-spacing: 0.14em;
  padding-top: 6px;
  position: relative;
  z-index: 2;
  transition: color 0.3s ease;
}

.modal-stage-num::before {
  content: "";
  position: absolute;
  left: -52px;
  top: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #08170F;
  border: 1.5px solid #2C5C41;
  transition: 0.35s ease;
  box-sizing: border-box;
}

.modal-stage.on .modal-stage-num::before {
  background: #C6A24C;
  border-color: #C6A24C;
  box-shadow: 0 0 0 5px rgba(198, 162, 76, 0.2), 0 0 12px rgba(198, 162, 76, 0.6);
}

.modal-stage.on .modal-stage-num {
  color: #C6A24C;
  font-weight: 600;
}

.modal-stage-main h4 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(19px, 2.2vw, 24px);
  font-weight: 500;
  color: #C6BCA6;
  transition: color 0.3s ease;
  margin-bottom: 2px;
}

.modal-stage.on .modal-stage-main h4 {
  color: #ffffff;
}

.modal-stage-key {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #7C9C88;
  text-transform: uppercase;
  margin-top: 4px;
}

.modal-stage-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s cubic-bezier(0.22, 0.68, 0.24, 1), opacity 0.4s ease, margin-top 0.4s ease;
  opacity: 0;
}

.modal-stage.on .modal-stage-body {
  max-height: 480px;
  opacity: 1;
  margin-top: 14px;
}

.modal-stage-body p {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: #D6CCA6;
  max-width: 66ch;
  line-height: 1.65;
  font-weight: 300;
  margin-bottom: 14px;
}

.modal-stage-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Modal Footer */
.modal-beantobar-footer {
  padding: 16px 36px;
  background: rgba(7, 21, 14, 0.92);
  border-top: 1px solid rgba(44, 92, 65, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.modal-b2b-btn-back {
  padding: 11px 22px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(243, 237, 215, 0.92);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.25s ease;
}

.modal-b2b-btn-back:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(212, 175, 55, 0.6);
  color: #ffffff;
  transform: translateX(-2px);
}

.modal-b2b-btn-workshop {
  padding: 11px 26px;
  background: #d4af37;
  color: #08170f;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 30px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.3px;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(212, 175, 55, 0.3);
}

.modal-b2b-btn-workshop:hover {
  background: #e6c44a;
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(212, 175, 55, 0.45);
}

/* --- RESPONSIVE BREAKPOINTS --- */
@media (max-width: 768px) {
  .spine-wrap, .stage {
    grid-template-columns: 54px 1fr;
  }
  .spine-line, .spine-fill {
    left: 18px;
  }
  .stage-num::before {
    left: -36px;
    width: 10px;
    height: 10px;
  }
  .stage-main h4 {
    font-size: 20px;
  }
  .modal-beantobar-backdrop {
    padding: 10px;
    box-sizing: border-box;
  }
  .modal-beantobar-box {
    max-height: 92vh;
    border-radius: 20px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .modal-beantobar-close {
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
  .modal-beantobar-header,
  .modal-beantobar-scroll-body,
  .modal-beantobar-footer {
    padding-left: 18px;
    padding-right: 18px;
    box-sizing: border-box;
  }
  .modal-beantobar-header {
    padding-top: 24px;
    padding-bottom: 16px;
    padding-right: 56px; /* Avoid collision with close button */
  }
  .modal-beantobar-title {
    font-size: 22px;
  }
  .modal-beantobar-lede {
    font-size: 13px;
    line-height: 1.5;
  }
  .modal-spine-wrap, .modal-stage {
    grid-template-columns: 48px 1fr;
  }
  .modal-spine-line, .modal-spine-fill {
    left: 15px;
  }
  .modal-stage-num::before {
    left: -33px;
    width: 10px;
    height: 10px;
  }
  .modal-beantobar-footer {
    padding: 14px 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .modal-b2b-btn-back,
  .modal-b2b-btn-workshop,
  .modal-b2b-btn-scroll,
  .modal-b2b-btn-close {
    width: 100%;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .spine-wrap, .stage {
    grid-template-columns: 44px 1fr;
  }
  .spine-line, .spine-fill {
    left: 14px;
  }
  .stage-num::before {
    left: -30px;
    width: 9px;
    height: 9px;
  }
  .spec {
    font-size: 10px;
    padding: 5px 9px;
  }
  .modal-beantobar-backdrop {
    padding: 8px 6px;
  }
  .modal-beantobar-box {
    max-height: 95vh;
    border-radius: 16px;
  }
  .modal-beantobar-header {
    padding: 20px 14px 12px;
  }
  .modal-beantobar-scroll-body {
    padding-left: 14px;
    padding-right: 14px;
  }
  .modal-spine-wrap, .modal-stage {
    grid-template-columns: 40px 1fr;
  }
  .modal-spine-line, .modal-spine-fill {
    left: 12px;
  }
  .modal-stage-num::before {
    left: -28px;
    width: 8px;
    height: 8px;
  }
  .modal-stage-main h4 {
    font-size: 17px;
  }
  .modal-stage-key {
    font-size: 11px;
  }
  .modal-stage-body p {
    font-size: 12.5px;
    line-height: 1.5;
  }
  .modal-beantobar-meta-strip .meta-item {
    font-size: 9.5px;
  }
}
