/* Interactive article cards. Flat fills, ink strokes, paper grain.
   The static .widget-fallback stays readable when JavaScript is off. */

.beer-widget {
  margin: 28px 0 34px;
  max-width: 100%;
  min-width: 0;
}
.widget-card,
.widget-fallback {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  padding: 18px 22px 16px;
  background: #f0efe2 url('../assets/paper-grain.svg');
  background-size: 200px 200px;
  border: 1px solid #dfdfcc;
  border-radius: 5px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.widget-fallback[hidden] { display: none; }
.widget-eyebrow {
  margin: 0 0 8px;
  font-size: var(--type-caption);
  letter-spacing: 1.6px;
  color: var(--olive);
}
.widget-instruction {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.7;
}
.widget-fallback > p { margin: 0 0 12px; font-size: var(--type-small); line-height: 1.7; color: var(--text); }
.widget-volumes {
  border: 0;
  margin: 0 0 10px;
  padding: 0;
  min-width: 0;
}
.widget-volumes legend {
  padding: 0;
  margin: 0 0 8px;
  font-size: var(--type-caption);
  letter-spacing: 1px;
  color: var(--olive);
}
.widget-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.widget-choice label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 14px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.2;
}
.widget-choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.widget-choice label:has(input:checked) {
  border-color: var(--ink);
  background: var(--pale);
  font-weight: 650;
  box-shadow: inset 0 -3px 0 var(--gold);
}
.widget-choice label:focus-within {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.widget-custom {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--ink);
  font-size: var(--type-small);
}
.widget-custom[hidden] { display: none; }
.widget-custom input {
  width: 6.5rem;
  max-width: 100%;
  min-height: 44px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.widget-slider {
  display: block;
  min-width: 0;
}
.widget-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: var(--type-small);
}
.widget-slider-value {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.widget-slider input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  max-width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}
.widget-slider input[type="range"]:focus { outline: none; }
.widget-slider input[type="range"]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.widget-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: var(--pale);
  border: 2px solid var(--ink);
  border-radius: 99px;
}
.widget-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -12px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
}
.widget-slider input[type="range"]::-moz-range-track {
  height: 8px;
  background: var(--pale);
  border: 2px solid var(--ink);
  border-radius: 99px;
}
.widget-slider input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--gold);
}
.widget-srm-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #f3f993, #c1963c 40%, #5d341a 70%, #120d0c) !important;
}
.widget-srm-range::-moz-range-track {
  background: linear-gradient(90deg, #f3f993, #c1963c 40%, #5d341a 70%, #120d0c) !important;
}
.widget-color-layout {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 12px 16px;
  align-items: center;
}
.widget-glass {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}
.widget-glass .glass-shadow { fill: var(--line); }
.widget-glass .glass-wall {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.widget-glass .liquid { fill: var(--beer, #be823a); }
.widget-glass .foam {
  fill: #f6f1e2;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
}
.widget-glass .glass-highlight {
  fill: none;
  stroke: #f7f1dc;
  stroke-width: 2;
  stroke-linecap: round;
  opacity: .8;
}
.widget-glass .bubble {
  fill: none;
  stroke: #f7f1dc;
  stroke-width: 1.5;
}
.widget-readout {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.widget-principle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: var(--type-caption);
  line-height: 1.7;
}
.widget-principle-label {
  display: inline-block;
  margin-right: 6px;
  color: var(--olive);
  font-weight: 650;
}
.widget-swatches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 8px;
}
.widget-swatches > div { min-width: 0; text-align: center; }
.widget-swatches svg,
.widget-swatches img { width: 72%; max-width: 120px; height: auto; margin: 0 auto; display: block; }
.widget-swatches p {
  margin: 4px 0 0;
  font-size: var(--type-caption);
  line-height: 1.5;
  color: var(--ink);
}
.beer-widget .table-wrap { margin: 8px 0 0; }
html[data-color-scheme="dark"] .widget-card,
html[data-color-scheme="dark"] .widget-fallback {
  background-color: var(--night-panel);
  border-color: var(--line);
}
html[data-color-scheme="dark"] .widget-choice label,
html[data-color-scheme="dark"] .widget-custom input,
html[data-color-scheme="dark"] .widget-readout,
html[data-color-scheme="dark"] .widget-press,
html[data-color-scheme="dark"] .widget-matrix-cell,
html[data-color-scheme="dark"] .widget-label-sheet,
html[data-color-scheme="dark"] .widget-entity,
html[data-color-scheme="dark"] .widget-stage,
html[data-color-scheme="dark"] .widget-angle,
html[data-color-scheme="dark"] .widget-crop div {
  background: var(--night-raised);
}
html[data-color-scheme="dark"] .beer-widget {
  --amber-ink: #ffe6c2;
  --amber-pill: #4a3214;
  --amber-flash: #6b4a22;
}
html[data-color-scheme="dark"] .widget-press[aria-pressed="true"],
html[data-color-scheme="dark"] .widget-press[aria-current="step"],
html[data-color-scheme="dark"] .widget-angle[data-on="true"],
html[data-color-scheme="dark"] .widget-stage[data-on="true"],
html[data-color-scheme="dark"] .widget-choice label:has(input:checked) {
  background: var(--pale);
}

@media (max-width: 700px) {
  .beer-widget { margin: 24px 0 28px; }
  .widget-card,
  .widget-fallback { padding: 14px 14px 12px; }
  .widget-color-layout { grid-template-columns: 84px minmax(0, 1fr); gap: 10px; }
}
@media (max-width: 360px) {
  .widget-color-layout { grid-template-columns: 72px minmax(0, 1fr); }
  .widget-choice label { padding-inline: 10px; }
}
.beer-widget {
  --amber: var(--gold);
  --amber-ink: #6a3d0a;
  --amber-pill: #f6e4c4;
  --amber-flash: #efcf8a;
}
.w-live {
  font-weight: 700;
  color: var(--amber-ink);
  background: var(--amber-pill);
  text-decoration-line: underline;
  text-decoration-color: var(--amber-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
  border-radius: 2px;
  padding: 0 0.2em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.w-live-flash { animation: w-live-flash 0.7s ease; }
@keyframes w-live-flash {
  from { background: var(--amber-flash); }
  to { background: var(--amber-pill); }
}
.widget-press {
  appearance: none;
  font: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 4px;
  min-height: 44px;
  min-width: 44px;
  max-width: 100%;
  padding: 8px 12px;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
}
.widget-press[aria-pressed="true"],
.widget-press[aria-current="step"] {
  border-color: var(--ink);
  background: var(--pale);
  font-weight: 650;
  box-shadow: inset 0 -3px 0 var(--gold);
}
.widget-press:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.widget-press:disabled { opacity: 0.45; }
.widget-nav,
.widget-dot,
.widget-angles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
  min-width: 0;
}
.widget-step-layout {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.widget-step-art { width: 100%; height: auto; color: var(--ink); }
.widget-step-copy {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.6;
}
.widget-meter { display: grid; gap: 8px; margin: 0 0 12px; }
.widget-meter-row {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.widget-meter-name,
.widget-meter-word {
  color: var(--ink);
  font-size: var(--type-caption);
  line-height: 1.4;
}
.widget-meter-track {
  height: 16px;
  border: 2px solid var(--ink);
  background: var(--paper);
  min-width: 0;
}
.widget-meter-fill { display: block; height: 100%; max-width: 100%; }
.widget-meter-fill[data-level="0"] { width: 12%; }
.widget-meter-fill[data-level="1"] { width: 56%; }
.widget-meter-fill[data-level="2"] { width: 100%; }
.widget-meter-fill[data-level="omit"] { width: 0; }
.widget-meter-fill[data-kind="starch"] {
  background: repeating-linear-gradient(135deg, var(--olive), var(--olive) 4px, transparent 4px, transparent 8px);
}
.widget-meter-fill[data-kind="sugar"] {
  background: repeating-linear-gradient(90deg, var(--gold), var(--gold) 6px, transparent 6px, transparent 9px);
}
.widget-meter-fill[data-kind="alcohol"] {
  background: repeating-linear-gradient(90deg, var(--ink), var(--ink) 2px, transparent 2px, transparent 5px);
}
.widget-prompt,
.widget-fiction,
.widget-note,
.widget-relation,
.widget-label-brand,
.widget-label-beer,
.widget-split-key,
.widget-trend-ends {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.6;
}
.widget-fiction { color: var(--olive); font-size: var(--type-caption); }
.widget-angle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
  font-size: var(--type-small);
}
.widget-angle[data-on="true"] {
  border-color: var(--ink);
  background: var(--pale);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--gold);
}
.widget-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.widget-matrix-cell {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}
.widget-card h3 {
  margin: 0 0 8px;
  font-size: var(--type-caption);
  font-weight: 650;
  letter-spacing: 0;
  color: var(--olive);
}
.widget-crop {
  display: grid;
  gap: 6px;
  max-width: 28rem;
  margin: 0 0 12px;
}
.widget-crop div {
  border: 2px solid var(--ink);
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  font-size: var(--type-caption);
  line-height: 1.5;
}
.widget-crop-foam { background: var(--pale); }
.widget-crop-body { min-height: 64px; }
.widget-fields { display: grid; gap: 8px; }
.widget-status { display: grid; gap: 8px; margin: 0 0 12px; }
.widget-status-row {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}
.widget-status-name {
  color: var(--ink);
  font-size: var(--type-caption);
}
.widget-status-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  font-size: var(--type-caption);
  line-height: 1.45;
  text-align: center;
}
.widget-status-mark[data-status="unknown"],
.widget-status-mark[data-status="missing"] { border-style: dashed; }
.widget-status-mark[data-status="miss"] { box-shadow: inset 0 -4px 0 var(--ink); }
.widget-status-mark[data-status="match"],
.widget-status-mark[data-status="applies"] { box-shadow: inset 4px 0 0 var(--ink); }
.widget-status-mark[data-status="undefined"],
.widget-status-mark[data-status="gap"] { border-style: double; border-width: 4px; }
.widget-check-source {
  margin: 0 0 8px;
  color: var(--olive);
  font-size: var(--type-caption);
  line-height: 1.6;
}
.widget-checks { display: grid; gap: 8px; margin: 0 0 12px; }
.widget-check {
  display: grid;
  grid-template-columns: 4.5em minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}
.widget-check-name {
  padding-top: 12px;
  color: var(--ink);
  font-size: var(--type-caption);
}
.widget-check-body { min-width: 0; }
.widget-check-mark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 0 4px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  line-height: 1.4;
}
.widget-check-mark[data-mark="must"] { box-shadow: inset 4px 0 0 var(--ink); }
.widget-check-mark[data-mark="forbid"] { box-shadow: inset 0 -4px 0 var(--ink); }
.widget-check-mark[data-mark="open"] { border-style: dashed; }
.widget-check-mark[data-mark="allow"] { border-style: double; border-width: 4px; }
.widget-check-line {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-small);
  line-height: 1.6;
}
.widget-stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
}
.widget-stage {
  min-width: 0;
  min-height: 44px;
  border: 2px dashed var(--line);
  border-radius: 4px;
  padding: 8px;
  color: var(--ink);
  font-size: var(--type-caption);
  line-height: 1.4;
}
.widget-stage[data-on="true"] {
  border-style: solid;
  border-color: var(--ink);
  background: var(--pale);
  font-weight: 700;
}
.widget-entities {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.widget-entity {
  min-width: 0;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
}
.widget-entity-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--olive);
  font-size: var(--type-caption);
}
.widget-label-sheet {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
}
.widget-label-sheet .widget-press { width: 100%; text-align: left; }
.widget-label-brand { font-weight: 650; }
.widget-split {
  display: flex;
  min-height: 28px;
  border: 2px solid var(--ink);
  margin: 4px 0 6px;
  min-width: 0;
}
.widget-split-used,
.widget-split-left { display: block; min-width: 0; }
.widget-split-used {
  background: repeating-linear-gradient(90deg, var(--ink), var(--ink) 3px, transparent 3px, transparent 6px);
}
.widget-split-left {
  background: repeating-linear-gradient(135deg, var(--gold), var(--gold) 4px, transparent 4px, transparent 8px);
}
.widget-split-key { display: flex; flex-wrap: wrap; gap: 12px; }
.widget-key-used::before,
.widget-key-left::before {
  content: "";
  display: inline-block;
  width: 1.1em;
  height: 0.8em;
  margin-right: 4px;
  border: 2px solid var(--ink);
  vertical-align: -1px;
}
.widget-key-used::before {
  background: repeating-linear-gradient(90deg, var(--ink), var(--ink) 2px, transparent 2px, transparent 4px);
}
.widget-key-left::before {
  background: repeating-linear-gradient(135deg, var(--gold), var(--gold) 3px, transparent 3px, transparent 6px);
}
.widget-trend {
  position: relative;
  height: 28px;
  margin: 8px 10px 0;
  border-bottom: 2px solid var(--ink);
}
.widget-trend-mark {
  position: absolute;
  top: 4px;
  width: 14px;
  height: 14px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 3px var(--ink);
  transform: translateX(-50%);
}
.widget-trend-ends { display: flex; justify-content: space-between; }

@media (max-width: 700px) {
  .widget-stages { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget-meter-row { grid-template-columns: 5.2em minmax(0, 1fr) auto; }
}
@media (min-width: 900px) {
  .widget-entities { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .beer-widget,
  .beer-widget * {
    transition: none !important;
    animation: none !important;
  }
  .w-live-flash { animation: none !important; }
}
