/* ========================================
   /decks, /slides, /deck-builder
   Layers on styles-v18.css and media.css (hero, sections, sheet cards, share modal).
   ======================================== */

/* ---- slim hero + the three-page menu ---- */
.page-hero--slim { padding-bottom: 26px; }
.page-hero--slim .page-hero__desc { margin-top: 16px; }
/* the builder is a tool: a small title, so the workspace fills the screen */
.page-hero--tool { padding-top: clamp(78px, 9vh, 96px); padding-bottom: 14px; }
.page-hero--tool .page-hero__sub { margin-bottom: 8px; }
.page-hero--tool h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.deck-tabs {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: center; gap: 4px; flex-wrap: wrap;
  padding: 0 var(--pad); background: rgba(10, 10, 10, .95);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.deck-tabs a {
  padding: 16px 20px 14px; font-size: .72rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700;
  color: var(--grey); text-decoration: none; border-bottom: 2px solid transparent;
}
.deck-tabs a:hover { color: var(--white); }
.deck-tabs a[aria-current="page"] { color: var(--white); border-bottom-color: var(--orange); }
.deck-tabs a b { font-weight: 400; color: var(--orange); margin-left: 6px; letter-spacing: 0; }

/* shared buttons */
.dk-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: 11px 15px; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22);
  white-space: nowrap; transition: background .2s, border-color .2s;
}
.dk-btn:hover { background: var(--orange); border-color: var(--orange); }
.dk-btn--primary { background: var(--orange); border-color: var(--orange); }
.dk-btn--primary:hover { background: var(--orange-hi); border-color: var(--orange-hi); }
.dk-btn--quiet { background: none; border-color: transparent; color: var(--grey); }
.dk-btn--quiet:hover { background: none; border-color: transparent; color: #fff; }
.dk-btn--danger:hover { background: #8e2b2b; border-color: #8e2b2b; }
.dk-btn[hidden] { display: none; }
.dk-btn[disabled] { opacity: .45; cursor: default; }
.dk-btn[disabled]:hover { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .22); }
.dk-btn--primary[disabled]:hover { background: var(--orange); border-color: var(--orange); }
.dk-input, .dk-select {
  padding: 10px 12px; font: inherit; font-size: .85rem; color: var(--white);
  background: #0d0d0d; border: 1px solid rgba(255, 255, 255, .18); outline: none;
}
.dk-select { cursor: pointer; font-size: .8rem; }
.dk-input:focus, .dk-select:focus { border-color: var(--orange); }

/* ========== /decks ========== */
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sec-head .page-section__title { margin: 0 auto 0 0; }
.sec-head .dk-input { width: 220px; }

/* deck cards are 16:9 */
.sheet-grid.deck-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 34px 26px; margin-top: 24px; }
.deck-grid .sheet-card__preview { aspect-ratio: 16 / 9; background: #000; }
.deck-grid .sheet-card__preview::after { background: linear-gradient(115deg, #161616 30%, #232323 50%, #161616 70%); background-size: 300% 100%; }
.deck-grid .sheet-card__actions { flex-wrap: wrap; gap: 6px; padding: 10px; }
.deck-grid .sheet-act { padding: 7px 10px; font-size: .6rem; }
.deck-grid .sheet-card__meta { padding-top: 14px; }
.deck-grid .sheet-card__title { font-size: .92rem; }
.deck-grid .sheet-card__sub { font-size: .66rem; }

/* one row per speech, opens to its decks */
.speech-list { margin-top: 22px; border-top: 1px solid rgba(255, 255, 255, .1); }
.speech { border-bottom: 1px solid rgba(255, 255, 255, .1); }
.speech > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 18px; padding: 16px 4px;
}
.speech > summary::-webkit-details-marker { display: none; }
.speech > summary:hover .speech__name { color: var(--orange); }
.speech__text { flex: 1 1 auto; min-width: 0; }
.speech__name { display: block; font-family: var(--display); font-weight: 900; font-size: 1.02rem; letter-spacing: .03em; text-transform: uppercase; transition: color .2s; }
.speech__meta { display: block; margin-top: 5px; font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--grey); }
.speech__chev { flex: none; width: 12px; height: 12px; border-right: 2px solid var(--grey); border-bottom: 2px solid var(--grey); transform: rotate(45deg); margin: 0 8px 6px; transition: transform .2s; }
.speech[open] > summary .speech__chev { transform: rotate(225deg); margin-bottom: 0; margin-top: 6px; }
.speech__body { padding: 0 4px 34px; }
.speech__body .deck-grid { margin-top: 6px; }
.speech__more { display: inline-block; margin-top: 26px; font-size: .64rem; letter-spacing: .18em; font-weight: 700; text-transform: uppercase; color: var(--orange); text-decoration: none; }
.speech__more:hover { color: #fff; }

/* ========== slide library (/slides) ========== */
.lib { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 34px; padding: 30px var(--pad) 80px; max-width: 1600px; margin: 0 auto; background: var(--black); }
.lib-side { position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 80px); overflow: auto; padding-right: 6px; scrollbar-width: thin; }
.lib-side .dk-input { width: 100%; }
.tree { margin-top: 16px; }
.tree__item {
  display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 8px 10px; text-align: left; cursor: pointer;
  font: inherit; font-size: .82rem; line-height: 1.3; color: var(--warm); background: none; border: 0; border-left: 2px solid transparent;
}
.tree__item b { margin-left: auto; font-weight: 400; font-size: .72rem; color: var(--grey); }
.tree__item:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.tree__item[aria-current="true"] { color: #fff; border-left-color: var(--orange); background: rgba(194, 90, 48, .12); }
.tree__speech { margin-top: 2px; }
.tree__speech > .tree__item { font-weight: 700; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.tree__twist { flex: none; width: 7px; height: 7px; border-right: 1.5px solid var(--grey); border-bottom: 1.5px solid var(--grey); transform: rotate(-45deg); margin-right: 2px; transition: transform .15s; position: relative; top: -1px; }
.tree__speech.is-open .tree__twist { transform: rotate(45deg); }
.tree__decks { display: none; padding: 2px 0 8px 14px; }
.tree__speech.is-open .tree__decks { display: block; }
.tree__decks .tree__item { font-size: .78rem; padding: 6px 10px; color: #bdb5a8; }
.tree__sep { height: 1px; margin: 10px 0; background: rgba(255, 255, 255, .08); }
.lib-side__toggle { display: none; }

.lib-bar {
  position: sticky; top: 49px; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
  padding: 12px 0; background: rgba(10, 10, 10, .95);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.lib-count { margin-right: auto; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--grey); }
.lib-count strong { color: var(--white); font-weight: 700; }
.lib-group, .lib-size { display: flex; align-items: center; gap: 8px; font-size: .64rem; letter-spacing: .2em; text-transform: uppercase; color: var(--grey); cursor: pointer; }
.lib-group input { accent-color: var(--orange); width: 16px; height: 16px; }
.lib-size input { width: 130px; accent-color: var(--orange); }

.lib-grid {
  --thumb: 240px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--thumb), 1fr));
  gap: 22px 18px; margin-top: 22px;
}
.lib-tile { position: relative; display: block; padding: 0; text-align: left; color: inherit; font: inherit; background: none; border: 0; cursor: pointer; }
.lib-tile__img {
  display: block; position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #111;
  border: 1px solid rgba(255, 255, 255, .08); transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.lib-tile__img img { width: 100%; height: 100%; object-fit: cover; }
.lib-tile__versions {
  position: absolute; right: 8px; top: 8px; padding: 4px 8px;
  font-size: .56rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700;
  color: #fff; background: rgba(0, 0, 0, .72); border: 1px solid var(--orange);
  box-shadow: 4px 4px 0 -1px rgba(0, 0, 0, .72), 4px 4px 0 0 var(--orange);
}
.lib-grid.is-small .lib-tile__versions { font-size: 0; padding: 0; width: 12px; height: 12px; background: var(--orange); }
.lib-tile__open { display: block; width: 100%; padding: 0; text-align: left; color: inherit; font: inherit; background: none; border: 0; cursor: pointer; }
.lib-tile__open:focus-visible { outline: none; }
.lib-tile:hover .lib-tile__img, .lib-tile__open:focus-visible .lib-tile__img { transform: translateY(-3px); border-color: var(--orange); box-shadow: 0 14px 30px rgba(0, 0, 0, .5); }
.lib-tile__label { display: block; margin-top: 9px; font-size: .8rem; line-height: 1.35; color: var(--warm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tile__tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.lib-tag { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; padding: 3px 6px; color: var(--grey); border: 1px solid rgba(255, 255, 255, .14); }
.lib-tag--more { color: var(--orange); border-color: rgba(194, 90, 48, .5); }
.lib-grid.is-small .lib-tile__tags, .lib-grid.is-small .lib-tile__label { display: none; }
.lib-empty { margin-top: 40px; color: var(--grey); }

/* picking slides: a tick box on each tile */
.lib-pick {
  position: absolute; left: 8px; top: 8px; z-index: 2; width: 28px; height: 28px; padding: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .6); border: 1.5px solid rgba(255, 255, 255, .75); border-radius: 50%;
  opacity: 0; transition: opacity .15s, background .15s;
}
.lib-pick::after { content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); opacity: .5; }
.lib-tile:hover .lib-pick, .lib-tile:focus-within .lib-pick, .lib-grid.is-picking .lib-pick { opacity: 1; }
.lib-pick:hover { background: rgba(194, 90, 48, .7); }
.lib-tile.is-picked .lib-pick { opacity: 1; background: var(--orange); border-color: var(--orange); }
.lib-tile.is-picked .lib-pick::after { opacity: 1; }
.lib-tile.is-picked .lib-tile__img { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }

/* the picked-slides tray */
.tray {
  position: fixed; left: 50%; bottom: 18px; z-index: 60; transform: translate(-50%, 140%);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  width: min(900px, calc(100% - 24px)); padding: 12px 14px;
  background: #1b1b1b; border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 18px 50px rgba(0, 0, 0, .7);
  transition: transform .25s ease;
}
.tray.is-on { transform: translate(-50%, 0); }
.tray__strip { display: flex; gap: 4px; flex: 1 1 200px; min-width: 0; overflow: hidden; }
.tray__strip img { width: 64px; height: 36px; object-fit: cover; flex: none; border: 1px solid rgba(255, 255, 255, .1); }
.tray__count { font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; white-space: nowrap; }
.tray .dk-select { max-width: 220px; }
.tray .dk-select[hidden] { display: none; }

/* ---- slide viewer ---- */
.viewer[hidden] { display: none; }
.viewer { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(6, 6, 6, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.viewer__box { width: min(1180px, 100%); max-height: 100%; display: flex; flex-direction: column; background: var(--dark); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 40px 100px rgba(0, 0, 0, .7); overflow: auto; }
.viewer__stage { position: relative; aspect-ratio: 16 / 9; background: #000; flex: none; }
.viewer__stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.viewer__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; font-size: 22px; cursor: pointer; opacity: .75; }
.viewer__nav:hover { opacity: 1; background: var(--orange); }
.viewer__nav--prev { left: 12px; }
.viewer__nav--next { right: 12px; }
.viewer__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 18px 22px 20px; }
.viewer__title { flex: 1 1 320px; min-width: 0; }
.viewer__title h3 { font-family: var(--display); font-weight: 900; font-size: .95rem; line-height: 1.35; text-transform: uppercase; }
.viewer__title p { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.viewer__title .lib-tag { cursor: pointer; }
.viewer__title .lib-tag:hover { color: #fff; border-color: var(--orange); }
.viewer__versions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; }
.viewer__vlabel { font-size: .6rem; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); margin-right: 4px; }
.viewer__v { padding: 0; border: 2px solid transparent; background: #000; cursor: pointer; line-height: 0; opacity: .7; }
.viewer__v img { width: 96px; height: 54px; object-fit: cover; }
.viewer__v:hover { opacity: 1; }
.viewer__v[aria-pressed="true"] { border-color: var(--orange); opacity: 1; }
.viewer__acts { display: flex; flex-wrap: wrap; gap: 8px; }
.viewer__acts button, .viewer__acts a {
  font: inherit; font-size: .66rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 700; cursor: pointer; text-decoration: none;
  padding: 11px 15px; color: #fff; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .22);
}
.viewer__acts button:hover, .viewer__acts a:hover { background: var(--orange); border-color: var(--orange); }
.viewer__acts .is-primary { background: var(--orange); border-color: var(--orange); }
.viewer__acts .is-primary:hover { background: var(--orange-hi); }
.viewer__acts button[disabled] { opacity: .55; cursor: wait; }
.viewer__close { position: absolute; top: 14px; right: 18px; z-index: 2; background: none; border: 0; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; opacity: .7; }
.viewer__close:hover { opacity: 1; }

/* ========== deck builder ========== */
.builder { display: flex; flex-direction: column; height: calc(100vh - 49px); min-height: 600px; background: var(--black); }
.builder__top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px var(--pad-b);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.builder { --pad-b: clamp(14px, 2vw, 28px); }
.builder__name {
  flex: 1 1 260px; min-width: 0; padding: 8px 10px; font-family: var(--display); font-weight: 900; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .02em;
  color: var(--white); background: transparent; border: 1px solid transparent; outline: none;
}
.builder__name:hover { border-color: rgba(255, 255, 255, .14); }
.builder__name:focus { border-color: var(--orange); background: #0d0d0d; }
.builder__status { font-size: .64rem; letter-spacing: .16em; text-transform: uppercase; color: var(--grey); white-space: nowrap; }
.builder__status.is-dirty { color: var(--gold); }
.builder__acts { display: flex; flex-wrap: wrap; gap: 6px; }
.builder__panes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.pane { display: flex; flex-direction: column; min-height: 0; }
.pane + .pane { border-left: 1px solid rgba(255, 255, 255, .08); }
.pane__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 12px var(--pad-b); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pane__title { font-size: .66rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 700; margin-right: auto; }
.pane__title small { font-weight: 400; color: var(--grey); letter-spacing: .14em; margin-left: 8px; }
.pane__head .dk-input { flex: 1 1 160px; min-width: 0; padding: 8px 10px; font-size: .8rem; }
.pane__head .dk-select { flex: 1 1 180px; min-width: 0; max-width: 100%; padding: 8px 10px; }
.pane__head .dk-btn { padding: 8px 12px; }
.pane__body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px var(--pad-b) 40px; scrollbar-width: thin; }
.pane__hint { font-size: .74rem; color: var(--grey); padding: 8px var(--pad-b); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.pane__hint button { font: inherit; color: var(--orange); background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; }

.bgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--bthumb, 170px), 1fr)); gap: 16px 12px; }
.btile { position: relative; cursor: grab; user-select: none; -webkit-user-select: none; }
.btile__img { position: relative; display: block; aspect-ratio: 16 / 9; background: #111; border: 1px solid rgba(255, 255, 255, .1); overflow: hidden; }
.btile__img img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.btile__n { position: absolute; left: 0; top: 0; min-width: 24px; padding: 3px 6px; font-size: .64rem; font-weight: 700; text-align: center; color: #fff; background: rgba(0, 0, 0, .72); }
.btile__label { display: block; margin-top: 6px; font-size: .7rem; line-height: 1.3; color: #bdb5a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btile__v { position: absolute; right: 6px; bottom: 6px; padding: 2px 6px; font-size: .52rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .72); border: 1px solid var(--orange); cursor: pointer; }
.btile__x, .btile__add {
  position: absolute; top: 5px; right: 5px; z-index: 2; width: 28px; height: 28px; padding: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 17px; line-height: 1; cursor: pointer;
  color: #fff; background: rgba(0, 0, 0, .7); border: 1px solid rgba(255, 255, 255, .5); opacity: 0; transition: opacity .15s, background .15s;
}
.btile:hover .btile__x, .btile:hover .btile__add, .btile:focus-within .btile__x, .btile:focus-within .btile__add { opacity: 1; }
.btile__x:hover { background: #8e2b2b; border-color: #8e2b2b; }
.btile__add { background: var(--orange); border-color: var(--orange); font-size: 20px; }
.btile__add:hover { background: var(--orange-hi); }
.btile.is-sel .btile__img { border-color: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.btile.is-in .btile__img::after { content: "In deck"; position: absolute; left: 6px; bottom: 6px; padding: 2px 6px; font-size: .52rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: #fff; background: rgba(45, 144, 144, .9); }
.btile.is-flash .btile__img { animation: bflash 1s ease; }
@keyframes bflash { 0% { box-shadow: 0 0 0 3px var(--gold); } 100% { box-shadow: 0 0 0 0 transparent; } }
.btile.sortable-ghost { opacity: .35; }
.btile.sortable-chosen .btile__img { border-color: var(--orange); }
.bgrid--deck .btile.sortable-ghost .btile__img { box-shadow: 0 0 0 2px var(--gold); }
.builder__empty { grid-column: 1 / -1; padding: 50px 20px; text-align: center; color: var(--grey); border: 1px dashed rgba(255, 255, 255, .2); line-height: 1.7; font-size: .9rem; }
.builder__empty .dk-select { margin-top: 14px; max-width: 100%; }
.builder__more { grid-column: 1 / -1; justify-self: center; }

@media (max-width: 900px) {
  .lib { grid-template-columns: 1fr; gap: 0; padding-top: 16px; }
  .lib-side { position: static; max-height: none; overflow: visible; }
  .lib-side__toggle { display: flex; width: 100%; margin-top: 10px; justify-content: center; }
  .lib-side .tree { display: none; }
  .lib-side.is-open .tree { display: block; }
  .lib-bar { top: 49px; }
  .builder { height: auto; min-height: 0; }
  .builder__panes { grid-template-columns: 1fr; }
  .pane + .pane { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
  .pane__body { max-height: 70vh; }
}
@media (max-width: 700px) {
  .sec-head .dk-input { width: 100%; }
  .lib-size input { width: 100px; }
  .sheet-grid.deck-grid { grid-template-columns: 1fr; }
  .viewer { padding: 0; align-items: flex-start; }
  .viewer__nav { width: 38px; height: 38px; font-size: 18px; }
  .deck-tabs { flex-wrap: nowrap; gap: 0; padding: 0 8px; }
  .deck-tabs a { padding: 14px 9px 12px; font-size: .62rem; letter-spacing: .1em; white-space: nowrap; }
  .lib-bar { position: static; }
  .btile__x, .btile__add { opacity: 1; }
}
