/* ============================================================================
   GRÖNSKAPER — AFFILIATE-KOMPONENTER
   Kontextuella produktlänkar (Wexthuset prio 1, Cramers prio 2).
   Bygger på design-tokens i /css/gronskaper-tokens.css.
   Länka in EFTER tokens-filen:
     <link rel="stylesheet" href="/css/gronskaper-tokens.css">
     <link rel="stylesheet" href="/css/affiliate.css">
   ============================================================================ */

/* ---- Gemensam "Annonslänk"-etikett (juridiskt krav på reklammärkning) ---- */
.aff-tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  line-height: 1.4;
}

/* Partner-avsändare (liten logga + text) */
.aff-source {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.aff-source img { height: 16px; width: auto; display: block; }

/* ====================== 1. "Vad du behöver"-ruta (NeedBox) ====================== */
.aff-needbox {
  background: var(--surface-wash);
  border: 1px solid var(--green-200);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: var(--space-5) 0 var(--space-6);
}
.aff-needbox__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.aff-needbox__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-strong);
  margin: 0;
}
.aff-needbox__sub {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin: 2px 0 0;
}
.aff-needbox__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.aff-needbox__item {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
}
.aff-needbox__kind {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--brand);
}
.aff-needbox__label { font-family: var(--font-body); font-size: var(--text-sm); color: var(--text-body); min-width: 0; }
.aff-needbox__label span { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: 2px; }
.aff-needbox__buy {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--accent-warm-text);
  text-decoration: none;
  white-space: nowrap;
}
.aff-needbox__buy:hover { text-decoration: underline; }
.aff-needbox__foot {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.aff-needbox__foot-text { font-family: var(--font-ui); font-size: var(--text-xs); color: var(--text-muted); }

@media (max-width: 560px) {
  .aff-needbox__item { grid-template-columns: 1fr auto; }
  .aff-needbox__kind { grid-column: 1 / -1; }
}

/* ====================== 2. Inline produktlänk i löptext ====================== */
.aff-inline {
  color: var(--accent-warm-text);
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-decoration-color: rgba(178, 106, 0, 0.4);
}
.aff-inline:hover { text-decoration-color: var(--accent-warm-text); }
.aff-inline-note {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ====================== 3. Trädgårdsakuten: produktkort ====================== */
.aff-diagnosis {
  background: var(--surface-wash);
  border: 1px solid var(--green-200);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  margin: var(--space-5) 0;
}
.aff-diagnosis__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.aff-diagnosis__title {
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-strong);
  margin: 0;
}
.aff-diagnosis__row {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.aff-diagnosis__thumb {
  width: 72px; height: 72px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-tinted);
  border: 1px solid var(--border-subtle);
}
.aff-diagnosis__info { flex: 1; min-width: 0; }
.aff-diagnosis__intro { font-family: var(--font-body); font-size: var(--text-sm); color: var(--text-body); margin: 0 0 var(--space-2); }
.aff-diagnosis__name { font-family: var(--font-body); font-size: var(--text-sm); font-weight: var(--weight-semibold); margin: 0 0 2px; color: var(--text-strong); }
.aff-diagnosis__sub  { font-size: var(--text-xs); color: var(--text-muted); margin: 0 0 var(--space-2); }
.aff-cta {
  display: inline-block;
  margin-top: var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-on-brand);
  background: var(--brand);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-soft);
}
.aff-cta:hover { background: var(--brand-strong); }
.aff-diagnosis__foot { margin-top: var(--space-3); }
.aff-disclosure { font-size: var(--text-xs); color: var(--text-muted); margin-top: var(--space-2); }

@media (max-width: 560px) {
  .aff-diagnosis__row { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* ====================== 4. Sidopanel-widget (SidebarWidget) ====================== */
.aff-sidebar {
  background: var(--surface-wash);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.aff-sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-3);
}
.aff-sidebar__title {
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-strong);
  margin: 0;
}
.aff-sidebar__body { display: grid; gap: 2px; }
.aff-sidebar__item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--green-200);
  text-decoration: none;
}
.aff-sidebar__item:last-child { border-bottom: none; }
.aff-sidebar__item:hover .aff-sidebar__name { text-decoration: underline; }
.aff-sidebar__thumb {
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
}
.aff-sidebar__meta { display: grid; gap: 1px; min-width: 0; }
.aff-sidebar__kind {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--brand);
}
.aff-sidebar__name {
  font-size: var(--text-xs);
  line-height: var(--leading-snug);
  color: var(--accent-warm-text);
  font-weight: var(--weight-semibold);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.aff-sidebar__price { font-size: var(--text-xs); color: var(--text-muted); }
.aff-sidebar__foot { margin-top: var(--space-3); }

/* Sidopanelen flyttas in i löptexten på mobil (av affiliate.js) och visas då. */
.aff-sidebar--inline {
  margin: var(--space-6) 0;
}

/* På desktop bor widgeten i .blabarstry-sidebar (grid-kolumn). På mobil är den
   grid-kolumnen dold – då flyttar JS in widgeten i innehållet i stället. */
