/* ===================================================================
   YouTube Backlinks Generator (/youtube-backlinks-generator)

   Built on the Backlink Maker design system: the page root carries both
   .bm and .yb, backlink-maker.css supplies the layout, buttons, progress
   ring, list and toolbar, and this file only
     1. swaps the accent to the A-Z palette colour for the letter Y
        (az-color-palette.js primaryForLetter("Y") = #f79250), and every
        blue tint backlink-maker.css hard-codes for its letter-B accent;
     2. renames the three link states (reachable / pinged / failed);
     3. adds the video preview card and the shareable-links list.

   --bm-accent-strong (#97552a) is the accent darkened for text: 5.9:1 on
   white, 5.4:1 on the soft tint. The accent itself (2.4:1 on white) is
   used only for decoration - rings, bars, borders, icons beside text.
   =================================================================== */

.bm.yb {
    --bm-accent: #f79250;
    --bm-accent-strong: #97552a;
    --bm-accent-soft: #fef4ee;
    --bm-accent-ring: rgba(247, 146, 80, .38);
    --yb-tint: #fff9f5;
    --yb-tint-line: #fbe2d2;
}

/* ---- Blue tints from backlink-maker.css, re-tinted for Y ---- */
.yb .bm-input > i { color: #e62117; }
.yb .bm-steps li.is-active .bm-step-dot {
    background: var(--bm-accent-strong); border-color: var(--bm-accent-strong);
}
.yb .bm-progress { background: linear-gradient(180deg, var(--yb-tint) 0%, var(--bm-surface) 100%); border-color: var(--yb-tint-line); }
.yb .bm-progress.is-done { border-color: rgba(23, 134, 79, .28); background: linear-gradient(180deg, #f1fbf5 0%, var(--bm-surface) 100%); }
.yb .bm-ring-track, .yb .bm-bar { stroke: #f6e6dc; background: #f6e6dc; }
.yb .bm-ring-bar { stroke: url(#ybRingGrad); }
.yb .bm-item:hover { border-color: var(--yb-tint-line); }
.yb .bm-item.is-checking {
    border-color: var(--yb-tint-line);
    background: linear-gradient(90deg, var(--bm-surface) 0%, var(--yb-tint) 50%, var(--bm-surface) 100%);
    background-size: 200% 100%;
}
.yb .bm-note { border-color: var(--yb-tint-line); }
@supports not (background: color-mix(in srgb, red 10%, white)) {
    .yb .bm-tile { border-color: var(--yb-tint-line); }
}
@keyframes yb-pulse { 0% { box-shadow: 0 0 0 0 var(--bm-accent-ring); } 70% { box-shadow: 0 0 0 8px rgba(247, 146, 80, 0); } 100% { box-shadow: 0 0 0 0 rgba(247, 146, 80, 0); } }
.yb .bm-steps li.is-active .bm-step-dot { animation-name: yb-pulse; }

/* ---- Link states: reachable / pinged / failed / skipped ---- */
.yb .bm-bar-seg.is-reachable { background: var(--bm-live); }
.yb .bm-bar-seg.is-pinged { background: #e39b1b; }
.yb .bm-stat.is-reachable { border-left-color: var(--bm-live); }
.yb .bm-stat.is-pinged { border-left-color: #e39b1b; }
.yb .bm-stat.is-skipped { border-left-color: #9aa0ae; }
.yb .bm-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.yb .bm-tabs [data-filter="reachable"] .bm-count { color: var(--bm-live); background: var(--bm-live-soft); }
.yb .bm-tabs [data-filter="pinged"] .bm-count { color: var(--bm-prot); background: var(--bm-prot-soft); }
.yb .bm-item.is-reachable .bm-status { color: var(--bm-live); background: var(--bm-live-soft); }
.yb .bm-item.is-pinged .bm-status { color: var(--bm-prot); background: var(--bm-prot-soft); }
.yb .bm-item.is-skipped .bm-status { color: var(--bm-ink-3); background: var(--bm-line-2); }

/* ---------------------------------------------------------------
   Video preview - the hero card
   --------------------------------------------------------------- */
.yb-preview {
    display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 20px; align-items: start;
    margin-top: 16px; padding: 14px; border-radius: var(--bm-r-lg);
    background: linear-gradient(135deg, var(--yb-tint) 0%, var(--bm-surface) 70%);
    border: 1px solid var(--yb-tint-line);
    box-shadow: 0 14px 34px -22px rgba(151, 85, 42, .45);
    animation: bm-rise .35s var(--bm-ease) both;
}

.yb-media { min-width: 0; }

.yb-thumb {
    position: relative; display: block; overflow: hidden;
    width: 100%; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 14px;
    background: #1b1b1f linear-gradient(110deg, #232328 30%, #33333a 50%, #232328 70%);
    background-size: 200% 100%;
    box-shadow: 0 18px 36px -18px rgba(16, 22, 43, .55), 0 0 0 1px rgba(16, 22, 43, .06);
    transition: transform .25s var(--bm-ease), box-shadow .25s var(--bm-ease);
}
.yb-thumb:hover { transform: translateY(-2px); box-shadow: 0 24px 42px -20px rgba(16, 22, 43, .6), 0 0 0 1px rgba(16, 22, 43, .08); }
.yb-thumb.is-loading { animation: bm-shimmer 1.2s linear infinite; }
.yb-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.yb-thumb img:not([hidden]) { animation: yb-fade .35s ease-out both; }
.yb-thumb::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .35) 100%);
}
.yb-thumb-play {
    position: absolute; left: 50%; top: 50%; z-index: 1; width: 72px; height: 50px; margin: -25px 0 0 -36px;
    display: grid; place-items: center; border-radius: 14px;
    color: #fff; background: rgba(230, 33, 23, .94); font-size: 1.3rem;
    box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .6);
    transition: transform .2s var(--bm-ease), background-color .2s;
}
.yb-thumb:hover .yb-thumb-play, .yb-thumb:focus-visible .yb-thumb-play { transform: scale(1.1); background: #e62117; }
.yb-thumb-res {
    position: absolute; right: 10px; bottom: 10px; z-index: 1;
    padding: 3px 8px; border-radius: 6px; font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums;
    color: #fff; background: rgba(0, 0, 0, .72);
}

.yb-meta { min-width: 0; }
.yb-kicker {
    display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 6px;
    font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--bm-accent-strong);
}
.yb-kicker.is-found { color: var(--bm-live); }
.yb-kicker.is-missing { color: var(--bm-prot); }
.yb-title {
    margin: 0; font-size: 1.16rem; font-weight: 800; line-height: 1.3; color: var(--bm-ink);
    overflow-wrap: anywhere;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.yb-title[hidden] { display: none; }
.yb-channel { margin: 4px 0 0; font-size: .88rem; color: var(--bm-ink-3); overflow-wrap: anywhere; }
.yb-channel:empty { display: none; }

.yb-idrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.yb-id {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border-radius: 999px;
    font: 700 .84rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--bm-ink);
    background: var(--bm-surface); border: 1px solid var(--bm-line);
}
.yb-id button {
    display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%;
    background: var(--bm-line-2); color: var(--bm-ink-2); cursor: pointer;
}
.yb-id button:hover { background: var(--bm-accent-soft); color: var(--bm-accent-strong); }
.yb .yb-watch {
    display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 700;
    color: var(--bm-accent-strong) !important; text-decoration: none;
}
.yb .yb-watch i { color: #e62117; }
.yb .yb-watch:hover { text-decoration: underline; }

/* Thumbnail sizes strip - spans the whole card under the hero row */
.yb-sizes { grid-column: 1 / -1; min-width: 0; padding-top: 12px; border-top: 1px dashed var(--yb-tint-line); }
.yb-sizes-head {
    display: flex; align-items: center; gap: 6px; margin: 0 0 8px;
    font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--bm-ink-3);
}
.yb-sizes ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.yb-sizes li {
    display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; gap: 8px 10px;
    padding: 8px; border-radius: 12px; background: var(--bm-surface); border: 1px solid var(--bm-line);
    transition: border-color .16s, box-shadow .16s;
    animation: bm-rise .3s var(--bm-ease) both;
}
.yb-sizes li:hover { border-color: var(--yb-tint-line); box-shadow: var(--bm-shadow); }
.yb-sizes li img { width: 48px; height: 27px; border-radius: 6px; object-fit: cover; background: #ddd; }
.yb-size-name { display: block; font-size: .86rem; font-weight: 700; color: var(--bm-ink); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yb-size-dims { display: block; font-size: .76rem; color: var(--bm-ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yb-size-actions { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.yb .yb-sizes .bm-icon-btn { width: auto; height: 32px; border-radius: 9px; font-size: .85rem; }
.yb-sizes li.is-skeleton { height: 90px; border-style: dashed; background: transparent; animation: none; }
.yb-sizes-note { margin: 6px 0 0; font-size: .84rem; color: var(--bm-prot); }@keyframes yb-fade { from { opacity: 0; } to { opacity: 1; } }

/* Shareable links */
.yb-share { margin-top: 10px; }
.yb-share summary {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
    font-size: .86rem; font-weight: 700; color: var(--bm-accent-strong);
}
.yb-share summary::-webkit-details-marker { display: none; }
.yb-share summary i { transition: transform .2s var(--bm-ease); }
.yb-share[open] summary i.fa-chevron-down { transform: rotate(180deg); }
.yb-share ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.yb-share li {
    display: grid; grid-template-columns: 116px minmax(0, 1fr) auto; align-items: center; gap: 8px;
    padding: 5px 5px 5px 10px; border-radius: 10px; background: var(--bm-surface); border: 1px solid var(--bm-line);
}
.yb-share-label { font-size: .78rem; font-weight: 700; color: var(--bm-ink-3); }
.yb-share code {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: .8rem; color: var(--bm-ink); background: none; padding: 0;
}
.yb .yb-share .bm-icon-btn { width: 32px; height: 32px; }

/* Recent videos carry a tiny thumbnail */
.yb .bm-recent button { display: inline-flex; align-items: center; gap: 8px; max-width: 280px; padding: 3px 12px 3px 3px; }
.yb .bm-recent img { width: 48px; height: 27px; border-radius: 999px 6px 6px 999px; object-fit: cover; flex: none; background: #ddd; }
.yb .bm-recent button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yb .bm-link-btn.yb-clear-history { font-size: .78rem; margin-left: 4px; color: var(--bm-ink-3); }

#ybResultsVideo { color: var(--bm-accent-strong); overflow-wrap: anywhere; }

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 860px) {
    .yb-preview { grid-template-columns: 1fr; }
    .yb-media { max-width: 640px; }
    .yb .bm-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .yb-preview { padding: 10px; gap: 14px; }
    .yb-media { margin: -10px -10px 0; }
    .yb-thumb { border-radius: 17px 17px 10px 10px; box-shadow: none; }
    .yb-sizes ul { grid-template-columns: 1fr; gap: 6px; }
    .yb-sizes li { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 6px; }
    .yb-size-actions { grid-column: auto; display: flex; }
    .yb .yb-sizes .bm-icon-btn { width: 34px; }
    .yb-sizes li.is-skeleton { height: 46px; }
    .yb-thumb-play { width: 60px; height: 42px; margin: -21px 0 0 -30px; font-size: 1.1rem; }
    .yb .bm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .yb-share li { grid-template-columns: minmax(0, 1fr) auto; }
    .yb-share-label { grid-column: 1 / -1; }
    .yb .bm-tabs button { flex: 1 1 calc(33% - 4px); }
    .yb .bm-recent button { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .yb-thumb.is-loading, .yb-thumb img:not([hidden]) { animation: none; }
    .yb-thumb:hover { transform: none; }
    .yb .bm-item.is-checking { background: var(--yb-tint); }
}
