/* Westerbone Medieval Measures - all rules scoped under .wbtm */

.wbtm {
  --wbtm-bg: #fbf7ef;
  --wbtm-panel: #fffdf8;
  --wbtm-ink: #2b2118;
  --wbtm-muted: #6b5d4f;
  --wbtm-rule: #e3d7c3;
  --wbtm-accent: #8b2e1f;
  --wbtm-accent-ink: #ffffff;
  --wbtm-soft: #f3eadb;
  --wbtm-warn-bg: #fdf3dc;
  --wbtm-warn-ink: #6b4a10;
  --wbtm-high: #2f6b3a;
  --wbtm-med: #6a5a2a;
  --wbtm-low: #9a4a1a;
  --wbtm-field: #c9a96b;
  --wbtm-acre: #8b2e1f;
  --wbtm-serif: "Alegreya", Georgia, "Times New Roman", serif;
  --wbtm-caps: "Alegreya SC", "Alegreya", Georgia, serif;
  container-type: inline-size;
  container-name: wbtm;
  box-sizing: border-box;
  max-width: 920px;
  margin: 0 auto 24px;
  padding: 20px;
  background: var(--wbtm-bg);
  color: var(--wbtm-ink);
  border: 1px solid var(--wbtm-rule);
  border-radius: 10px;
  font-family: var(--wbtm-serif);
  font-size: 17px;
  line-height: 1.5;
  text-align: left;
}
.wbtm.wbtm--themefonts { --wbtm-serif: inherit; --wbtm-caps: inherit; }
.wbtm *, .wbtm *::before, .wbtm *::after { box-sizing: border-box; }

.wbtm.wbtm--dark,
.wbtm.wbtm--auto.wbtm--dark {
  --wbtm-bg: #1c1814; --wbtm-panel: #241f1a; --wbtm-ink: #eee4d3; --wbtm-muted: #b9a993; --wbtm-rule: #3d342b;
  --wbtm-accent: #e38b6e; --wbtm-accent-ink: #1c1814; --wbtm-soft: #2c261f; --wbtm-warn-bg: #3a2f17; --wbtm-warn-ink: #f0d79c;
  --wbtm-high: #8fcf96; --wbtm-med: #d8c48a; --wbtm-low: #f0a77a; --wbtm-field: #b8975a; --wbtm-acre: #e38b6e;
}
@media (prefers-color-scheme: dark) {
  .wbtm.wbtm--auto {
    --wbtm-bg: #1c1814; --wbtm-panel: #241f1a; --wbtm-ink: #eee4d3; --wbtm-muted: #b9a993; --wbtm-rule: #3d342b;
    --wbtm-accent: #e38b6e; --wbtm-accent-ink: #1c1814; --wbtm-soft: #2c261f; --wbtm-warn-bg: #3a2f17; --wbtm-warn-ink: #f0d79c;
    --wbtm-high: #8fcf96; --wbtm-med: #d8c48a; --wbtm-low: #f0a77a; --wbtm-field: #b8975a; --wbtm-acre: #e38b6e;
  }
}

/* ---------- head ---------- */
.wbtm .wbtm-head { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; margin: 0 0 14px; }
.wbtm .wbtm-titles { flex: 1 1 320px; min-width: 0; }
.wbtm .wbtm-kicker { margin: 0; font-family: var(--wbtm-caps); font-size: 14px; letter-spacing: .06em; color: var(--wbtm-accent); }
.wbtm .wbtm-title { margin: 0; padding: 0; font-family: var(--wbtm-serif); font-size: 30px; line-height: 1.15; font-weight: 700; color: var(--wbtm-ink); border: 0; text-transform: none; letter-spacing: 0; }
.wbtm .wbtm-sub { margin: 4px 0 0; font-size: 16px; color: var(--wbtm-muted); }
.wbtm .wbtm-year { display: flex; align-items: center; gap: 8px; margin: 0; font-family: var(--wbtm-caps); font-size: 16px; color: var(--wbtm-muted); }
.wbtm .wbtm-year input { width: 92px; text-align: center; font-weight: 700; }

/* ---------- tabs ---------- */
.wbtm .wbtm-tabs { display: flex; gap: 4px; margin: 0 0 16px; padding: 0; border-bottom: 2px solid var(--wbtm-rule); overflow-x: auto; scrollbar-width: none; }
.wbtm .wbtm-tab {
  appearance: none; flex: 0 0 auto; margin: 0 0 -2px; padding: 8px 16px; min-height: 44px; width: auto;
  background: transparent; color: var(--wbtm-muted); border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  font-family: var(--wbtm-caps); font-size: 17px; font-weight: 500; line-height: 1.2; letter-spacing: .03em; text-transform: none;
  cursor: pointer; box-shadow: none;
}
.wbtm .wbtm-tab:hover { color: var(--wbtm-ink); background: transparent; }
.wbtm .wbtm-tab[aria-selected="true"] { color: var(--wbtm-accent); border-bottom-color: var(--wbtm-accent); font-weight: 700; }
.wbtm .wbtm-tab:focus-visible, .wbtm button:focus-visible, .wbtm input:focus-visible, .wbtm select:focus-visible, .wbtm a:focus-visible { outline: 2px solid var(--wbtm-accent); outline-offset: 2px; }

/* ---------- forms ---------- */
.wbtm .wbtm-label { display: block; margin: 0 0 4px; font-family: var(--wbtm-caps); font-size: 15px; color: var(--wbtm-muted); }
.wbtm .wbtm-ask { margin: 0 0 10px; }
.wbtm .wbtm-row { display: flex; gap: 8px; }
.wbtm .wbtm-row input { flex: 1 1 auto; min-width: 0; }
.wbtm input[type="text"], .wbtm input[type="search"], .wbtm input[type="number"], .wbtm select {
  display: block; width: 100%; max-width: none; height: 46px; min-height: 46px; margin: 0; padding: 8px 12px;
  background: var(--wbtm-panel); color: var(--wbtm-ink); border: 1px solid var(--wbtm-rule); border-radius: 6px;
  font-family: var(--wbtm-serif); font-size: 16px; line-height: 1.3; box-shadow: none; appearance: auto;
}
.wbtm .wbtm-year input[type="number"] { width: 92px; display: inline-block; }
.wbtm .wbtm-go {
  appearance: none; flex: 0 0 auto; width: auto; height: 46px; min-height: 46px; margin: 0; padding: 0 18px;
  background: var(--wbtm-accent); color: var(--wbtm-accent-ink); border: 0; border-radius: 6px;
  font-family: var(--wbtm-caps); font-size: 17px; font-weight: 700; line-height: 1; letter-spacing: .03em; text-transform: none;
  cursor: pointer; box-shadow: none;
}
.wbtm .wbtm-go:hover { filter: brightness(1.08); background: var(--wbtm-accent); color: var(--wbtm-accent-ink); }
.wbtm .wbtm-fieldset { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 0 0 10px; padding: 0; border: 0; }
.wbtm .wbtm-fieldset label { display: block; margin: 0; min-width: 0; }
.wbtm .wbtm-ask > .wbtm-go { width: 100%; }

.wbtm .wbtm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; }
.wbtm .wbtm-chip {
  appearance: none; width: auto; margin: 0; padding: 6px 12px; min-height: 36px;
  background: var(--wbtm-soft); color: var(--wbtm-ink); border: 1px solid var(--wbtm-rule); border-radius: 999px;
  font-family: var(--wbtm-serif); font-size: 15px; line-height: 1.2; text-transform: none; letter-spacing: 0; cursor: pointer; box-shadow: none;
}
.wbtm .wbtm-chip:hover { border-color: var(--wbtm-accent); color: var(--wbtm-accent); background: var(--wbtm-soft); }

/* ---------- results ---------- */
.wbtm .wbtm-answer { margin: 0 0 14px; padding: 14px 16px; background: var(--wbtm-panel); border: 1px solid var(--wbtm-rule); border-left: 4px solid var(--wbtm-accent); border-radius: 6px; }
@keyframes wbtm-flash { from { background: var(--wbtm-soft); box-shadow: 0 0 0 3px var(--wbtm-accent); } to { background: var(--wbtm-panel); box-shadow: 0 0 0 0 transparent; } }
.wbtm .wbtm-answer.wbtm-flash { animation: wbtm-flash .7s ease-out; }
@media (prefers-reduced-motion: reduce) { .wbtm .wbtm-answer.wbtm-flash { animation: none; } }
.wbtm .wbtm-big { margin: 0; font-size: 22px; line-height: 1.35; overflow-wrap: anywhere; }
.wbtm .wbtm-qty { font-weight: 700; color: var(--wbtm-accent); }
.wbtm .wbtm-eq { color: var(--wbtm-muted); font-size: 18px; }
.wbtm .wbtm-range { margin: 6px 0 0; font-size: 15px; color: var(--wbtm-muted); }
.wbtm .wbtm-dot { color: var(--wbtm-muted); padding: 0 2px; }
.wbtm .wbtm-err { margin: 0 0 12px; padding: 10px 14px; background: var(--wbtm-warn-bg); color: var(--wbtm-warn-ink); border-radius: 6px; font-size: 16px; }
.wbtm ul.wbtm-warn { margin: 0 0 14px; padding: 8px 14px; list-style: none; background: var(--wbtm-warn-bg); color: var(--wbtm-warn-ink); border-radius: 6px; font-size: 15px; }
.wbtm ul.wbtm-warn li { margin: 2px 0; padding: 0; list-style: none; }
.wbtm ul.wbtm-warn li::before { content: none; }
.wbtm .wbtm-goto { margin: 0 0 14px; font-size: 16px; }
.wbtm .wbtm-h3 { margin: 18px 0 8px; padding: 0; font-family: var(--wbtm-caps); font-size: 19px; font-weight: 700; line-height: 1.25; color: var(--wbtm-ink); border: 0; text-transform: none; letter-spacing: .02em; }
.wbtm .wbtm-muted { color: var(--wbtm-muted); }
.wbtm .wbtm-small { font-size: 13px; }
.wbtm p { margin: 0 0 8px; }
.wbtm a { color: var(--wbtm-accent); text-decoration: underline; text-underline-offset: 2px; }

.wbtm dl.wbtm-reck { margin: 0 0 14px; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--wbtm-rule); }
.wbtm dl.wbtm-reck > div { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--wbtm-rule); }
.wbtm dl.wbtm-reck dt { float: none; width: auto; margin: 0; padding: 0; font-family: var(--wbtm-caps); font-size: 15px; font-weight: 500; color: var(--wbtm-muted); }
.wbtm dl.wbtm-reck dd { margin: 0; padding: 0; font-size: 16px; overflow-wrap: anywhere; }

.wbtm .wbtm-card { margin: 0 0 14px; padding: 12px 16px; background: var(--wbtm-soft); border-radius: 6px; font-size: 16px; }
.wbtm .wbtm-card-h { font-size: 17px; }
.wbtm .wbtm-meta { font-size: 15px; color: var(--wbtm-muted); }
.wbtm .wbtm-src { margin: 0; font-size: 13px; color: var(--wbtm-muted); font-style: italic; }

.wbtm .wbtm-conf { display: inline-block; margin: 0 0 0 4px; padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; font-family: var(--wbtm-caps); font-size: 12px; font-weight: 500; line-height: 1.4; vertical-align: 2px; white-space: nowrap; }
.wbtm .wbtm-conf--high { color: var(--wbtm-high); }
.wbtm .wbtm-conf--medium { color: var(--wbtm-med); }
.wbtm .wbtm-conf--low { color: var(--wbtm-low); }

.wbtm .wbtm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 20px; align-items: start; }
.wbtm .wbtm-group { margin: 0 0 14px; min-width: 0; }
.wbtm .wbtm-group h4 { margin: 0 0 4px; padding: 0; font-family: var(--wbtm-caps); font-size: 16px; font-weight: 700; color: var(--wbtm-accent); border: 0; text-transform: none; letter-spacing: .02em; }

.wbtm table.wbtm-tbl { width: 100%; margin: 0; border-collapse: collapse; border: 0; background: transparent; font-size: 15px; table-layout: auto; }
.wbtm table.wbtm-tbl th, .wbtm table.wbtm-tbl td { padding: 5px 6px; border: 0; border-bottom: 1px solid var(--wbtm-rule); background: transparent; color: var(--wbtm-ink); text-align: left; vertical-align: top; font-weight: 400; }
.wbtm table.wbtm-tbl td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wbtm table.wbtm-tbl thead th { font-family: var(--wbtm-caps); font-size: 14px; color: var(--wbtm-muted); font-weight: 500; }
.wbtm table.wbtm-tbl--units td { text-align: left; white-space: normal; }
.wbtm table.wbtm-tbl tr.wbtm-off th, .wbtm table.wbtm-tbl tr.wbtm-off td { opacity: .55; }
.wbtm table.wbtm-tbl tr.wbtm-more td { background: var(--wbtm-soft); font-size: 15px; text-align: left; white-space: normal; }
.wbtm .wbtm-unit {
  appearance: none; display: inline; width: auto; height: auto; min-height: 0; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0; box-shadow: none; color: var(--wbtm-accent);
  font-family: var(--wbtm-serif); font-size: 15px; font-weight: 700; line-height: 1.4; text-align: left; text-transform: none; letter-spacing: 0;
  text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer;
}
.wbtm .wbtm-unit:hover { background: none; color: var(--wbtm-ink); }
.wbtm .wbtm-ladder { margin: 0 0 8px; padding: 8px 12px; background: var(--wbtm-soft); border-radius: 6px; font-size: 15px; }
.wbtm .wbtm-sys { margin: 0 0 18px; }

.wbtm .wbtm-fig { margin: 0 0 12px; padding: 10px; background: var(--wbtm-panel); border: 1px solid var(--wbtm-rule); border-radius: 6px; }
.wbtm .wbtm-fig svg { display: block; width: 100%; max-width: 100%; height: auto; }
.wbtm .wbtm-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; font-size: 14px; }
.wbtm .wbtm-key { display: inline-block; width: 14px; height: 14px; margin: 0 6px -2px 0; border-radius: 2px; border: 1.5px solid; }
.wbtm .wbtm-key--f { background: color-mix(in srgb, var(--wbtm-field) 55%, transparent); border-color: var(--wbtm-field); }
.wbtm .wbtm-key--a { background: color-mix(in srgb, var(--wbtm-acre) 25%, transparent); border-color: var(--wbtm-acre); }
.wbtm .wbtm-svg-f { fill: var(--wbtm-field); fill-opacity: .55; stroke: var(--wbtm-field); stroke-width: 1.5; }
.wbtm .wbtm-svg-a { fill: var(--wbtm-acre); fill-opacity: .25; stroke: var(--wbtm-acre); stroke-width: 1.5; }

.wbtm .wbtm-cta { margin: 18px 0 0; padding: 12px 16px; background: var(--wbtm-soft); border-radius: 6px; font-size: 16px; }
.wbtm .wbtm-foot { margin: 16px 0 0; font-size: 13px; color: var(--wbtm-muted); }

/* ---------- narrow layouts, by the tool's own width ---------- */
@container wbtm (max-width: 640px) {
  .wbtm .wbtm-fieldset { grid-template-columns: 1fr 1fr; }
  .wbtm .wbtm-fieldset label:last-child { grid-column: 1 / -1; }
  .wbtm dl.wbtm-reck > div { grid-template-columns: 1fr; gap: 0; }
}
@container wbtm (max-width: 460px) {
  .wbtm .wbtm-title { font-size: 25px; }
  .wbtm .wbtm-big { font-size: 19px; }
  .wbtm .wbtm-row { flex-direction: column; }
  .wbtm .wbtm-go { width: 100%; }
  .wbtm .wbtm-fieldset { grid-template-columns: 1fr; }
  .wbtm .wbtm-tab { padding: 8px 11px; font-size: 16px; }
  .wbtm table.wbtm-tbl--units thead { display: none; }
  .wbtm table.wbtm-tbl--units tr { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--wbtm-rule); }
  .wbtm table.wbtm-tbl--units th, .wbtm table.wbtm-tbl--units td { border: 0; }
  .wbtm table.wbtm-tbl--units th { grid-column: 1 / -1; padding-bottom: 0; }
  .wbtm table.wbtm-tbl--units tr.wbtm-more { display: block; }
  .wbtm table.wbtm-tbl--units tr.wbtm-more td { display: block; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 640px) {
    .wbtm .wbtm-fieldset { grid-template-columns: 1fr; }
    .wbtm dl.wbtm-reck > div { grid-template-columns: 1fr; }
  }
}
@media (max-width: 480px) { .wbtm { padding: 14px; border-radius: 0; border-left: 0; border-right: 0; } }

/* ---------- guard: undo theme styles that commonly break plugins ---------- */
.wbtm ul, .wbtm ol { margin-left: 0; padding-left: 0; }
.wbtm li { background: none; }
.wbtm input[type="radio"], .wbtm input[type="checkbox"] { position: static; opacity: 1; display: inline-block; width: auto; height: auto; }
.wbtm button { text-shadow: none; }
.wbtm table { border-spacing: 0; }
.wbtm table tr:nth-child(odd) td, .wbtm table tr:nth-child(odd) th { background: transparent; }
.wbtm table.wbtm-tbl tr.wbtm-more td { background: var(--wbtm-soft); }
.wbtm svg { max-width: 100%; height: auto; width: 100%; }
.wbtm dt { clear: none; }
.wbtm h2::before, .wbtm h2::after, .wbtm h3::before, .wbtm h3::after, .wbtm h4::before, .wbtm h4::after { content: none; display: none; }
.wbtm [hidden] { display: none !important; }
