/* Terroir Map — design tokens and components, ported from the Claude Design file (Modernist system).
   Layout: top bar, then map (fills) | data panel (440px); stacks below 960px. Change the look via the tokens. */
@font-face {
  font-family: "Head"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("https://www.baristahustle.com/wp-content/themes/divi-child/assets/fonts/head/Head-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "NoBH"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("https://www.baristahustle.com/wp-content/themes/divi-child/assets/fonts/nobh/NoBH-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "NoBH"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("https://www.baristahustle.com/wp-content/themes/divi-child/assets/fonts/nobh/NoBH-Bold.woff2") format("woff2");
}

:root {
  --color-bg: #f3f2f2;
  --color-surface: #eae9e9;
  --color-text: #201e1d;
  --color-accent: #c4274d;
  --color-divider: color-mix(in srgb, #201e1d 40%, transparent);
  --color-field: #f9f9f9;       /* inputs, tiles, cards */
  --color-band: #e9e9e9;        /* alternating panel sections */
  --color-map-bg: #1d1c1b;

  --color-neutral-200: #eae7e7;
  --color-neutral-300: #d7d3d3;
  --color-neutral-700: #605d5d;
  --color-neutral-800: #444141;

  --color-accent-100: #fdf0f3;
  --color-accent-700: #921838;
  --color-accent-800: #69132b;

  /* Barista Hustle fonts (see @font-face below): Head for headings and large text,
     NoBH for everything else. Any weight of 600+ on NoBH uses NoBH-Bold (sub-headings, emphasis). */
  --font-body: "NoBH", system-ui, sans-serif;
  --font-heading: "Head", "NoBH", system-ui, sans-serif;
  --font-heading-weight: 700;

  --radius: 6px;
  --shadow-md: 0 3px 10px color-mix(in srgb, #2d2b2b 16%, transparent);

  --panel-w: 440px;
  --topbar-h: 54px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--color-bg); color: var(--color-text);
  font: 400 14px/1.5 var(--font-body);
}
h1, h2, h3 { margin: 0; }
h1, h2 { font-family: var(--font-heading); font-weight: var(--font-heading-weight); }
p { margin: 0; }
a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
[hidden] { display: none !important; }

/* — shell — */
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar {
  flex: none; height: var(--topbar-h); padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  position: relative; z-index: 2; box-shadow: var(--shadow-md);
}
.topbar h1 { display: flex; align-items: center; }
.topbar h1 img { display: block; height: 30px; width: auto; }
.brand-badge { display: block; flex: none; border-radius: 50%; }
.brand-badge:hover { opacity: .8; }
.brand-badge img { display: block; width: 48px; height: 48px; mix-blend-mode: multiply; }

.layout { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* — map — */
.map-pane { position: relative; flex: none; height: min(62vh, 560px); min-height: 300px; min-width: 0; background: var(--color-map-bg); }
.map { position: absolute; inset: 0; }

/* Top-left stack: help box, then the loading indicator just below it. */
.map-topleft {
  position: absolute; left: 10px; top: 10px; z-index: 2; max-width: min(360px, calc(100% - 70px));
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.hint {
  display: flex; align-items: flex-start; gap: 8px;
  border-radius: 14px;
}
.hint.open { padding: 8px; background: rgba(243, 242, 242, .82); backdrop-filter: blur(6px); }
.hint:not(.open) .hint-text { display: none; }
.hint-btn {
  flex: none; width: 24px; height: 24px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: #fff; color: var(--color-text);
  font: 800 14px/1 var(--font-body); cursor: pointer; box-shadow: 0 0 0 2px rgba(0, 0, 0, .1);
}
.hint-btn:hover { background: var(--color-neutral-200); }
.hint-text { padding: 2px 6px 2px 0; font-size: 13px; line-height: 1.45; text-wrap: pretty; }

/* Bottom-left stack: origin card, soil panel, legend (bottom-anchored so they never overlap). */
.map-stack {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; max-width: calc(100% - 24px);
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none;
}
.map-stack > * { pointer-events: auto; }
.region-card {
  padding: 8px 12px; pointer-events: none !important;
  background: var(--color-bg); border: 2px solid var(--color-text);
}
.region-card-name { font-weight: 800; font-size: 15px; line-height: 1.2; }
.region-card-country { font-size: 12px; color: var(--color-neutral-700); }

.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
  padding: 6px 10px; background: var(--color-bg); font-size: 12px; border-radius: var(--radius);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-belt { width: 16px; height: 0; border-top: 2px dashed var(--color-accent); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--color-text); }
.legend-pt { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px rgba(32, 30, 29, .35); }
.legend-pt.farm { background: #3b9e5d; }
.legend-pt.mill { background: #e0a526; }
.legend-pt.auction { background: #4f7be8; }

.map-loading {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px;
  background: rgba(243, 242, 242, .82); backdrop-filter: blur(6px); border-radius: 14px;
  font-size: 12px; font-weight: 700; color: var(--color-text);
}
.spinner {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid var(--color-neutral-300); border-top-color: var(--color-accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* selected region's name, pinned above its dot */
.region-label {
  display: grid; justify-items: center; padding: 5px 10px 6px; pointer-events: none;
  background: rgba(32, 30, 29, .82); color: #f9f9f9; border-radius: var(--radius);
  box-shadow: var(--shadow-md); white-space: nowrap; line-height: 1.15;
}
.region-label-name { font-weight: 700; font-size: 14px; }
.region-label-country { font-size: 11px; opacity: .8; }

/* "Try the Soil Types Overlay" speech bubble, pointing down at the switch */
.soil-nudge {
  position: absolute; z-index: 4; width: min(270px, calc(100% - 24px));
  background: rgba(244, 244, 244, .85); /* #f4f4f4 at 85% */ backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(32, 30, 29, .28);
  animation: nudge-in .35s ease-out;
}
.soil-nudge-body {
  display: grid; gap: 3px; width: 100%; padding: 10px 30px 11px 12px; border: 0; background: none;
  font: inherit; font-size: 13px; line-height: 1.4; color: var(--color-text); text-align: left; cursor: pointer;
}
.soil-nudge-body strong { font-weight: 700; font-size: 14px; }
.soil-nudge-close {
  position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(32, 30, 29, .08); color: var(--color-text); cursor: pointer;
}
.soil-nudge-close:hover { background: rgba(32, 30, 29, .16); }
.soil-nudge-arrow {
  position: absolute; top: 100%; width: 0; height: 0; transform: translateX(-50%);
  border: 9px solid transparent; border-top-color: rgba(244, 244, 244, .85); border-bottom: 0;
}
@keyframes nudge-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* soil type overlay */
.soil-toggle {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; border: 0; background: none;
  font: inherit; font-size: 12px; font-weight: 700; color: var(--color-text); cursor: pointer;
}
.soil-switch {
  position: relative; width: 26px; height: 15px; flex: none; border-radius: 99px;
  background: var(--color-neutral-300); transition: background .15s;
}
.soil-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: transform .15s;
}
.soil-toggle[aria-checked="true"] .soil-switch { background: var(--color-accent); }
.soil-toggle[aria-checked="true"] .soil-switch::after { transform: translateX(11px); }

.soil-panel {
  width: min(260px, 100%); display: grid; gap: 8px; padding: 10px 12px;
  background: var(--color-bg); border-radius: var(--radius); box-shadow: var(--shadow-md); font-size: 12px;
}
.soil-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.soil-panel-title { font-weight: 700; font-size: 13px; }
.soil-opacity { display: inline-flex; align-items: center; gap: 6px; color: var(--color-neutral-700); }
.soil-opacity input { width: 90px; accent-color: var(--color-accent); }
.soil-legend { max-height: min(260px, 32vh); overflow-y: auto; background: #fff; border-radius: 4px; }
.soil-legend img { display: block; max-width: 100%; height: auto; }
.soil-legend-list { display: grid; padding: 4px; }
.soil-legend-theme { padding: 6px 6px 2px; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700); }
.soil-legend-item {
  display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 3px 6px; border: 0; border-radius: 4px;
  background: none; font: inherit; font-size: 12px; color: var(--color-text); text-align: left; cursor: pointer;
}
.soil-legend-item:hover { background: var(--color-surface); }
.soil-swatch { width: 16px; height: 12px; flex: none; border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.soil-legend-aka { color: var(--color-neutral-700); }
.soil-layer-msg { color: var(--color-accent-700); }
.soil-panel-note { color: var(--color-neutral-700); font-size: 11px; line-height: 1.4; }

/* — panel — */
.panel { flex: none; width: 100%; display: flex; flex-direction: column; background: var(--color-bg); }
.section { padding: 16px; display: grid; gap: 12px; }
.section.band { background: var(--color-band); }

.label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-neutral-700);
}
.field { display: grid; gap: 6px; min-width: 0; }
.control {
  width: 100%; min-height: 44px; padding: 6px 10px;
  font: inherit; font-size: 15px; color: var(--color-text);
  background: var(--color-field); border: 0; border-radius: var(--radius);
}
select.control { padding-inline: 8px; }
.control-strong { font-weight: 600; padding-inline: 10px; }
.num { font-variant-numeric: tabular-nums; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* region picker: countries expand to show their regions */
.region-picker { position: relative; }
.region-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.region-btn-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { flex: none; transition: transform .15s; }
.region-btn[aria-expanded="true"] .chev, .country-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.region-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  display: grid; gap: 8px; padding: 8px; background: var(--color-bg);
  border-radius: var(--radius); box-shadow: var(--shadow-lg, 0 12px 32px rgba(45,43,43,.22));
}
.region-search { min-height: 40px; font-size: 14px; background: #fff; }
.region-list { max-height: min(60vh, 460px); overflow-y: auto; display: grid; align-content: start; }
.country-btn, .region-item {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; cursor: pointer;
  font: inherit; color: var(--color-text); text-align: left; border-radius: 4px;
}
.country-btn { min-height: 40px; padding: 6px 8px; font-weight: 700; font-size: 14px; }
.country-btn:hover, .region-item:hover { background: var(--color-surface); }
.country-count { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--color-neutral-700); }
.country-regions { display: grid; padding: 0 0 6px 10px; }
.region-item { min-height: 36px; padding: 5px 8px; flex-wrap: wrap; row-gap: 0; font-size: 13px; }
.region-item[aria-current="true"] { background: var(--color-accent); color: #fff; }
.region-item[aria-current="true"] .region-meta { color: rgba(255,255,255,.85); }
.region-item-name { font-weight: 700; }
.region-meta { width: 100%; font-size: 11px; color: var(--color-neutral-700); }
.region-empty { padding: 10px 8px; font-size: 13px; color: var(--color-neutral-700); }

/* readouts: altitude, −ΔT, UV, irradiance */
.readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.readout { background: var(--color-field); padding: 10px 10px 10px 12px; display: grid; gap: 2px; min-width: 0; border-radius: var(--radius); }
.readout-v {
  font-family: var(--font-heading); font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.readout-u { font-size: 11px; color: var(--color-neutral-700); white-space: nowrap; }
.readout .label { white-space: nowrap; }

/* weather variable picker */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.metric-btn {
  min-height: 44px; padding: 6px 10px; font: inherit; font-size: 13px; font-weight: 600; text-align: left;
  cursor: pointer; border: 0; border-radius: var(--radius);
  background: var(--color-field); color: var(--color-text);
}
.metric-btn:hover { box-shadow: inset 0 0 0 2px var(--color-accent); }
.metric-btn[aria-checked="true"] { background: var(--color-accent); color: #fff; }

/* chart */
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.chart-head h2 { font-size: 20px; letter-spacing: -.015em; }
.unit { font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--color-neutral-700); }
.status { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--color-neutral-700); }
.status.error { color: var(--color-accent-700); }
.chart { min-height: 180px; display: grid; align-items: center; }
.chart-box { position: relative; width: 100%; max-width: 720px; aspect-ratio: 2 / 1; }
.chart-box svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.chart-tick, .chart-month {
  position: absolute; font-size: 11px; line-height: 1; pointer-events: none; font-variant-numeric: tabular-nums;
  color: var(--color-neutral-700);
}
.chart-tick { left: 0; width: 8.5%; transform: translateY(-50%); text-align: right; }
.chart-month { bottom: 0; transform: translateX(-50%); font-weight: 600; }
.chart-month.active { color: var(--color-accent-700); }
.chart .grid { stroke: var(--color-neutral-300); stroke-width: 1; }
.chart .base { stroke: var(--color-text); stroke-width: 2; }
.chart .bar { fill: var(--color-accent); }
.chart .bar.active { fill: var(--color-text); }
.chart .whisker { stroke: var(--color-text); stroke-width: 1.5; }
.chart .hit { fill: transparent; cursor: crosshair; }

.link-btn {
  display: inline-flex; align-items: center; min-height: 36px; padding: 6px 4px;
  font: inherit; font-size: 13px; font-weight: 800; color: var(--color-accent-700);
  background: transparent; border: 0; cursor: pointer;
}
.link-btn:hover { background: var(--color-accent-100); }

.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.table-scroll th {
  padding: 6px 8px; text-align: right; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--color-neutral-700); border-bottom: 2px solid var(--color-divider); white-space: nowrap;
}
.table-scroll td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--color-divider); white-space: nowrap; }
.table-scroll th:first-child, .table-scroll td:first-child { text-align: left; }
.table-scroll td:first-child { font-weight: 600; }
.table-scroll td:nth-child(2) { font-weight: 800; }

/* weather summary */
.summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--color-field); padding: 10px 12px; display: grid; gap: 2px; min-width: 0; border-radius: var(--radius); }
.stat-k { font-size: 12px; color: var(--color-neutral-700); }
.stat-v { font-size: 18px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.fits { display: flex; flex-wrap: wrap; gap: 6px; }
.fit { display: inline-flex; align-items: center; padding: 4px 10px; font-size: 12px; font-weight: 600; background: var(--color-accent-100); color: var(--color-accent-800); }
.fit.optimum { background: var(--color-accent); color: #fff; }
.fit.outside { background: var(--color-neutral-200); color: var(--color-neutral-800); }

/* Köppen */
.koppen { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 16px; align-items: baseline; }
.koppen-code { font-family: var(--font-heading); font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--color-accent); }
.koppen-text { display: grid; gap: 2px; }
.koppen-name { font-size: 15px; font-weight: 800; line-height: 1.25; }
.koppen-veg { font-size: 13px; color: var(--color-neutral-800); text-wrap: pretty; }
.note { font-size: 12px; color: var(--color-neutral-700); }
#soilMsg, #soilTypeMsg { font-size: 13px; }

/* soil */
.soil-props { display: grid; background: var(--color-field); padding: 4px 12px; border-radius: var(--radius); }
.soil-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; }
.soil-row strong { font-weight: 800; font-variant-numeric: tabular-nums; }
.soil-types { display: grid; gap: 8px; }
.prob { display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 40%) 40px; gap: 10px; align-items: center; font-size: 13px; }
.prob-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prob-track { display: block; height: 8px; background: var(--color-neutral-300); }
.prob-fill { display: block; height: 100%; background: var(--color-neutral-700); }
.prob:first-child .prob-fill { background: var(--color-accent); }
.prob-pct { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }

.credits { font-size: 11px; color: var(--color-neutral-700); padding-top: 8px; }

/* — glossary tooltips (text in glossary.js; shown after hovering a term for 1.5 s) — */
[data-tip]:not(button) { cursor: help; }
.term {
  text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent);
  text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.tip {
  position: fixed; z-index: 20; max-width: min(340px, calc(100vw - 16px));
  display: grid; gap: 2px;
  padding: 12px 14px; border-radius: var(--radius); pointer-events: none;
  background: var(--color-text); color: var(--color-bg); box-shadow: var(--shadow-md);
  font: 400 13px/1.45 var(--font-body); text-transform: none; letter-spacing: 0; text-wrap: pretty;
}
.tip-title { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.tip-h {
  margin-top: 4px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: color-mix(in srgb, var(--color-bg) 65%, transparent);
}
.tip-p { margin: 0; }

/* — wide: fixed-height app, map fills, panel scrolls — */
@media (min-width: 960px) {
  .app { height: 100dvh; }
  .layout { flex-direction: row; }
  .map-pane { flex: 1 1 auto; height: auto; }
  .panel { width: var(--panel-w); overflow-y: auto; }
}
/* Four readouts don't fit on a phone without truncating (e.g. "1,8…"), so use two rows there. */
@media (max-width: 480px) {
  .readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* — soil type details popup — */
.soil-link {
  padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer;
  text-decoration: underline dotted color-mix(in srgb, currentColor 45%, transparent); text-underline-offset: 3px;
}
.soil-link:hover { color: var(--color-accent-700); }
.soil-dialog {
  position: fixed; width: min(680px, calc(100vw - 24px)); max-height: min(88dvh, 920px); padding: 0; border: 0;
  border-radius: 12px; overflow: hidden; color: var(--color-text);
  background: rgba(244, 244, 244, .85); /* #f4f4f4 at 85% */ backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 48px rgba(32, 30, 29, .35);
}
.soil-dialog::backdrop { background: rgba(32, 30, 29, .45); backdrop-filter: blur(2px); }
.soil-dialog[open] { display: flex; flex-direction: column; }
.soil-dlg-scroll { overflow-y: auto; padding: 22px 22px 18px; display: grid; gap: 16px; overscroll-behavior: contain; }
.soil-dlg-close {
  position: absolute; top: 12px; right: 12px; z-index: 1; width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(32, 30, 29, .08); color: var(--color-text); cursor: pointer;
}
.soil-dlg-close:hover { background: rgba(32, 30, 29, .16); }
.soil-dialog section { display: grid; gap: 6px; }
.soil-dialog p { margin: 0; font-size: 14px; line-height: 1.5; }
.sd-head { display: flex; align-items: center; gap: 14px; padding-right: 40px; }
.sd-swatch { width: 52px; height: 52px; flex: none; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.sd-theme { font-size: 11px !important; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--color-accent-700); }
.sd-head h2 { font-family: var(--font-heading); font-size: 28px; line-height: 1.1; }
.sd-formerly { font-size: 12px !important; color: var(--color-neutral-700); }
.sd-what { font-size: 15px !important; }
.sd-coffee { padding: 12px 14px; border-radius: 8px; background: #fff; border-left: 4px solid var(--color-neutral-300); }
.sd-coffee.good { border-left-color: #3b9e5d; }
.sd-coffee.some { border-left-color: #e0a526; }
.sd-coffee.rare { border-left-color: #c97a3c; }
.sd-coffee.no { border-left-color: var(--color-neutral-700); }
.sd-badge { justify-self: start; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--color-surface); }
.sd-coffee.good .sd-badge { background: #3b9e5d; color: #fff; }
.sd-coffee.some .sd-badge { background: #e0a526; color: var(--color-text); }
.sd-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sd-fact { display: grid; gap: 2px; padding: 8px 10px; background: #fff; border-radius: 6px; font-size: 13px; line-height: 1.3; }
.sd-question { font-style: italic; }
.sd-more summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--color-accent-700); }
.sd-more p { margin-top: 6px !important; font-size: 13px !important; }
.sd-origin { color: var(--color-neutral-700); }

/* soil profile: proportional bar of horizons + list */
.sp { display: grid; grid-template-columns: 26px 56px minmax(0, 1fr); gap: 4px 12px; align-items: start; }
.sp-scale { position: relative; height: 220px; font-size: 10px; color: var(--color-neutral-700); }
.sp-scale span { position: absolute; right: 0; transform: translateY(-50%); }
.sp-scale span:first-child { transform: none; }
.sp-scale span:last-child { transform: translateY(-100%); }
.sp-bar { height: 220px; display: flex; flex-direction: column; border-radius: 4px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.sp-layer { display: grid; place-items: center; min-height: 2px; font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, .9); text-shadow: 0 0 2px rgba(0, 0, 0, .6); overflow: hidden; }
.sp-layer.abrupt { border-bottom: 2px solid rgba(255, 255, 255, .75); }
.sp-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.sp-list li { display: grid; grid-template-columns: 12px auto 1fr; gap: 0 8px; align-items: baseline; font-size: 13px; line-height: 1.35; }
.sp-chip { width: 12px; height: 12px; border-radius: 2px; align-self: center; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.sp-code { font-weight: 700; }
.sp-depth { justify-self: end; font-size: 11px; color: var(--color-neutral-700); font-variant-numeric: tabular-nums; }
.sp-desc { grid-column: 2 / -1; color: var(--color-neutral-800); }

/* phones: near full-width, with a 12px gap all round */
@media (max-width: 560px) {
  .soil-dialog {
    width: calc(100vw - 24px); max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    margin: auto auto calc(12px + env(safe-area-inset-bottom)); border-radius: 14px;
  }
  .soil-dlg-scroll { padding: 18px 16px 16px; }
  .sd-head h2 { font-size: 24px; }
  .sd-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp { grid-template-columns: 22px 44px minmax(0, 1fr); gap: 4px 10px; }
}
