/* Welly components (DESIGN.md §4), reimplemented for server-rendered Twig.
   Class prefix wl-; variants are data-* attributes. Tokens only. */

/* the hidden attribute always wins over a component's display value */
[hidden] { display: none !important; }

/* Icon: Lucide outline via the sprite in partials/icons.html.twig */
.wl-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.wl-icon { flex: none; display: inline-block; vertical-align: middle; width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.wl-icon[data-size="16"] { width: 16px; height: 16px; }
.wl-icon[data-size="18"] { width: 18px; height: 18px; }
.wl-icon[data-size="24"] { width: 24px; height: 24px; }

/* Button */
.wl-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  height: var(--control-h-md); padding: 0 var(--space-5); border: 1px solid transparent;
  border-radius: var(--radius-control); font: var(--type-label); cursor: pointer; white-space: nowrap;
  text-decoration: none; user-select: none;
  transition: var(--transition-color), transform var(--dur-fast) var(--ease-standard); }
.wl-btn:hover { text-decoration: none; }
.wl-btn:active { transform: scale(var(--press-scale)); }
.wl-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.wl-btn[disabled] { opacity: .4; cursor: not-allowed; transform: none; }
.wl-btn[data-size="sm"] { height: var(--control-h-sm); padding: 0 var(--space-3); }
.wl-btn[data-size="lg"] { height: var(--control-h-lg); padding: 0 var(--space-6); font-size: var(--text-md); }
.wl-btn[data-full="true"] { width: 100%; }
.wl-btn[data-variant="primary"] { background: var(--accent); color: var(--text-on-accent); }
.wl-btn[data-variant="primary"]:hover:not([disabled]) { background: var(--accent-hover); color: var(--text-on-accent); }
.wl-btn[data-variant="primary"]:active { background: var(--accent-active); }
.wl-btn[data-variant="secondary"] { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.wl-btn[data-variant="ghost"] { background: transparent; color: var(--text-primary); }
.wl-btn[data-variant="secondary"]:hover:not([disabled]),
.wl-btn[data-variant="ghost"]:hover:not([disabled]) { background: var(--surface-sunken); color: var(--text-primary); }

/* IconButton: square, accessible name required */
.wl-ibtn { display: inline-grid; place-items: center; width: var(--control-h-md); height: var(--control-h-md);
  padding: 0; border: 1px solid transparent; border-radius: var(--radius-control); background: transparent;
  color: var(--text-primary); cursor: pointer;
  transition: var(--transition-color), transform var(--dur-fast) var(--ease-standard); }
.wl-ibtn:hover { background: var(--surface-sunken); color: var(--text-primary); text-decoration: none; }
.wl-ibtn:active { transform: scale(var(--press-scale)); }
.wl-ibtn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.wl-ibtn[data-variant="outline"] { border-color: var(--border-strong); }

/* Input */
.wl-field { display: flex; flex-direction: column; gap: var(--space-2); }
.wl-field > label { font: var(--type-label); color: var(--text-primary); }
.wl-field .wl-hint { font: var(--type-caption); color: var(--text-secondary); }
.wl-field[data-invalid="true"] .wl-hint { color: var(--danger-fg); }
.wl-inwrap { position: relative; display: flex; align-items: center; }
.wl-inwrap > .wl-adorn { position: absolute; left: var(--space-3); display: grid; color: var(--text-muted); pointer-events: none; }
.wl-input { width: 100%; height: var(--control-h-md); padding: 0 var(--space-3); border: 1px solid var(--border-strong);
  border-radius: var(--radius-control); background: var(--surface-card); color: var(--text-primary); font: var(--type-body);
  transition: var(--transition-color), box-shadow var(--dur-fast); }
.wl-inwrap > .wl-adorn + .wl-input { padding-left: var(--space-10); }
.wl-input::placeholder { color: var(--text-muted); }
.wl-input:hover { border-color: var(--text-muted); }
.wl-input:focus { outline: none; border-color: var(--border-focus); box-shadow: var(--focus-ring); }
.wl-field[data-invalid="true"] .wl-input { border-color: var(--danger); }
/* Select: native select styled like Input, with a chevron in place of the browser arrow */
.wl-select { appearance: none; -webkit-appearance: none; padding-right: var(--space-10); cursor: pointer; }
.wl-select:disabled { cursor: not-allowed; opacity: .6; background: var(--surface-sunken); }
.wl-select-chevron { position: absolute; right: var(--space-3); display: grid; color: var(--text-secondary); pointer-events: none; }

/* Checkbox: gold-filled square */
.wl-check { position: relative; display: inline-flex; align-items: flex-start; gap: var(--space-3); min-height: var(--space-6);
  font: var(--type-body-sm); color: var(--text-primary); cursor: pointer; }
.wl-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.wl-check .box { flex: none; display: grid; place-items: center; width: var(--space-5); height: var(--space-5);
  border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-card);
  transition: var(--transition-color); }
.wl-check:hover .box { border-color: var(--text-muted); }
.wl-check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.wl-check input:focus-visible + .box { box-shadow: var(--focus-ring); }
.wl-check .box svg { display: none; width: 14px; height: 14px; fill: none; stroke: var(--text-on-accent);
  stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.wl-check input:checked + .box svg { display: block; }

/* Radio / RadioGroup; data-card="true" renders each option as a bordered card */
.wl-fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.wl-fieldset-legend { padding: 0; margin-bottom: var(--space-2); font: var(--type-label); color: var(--text-primary); }
.wl-fieldset .wl-hint { margin-top: var(--space-2); font: var(--type-caption); color: var(--text-secondary); }
.wl-fieldset[data-invalid="true"] .wl-hint { color: var(--danger-fg); }
.wl-radios { display: grid; gap: var(--space-3); }
.wl-radio { position: relative; display: flex; align-items: center; gap: var(--space-3); min-height: var(--touch-min);
  font: var(--type-body); color: var(--text-primary); cursor: pointer; }
.wl-radio input { position: absolute; opacity: 0; width: 0; height: 0; }
.wl-radio .dot { flex: none; width: 22px; height: 22px; border: 1.5px solid var(--border-strong); border-radius: 50%;
  background: var(--surface-card); transition: var(--transition-color); }
.wl-radio:hover .dot { border-color: var(--text-muted); }
.wl-radio input:checked + .dot { border-color: var(--accent); background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface-card); }
.wl-radio input:focus-visible + .dot { box-shadow: inset 0 0 0 4px var(--surface-card), var(--focus-ring); }
.wl-radio[data-card="true"] { padding: var(--space-3) var(--space-4); border: 1px solid var(--border-strong);
  border-radius: var(--radius-card); background: var(--surface-card); }
.wl-radio[data-card="true"]:hover { border-color: var(--text-muted); }
.wl-radio[data-card="true"]:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.wl-radio[data-card="true"]:has(input:checked) .dot { box-shadow: inset 0 0 0 4px var(--accent-soft); }
@media (min-width: 600px) {
  .wl-radios { grid-template-columns: repeat(2, 1fr); }
}

/* Tabs: underline variant with the gold indicator (DESIGN.md §4). Tabs may be links (?tab=...)
   that the page script switches in place; the strip scrolls sideways when it outgrows the screen. */
.wl-tabs { display: flex; gap: var(--space-5); border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto; scrollbar-width: none; }
.wl-tabs::-webkit-scrollbar { display: none; }
.wl-tab { position: relative; flex: none; display: inline-flex; align-items: center; height: var(--control-h-md);
  padding: 0 var(--space-1); border: 0; background: none; color: var(--text-secondary); font: var(--type-label);
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: var(--transition-color); }
.wl-tab:hover { color: var(--text-primary); text-decoration: none; }
.wl-tab[aria-selected="true"] { color: var(--text-primary); }
.wl-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); }
.wl-tab:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }

/* Tabs, segmented variant: 2-3 compact options (a filter); the current one has aria-current or aria-selected */
.wl-tabs[data-variant="segmented"] { display: inline-flex; width: fit-content; max-width: 100%; gap: var(--space-1); padding: var(--space-1); border: 0;
  border-radius: var(--radius-md); background: var(--surface-sunken); }
.wl-tabs[data-variant="segmented"] .wl-tab { height: var(--control-h-sm); padding: 0 var(--space-4); border-radius: var(--radius-sm); }
.wl-tabs[data-variant="segmented"] .wl-tab[aria-current="true"],
.wl-tabs[data-variant="segmented"] .wl-tab[aria-selected="true"] { background: var(--surface-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.wl-tabs[data-variant="segmented"] .wl-tab::after { display: none; }

/* ThemeToggle: segmented light/dark */
.wl-theme { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); background: var(--surface-sunken); }
.wl-theme button { display: inline-grid; place-items: center; height: 30px; padding: 0 var(--space-3); border: 0;
  border-radius: var(--radius-sm); background: transparent; color: var(--text-secondary); font: var(--type-label);
  cursor: pointer; transition: var(--transition-color); }
.wl-theme button[aria-pressed="true"] { background: var(--surface-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.wl-theme button:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Card: flat, 1px border, no shadow */
.wl-card { border: 1px solid var(--border-subtle); border-radius: var(--radius-card); background: var(--surface-card); color: var(--text-primary); }
.wl-card[data-padding="md"] { padding: var(--space-5); }
.wl-card[data-padding="lg"] { padding: var(--space-8); }
.wl-card[data-tone="sunken"] { background: var(--surface-sunken); }

/* Badge: small uppercase status label, 2px radius, never pill */
.wl-badge { display: inline-flex; align-items: center; height: var(--space-5); padding: 0 var(--space-2);
  border-radius: var(--radius-badge); font: var(--type-eyebrow); letter-spacing: var(--tracking-caps);
  text-transform: uppercase; white-space: nowrap; background: var(--surface-sunken); color: var(--text-secondary); }
.wl-badge[data-tone="accent"] { background: var(--accent-soft); color: var(--accent-soft-fg); }
.wl-badge[data-tone="inverse"] { background: var(--surface-inverse); color: var(--text-inverse); }
.wl-badge[data-tone="info"] { background: var(--info-soft); color: var(--info-fg); }
.wl-badge[data-tone="danger"] { background: var(--danger-soft); color: var(--danger-fg); }

/* a link or span styled as a button that cannot be used */
.wl-btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* Inline status message (error on a form) */
.wl-alert { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-control); font: var(--type-body-sm); }
.wl-alert[data-tone="danger"] { background: var(--danger-soft); color: var(--danger-fg); }
.wl-alert[data-tone="success"] { background: var(--success-soft); color: var(--success-fg); }

.wl-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
