/* =========================================================================
   s7b.me — Shared Modals, Media Covers, Progress Box & Toast
   ========================================================================= */

[hidden] { display: none !important; }

/* Reusable Living s7b Logo */
.s7b-mark-svg { width: 100%; height: 100%; overflow: visible; display: block; }
.s7b-mark-svg path { fill: none; stroke: var(--ink); stroke-width: 4.6; stroke-linecap: round; stroke-linejoin: round; transition: stroke 0.3s; }
.s7b-mark-svg .band { stroke-width: 2; }
.s7b-mark-svg .s7b-pen, .s7b-mark-svg #pen { fill: var(--accent); stroke: none; transition: fill 0.3s; }

/* Boot Page Loader */
.page-loader {
  position: fixed; inset: 0; z-index: 160; background: var(--bg);
  display: grid; place-items: center;
  transition: opacity 0.34s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.34s;
}
.page-loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.s7b-loader-box { width: 156px; aspect-ratio: 2 / 1; direction: ltr; }

/* Real Media & Typographic Cover (ZERO cartoon SVGs) */
.typo-cover {
  width: 100%; height: 100%; padding: 20px 22px;
  background: var(--bg-2);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start;
  position: relative;
}
.typo-cover.icon-cover {
  align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--bg-2) 70%, var(--surface));
}
.brand-icon-img {
  width: 72px; height: 72px; border-radius: 18px; object-fit: cover;
  box-shadow: 0 10px 26px -10px rgba(32, 18, 10, 0.35);
}
.typo-cover-meta {
  position: absolute; bottom: 12px; inset-inline-end: 14px;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--ink-soft);
}
.typo-cover-kicker {
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
}
.typo-cover-title {
  font-size: 17px; font-weight: 600; line-height: 1.35; color: var(--ink); max-width: 90%;
}
.typo-cover-pct {
  font-family: "IBM Plex Mono", monospace; font-size: 11.5px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.media-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(18, 12, 9, 0.16); transition: background-color 0.2s;
}
.media-play span {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(253, 249, 241, 0.92); color: #3E271B;
  display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s, color 0.2s;
}
.media-play svg { width: 15px; height: 15px; fill: currentColor; stroke: none; margin-inline-start: 2px; }
.media-dur {
  position: absolute; bottom: 9px; inset-inline-end: 9px;
  padding: 2px 7px; border-radius: 5px;
  background: rgba(18, 12, 9, 0.78); color: #F6EFE2;
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-variant-numeric: tabular-nums;
}

/* Modal Backdrop & Sheet */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(16, 11, 8, 0.56); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 18px;
  animation: mFade 0.2s ease both;
}
.modal-sheet {
  position: relative; width: 100%; max-width: 740px; max-height: min(88vh, 820px);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 16px; box-shadow: 0 32px 72px -20px rgba(0,0,0,0.45);
  display: flex; flex-direction: column; overflow: hidden;
  animation: mSheet 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal-progress { position: relative; height: 2px; background: var(--border); flex-shrink: 0; }
.modal-progress-fill { position: relative; height: 100%; width: 0%; background: var(--accent); transition: width 0.08s linear; }
.modal-progress-dot {
  position: absolute; inset-inline-end: -3.5px; top: 50%; transform: translateY(-50%);
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.modal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--border); color: var(--ink);
  transition: background-color 0.18s, color 0.18s;
}
.modal-close:hover { background: var(--ink); color: var(--bg); }
.modal-close svg { width: 15px; height: 15px; }
.modal-body { padding: 24px 26px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.modal-body h2 { font-size: clamp(20px, 3.6vw, 26px); font-weight: 600; letter-spacing: -0.02em; line-height: 1.28; }
.modal-lead { font-size: 15px; color: var(--ink-2); }
.modal-media-wrap {
  position: relative; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: #140E0B; aspect-ratio: 16 / 9;
}
.modal-media-wrap > iframe, .modal-media-wrap > img { width: 100%; height: 100%; border: 0; object-fit: cover; display: block; }
.yt-cinema-loader {
  position: absolute; inset: 0; z-index: 2; background: #140E0B;
  display: grid; place-items: center; transition: opacity 0.32s ease;
}
.yt-cinema-loader.ready { opacity: 0; pointer-events: none; }
.yt-cinema-loader .yt-loader-mark { width: 140px; aspect-ratio: 2 / 1; direction: ltr; }
.yt-cinema-loader .s7b-mark-svg path { stroke: #F6EFE2; }
.yt-cinema-loader .s7b-mark-svg .s7b-pen { fill: #E5833B; }

.modal-prog-box {
  padding: 13px 15px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.modal-prog-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); }
.modal-prog-top strong { font-family: "IBM Plex Mono", monospace; color: var(--accent); font-variant-numeric: tabular-nums; }
.modal-prog-track { height: 4px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.modal-prog-track i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.detail-stat { padding: 11px 13px; border-radius: 9px; background: var(--bg); border: 1px solid var(--border); }
.detail-stat span { display: block; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 2px; }
.detail-stat strong { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.note-prose p { margin-bottom: 12px; font-size: 15.5px; line-height: 1.8; color: var(--ink); }
.note-takeaway { padding: 13px 16px; border-radius: 9px; background: var(--accent-soft); border-inline-start: 2.5px solid var(--accent); font-size: 14.5px; }
.quote-card-box { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; background: var(--bg); border: 1px solid var(--border); }
.quote-canvas { width: 100%; border-radius: 8px; border: 1px solid var(--border); display: block; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  transition: background-color 0.18s, color 0.18s, border-color 0.18s;
}
.m-btn-primary { background: var(--ink); color: var(--bg); }
.m-btn-primary:hover { background: var(--accent); color: #FFFDF8; }
.m-btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--border-strong); }
.m-btn-ghost:hover { background: var(--bg); }

.toast {
  position: fixed; bottom: 82px; left: 50%; transform: translateX(-50%) translateY(12px);
  padding: 9px 16px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 13px; font-weight: 500; box-shadow: 0 14px 32px -10px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none; z-index: 150;
  transition: opacity 0.22s, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes mFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mSheet { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

@media (max-width: 720px) {
  .detail-grid { grid-template-columns: 1fr; }
  .modal-body { padding: 18px 16px 24px; }
}
