/* Site promotion (Black Friday): ribbon, homepage banner, sidebar card, popups, deal page.
   The cards are dark in both themes; the yellow is the site's Python accent. */
:root {
  --bf-bg: #0b0f19;
  --bf-bg-2: #151c2c;
  --bf-ink: #ffffff;
  --bf-text: #d5dbe5;
  --bf-muted: #9ba6b8;
  --bf-line: rgba(255, 255, 255, .12);
  --bf-accent: #ffd43b;
  --bf-accent-2: #ffc21a;
  --bf-accent-ink: #1c1600;
  --bf-shelf: #ffffff;
  --bf-ring: rgba(255, 212, 59, .55);
}
html[data-theme="dark"] {
  --bf-bg: #101827;
  --bf-bg-2: #18233a;
  --bf-line: rgba(255, 212, 59, .22);
  --bf-shelf: #f3f5f9;
}

/* ---------------------------------------------------------------- shared */
.bf-dark { background: var(--bf-bg); color: var(--bf-text); border: 1px solid var(--bf-line); }
.bf-dark h2, .bf-dark h3, .bf-dark h4, .bf-dark strong, .bf-dark b { color: var(--bf-ink); }
.bf-dark a:not(.bf-btn) { color: var(--bf-accent); }
.bf-dark a:not(.bf-btn):hover { color: var(--bf-accent-2); }
.bf-tag {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bf-accent); color: var(--bf-accent-ink);
  font-size: 11.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 10px; line-height: 1.5; white-space: nowrap;
}
.bf-eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; color: var(--bf-muted); }
.bf-eyebrow [data-bf-countdown] { color: var(--bf-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.bf-hl { color: var(--bf-accent) !important; }
.bf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bf-accent); color: var(--bf-accent-ink) !important;
  font-weight: 800; font-size: 16px; line-height: 1.2; text-decoration: none !important;
  border: 0; border-radius: 12px; padding: 14px 22px;
  box-shadow: 0 10px 24px -10px rgba(255, 212, 59, .65);
  transition: transform .15s, background-color .15s, box-shadow .15s;
}
.bf-btn:hover, .bf-btn:focus-visible { background: var(--bf-accent-2); color: var(--bf-accent-ink) !important; transform: translateY(-1px); box-shadow: 0 14px 28px -12px rgba(255, 212, 59, .8); }
.bf-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.bf-btn s { opacity: .55; font-weight: 700; }
.bf-btn-block { width: 100%; }
.bf-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-variant-numeric: tabular-nums; }
.bf-price s { color: var(--bf-muted); font-size: 1.15rem; font-weight: 600; }
.bf-price strong { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--bf-ink); letter-spacing: -.01em; }
.bf-save { color: #86efac; font-weight: 700; font-size: 14px; }
.bf-shelf { background: var(--bf-shelf); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bf-shelf img { display: block; width: 100%; height: auto; }
.bf-code {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: transparent; color: var(--bf-text); border: 1px dashed rgba(255, 255, 255, .35);
  border-radius: 10px; padding: 11px 14px; font-size: 14px;
}
.bf-code b { font-family: var(--mono, monospace); letter-spacing: .04em; }
.bf-code:hover { border-color: var(--bf-accent); color: var(--bf-ink); }
.bf-code .bf-copied { display: none; color: #86efac; font-weight: 700; }
.bf-code.is-copied .bf-copied { display: inline; }
.bf-code.is-copied .fa-copy { display: none; }
.bf-fine { color: var(--bf-muted); font-size: 13px; margin: 0; }
.bf-x {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(15, 23, 42, .55); color: #fff; font-size: 20px; line-height: 32px; text-align: center;
}
.bf-x:hover { background: rgba(15, 23, 42, .85); }

/* ---------------------------------------------------------------- ribbon */
.bf-ribbon { background: var(--bf-bg); color: var(--bf-text); border-bottom: 1px solid var(--bf-line); font-size: 14px; }
.bf-ribbon[hidden] { display: none; }
.bf-ribbon-inner { display: flex; align-items: center; gap: 8px 14px; min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.bf-ribbon-text b, .bf-ribbon-text strong { color: #fff; }
.bf-ribbon-text s { color: var(--bf-muted); }
.bf-ribbon-time { color: var(--bf-muted); white-space: nowrap; }
.bf-ribbon-time b { color: #fff; font-variant-numeric: tabular-nums; }
.bf-ribbon-cta {
  margin-left: auto; white-space: nowrap; font-weight: 800; text-decoration: none !important;
  background: var(--bf-accent); color: var(--bf-accent-ink) !important; border-radius: 999px; padding: 6px 14px;
}
.bf-ribbon-cta:hover { background: var(--bf-accent-2); }
.bf-ribbon .bf-x { position: static; flex: none; width: 28px; height: 28px; line-height: 28px; font-size: 18px; background: transparent; color: var(--bf-muted); }
.bf-ribbon .bf-x:hover { color: #fff; background: rgba(255, 255, 255, .08); }
@media (max-width: 575.98px) {
  .bf-ribbon { font-size: 13px; }
  .bf-ribbon .bf-tag { display: none; }
  .bf-ribbon-cta { padding: 5px 11px; }
}

/* ---------------------------------------------------------------- homepage + deal page banner */
.bf-hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 28px; align-items: center;
  border-radius: var(--radius, 16px); padding: 32px; margin-bottom: 1.5rem; position: relative; overflow: hidden;
  background:
    radial-gradient(600px 260px at 0% 0%, rgba(255, 212, 59, .14), transparent 70%),
    radial-gradient(500px 300px at 100% 100%, rgba(47, 109, 181, .28), transparent 70%),
    var(--bf-bg);
}
.bf-hero-title { font-size: clamp(1.9rem, 3.4vw, 2.75rem); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; margin: 14px 0 10px; }
.bf-hero-sub { font-size: 1.05rem; margin: 0 0 14px; color: var(--bf-text); }
.bf-topics { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 18px; }
.bf-topics li { font-size: 13px; color: var(--bf-text); background: rgba(255, 255, 255, .07); border: 1px solid var(--bf-line); border-radius: 999px; padding: 3px 10px; }
.bf-hero .bf-price { margin-bottom: 16px; }
.bf-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.bf-hero-shelf { padding: 22px 14px; box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .6); }
@media (max-width: 991.98px) {
  .bf-hero { grid-template-columns: 1fr; padding: 22px; gap: 18px; }
  .bf-hero-shelf { order: -1; padding: 12px 8px; }
}
@media (max-width: 575.98px) {
  .bf-hero .bf-btn { width: 100%; }
  .bf-price strong { font-size: 1.85rem; }
}

/* homepage bundle card during the sale */
.tpc-home .ebook-card.bf-bundle-card, .bf-bundle-card { box-shadow: 0 0 0 2px var(--bf-ring), var(--shadow, 0 8px 24px -12px rgba(15, 23, 42, .18)) !important; }
.bf-bundle-card .bf-tag { position: absolute; top: 12px; left: 12px; }
.bf-bundle-card .bf-bundle-ends { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.bf-bundle-card .bf-bundle-ends b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bf-btn-sm { font-size: 14px; padding: 9px 16px; border-radius: 999px; box-shadow: none; }

/* ---------------------------------------------------------------- sidebar card */
.bf-side { position: relative; border-radius: var(--radius, 16px); padding: 18px; margin-bottom: 18px; }
.bf-side h4 { font-size: 1.2rem; font-weight: 800; line-height: 1.25; margin: 10px 0 12px; }
.bf-side .bf-shelf { padding: 10px 6px; margin-bottom: 14px; }
.bf-side .bf-price { margin-bottom: 12px; }
.bf-side .bf-price strong { font-size: 1.7rem; }
.bf-side .bf-fine { margin-top: 10px; text-align: center; }

/* ---------------------------------------------------------------- popup A: side card */
.bf-pop {
  position: fixed; right: 20px; bottom: 20px; z-index: 1060; width: 360px; max-width: calc(100vw - 24px);
  border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .55);
  opacity: 0; transform: translateY(24px); transition: opacity .25s ease, transform .25s ease;
}
.bf-pop.is-open { opacity: 1; transform: none; }
.bf-pop[hidden] { display: none; }
.bf-pop .bf-shelf { border-radius: 0; padding: 12px 8px; }
.bf-pop-body { padding: 16px 18px 18px; }
.bf-pop h3 { font-size: 1.3rem; font-weight: 800; line-height: 1.2; margin: 10px 0 6px; }
.bf-pop p { font-size: 14.5px; margin: 0 0 14px; }
@media (max-width: 575.98px) {
  .bf-pop { right: 12px; left: 12px; bottom: 12px; width: auto; }
  .bf-pop .bf-shelf { display: none; }
  .bf-pop-body { padding-right: 46px; }
}

/* ---------------------------------------------------------------- popup B: full screen */
.bf-modal { position: fixed; inset: 0; z-index: 1070; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bf-modal[hidden] { display: none; }
.bf-modal-backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .78); opacity: 0; transition: opacity .25s ease; }
.bf-modal-card {
  position: relative; width: 100%; max-width: 780px; max-height: calc(100vh - 32px); overflow: auto;
  border-radius: 20px; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7);
  opacity: 0; transform: scale(.96) translateY(12px); transition: opacity .25s ease, transform .25s ease;
}
.bf-modal.is-open .bf-modal-backdrop { opacity: 1; }
.bf-modal.is-open .bf-modal-card { opacity: 1; transform: none; }
.bf-modal .bf-shelf { border-radius: 0; padding: 20px 16px; }
.bf-modal-body { padding: 24px 32px 26px; text-align: center; }
.bf-modal-body .bf-eyebrow { justify-content: center; }
.bf-modal-body h3 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; margin: 12px 0 8px; }
.bf-modal-body > p { font-size: 1.05rem; margin: 0 auto 16px; max-width: 560px; }
.bf-book-list { list-style: none; padding: 0; margin: 0 auto 20px; max-width: 600px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; text-align: left; font-size: 14.5px; }
.bf-book-list li { display: flex; gap: 8px; align-items: baseline; }
.bf-book-list i { color: var(--bf-accent); width: 16px; text-align: center; flex: none; }
.bf-modal .bf-btn { min-width: 300px; }
.bf-nothanks { display: block; margin: 12px auto 0; background: none; border: 0; color: var(--bf-muted); font-size: 13.5px; text-decoration: underline; cursor: pointer; }
.bf-nothanks:hover { color: #fff; }
html.bf-lock, html.bf-lock body { overflow: hidden; }
@media (max-width: 575.98px) {
  .bf-modal-body { padding: 18px 18px 20px; }
  .bf-book-list { grid-template-columns: 1fr; }
  .bf-modal .bf-btn { min-width: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .bf-pop, .bf-modal-card, .bf-modal-backdrop, .bf-btn { transition: none; }
}

/* ---------------------------------------------------------------- deal page */
.bf-page { padding-top: 28px; padding-bottom: 40px; }
.bf-section-title { font-size: 1.5rem; font-weight: 800; color: var(--ink); margin: 34px 0 16px; }
.bf-books { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.bf-book { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 16px 18px; display: flex; gap: 14px; }
.bf-book > i { color: var(--brand); font-size: 20px; width: 26px; text-align: center; margin-top: 3px; flex: none; }
.bf-book h3 { font-size: 1.02rem; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.bf-book p { font-size: 14.5px; color: var(--body); margin: 0 0 6px; }
.bf-book a { font-size: 13.5px; font-weight: 600; }
.bf-bonus { border-style: dashed; }
.bf-bonus > i { color: #d97706; }
.bf-faq { max-width: 760px; }
.bf-faq h3 { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin: 18px 0 4px; }
.bf-faq p { margin: 0; }
.bf-cta-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; border-radius: 16px; padding: 20px 24px; margin-top: 34px; }
.bf-cta-bar h3 { font-size: 1.25rem; font-weight: 800; margin: 0; }
.bf-ended { text-align: center; padding: 60px 16px; }
