/* 05-components.css — Cards, buttons, badges, forms, toasts, star ratings */

/* ─── Feature Grid ─── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

/* DESIGN.md §4: depth via tonal layering + border, not glass. Glass is reserved
   for the navbar + the wine-detail hero stats panel. Don't reintroduce
   backdrop-filter on general-purpose cards or filter chrome here. */
.feature-card {
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--noir-900);
  border: 1px solid var(--border-default);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

/* Single hover affordance: amber glow + border shift. No translateY lift —
   DESIGN.md §4 explicitly replaces the cliché dashboard lift with the glow. */
.feature-card:hover {
  border-color: var(--border-accent-hover);
  box-shadow: var(--shadow-glow);
}

.feature-card h3 {
  margin-top: 1.5rem;
  font-size: 1.2rem;
}

.feature-card p {
  flex: 1;
  color: var(--ivory-300);
  line-height: 1.6;
}

.feature-card .btn {
  align-self: flex-start;
  margin-top: auto;
}

.feature-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--border-accent);
  color: var(--amber-400);
  font-size: 1.4rem;
}

.feature-icon svg {
  width: 22px;
  height: 22px;
}

/* ─── Filter Panel ─── */

/* DESIGN.md §4: depth via tonal layering, not glass. See feature-card note. */
.filter-panel {
  background: var(--noir-900);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--border-default);
}

.filter-panel .form-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ivory-400);
  font-weight: 500;
}

/* ─── Filter chips (styled radio groups) ─── */

.filter-groups {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-chips {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filter-chips__label {
  flex: 0 0 100%;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ivory-400);
  font-weight: 500;
  margin: 0 0 0.25rem;
  padding: 0;
}

/* Visually hide the radio but keep it in the a11y tree + focusable. */
.filter-chips__input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill, 999px);
  background: var(--noir-800);
  color: var(--ivory-300);
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-chip:hover {
  color: var(--ivory-100);
  border-color: var(--border-accent);
}

.filter-chips__input:checked + .filter-chip {
  background: var(--amber-400);
  border-color: var(--amber-400);
  color: var(--noir-950);
  font-weight: 500;
}

/* Keyboard focus ring on the chip when its (hidden) radio is focused. */
.filter-chips__input:focus-visible + .filter-chip {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
}

/* ─── Cards (Global) ─── */

.card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  background: var(--noir-900);
  color: var(--ivory-100);
  transition: border-color var(--duration-normal) var(--ease-out),
              background-color var(--duration-normal) var(--ease-out);
}

.card:hover {
  border-color: var(--border-medium);
  background: rgba(255, 255, 255, 0.02);
}

.card:focus-within {
  border-color: var(--border-accent-hover);
}

.card-header {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-default);
  font-weight: 600;
  color: var(--ivory-100);
}

.card-footer {
  background: transparent;
  border-top: 1px solid var(--border-default);
}

/* ─── Tables ─── */
/* Bootstrap dropped — own the table shape directly. */
.table {
  width: 100%;
  margin-bottom: 0;
  color: var(--ivory-100);
  vertical-align: top;
  background: transparent;
  border-collapse: collapse;
}

.table > :not(caption) > * > * {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-default);
}

.table thead th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ivory-400);
  border-bottom: 1px solid var(--border-default);
}

.table tbody tr:hover {
  background: rgba(212, 168, 83, 0.05);
}

/* ─── Forms (Dark) ─── */

.form-control,
.form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-medium);
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--ivory-100);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--duration-normal) ease, box-shadow var(--duration-normal) ease;
}

/* Suppress the native UA chevron so the custom SVG below renders alone.
   Without this, browsers (notably WebKit on macOS, Firefox) paint their own
   triangle on top of ours — the "double chevron" bug. */
.form-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.25rem;
}

.form-control::placeholder {
  color: var(--ivory-400);
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(212, 168, 83, 0.5);
  box-shadow: 0 0 0 0.2rem rgba(212, 168, 83, 0.1);
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--ivory-100);
}

.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23b8ad9e' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 12px 12px;
}

.form-select option {
  background: var(--noir-800);
  color: var(--ivory-100);
}

.form-check-input {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.form-check-input:checked {
  background-color: var(--amber-400);
  border-color: var(--amber-400);
}

.form-range::-webkit-slider-thumb {
  background-color: var(--amber-400);
}

.form-range::-moz-range-thumb {
  background-color: var(--amber-400);
}

/* ─── Form Validation States ─── */

.form-control:focus {
  border-color: rgba(212, 168, 83, 0.4);
  box-shadow: var(--input-focus-ring);
  background-color: var(--noir-800);
}

.form-control.is-invalid,
.was-validated .form-control:invalid {
  border-color: rgba(139, 41, 66, 0.5);
  box-shadow: var(--input-error-ring);
}

.form-control.is-valid,
.was-validated .form-control:valid {
  border-color: rgba(59, 109, 92, 0.5);
  box-shadow: var(--input-success-ring);
}

.invalid-feedback {
  color: var(--rouge-400);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.valid-feedback {
  color: var(--sage-500);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.form-select:focus {
  border-color: rgba(212, 168, 83, 0.4);
  box-shadow: var(--input-focus-ring);
  background-color: var(--noir-800);
}

/* ─── Buttons ─── */

.btn {
  border-radius: 999px;
  font-weight: 600;
  padding: 0.5rem 1.5rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  transition: all var(--duration-normal) ease;
}

/* Inherits border-radius: 999px from .btn — the system is pill-only.
   DESIGN.md §5: "Pill (999px radius). Square buttons are not in the system." */
.btn-primary {
  background: var(--btn-primary-gradient);
  color: var(--noir-950);
  border: none;
  font-weight: 600;
  box-shadow: var(--btn-primary-shadow);
  transition: all var(--duration-normal) var(--ease-out);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #f0dba8 0%, #e3c17a 100%);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
  box-shadow: var(--btn-primary-shadow);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}

.btn-primary:disabled,
.btn-primary.disabled {
  background: var(--noir-600);
  color: var(--ivory-400);
  border: 1px solid var(--border-default);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-primary .btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(10, 10, 10, 0.3);
  border-top-color: var(--noir-950);
  border-radius: 50%;
  animation: cellar-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}

.btn-outline-primary {
  color: var(--amber-400);
  border-color: var(--amber-400);
}

.btn-outline-primary:hover {
  background: var(--amber-400);
  border-color: var(--amber-400);
  color: var(--noir-950);
}

.btn-outline-primary:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
  background: var(--amber-400);
  border-color: var(--amber-400);
  color: var(--noir-950);
}

.btn-outline-primary:disabled,
.btn-outline-primary.disabled {
  color: var(--ivory-400);
  border-color: var(--border-default);
  cursor: not-allowed;
  background: transparent;
}

.btn-outline-light {
  color: var(--ivory-200);
  border-color: var(--border-strong);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--ivory-100);
}

.btn-outline-secondary {
  border-color: var(--border-medium);
  color: var(--ivory-200);
}

.btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-accent-hover);
  color: var(--ivory-100);
}

/* ─── Badges ─── */

.badge {
  border-radius: 999px;
  padding: 0.3rem 0.6rem;
  font-weight: 500;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.bg-danger {
  background: rgba(164, 58, 58, 0.2) !important;
  color: #e88 !important;
}

.bg-warning {
  background: rgba(225, 185, 106, 0.15) !important;
  color: #e1b96a !important;
}

.bg-info {
  background: rgba(79, 126, 163, 0.15) !important;
  color: #6a9fc4 !important;
}

.bg-secondary {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--ivory-300) !important;
}

.bg-primary {
  background: rgba(212, 168, 83, 0.15) !important;
  color: var(--amber-400) !important;
}

/* Quiet badge variant. Replaces the Bootstrap `bg-light` residue on dark
   surfaces, which read as a stark white pill against the canvas. Token-
   driven, subtle, ivory text on a low-elevation surface. */
.badge--quiet {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ivory-200);
  border: 1px solid var(--border-default);
}

/* ─── List Group (Dark) ─── */

.list-group-item {
  background: transparent;
  border-color: var(--border-default);
  color: var(--ivory-100);
}

.list-group-item .text-muted {
  color: var(--ivory-400) !important;
}

.list-group-item a {
  color: var(--amber-400);
}

/* ─── Breadcrumb ─── */

.breadcrumb {
  background: none;
  padding: 0;
}

.breadcrumb a {
  color: var(--amber-400);
}

.breadcrumb-item.active {
  color: var(--ivory-300);
}

.breadcrumb-item + .breadcrumb-item::before {
  color: var(--ivory-400);
}

/* ─── Pagination ─── */

.cellar-pagination {
  display: flex;
  justify-content: center;
  margin-top: var(--space-5);
}

.cellar-pagination ul {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.cellar-pagination__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--ivory-200);
  font-size: 0.85rem;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.cellar-pagination__link:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-medium);
  color: var(--ivory-100);
}

.cellar-pagination__link:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
}

.cellar-pagination__link--active {
  background: rgba(212, 168, 83, 0.12);
  border-color: rgba(212, 168, 83, 0.25);
  color: var(--amber-400);
  font-weight: 600;
}

.cellar-pagination__link--disabled {
  color: var(--ivory-400);
  cursor: default;
  opacity: 0.5;
}

.cellar-pagination__link--disabled:hover {
  background: transparent;
  border-color: var(--border-default);
}

.cellar-pagination__nav {
  padding: 6px 10px;
}

/* ─── Confirmation modal (styled replacement for window.confirm) ─── */

.cask-confirm {
  position: fixed;
  inset: 0;
  z-index: 1080;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-4);
}

.cask-confirm[aria-hidden="false"] {
  display: flex;
}

@media (min-width: 600px) {
  .cask-confirm { align-items: center; }
}

.cask-confirm__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.cask-confirm__dialog {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: var(--noir-900);
  border: 1px solid rgba(212, 168, 83, 0.22);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: cask-confirm-rise var(--duration-normal) var(--ease-out);
}

@keyframes cask-confirm-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cask-confirm__eyebrow {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--amber-400);
  margin: 0 0 var(--space-2);
}

.cask-confirm__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ivory-100);
  margin: 0 0 var(--space-3);
}

.cask-confirm__body {
  color: var(--ivory-300);
  margin: 0 0 var(--space-5);
  line-height: 1.5;
}

.cask-confirm__actions {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
}

@media (prefers-reduced-motion: reduce) {
  .cask-confirm__dialog { animation: none; }
}

/* ─── Toast notifications ─── */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 380px;
}

.cellar-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--noir-900);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  animation: cellar-slide-in 0.25s var(--ease-out);
}

.cellar-toast--success { border-left: 3px solid var(--sage-500); border-color: rgba(59, 109, 92, 0.25); }
.cellar-toast--error { border-left: 3px solid var(--rouge-500); border-color: rgba(139, 41, 66, 0.25); }
.cellar-toast--warning { border-left: 3px solid var(--amber-400); border-color: rgba(212, 168, 83, 0.2); }
.cellar-toast--info { border-left: 3px solid var(--ivory-300); border-color: rgba(255, 255, 255, 0.1); }

.cellar-toast__icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
}

.cellar-toast--success .cellar-toast__icon { color: var(--sage-500); }
.cellar-toast--error .cellar-toast__icon { color: var(--rouge-400); }
.cellar-toast--warning .cellar-toast__icon { color: var(--amber-400); }
.cellar-toast--info .cellar-toast__icon { color: var(--ivory-300); }

.cellar-toast__content { flex: 1; min-width: 0; }

.cellar-toast__title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ivory-100);
}

.cellar-toast__subtitle {
  font-size: 0.8rem;
  color: var(--ivory-400);
  margin-top: 2px;
}

.cellar-toast__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 1px;
  transition: width linear;
}

.cellar-toast--success .cellar-toast__progress { background: rgba(59, 109, 92, 0.4); }

/* Dismiss button for server-rendered cellar-toasts (no auto-dismiss). */
.cellar-toast__dismiss {
  flex-shrink: 0;
  background: transparent;
  border: 0;
  padding: 0;
  margin-top: 1px;
  width: 18px;
  height: 18px;
  color: var(--ivory-400);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.cellar-toast__dismiss:hover,
.cellar-toast__dismiss:focus-visible {
  color: var(--ivory-100);
}

.cellar-toast__dismiss .icon {
  width: 16px;
  height: 16px;
}

.cellar-toast--exiting {
  animation: cellar-exit 0.3s var(--ease-out) forwards;
}
.cellar-toast--error .cellar-toast__progress { background: rgba(139, 41, 66, 0.4); }
.cellar-toast--warning .cellar-toast__progress { background: rgba(212, 168, 83, 0.3); }
.cellar-toast--info .cellar-toast__progress { background: rgba(255, 255, 255, 0.15); }

.cellar-toast--exiting {
  animation: cellar-exit 0.3s var(--ease-out) forwards;
}

/* ─── Icon System ─── */

.icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon--sm {
  width: 16px;
  height: 16px;
}

.icon--lg {
  width: 32px;
  height: 32px;
}

.icon--xl {
  width: 48px;
  height: 48px;
}

/* ─── Star Rating Component ─── */
/*
 * Half-star re-enable (2026-05-17): ONE <button> per unit, click X
 * decides half-vs-full. The dual-button overlap pattern is gone — the
 * compact-mode specificity bug it caused is structurally impossible
 * here because every unit has exactly one full-size hit button, no
 * per-half siblings whose width can be overridden.
 *
 * Visual primitive: base ivory star + clipped amber fill span. The
 * fill clip is driven by --star-fill (0%, 50%, or 100%) which the
 * half/full/empty state classes set. Hover preview cascades the same
 * primitive via the --star-preview-score CSS variable, set on the
 * .star-rating container by JS.
 */

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.star-rating__unit {
  position: relative;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
}

.star-rating__visual {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: transform var(--duration-fast) ease;
  --star-fill: 0%;
  --star-fill-color: var(--amber-400);
}

.star-rating__unit:hover .star-rating__visual,
.star-rating__unit:focus-within .star-rating__visual {
  transform: scale(1.15);
}

.star-rating__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
}

.star-rating__icon svg {
  width: 22px;
  height: 22px;
  transition: fill var(--duration-fast) ease;
}

.star-rating__icon--base svg {
  fill: var(--ivory-400);
}

.star-rating__icon--fill {
  clip-path: inset(0 calc(100% - var(--star-fill)) 0 0);
}

.star-rating__icon--fill svg {
  fill: var(--star-fill-color);
}

.star-rating__visual--full {
  --star-fill: 100%;
}

.star-rating__visual--half {
  --star-fill: 50%;
}

.star-rating__visual--empty {
  --star-fill: 0%;
}

.star-rating__visual--preview {
  --star-fill-color: var(--amber-300);
}

/*
 * The hit button is the full unit. It sits above the icon stack with a
 * transparent background — the icons (visual) are what the user sees.
 * No width/height overrides per variant: the unit owns the size, the
 * button inherits via inset:0. Click X (read in JS) decides whether
 * the click commits the half value or the full value of this star.
 */
.star-rating__hit {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
  /* Transparent — the icon stack provides the visual */
  color: transparent;
  appearance: none;
  -webkit-appearance: none;
}

.star-rating__hit:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
  border-radius: 2px;
}

.star-rating__label {
  font-size: 0.85rem;
  color: var(--ivory-300);
  margin-left: var(--space-2);
  font-family: var(--font-sans, "DM Sans", sans-serif);
  letter-spacing: 0.02em;
  transition: color var(--duration-fast) ease;
  min-width: 5.5rem; /* reserve space so star row doesn't reflow on swap */
  display: inline-block;
}

/* On hover/focus of any star in the row, label warms to amber-400 to
 * preview the editorial word. */
.star-rating:hover .star-rating__label,
.star-rating:focus-within .star-rating__label {
  color: var(--amber-400);
}

/* Save-confirmation pulse: amber-400 for 600ms then fades back to
 * ivory-300. Applied via JS (and on initial render via just_saved) so a
 * click that returns the partial reads as confirmed. */
@keyframes star-rating-label-flash {
  0% {
    color: var(--amber-400);
    transform: translateY(0);
  }
  60% {
    color: var(--amber-400);
  }
  100% {
    color: var(--ivory-300);
  }
}

.star-rating__label--flash {
  animation: star-rating-label-flash 600ms ease-out 1;
}

/* Compact variant (vintage rows): smaller stars, label hidden for
 * density. The unit sizing cascades to the button via inset:0 — there
 * is intentionally NO ``.star-rating--compact .star-rating__hit`` rule
 * here. Resizing the unit is enough; the hit button has no width/height
 * of its own to override. (This is the structural fix for the bug that
 * broke half-star clicks before today's redesign.) */
.star-rating--compact .star-rating__unit {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
}

.star-rating--compact .star-rating__icon,
.star-rating--compact .star-rating__icon svg {
  width: 18px;
  height: 18px;
}

.user-rating-section {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}

/* Median/computed rating variant */
.star-rating--median .star-rating__visual {
  opacity: 0.5;
}

.star-rating--median .star-rating__label {
  font-style: italic;
  color: var(--ivory-400);
  font-size: 0.75rem;
}

/* Inherited rating — muted stars with source label */
.star-rating--inherited .star-rating__visual {
  opacity: 0.5;
}

.star-rating__inherited-label {
  font-size: 0.75rem;
  color: var(--ivory-400);
  margin-left: var(--space-1);
  font-style: italic;
}

/* ─── Tooltips ─── */

.cellar-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  color: var(--ivory-400);
  transition: color var(--duration-fast) ease;
}

.cellar-tooltip:hover,
.cellar-tooltip:focus-visible {
  color: var(--ivory-200);
}

.cellar-tooltip__content {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: var(--noir-800);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ivory-200);
  white-space: normal;
  width: max-content;
  max-width: 240px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-fast) ease, visibility var(--duration-fast) ease;
  pointer-events: none;
  z-index: 1050;
}

.cellar-tooltip__content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--noir-800);
}

.cellar-tooltip:hover .cellar-tooltip__content,
.cellar-tooltip:focus-visible .cellar-tooltip__content {
  opacity: 1;
  visibility: visible;
}

/* Modal overlay (used by HTMX-injected modals like the report modal).
   Tinted noir scrim, never pure black — see DESIGN.md "The No-Pure-Black Rule". */
.ds-modal-overlay {
  background: rgba(10, 10, 10, 0.72);
}

/* ─── Alerts (Django messages) ─── */
/* Bootstrap's .alert was carrying the styling; now owned in-system. */
.alert {
  position: relative;
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.5;
}

.alert-info,
.alert-primary {
  background: rgba(212, 168, 83, 0.08);
  border-color: rgba(212, 168, 83, 0.2);
  color: var(--amber-200);
}

.alert-success {
  background: rgba(59, 109, 92, 0.1);
  border-color: rgba(59, 109, 92, 0.3);
  color: var(--sage-400);
}

.alert-warning {
  background: rgba(212, 168, 83, 0.1);
  border-color: rgba(212, 168, 83, 0.25);
  color: var(--amber-300);
}

.alert-danger,
.alert-error {
  background: rgba(139, 41, 66, 0.12);
  border-color: rgba(139, 41, 66, 0.3);
  color: var(--rouge-400);
}

/* ─── Navbar shape ─── */
/* Owned in-system now. Visual styling (colors, padding, brand mark) is
   already in 03-layout.css; this is structural shape only. */
.navbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
  margin-right: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  padding-left: 0;
  margin-bottom: 0;
  list-style: none;
}

.navbar-nav .nav-link {
  padding-right: 0.5rem;
  padding-left: 0.5rem;
  text-decoration: none;
}

/* Safari hardening: <li> defaults to display:list-item, but explicit
   display:list-item here paired with the parent's list-style:none was
   resurrecting bullet markers in WebKit when ::marker rendering picked
   up the descendant context. display:block + an inline list-style:none
   reset on the item is the belt-and-suspenders fix. */
.nav-item { display: block; list-style: none; }

.navbar-toggler {
  padding: 0.25rem 0.5rem;
  font-size: 1.25rem;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: box-shadow var(--duration-fast) ease;
}

.navbar-toggler:focus-visible {
  outline: 2px solid var(--amber-400);
  outline-offset: 2px;
}

.navbar-toggler-icon {
  display: inline-block;
  width: 1.5em;
  height: 1.5em;
  vertical-align: middle;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100%;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28245,240,232,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Desktop layout: nav items visible inline */
@media (min-width: 992px) {
  .navbar-expand-lg .navbar-toggler { display: none; }
  .navbar-expand-lg .navbar-collapse {
    display: flex !important;
    flex-basis: auto;
    flex-grow: 1;
    align-items: center;
  }
  .navbar-expand-lg .navbar-nav {
    flex-direction: row;
  }
}

/* Mobile: collapsed by default, open class shows it */
@media (max-width: 991.98px) {
  .navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
    display: none;
  }
  .navbar-collapse.is-open {
    display: block;
  }
  .navbar-nav { flex-direction: column; }
}

/* ─── Dropdown (the user menu) ─── */
/* We use <details>/<summary> now — no Bootstrap JS. */
.user-menu {
  position: relative;
}

.user-menu > summary {
  /* Safari hardening: <summary> defaults to display:list-item which
     paints the disclosure triangle. list-style:none alone doesn't
     suppress it in older WebKit — display:block does. */
  display: block;
  list-style: none;
  cursor: pointer;
}

/* Split the pseudo-element rules: per CSS spec a selector list with an
   unknown pseudo-element invalidates the entire rule. Older Safari
   doesn't recognize ::marker on <summary> and would discard both
   declarations. Splitting keeps the WebKit-specific marker hidden
   even when ::marker is unrecognized. */
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::marker { display: none; content: ""; }

.user-menu__panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 12rem;
  background: var(--noir-800);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  padding: 0.5rem 0;
  z-index: 1040;
}

.user-menu__item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: transparent;
  border: 0;
  text-align: left;
  color: var(--ivory-200);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
}

.user-menu__item:hover,
.user-menu__item:focus-visible {
  background: rgba(212, 168, 83, 0.1);
  color: var(--amber-300);
  outline: none;
}

.user-menu__divider {
  height: 1px;
  margin: 0.5rem 0;
  background: var(--border-default);
  border: 0;
}
