/* ── NODE DETAIL PANEL ── */
.detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 600px;
  background: var(--cream);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 30;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }

.detail-inner {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.detail-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge-receta    { background: var(--accent-light); color: var(--accent); }
.badge-tutorial  { background: var(--green-light);  color: var(--green); }
.badge-dulce     { background: #FFF3E0; color: #B45309; }
.badge-salado    { background: #E8F5E9; color: #2E7D32; }
.badge-otros     { background: #F3E5F5; color: #7B1FA2; }
.badge-publicado { background: var(--accent-light); color: var(--accent); }
.badge-borrador  { background: #FFF3CD; color: #856404; }

/* Dieta */
.badge-vegetariano { background: #E8F5E9; color: #2E7D32; }
.badge-vegano      { background: #DCEDC8; color: #33691E; }

/* Curso */
.badge-desayuno   { background: #FFFDE7; color: #9E7B00; }
.badge-principal  { background: #E3F2FD; color: #1565C0; }
.badge-entrante   { background: #F3E5F5; color: #6A1B9A; }
.badge-aperitivo  { background: #FFF8E1; color: #E65100; }
.badge-postre     { background: #FCE4EC; color: #AD1457; }
.badge-bebida     { background: #E1F5FE; color: #01579B; }
.badge-guarnicion { background: #E0F2F1; color: #00695C; }
.badge-salsa      { background: #FBE9E7; color: #BF360C; }
.badge-fondo      { background: #FFF3E0; color: #B45309; }
.badge-conserva   { background: #F1F8E9; color: #558B2F; }
.badge-masa       { background: #EDE7F6; color: #4527A0; }
.badge-basico     { background: #ECEFF1; color: #455A64; }

/* Dificultad */
.badge-facil   { background: #E8F5E9; color: #2E7D32; }
.badge-media   { background: #FFF8E1; color: #F57F17; }
.badge-dificil { background: #FFEBEE; color: #C62828; }

/* Serie */
.badge-htm        { background: #E8EAF6; color: #283593; }
.badge-cocinaselo { background: #FFF3E0; color: #E65100; }

/* Fit / Publi */
.badge-fit   { background: #F1F8E9; color: #558B2F; }
.badge-publi { background: #EDE7F6; color: #4527A0; }

/* ── CREDIT CARD ── */
.credit-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 100px;
  text-decoration: none;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  margin: 0 0 10px;
  transition: background 0.15s;
}
.credit-card:not(.no-link):hover { background: rgba(28,28,26,0.04); }

.credit-avatar-fallback {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(28,28,26,0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.credit-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.credit-name { color: var(--ink); }
.sponsor-favicon {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.credit-arrow { color: var(--ink-faint); flex-shrink: 0; }
.credit-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.credit-cards .credit-card { margin: 0; }

/* ── VIDEO BUTTONS (public view) ── */
.video-links { display: flex; flex-wrap: nowrap; gap: 6px; margin: 10px 0 4px; }

.video-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 100px;
  background: var(--vcolor, var(--ink));
  color: #fff;
  text-decoration: none !important;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: filter 0.15s;
}
.video-btn:hover { filter: brightness(1.1); }
.video-btn:active { filter: brightness(0.95); }
.video-btn svg { color: #fff; flex-shrink: 0; }
.video-btn-arrow { opacity: 0.75; }

.detail-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 100px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-muted);
  flex-shrink: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.detail-close:hover { color: var(--ink); background: rgba(28,28,26,0.05); }

.detail-text-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-muted);
  text-decoration: none;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  box-sizing: border-box;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.detail-text-btn:hover {
  color: var(--ink);
  background: rgba(28,28,26,0.04);
  border-color: var(--ink-faint);
}
.detail-text-btn.copied {
  color: var(--green, #2E7D32);
  border-color: var(--green, #2E7D32);
}

.detail-title {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
}

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.detail-title-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* Graph panel only (#recipe-detail-panel on index.html keeps the title on
   one truncated line inside its fixed compact header bar — see cocina.css),
   and only above the mobile breakpoint: on mobile the panel is a full-width
   bottom sheet (see responsive.css) where a single row already had plenty
   of room, so it keeps that layout unchanged. It's the desktop split-view
   panel that's narrow (600px) with long titles — there, sharing a row with
   the action buttons squeezed the title down to a few characters per line;
   stacking both left-aligned reads far better. */
@media (min-width: 769px) {
  #detail-panel .detail-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

.detail-thumb-wrap {
  position: relative;
  width: 230px;
  margin: 0 auto;
  cursor: pointer;
  transition: width 0.45s cubic-bezier(.16,1,.3,1);
}
.detail-thumb-wrap.expanded { width: 280px; }
.detail-thumb {
  width: 230px;
  height: 230px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
  transition: height 0.45s cubic-bezier(.16,1,.3,1), width 0.45s cubic-bezier(.16,1,.3,1), object-fit 0s 0.45s;
}
.detail-thumb-wrap.expanded .detail-thumb {
  width: 280px;
  height: 498px;
  object-fit: contain;
  background: rgba(28,28,26,0.06);
}

.detail-thumb-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0,0,0,0.48);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
}
.detail-thumb-wrap:hover .detail-thumb-btn { opacity: 1; }

.detail-thumb-btn .icon-zoom-out { display: none; }
.detail-thumb-wrap.expanded .detail-thumb-btn .icon-zoom-in { display: none; }
.detail-thumb-wrap.expanded .detail-thumb-btn .icon-zoom-out { display: block; }

/* ── SECTION LABEL ── */
.detail-section { display: flex; flex-direction: column; gap: 7px; }
.detail-section-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.detail-section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-mini-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-faint);
  background: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.detail-mini-btn:hover { color: var(--ink); background: rgba(28,28,26,0.04); border-color: var(--ink-faint); }
.detail-mini-btn.copied { color: var(--green, #2E7D32); border-color: var(--green, #2E7D32); }

/* ── RELATED RECIPES ── */
.related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: none;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.related-chip:hover { background: rgba(28,28,26,0.04); border-color: var(--ink-faint); }

.related-chip-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.related-chip-label {
  color: var(--ink-muted);
  font-weight: 400;
}

/* ── BUY LINKS ── */
.buy-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.buy-links-grid {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.buy-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: var(--accent-light);
  border: 1px solid rgba(24,95,165,0.18);
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 12px;
  transition: background 0.15s, border-color 0.15s;
}
.buy-link-card:hover {
  background: rgba(24,95,165,0.12);
  border-color: rgba(24,95,165,0.35);
}
.buy-link-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buy-link-card svg { flex-shrink: 0; color: var(--accent); }

/* ── PUBLICATION DATE ── */
.detail-date {
  font-size: 12px;
  color: var(--ink-faint);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ── TAG CHIPS ── */
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag-chip {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(28,28,26,0.05);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  color: var(--ink-muted);
}
.tag-chip-alergeno {
  background: #FFF3CD;
  border-color: #F0C040;
  color: #7A5800;
}
.tag-chip-salud {
  background: #E3F3E1;
  border-color: #7CC08A;
  color: #2C6B3F;
}

/* ── MARKDOWN DESCRIPTION ── */
.detail-description {
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.detail-description h4 {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 16px 0 6px;
}
.detail-description h4:first-child { margin-top: 0; }

.detail-description p { margin-bottom: 10px; }
.detail-description p:last-child { margin-bottom: 0; }

.detail-description ul,
.detail-description ol {
  padding-left: 16px;
  margin-bottom: 10px;
}
.detail-description li { margin-bottom: 3px; }

.detail-description strong { color: var(--ink); font-weight: 600; }

.detail-description table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-bottom: 10px;
}
.detail-description th,
.detail-description td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}
.detail-description th {
  font-weight: 600;
  color: var(--ink);
  background: rgba(28,28,26,0.03);
}

.detail-description a { color: var(--accent); text-decoration: none; }
.detail-description a:hover { text-decoration: underline; }

.detail-description img {
  max-height: 22px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ── PRINT: just the open recipe, nothing else ── */
@media print {
  header, nav.site-nav, .cookie-banner,
  .intro, .page-intro, .recipes-controls,
  #search-bar, #filter-area, #zoom-controls, #graph,
  #recipe-backdrop, .detail-close, .detail-title-actions {
    display: none !important;
  }

  .graph-wrapper {
    position: static !important;
    overflow: visible !important;
    height: auto !important;
  }

  .detail-panel, #recipe-detail-panel {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
  }

  #recipe-detail-panel .detail-header {
    position: static !important;
  }
  #recipe-detail-panel .detail-inner {
    padding: 0 !important;
    overflow: visible !important;
  }

  .detail-inner { overflow: visible !important; }

  body, html { background: #fff !important; }
}
