/* ==========================================================================
   Whiskybase Ratings – Frontend Widget Styles
   
   COMPATIBILITY STRATEGY
   ──────────────────────
   1. All selectors are prefixed with `body` for free +1 element specificity,
      beating most theme rules without needing `!important` everywhere.
   2. `!important` is used ONLY on display/layout properties — the ones that
      are fatal to the widget if a theme overrides them to something else.
   3. Every inheritable CSS property is explicitly declared on `.wbr-card`
      so nothing bleeds in from the theme's body/p/a/h2 rules.
   4. Box-model properties use px values (not em) so they are immune to
      theme font-size inheritance chains.
   5. A companion inline style block (added via wp_add_inline_style) carries
      the absolute-critical layout rules with !important — inline <style> tags
      in <head> always win over external stylesheets of equal specificity.
   ========================================================================== */

/* ── Box model reset for all widget children ─────────────────────────────── */
body .wbr-card,
body .wbr-card * {
	box-sizing: border-box !important;
}

/* ── Anchor wrapper ──────────────────────────────────────────────────────── */
body a.wbr-link {
	display: inline-block !important;    /* some themes set a { display: block } */
	text-decoration: none !important;
	color: inherit !important;
	border: none !important;             /* some themes add a bottom-border to all links */
	outline: none;
	background: transparent !important;
	padding: 0 !important;
	margin: 0 !important;
}
body a.wbr-link:hover .wbr-card,
body a.wbr-link:focus .wbr-card {
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.13) !important;
	transform: translateY(-1px);
}

/* ── Card container ──────────────────────────────────────────────────────── */
body .wbr-card {
	/* Layout — !important: fatal if overridden */
	display: inline-flex !important;
	flex-direction: row !important;
	align-items: stretch !important;
	flex-wrap: nowrap !important;
	float: none !important;

	/* Hard-reset every common inheritable property */
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
	             "Helvetica Neue", Arial, sans-serif !important;
	font-size:   14px !important;
	font-weight: 400 !important;
	font-style:  normal !important;
	line-height: 1 !important;
	color:       #1e2b3a !important;
	text-transform:   none !important;
	text-decoration:  none !important;
	letter-spacing:   normal !important;
	word-spacing:     normal !important;
	white-space:      nowrap;
	vertical-align:   middle;

	/* Visual */
	background:    #ffffff !important;
	border:        1px solid #e2e6ea !important;
	border-radius: 8px !important;
	box-shadow:    0 1px 4px rgba(0, 0, 0, 0.07) !important;
	overflow:      hidden !important;
	transition:    box-shadow 0.18s ease, transform 0.18s ease;

	/* Spacing — explicit so theme * { margin/padding: 0 } can't interfere */
	margin:    10px 0 14px !important;
	padding:   0 !important;
	max-width: 320px;
	min-width: 0;
}

/* ── Left column: star + score ───────────────────────────────────────────── */
body .wbr-card__left {
	display:         flex !important;
	flex-direction:  column !important;
	align-items:     center !important;
	justify-content: center !important;
	flex-shrink:     0;
	padding:         14px 18px !important;
	gap:             2px;
	min-width:       72px;
	background:      transparent !important;
	border:          none !important;
	margin:          0 !important;
}

body .wbr-star {
	display:     block !important;
	font-size:   22px !important;
	line-height: 1 !important;
	color:       #f0a500 !important;     /* overridden per tier below */
	font-style:  normal !important;
	font-weight: 400 !important;
	text-shadow: none !important;
	margin:      0 !important;
	padding:     0 !important;
}

body .wbr-score {
	display:        block !important;
	font-size:      20px !important;
	font-weight:    700 !important;
	line-height:    1.1 !important;
	color:          #1e2b3a !important;
	letter-spacing: -0.5px !important;
	text-shadow:    none !important;
	margin:         0 !important;
	padding:        0 !important;
	background:     transparent !important;
	border:         none !important;
}

/* ── Vertical divider ────────────────────────────────────────────────────── */
body .wbr-card__divider {
	display:    block !important;
	width:      1px !important;
	min-height: 100%;
	background-color: #e2e6ea !important;
	flex-shrink: 0;
	margin:  0 !important;
	padding: 0 !important;
	border:  none !important;
}

/* ── Right column: label + meta ──────────────────────────────────────────── */
body .wbr-card__right {
	display:         flex !important;
	flex-direction:  column !important;
	justify-content: center !important;
	align-items:     flex-start !important;
	padding:         12px 16px !important;
	gap:             4px;
	background:      transparent !important;
	border:          none !important;
	margin:          0 !important;
}

body .wbr-label {
	display:        block !important;
	font-size:      15px !important;
	font-weight:    700 !important;
	line-height:    1.2 !important;
	color:          #1e2b3a !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	margin:         0 !important;
	padding:        0 !important;
	background:     transparent !important;
	border:         none !important;
}

body .wbr-meta {
	display:        block !important;
	font-size:      12px !important;
	font-weight:    400 !important;
	line-height:    1.3 !important;
	color:          #6b7a8d !important;
	letter-spacing: 0.02em !important;
	text-transform: none !important;
	margin:         0 !important;
	padding:        0 !important;
	background:     transparent !important;
	border:         none !important;
}

/* ==========================================================================
   Score tier: star colour per quality level
   ========================================================================== */
body .wbr-card--superior           .wbr-star { color: #c0392b !important; }
body .wbr-card--outstanding        .wbr-star { color: #e07b1a !important; }
body .wbr-card--highly-recommended .wbr-star { color: #f0a500 !important; }
body .wbr-card--recommended        .wbr-star { color: #f0a500 !important; }
body .wbr-card--unlabeled          .wbr-star { color: #a0aab4 !important; }

/* ==========================================================================
   Hover / focus accessibility
   ========================================================================== */
body a.wbr-link:focus-visible .wbr-card {
	outline:        2px solid #1d6fa4;
	outline-offset: 2px;
}

/* ==========================================================================
   Compact variant — archive / shop loop cards
   ========================================================================== */
body .wbr-card.wbr-widget--loop {
	margin:    4px 0 6px !important;
	max-width: 260px;
}
body .wbr-widget--loop .wbr-card__left {
	padding:   10px 14px !important;
	min-width: 58px;
}
body .wbr-widget--loop .wbr-star  { font-size: 17px !important; }
body .wbr-widget--loop .wbr-score { font-size: 16px !important; }
body .wbr-widget--loop .wbr-card__right { padding: 10px 13px !important; }
body .wbr-widget--loop .wbr-label { font-size: 13px !important; }
body .wbr-widget--loop .wbr-meta  { font-size: 11px !important; }

/* ==========================================================================
   Dark-mode support (respects OS preference; themes can still override)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
	body .wbr-card {
		background:  #1e2b3a !important;
		border-color: #2e3f52 !important;
		color:        #e8edf2 !important;
	}
	body .wbr-card__divider  { background-color: #2e3f52 !important; }
	body .wbr-score,
	body .wbr-label          { color: #e8edf2 !important; }
	body .wbr-meta           { color: #8fa3b8 !important; }
}
