/* Examples carousel and popup (landing/examples.js). Apple-style: big cards that snap, a preview of
   the real page on dotted paper, ‹ › round buttons; the popup is a native <dialog>. */

.dl-ex-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.dl-ex-head .dl-section-lead { margin-bottom: 0; }
.dl-ex-nav { display: flex; gap: 10px; flex: none; }

.dl-arrowbtn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--bench);
  color: var(--dl-navy); font: 500 1.5rem/1 var(--font-display); cursor: pointer; display: grid; place-items: center;
  transition: transform 200ms var(--dl-ease), border-color 200ms, background 200ms;
}
.dl-arrowbtn span { margin-top: -3px; }
.dl-arrowbtn:hover { border-color: var(--accent); color: var(--accent); }
.dl-arrowbtn:active { transform: scale(0.94); }

/* The track bleeds to the page edge on the right, like Apple's shelves. */
.dl-slides {
  list-style: none; margin: 0 calc(-1 * var(--dl-gutter)) 0 0; padding: 4px var(--dl-gutter) 28px 0;
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 0;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.dl-slides::-webkit-scrollbar { display: none; }
.dl-slide { flex: 0 0 clamp(260px, 30vw, 380px); scroll-snap-align: start; }
.dl-slide-card {
  width: 100%; height: 100%; display: flex; flex-direction: column; text-align: left; padding: 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 22px; background: var(--bench); overflow: hidden; font: inherit; color: inherit;
  transition: transform 400ms var(--dl-ease), box-shadow 400ms var(--dl-ease), border-color 200ms;
}
.dl-slide-card:hover { transform: translateY(-6px); border-color: transparent; box-shadow: 0 30px 50px -30px rgba(38, 42, 74, 0.5); }
.dl-slide-card:active { transform: translateY(-2px) scale(0.99); }
/* The paper stays light in both themes: the drawings are printed in black ink, like the exports. */
.dl-slide-art {
  aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 18px;
  background-color: #fbfcfd;
  background-image: radial-gradient(#dfe4ea 1.2px, transparent 1.3px);
  background-size: 16px 16px; border-bottom: 1px solid var(--line);
}
/* Every preview fits the same 4:3 box, however tall the page is (Lab 6), so the cards line up. */
.dl-slide-art { min-height: 0; overflow: hidden; }
.dl-slide-art svg { width: 100%; height: 100%; display: block; }
.dl-slide-art:empty::before, .dl-pop-loading::before {
  content: ''; width: 60%; height: 40%; border-radius: 12px;
  background: linear-gradient(90deg, var(--panel-2), var(--panel), var(--panel-2)); background-size: 200% 100%;
  animation: dl-shimmer 1.4s linear infinite;
}
@keyframes dl-shimmer { to { background-position: -200% 0; } }
.dl-slide-text { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px 22px; }
.dl-slide-tag { font: 500 0.7rem var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.dl-slide-tag b { color: var(--accent); font-weight: 500; }
.dl-slide-text strong { font: 600 1.15rem var(--font-display); color: var(--dl-navy); line-height: 1.25; }
.dl-slide-note { color: var(--muted); font-size: 0.9rem; }

/* Popup */
.dl-pop {
  width: min(1040px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: none; border-radius: 26px;
  background: var(--bench); color: var(--ink); box-shadow: 0 50px 100px -30px rgba(15, 18, 40, 0.55); overflow: hidden;
}
.dl-pop[open] { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); animation: dl-pop-in 450ms var(--dl-ease); }
.dl-pop::backdrop { background: rgba(20, 22, 40, 0.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: dl-fade 300ms ease; }
@keyframes dl-pop-in { from { opacity: 0; transform: translateY(24px) scale(0.97); } }
@keyframes dl-fade { from { opacity: 0; } }
.dl-pop-art {
  display: grid; place-items: center; padding: clamp(18px, 3vw, 36px); min-height: 360px;
  background-color: #fbfcfd; background-image: radial-gradient(#dfe4ea 1.2px, transparent 1.3px); background-size: 18px 18px;
}
.dl-pop-svg { display: grid; place-items: center; width: 100%; height: 100%; }
.dl-pop-svg svg { max-width: 100%; max-height: min(64vh, 560px); width: auto; height: auto; }
.dl-pop-loading { display: grid; place-items: center; width: 100%; height: 280px; }
.dl-pop-missing { color: var(--muted); }
.dl-pop-info { display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: clamp(24px, 4vw, 44px); }
.dl-pop-count { font: 500 0.76rem var(--font-mono); letter-spacing: 0.14em; color: var(--muted); margin: 0; }
.dl-pop-tag { font: 500 0.76rem var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 8px 0 0; }
.dl-pop h3 { font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.4rem); line-height: 1.1; letter-spacing: -0.02em; margin: 0; color: var(--dl-navy); text-wrap: balance; }
.dl-pop-note { color: var(--ink-2); font-size: 1.05rem; margin: 0 0 18px; }
.dl-pop-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dl-pop-nav { display: flex; gap: 8px; }
.dl-pop-actions .dl-btn { text-decoration: none; }
.dl-pop-close {
  position: absolute; top: 14px; right: 14px; z-index: 1; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bench); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.dl-pop-close:hover { border-color: var(--accent); color: var(--accent); }

:root[lang="th"] .dl-slide-tag, :root[lang="th"] .dl-pop-tag { font-family: var(--font-body); letter-spacing: 0; text-transform: none; }
:root[lang="th"] .dl-slide-text strong, :root[lang="th"] .dl-pop h3 { line-height: 1.35; }

@media (max-width: 760px) {
  .dl-ex-head { align-items: flex-start; flex-direction: column; }
  .dl-ex-nav { display: none; }
  .dl-slide { flex-basis: 80vw; }
  .dl-pop[open] { grid-template-columns: 1fr; overflow-y: auto; }
  .dl-pop-art { min-height: 220px; }
}
@media (prefers-reduced-motion: reduce) {
  .dl-pop[open], .dl-pop::backdrop, .dl-slide-art:empty::before, .dl-pop-loading::before { animation: none; }
  .dl-slide-card, .dl-arrowbtn { transition: none; }
}
