/*
 * The original olive palette is archived in docs/theme-baselines/olive.
 * The refined olive palette is the default. Sage remains an optional experiment.
 * selected before first paint by store_theme.js. Typography and layout are shared.
 */
:root[data-store-theme="olive"] {
  --farm-canvas: #fbfaf6;
  --farm-linen: #f2eee7;
  --farm-sage: #f3f1eb;
  --farm-primary: #526044;
  --farm-primary-rgb: 82, 96, 68;
  --farm-primary-hover: #47583c;
  --farm-primary-soft: #eeefe8;
  --farm-line: #dfdbd2;
  --farm-line-strong: #b6b6a9;
  --farm-focus: rgba(82, 96, 68, .16);
  --farm-button-bg: #5c6b4d;
  --farm-button-ink: #fff;
  --farm-button-border: transparent;
  --farm-button-gradient: linear-gradient(85deg, #65734e 0%, #435633 50%, #6d7b57 100%);
  --farm-button-shadow: rgba(82, 96, 68, .16);
  --farm-selected-bg: #526044;
  --farm-selected-ink: #fff;
  --farm-selected-border: #526044;
  --farm-selected-hover-bg: #47583c;
  --farm-home-glow: rgba(200, 177, 150, .12);
  --farm-home-start: #fbfaf7;
  --farm-home-end: #f4efe8;
  --farm-group-gradient: linear-gradient(110deg, #fff 0%, #f8f7f3 48%, #eeefe7 100%);
}

:root[data-store-theme="sage"] {
  --farm-canvas: #fcfaf5;
  --farm-linen: #f5f0e6;
  --farm-sage: #f0f3e9;
  --farm-ink: #303b2e;
  --farm-muted: #66705f;
  --farm-primary: #526442;
  --farm-primary-rgb: 82, 100, 66;
  --farm-primary-hover: #3e5533;
  --farm-primary-soft: #e5edda;
  --farm-line: #dedfcf;
  --farm-line-strong: #a6b29a;
  --farm-focus: rgba(82, 100, 66, .18);
  --farm-button-bg: #dce7d2;
  --farm-button-ink: #2d3d2b;
  --farm-button-border: #a9ba9b;
  --farm-button-gradient: linear-gradient(110deg, #efe4c7 0%, #dce7ce 48%, #b4cba4 100%);
  --farm-button-shadow: rgba(82, 100, 66, .12);
  --farm-button-highlight: rgba(255, 255, 255, .26);
  --farm-selected-bg: #d0dfc2;
  --farm-selected-ink: #35492d;
  --farm-selected-border: #9eaf8d;
  --farm-selected-hover-bg: #c1d4b0;
  --farm-home-glow: rgba(206, 220, 179, .2);
  --farm-home-start: #fcfaf5;
  --farm-home-end: #f5f2e7;
  --farm-group-gradient: linear-gradient(110deg, #fff 0%, #f6f8ef 48%, #e0ebd3 100%);
}

/* Match production: a light-dark-light gradient slides across a 200% background. */
.btn.btn-accent,
.btn.btn-accent:hover,
.btn.btn-accent:focus,
.btn.btn-accent:focus-visible,
.btn.btn-accent:active {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-size: 200% 100%;
  background-repeat: no-repeat;
  transition: background-position .38s ease, box-shadow .25s ease;
}
.btn.btn-accent::before { content: none; }
.btn.btn-accent:hover,
.btn.btn-accent:focus-visible { background-position: 100% 50%; }
.btn.btn-accent:hover { box-shadow: 0 5px 14px var(--farm-button-shadow); }
.btn.btn-accent:active { background-position: 100% 50%; box-shadow: 0 2px 7px var(--farm-button-shadow); }
.product-bag.has-items:hover { box-shadow: none; }

/* A small preference control, kept away from the cart and the back-to-top link. */
.theme-picker {
  position: fixed;
  z-index: 1030;
  left: 22px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  font-family: var(--farm-font-ui);
  color: var(--farm-ink);
}
.theme-picker-panel { position: relative; }
.theme-picker-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  list-style: none;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--farm-muted);
  box-shadow: none;
  font-size: 12px;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  transition: color .2s ease, border-color .2s ease;
}
.theme-picker-toggle::-webkit-details-marker { display: none; }
.theme-picker-toggle::marker { content: ''; }
.theme-picker-toggle:hover,
.theme-picker-panel[open] .theme-picker-toggle { color: var(--farm-primary); background: var(--farm-surface); }
.theme-picker-toggle { width: 44px; }
.theme-picker-toggle > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.theme-picker-toggle svg { display: block; flex: none; width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.4; }
.theme-picker-toggle:focus-visible { outline: 2px solid var(--farm-primary); outline-offset: 3px; }
.theme-picker-options {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 0;
  width: 260px;
  max-width: calc(100vw - 44px);
  margin: 0;
  padding: 18px 12px 12px;
  border: 1px solid var(--farm-line);
  border-radius: 16px;
  background: var(--farm-surface);
  box-shadow: var(--farm-shadow);
}
.theme-picker-options legend {
  float: none;
  width: auto;
  margin: 0 0 6px 7px;
  padding: 0;
  color: var(--farm-muted);
  font-size: 12px;
  line-height: 1.3;
}
.theme-picker-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 9px 8px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1.3;
  cursor: pointer;
}
.theme-picker-option:hover,
.theme-picker-option:has(input:checked) { background: var(--farm-sage); }
.theme-picker-option input { width: 15px; height: 15px; margin: 0; flex: none; accent-color: var(--farm-primary); }
.theme-picker-name { flex: 1; }
.theme-picker-swatches { display: inline-flex; flex: none; margin-left: 5px; }
.theme-picker-swatches > span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(47, 53, 45, .12); }
.theme-picker-swatches > span + span { margin-left: -4px; }
.theme-picker-swatches--sage > span:nth-child(1) { background: #f5f0e6; }
.theme-picker-swatches--sage > span:nth-child(2) { background: #dce7d2; }
.theme-picker-swatches--sage > span:nth-child(3) { background: #9d5348; }
.theme-picker-swatches--olive > span:nth-child(1) { background: #f1ede3; }
.theme-picker-swatches--olive > span:nth-child(2) { background: #46543c; }
.theme-picker-swatches--olive > span:nth-child(3) { background: #5b3f2c; }
body:has(.modal.show, .page-photo-viewer[open]) .theme-picker { visibility: hidden; }
@media (max-width: 767px) {
  .theme-picker-toggle { padding: 0; width: 44px; }
  .theme-picker-toggle > span {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn.btn-accent,
  .btn.btn-accent:hover,
  .btn.btn-accent:focus,
  .btn.btn-accent:focus-visible,
  .btn.btn-accent:active,
  .theme-picker-toggle { transition: none; }
  .btn.btn-accent::before { display: none; transition: none; }
}
