/* Shared components, loaded by every page after tokens.css: the landing and sign-in pages,
   the cellar app, the public wine pages and the privacy page. Page stylesheets only set sizes
   and layout on top of these. */

/* ---------- Buttons (Material 3) ----------
   .btn          outlined: secondary actions ("Cancel", "No thanks")
   .btn.primary  filled: the one main action on a screen ("Drink it", "Put it in the fridge")
   .btn.tonal    filled tonal: an action a list item asks for ("Choose the wine")
   .btn.danger / .btn.danger-solid   outlined / filled in the error colour
   Hover and press add Material's state layer: the label colour at 8% / 10% over the button. */
.btn {
  appearance: none; font: inherit; font-weight: 500; font-size: 14px; letter-spacing: .01em; line-height: 1.2;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 24px; border-radius: var(--r-pill);
  border: 1px solid var(--outline); background: transparent; color: var(--primary);
  transition: box-shadow var(--dur-short) var(--ease), background-color var(--dur-short) var(--ease);
}
.btn:hover { box-shadow: inset 0 0 0 100vmax color-mix(in srgb, currentColor calc(var(--state-hover) * 100%), transparent); }
.btn:active { box-shadow: inset 0 0 0 100vmax color-mix(in srgb, currentColor calc(var(--state-press) * 100%), transparent); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.primary { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.btn.tonal { background: var(--secondary-container); border-color: transparent; color: var(--on-secondary-container); }
.btn.danger { color: var(--error); border-color: var(--error); }
.btn.danger-solid { background: var(--error); border-color: transparent; color: var(--on-error); }
.btn.danger-solid[disabled] { opacity: .38; cursor: not-allowed; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn.small { min-height: 32px; padding: 4px 16px; font-size: 13px; }

/* ---------- Text button ("Not this wine?", "Clear all", Account actions) ----------
   Material's text button: no underline, the primary colour, a state layer on hover. 48 px tall
   target, drawn smaller. */
.link-btn {
  appearance: none; border: 0; background: none; margin: 0;
  font: inherit; font-weight: 500; color: var(--primary); cursor: pointer; text-decoration: none;
  white-space: nowrap; justify-self: start;
  padding: 6px 12px; margin: -6px -12px; border-radius: var(--r-pill);
  transition: background-color var(--dur-short) var(--ease);
}
.link-btn:hover { background: color-mix(in srgb, currentColor calc(var(--state-hover) * 100%), transparent); }
.link-btn:active { background: color-mix(in srgb, currentColor calc(var(--state-press) * 100%), transparent); }
.link-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 0; }
.link-btn.danger { color: var(--error); }
.link-btn[disabled] { opacity: .5; cursor: progress; }

/* ---------- An inset panel inside a card or dialog ---------- */
.panel { border: 1px solid var(--outline-variant); border-radius: var(--r-md); background: var(--surface-container-low); }

/* ---------- Screen readers only ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Analytics consent bar (scripts/shared/analytics.js) ----------
   A Material banner-style card: container surface, extra-large corners, level 3 elevation. */
.consent-bar {
  position: fixed; z-index: 60; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(560px, calc(100vw - 32px));
  display: grid; grid-template-columns: 1fr auto; gap: 12px 16px; align-items: center;
  padding: 16px 16px 16px 20px; border-radius: var(--r-lg);
  background: var(--surface-container-high); color: var(--on-surface); box-shadow: var(--elev-3); font-size: 14px; line-height: 1.45;
}
.consent-bar p { margin: 0; }
.consent-bar a { color: var(--primary); }
.consent-actions { display: flex; gap: 8px; }
@media (max-width: 520px) { .consent-bar { grid-template-columns: 1fr; } .consent-actions { justify-content: flex-end; } }
/* Above the cellar's navigation bar (phones); beside the rail on wide screens. */
body:has(.bottom-nav) .consent-bar { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 840px) { body:has(.bottom-nav) .consent-bar { bottom: 24px; left: calc(50% + 40px); } }

/* Folding groups of a wine's details (the app's bottle sheet and the catalogue's wine page): a
   native <details>, a full-width header row (44 px or more) with a chevron; closed, a one-line gist
   of what's inside. */
.sections { display: grid; margin-top: 4px; }
details.sec { border-top: 1px solid var(--line); }
details.sec:last-child { border-bottom: 1px solid var(--line); }
details.sec > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px;
  align-items: center; min-height: 44px; padding: 8px 2px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary .t { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
details.sec > summary .gist { display: block; margin-top: 2px; font-size: 13px; color: var(--ink, var(--on-surface)); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
details.sec[open] > summary .gist, details.sec > summary .gist:empty { display: none; }
details.sec > summary::after { content: ""; width: 8px; height: 8px; margin: 0 8px 4px 0; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
details.sec[open] > summary::after { transform: rotate(-135deg); margin-bottom: -2px; }
details.sec > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-xs, 4px); }
details.sec > :not(summary) { margin-bottom: 14px; }
@media (prefers-reduced-motion: reduce) { details.sec > summary::after { transition: none; } }
/* A blend's shares as one bar (each grape a darker-to-lighter step of the wine's colour). */
.comp { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 4px 0 4px; max-width: 260px; }
.comp i { display: block; background: var(--primary); }
.comp i:nth-child(2) { opacity: .7; } .comp i:nth-child(3) { opacity: .5; } .comp i:nth-child(n+4) { opacity: .32; }
.comp i + i { margin-left: 2px; }
