/* Raised Bed Soil Calculator — elevated UI.
   Palette: deep earth, living green, warm cream. Everything scoped to
   .rbsc-wrap so it never collides with the host theme. Motion is restrained:
   one signature (the bed filling), plus tactile feedback on results. */

.rbsc-wrap {
  --e-earth: #33241a;
  --e-earth-soft: #5c4433;
  --e-green: #4b7f52;
  --e-green-deep: #2f5836;
  --e-green-bright: #6aa06f;
  --e-cream: #f7f2e9;
  --e-cream-deep: #efe7d7;
  --e-line: #e0d4c0;
  --e-line-soft: #ece2d0;
  --e-ink: #2b241b;
  --e-ink-soft: #766854;
  --e-white: #fffdf9;
  --e-r: 16px;
  --e-r-sm: 11px;
  --e-ease: cubic-bezier(.22,.61,.36,1);
  --e-spring: cubic-bezier(.34,1.56,.64,1);
  --e-sh-sm: 0 1px 2px rgba(51,36,26,.06);
  --e-sh: 0 4px 12px rgba(51,36,26,.07), 0 1px 3px rgba(51,36,26,.06);
  --e-sh-lg: 0 18px 40px -12px rgba(51,36,26,.22), 0 4px 12px rgba(51,36,26,.08);

  max-width: 940px;
  margin: 2rem auto;
  background: var(--e-cream);
  border: 1px solid var(--e-line);
  border-radius: var(--e-r);
  overflow: hidden;
  color: var(--e-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  box-shadow: var(--e-sh-lg);
  -webkit-font-smoothing: antialiased;
}
.rbsc-wrap *, .rbsc-wrap *::before, .rbsc-wrap *::after { box-sizing: border-box; }
.rbsc-wrap :focus-visible { outline: 2px solid var(--e-green); outline-offset: 2px; }

/* ---- Header ---- */
.rbsc-header {
  padding: 2rem 2rem 1.6rem;
  background:
    radial-gradient(130% 150% at 100% -10%, rgba(75,127,82,.13), transparent 55%),
    linear-gradient(180deg, var(--e-white), var(--e-cream));
  border-bottom: 1px solid var(--e-line);
}
.rbsc-eyebrow {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: .7rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--e-green-deep); font-weight: 800; margin-bottom: .6rem;
}
.rbsc-eyebrow::before { content: ""; width: 16px; height: 2px; background: var(--e-green); border-radius: 2px; }
.rbsc-title { margin: 0 0 .45rem; font-size: 2rem; line-height: 1.08; font-weight: 800; color: var(--e-earth); letter-spacing: -.02em; }
.rbsc-sub { margin: 0; color: var(--e-ink-soft); font-size: 1.02rem; max-width: 48ch; }

/* ---- Region bar ---- */
.rbsc-region-bar { display: flex; align-items: center; gap: .85rem; flex-wrap: wrap; padding: 1rem 2rem; background: var(--e-cream-deep); border-bottom: 1px solid var(--e-line); }
.rbsc-region-label { font-size: .7rem; letter-spacing: .13em; text-transform: uppercase; color: var(--e-ink-soft); font-weight: 800; }
.rbsc-region-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.rbsc-pill { border: 1px solid var(--e-line); background: var(--e-white); color: var(--e-ink-soft); padding: .42rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 700; cursor: pointer; transition: transform .15s var(--e-spring), background .15s var(--e-ease), color .15s var(--e-ease), border-color .15s var(--e-ease), box-shadow .15s var(--e-ease); }
.rbsc-pill:hover { border-color: var(--e-green-bright); color: var(--e-green-deep); transform: translateY(-1px); box-shadow: var(--e-sh-sm); }
.rbsc-pill.is-active { background: var(--e-green-deep); color: #fff; border-color: var(--e-green-deep); box-shadow: 0 3px 10px -2px rgba(47,88,54,.5); }

/* ---- Body ---- */
.rbsc-body { display: grid; grid-template-columns: 1fr 1.05fr; }
.rbsc-inputs { padding: 1.7rem 2rem; border-right: 1px solid var(--e-line); }
.rbsc-output { padding: 1.7rem 2rem; background: linear-gradient(180deg, var(--e-white), #fffefb); }

/* ---- Shape toggle & unit switch (segmented) ---- */
.rbsc-shape-toggle { display: inline-flex; padding: .28rem; background: var(--e-cream-deep); border-radius: 12px; margin-bottom: 1.3rem; gap: .2rem; }
.rbsc-shape-btn { border: 0; background: transparent; padding: .48rem 1.05rem; border-radius: 9px; font-size: .88rem; font-weight: 700; color: var(--e-ink-soft); cursor: pointer; transition: all .18s var(--e-ease); }
.rbsc-shape-btn.is-active { background: var(--e-white); color: var(--e-earth); box-shadow: var(--e-sh-sm); }

.rbsc-unit-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.rbsc-unit-label { font-size: .8rem; color: var(--e-ink-soft); font-weight: 700; }
.rbsc-unit-switch { display: inline-flex; border: 1px solid var(--e-line); border-radius: 10px; overflow: hidden; background: var(--e-white); }
.rbsc-unit-opt { border: 0; background: transparent; padding: .42rem .72rem; font-size: .82rem; font-weight: 700; color: var(--e-ink-soft); cursor: pointer; border-right: 1px solid var(--e-line); transition: all .14s var(--e-ease); }
.rbsc-unit-opt:last-child { border-right: 0; }
.rbsc-unit-opt:hover { background: var(--e-cream); }
.rbsc-unit-opt.is-active { background: var(--e-green); color: #fff; }

/* ---- Fields ---- */
.rbsc-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-bottom: 1.05rem; }
.rbsc-field { display: flex; flex-direction: column; gap: .38rem; }
.rbsc-field-full { grid-column: 1 / -1; margin-bottom: 1.05rem; }
.rbsc-field > span { font-size: .82rem; font-weight: 700; color: var(--e-earth-soft); }
.rbsc-field input, .rbsc-field select {
  width: 100%; padding: .68rem .8rem; border: 1px solid var(--e-line); border-radius: 10px;
  font-size: 1rem; background: var(--e-white); color: var(--e-ink); font-weight: 600;
  transition: border-color .15s var(--e-ease), box-shadow .15s var(--e-ease);
  -moz-appearance: textfield;
}
.rbsc-field input:hover, .rbsc-field select:hover { border-color: var(--e-green-bright); }
.rbsc-field input:focus, .rbsc-field select:focus { outline: none; border-color: var(--e-green); box-shadow: 0 0 0 3px rgba(75,127,82,.16); }
.rbsc-hint { font-size: .75rem; color: var(--e-ink-soft); line-height: 1.45; }

.rbsc-multi { margin-bottom: 1.05rem; }
.rbsc-check { display: inline-flex; align-items: center; gap: .55rem; font-size: .86rem; color: var(--e-earth-soft); cursor: pointer; font-weight: 600; }
.rbsc-check input { width: 17px; height: 17px; accent-color: var(--e-green); cursor: pointer; }
.rbsc-qty { margin-top: .8rem; max-width: 160px; }

.rbsc-adv { border-top: 1px solid var(--e-line); padding-top: 1rem; margin-top: .4rem; }
.rbsc-adv summary { font-size: .84rem; font-weight: 700; color: var(--e-green-deep); cursor: pointer; list-style-position: inside; }
.rbsc-adv-inner { padding-top: 1rem; }

/* ---- Signature visual: the bed filling ---- */
.rbsc-visual { margin-bottom: 1.5rem; }
.rbsc-bed {
  position: relative; height: 200px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg, #edf2e6 0%, #dde5d2 100%);
  border: 1px solid var(--e-line);
  box-shadow: inset 0 2px 8px rgba(51,36,26,.06);
}
.rbsc-bed-fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background:
    repeating-linear-gradient(118deg, rgba(0,0,0,.05) 0 5px, transparent 5px 12px),
    repeating-linear-gradient(62deg, rgba(255,255,255,.04) 0 4px, transparent 4px 11px),
    linear-gradient(180deg, #755337 0%, #593d28 55%, #40291a 100%);
  transition: height .6s var(--e-ease);
}
.rbsc-bed-fill::before {
  content: ""; position: absolute; top: -4px; left: 0; right: 0; height: 9px;
  background: radial-gradient(circle at 18% 60%, #825b3b 2px, transparent 2.6px) 0 0/14px 9px, #6f4d33;
  opacity: .95;
}
.rbsc-bed-frame { position: absolute; inset: 0; border: 7px solid #7c5a3c; border-radius: 14px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.09), inset 0 0 22px rgba(0,0,0,.14); pointer-events: none; }
.rbsc-depth-marker { position: absolute; right: 20px; bottom: 0; width: 2px; background: rgba(255,255,255,.65); transition: height .6s var(--e-ease); }
.rbsc-depth-marker span { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: var(--e-earth); color: #fff; font-size: .68rem; font-weight: 800; padding: .14rem .45rem; border-radius: 6px; white-space: nowrap; box-shadow: var(--e-sh-sm); }
.rbsc-visual-caption { text-align: center; font-size: .7rem; color: var(--e-ink-soft); margin-top: .55rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }

/* ---- Results: the hero ---- */
.rbsc-result-primary { display: grid; grid-template-columns: 1fr 1.15fr; gap: .85rem; margin-bottom: 1.1rem; }
.rbsc-result-volume, .rbsc-result-bags { border-radius: 14px; padding: 1.1rem 1.1rem; text-align: center; position: relative; overflow: hidden; }
.rbsc-result-volume { background: var(--e-cream); border: 1px solid var(--e-line); }
.rbsc-result-bags {
  background: linear-gradient(158deg, #3a6b41 0%, #2f5836 100%);
  border: 1px solid var(--e-green-deep);
  box-shadow: 0 10px 26px -8px rgba(47,88,54,.55);
}
.rbsc-result-bags::after { content: ""; position: absolute; top: -40%; right: -20%; width: 120px; height: 120px; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); pointer-events: none; }
.rbsc-big, .rbsc-bags-num { font-variant-numeric: tabular-nums; display: block; line-height: 1; transition: transform .2s var(--e-spring); }
.rbsc-big { font-size: 2.1rem; font-weight: 800; color: var(--e-earth); }
.rbsc-big-unit { font-size: .78rem; color: var(--e-ink-soft); font-weight: 700; }
.rbsc-bags-num { font-size: 2.5rem; font-weight: 800; color: #fff; }
.rbsc-bags-label { font-size: .82rem; color: rgba(255,255,255,.9); font-weight: 700; }
.rbsc-result-bags .rbsc-bags-hint { display: block; font-size: .72rem; color: rgba(255,255,255,.7); margin-top: .3rem; }
/* pulse feedback when a value changes */
.rbsc-pulse { animation: rbsc-pop .32s var(--e-spring); }
@keyframes rbsc-pop { 0% { transform: scale(1); } 40% { transform: scale(1.11); } 100% { transform: scale(1); } }

.rbsc-result-secondary { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.1rem; }
.rbsc-chip { font-size: .78rem; background: var(--e-cream-deep); border: 1px solid var(--e-line); padding: .38rem .7rem; border-radius: 999px; color: var(--e-earth-soft); font-weight: 700; font-variant-numeric: tabular-nums; }
.rbsc-chip strong { color: var(--e-earth); }

.rbsc-shopping { background: var(--e-cream); border: 1px dashed var(--e-green-bright); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; font-size: .88rem; }
.rbsc-shopping h4 { margin: 0 0 .55rem; font-size: .74rem; color: var(--e-green-deep); text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.rbsc-shopping ul { margin: 0; padding-left: 1.15rem; color: var(--e-earth-soft); }
.rbsc-shopping li { margin: .28rem 0; }

.rbsc-copy { width: 100%; border: 0; background: var(--e-earth); color: #fff; font-weight: 800; padding: .82rem; border-radius: 11px; cursor: pointer; font-size: .92rem; transition: transform .12s var(--e-ease), background .15s var(--e-ease); letter-spacing: .01em; }
.rbsc-copy:hover { background: var(--e-earth-soft); }
.rbsc-copy:active { transform: scale(.985); }
.rbsc-copy.is-copied { background: var(--e-green); }

/* ---- Disclaimer ---- */
.rbsc-disclaimer {
  display: flex; gap: .7rem; align-items: flex-start;
  margin: 0; padding: 1rem 2rem;
  background: #fbf6ec; border-top: 1px solid var(--e-line);
  font-size: .8rem; color: var(--e-ink-soft); line-height: 1.5;
}
.rbsc-disclaimer svg { flex-shrink: 0; margin-top: 1px; }
.rbsc-disclaimer strong { color: var(--e-earth-soft); }

.rbsc-foot { margin: 0; padding: .85rem 2rem; font-size: .74rem; color: var(--e-ink-soft); background: var(--e-cream-deep); border-top: 1px solid var(--e-line); }

.rbsc-hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .rbsc-body { grid-template-columns: 1fr; }
  .rbsc-inputs { border-right: 0; border-bottom: 1px solid var(--e-line); }
  .rbsc-header, .rbsc-region-bar, .rbsc-inputs, .rbsc-output, .rbsc-disclaimer, .rbsc-foot { padding-left: 1.3rem; padding-right: 1.3rem; }
  .rbsc-title { font-size: 1.55rem; }
  .rbsc-big { font-size: 1.7rem; } .rbsc-bags-num { font-size: 2.1rem; }
  /* On mobile, show the result first so the payoff is immediate */
  .rbsc-output { order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  .rbsc-bed-fill, .rbsc-depth-marker, .rbsc-big, .rbsc-bags-num, .rbsc-pill, .rbsc-copy { transition: none; }
  .rbsc-pulse { animation: none; }
}
