/* Séquence « source ouverte » (copie d'essai) : la dernière carte s'ouvre sur une page d'article,
   la caméra zoome et surligne comme dans un documentaire. Registre vente : 600–1 300 ms, une courbe. */
:root {
  --sd-paper: #f6f4ef;
  --sd-ink: #1e1e1e;
  --sd-ink-2: #555a54;
  --sd-rule: rgba(30,30,30,.14);
  --sd-brand: #23395b;
  --sd-mark: rgba(0,168,169,.38);
  --sd-w: min(960px, calc(100vw - 64px));
  --sd-h: min(600px, 66vh);
}

.source-demo { position: relative; z-index: 2; pointer-events: none; min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 16px; padding: 64px 0 32px; }
.sd-stage { position: relative; width: var(--sd-w); height: var(--sd-h); }

/* La carte qui s'ouvre : même modèle que les cartes des piles (classes .content .card),
   posée à plat au centre. Une jumelle suit la trajectoire de la pile puis décroche (voir le JS). */
.sd-holder.content { position: absolute; inset: 0; width: auto; min-height: 0; transform: none; }
.sd-holder .card { --color-card: var(--color-card-1); }
.card.is-off { visibility: hidden; }
/* Fenêtre de navigateur : angles droits, filet, surface neutre. */
.sd-window { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--sd-paper); border: 1px solid var(--fh-line); box-shadow: 0 24px 64px rgba(0,0,0,.45); }
.sd-bar { flex: none; display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 16px; background: #1b1c1b; border-bottom: 1px solid var(--fh-line); }
.sd-dots { display: flex; gap: 8px; }
.sd-dots i { width: 10px; height: 10px; border-radius: 999px; background: rgba(186,196,184,.28); }
.sd-url { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 12px; background: #141414; color: var(--fh-sage); font: 400 12.5px/1 'Geist', sans-serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-lock { flex: none; width: 9px; height: 7px; margin-top: 4px; border: 1.5px solid var(--fh-sage); border-radius: 1px; position: relative; }
.sd-lock::before { content: ''; position: absolute; left: 50%; bottom: 100%; width: 5px; height: 5px; translate: -50% 0; border: 1.5px solid var(--fh-sage); border-bottom: 0; border-radius: 4px 4px 0 0; }

.sd-viewport { position: relative; flex: 1; overflow: hidden; }
.sd-page { position: absolute; left: 0; top: 0; width: 100%; padding: 24px 48px 48px; transform-origin: 0 0; color: var(--sd-ink); font: 400 15px/1.6 'Geist', sans-serif; text-align: left; text-transform: none; }

/* Le site fictif : sobre, signé, daté, sourcé — les signes d'une source fiable. */
.sd-mast { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 12px; border-bottom: 2px solid var(--sd-ink); }
.sd-logo { font: 600 26px/1 'Cormorant Garamond', serif; color: var(--sd-brand); letter-spacing: .01em; }
.sd-logo em { font-style: italic; font-weight: 500; }
.sd-tagline { font-size: 12.5px; color: var(--sd-ink-2); }
.sd-mast nav { margin-left: auto; display: flex; gap: 16px; font: 500 12.5px/1 'Geist', sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--sd-ink-2); }
.sd-kicker { margin: 24px 0 8px; font: 500 12.5px/1 'Geist', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--sd-brand); }
.sd-title { margin: 0 0 12px; max-width: 760px; font: 600 40px/1.12 'Cormorant Garamond', serif; color: var(--sd-ink); text-transform: none; }
.sd-byline { margin: 0 0 24px; font-size: 13px; color: var(--sd-ink-2); }
.sd-byline b { color: var(--sd-ink); font-weight: 500; }
.sd-check::before { content: '✓ '; color: var(--sd-brand); }
.sd-fig { margin: 0 0 24px; }
.sd-img { width: 100%; aspect-ratio: 16 / 7; background: 50% 30% / cover no-repeat; }
.sd-fig figcaption { margin-top: 8px; font-size: 12.5px; color: var(--sd-ink-2); }
.sd-body { display: grid; grid-template-columns: minmax(0, 1fr) 220px; column-gap: 48px; }
.sd-body > p { grid-column: 1; margin: 0 0 16px; font-size: 17px; line-height: 1.7; }
.sd-body > p.sd-key { margin-top: 48px; }
.sd-refs { grid-column: 2; grid-row: 1 / span 3; align-self: start; padding-left: 16px; border-left: 2px solid var(--sd-rule); font-size: 12.5px; line-height: 1.5; color: var(--sd-ink-2); }
.sd-refs b { display: block; margin-bottom: 8px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--sd-ink); }
.sd-refs ol { margin: 0; padding-left: 16px; }

/* Surligneur : la bande se dessine de gauche à droite (--hl de 0 à 100 %). */
.sd-page mark {
  color: inherit; background: linear-gradient(var(--sd-mark), var(--sd-mark)) no-repeat 0 88% / var(--hl, 0%) 82%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 2px;
}

.sd-chip {
  position: absolute; left: 0; top: 0; margin: 0; padding: 0 12px; height: 34px; display: flex; align-items: center;
  background: var(--fh-accent); color: var(--fh-bg);
  font: 500 12.5px/1 'Geist', sans-serif; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; pointer-events: none;
}
.sd-note { margin: 0; font-size: 12.5px; color: var(--fh-sage-2); }

@media (max-width: 600px) {
  :root { --sd-w: calc(100vw - 32px); --sd-h: 64svh; }
  .sd-page { padding: 16px 16px 32px; font-size: 14px; }
  .sd-mast nav { display: none; }
  .sd-logo { font-size: 22px; }
  .sd-title { font-size: 28px; }
  .sd-body { grid-template-columns: 1fr; }
  .sd-body > p { font-size: 15px; }
  .sd-refs { grid-column: 1; grid-row: auto; margin-top: 8px; }
  .sd-url { font-size: 12.5px; }
  .sd-dots { display: none; }
}

/* ── Séquence « vidéos » : fiche d'archive neutre (fictive), téléchargement, puis lecteur traité ── */
:root { --vd-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 1.2 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.vd-page { position: absolute; inset: 0; padding: 24px 48px; color: var(--sd-ink); font: 400 15px/1.5 'Geist', sans-serif; text-align: left; text-transform: none; overflow: hidden; }
.vd-mast { display: flex; align-items: baseline; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--sd-rule); }
.vd-logo { font: 600 20px/1 'Geist', sans-serif; letter-spacing: -.01em; color: var(--sd-ink); }
.vd-tagline { font-size: 12.5px; color: var(--sd-ink-2); }
.vd-crumbs { margin: 16px 0; font-size: 12.5px; color: var(--sd-ink-2); }
.vd-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.vd-thumb { position: relative; aspect-ratio: 4 / 3; background: center / cover no-repeat #000; }
.vd-play { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; translate: -50% -50%; border-radius: 999px; background: rgba(20,20,20,.72); }
.vd-play::after { content: ''; position: absolute; left: 22px; top: 17px; border-left: 16px solid #eeebe5; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.vd-dur { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; background: rgba(20,20,20,.8); color: #eeebe5; font-size: 12.5px; }
.vd-title { margin: 0 0 16px; font: 600 24px/1.2 'Geist', sans-serif; letter-spacing: -.01em; color: var(--sd-ink); text-transform: none; }
.vd-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 24px; font-size: 13px; }
.vd-meta dt { color: var(--sd-ink-2); }
.vd-meta dd { margin: 0; color: var(--sd-ink); }
.vd-dl { display: inline-flex; align-items: center; height: 44px; padding: 0 16px; background: var(--sd-brand); color: #f6f4ef; font: 500 13px/1 'Geist', sans-serif; transform-origin: 50% 50%; }
.vd-progress { height: 4px; margin-top: 16px; background: var(--sd-rule); }
.vd-progress i { display: block; height: 100%; width: var(--dl, 0%); background: var(--sd-brand); }
.vd-status { margin: 8px 0 0; font-size: 12.5px; color: var(--sd-ink-2); font-variant-numeric: tabular-nums; }

/* Lecteur : s'ouvre depuis la vignette et remplit la scène. Traitement documentaire piloté par variables. */
.vd-player { position: absolute; inset: 0; overflow: hidden; background: #000; visibility: hidden; --sep: 0; --con: 1; --sat: 1; --bar: 0%; --grain: 0; }
.vd-player video { width: 100%; height: 100%; object-fit: cover; display: block; filter: sepia(var(--sep)) contrast(var(--con)) saturate(var(--sat)); }
.vd-grain { position: absolute; inset: -20%; background: var(--vd-grain); opacity: var(--grain); mix-blend-mode: overlay; animation: vd-grain .5s steps(4) infinite; pointer-events: none; }
@keyframes vd-grain { 0% { transform: translate(0,0) } 25% { transform: translate(-6%,4%) } 50% { transform: translate(5%,-3%) } 75% { transform: translate(-3%,-6%) } 100% { transform: translate(0,0) } }
.vd-bars i { position: absolute; left: 0; right: 0; height: var(--bar); background: #000; }
.vd-bars i:first-child { top: 0; } .vd-bars i:last-child { bottom: 0; }
.vd-lower { position: absolute; left: 32px; bottom: calc(var(--bar) + 24px); margin: 0; padding-left: 12px; border-left: 2px solid var(--fh-accent); color: #eeebe5; font: 500 13px/1.4 'Geist', sans-serif; letter-spacing: .14em; text-transform: uppercase; opacity: 0; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.vd-lower b { font-weight: 600; }
.vd-credit { position: absolute; right: 24px; bottom: calc(var(--bar) + 24px); margin: 0; color: rgba(238,235,229,.85); font: 400 12.5px/1 'Geist', sans-serif; opacity: 0; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.vd-chip { z-index: 3; }

@media (max-width: 600px) {
  .vd-page { padding: 16px; font-size: 13px; }
  .vd-tagline { display: none; }
  .vd-grid { grid-template-columns: 1fr; gap: 16px; }
  .vd-thumb { aspect-ratio: 16 / 9; }
  .vd-title { font-size: 18px; margin-bottom: 8px; }
  .vd-meta dl { margin-bottom: 16px; font-size: 12.5px; gap: 4px 12px; }
  /* Sur téléphone : on garde l'essentiel (producteur, droits) pour que le téléchargement reste visible. */
  .vd-crumbs { display: none; }
  .vd-meta dt:nth-of-type(1), .vd-meta dd:nth-of-type(1), .vd-meta dt:nth-of-type(2), .vd-meta dd:nth-of-type(2), .vd-meta dt:nth-of-type(5), .vd-meta dd:nth-of-type(5) { display: none; }
  .vd-mast { padding-bottom: 8px; margin-bottom: 16px; }
  .vd-lower { left: 16px; font-size: 12.5px; }
  .vd-credit { right: 16px; left: 16px; bottom: calc(var(--bar) + 56px); }
}
@media (prefers-reduced-motion: reduce) { .vd-grain { animation: none; } }

/* Repli si la lecture automatique est refusée : bouton lecture cliquable sur la vidéo. */
.vd-player.needs-tap { pointer-events: auto; cursor: pointer; }
.vd-player.needs-tap::after { content: ''; position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; translate: -50% -50%; border-radius: 999px; background: rgba(20,20,20,.72); }
.vd-player.needs-tap::before { content: ''; position: absolute; z-index: 1; left: 50%; top: 50%; translate: -35% -50%; border-left: 18px solid #eeebe5; border-top: 12px solid transparent; border-bottom: 12px solid transparent; }

/* ── Séquence « mots-clés » : copie depuis la carte, collage dans une banque d'images fictive ── */
.keywords-demo .sd-card .keyword-string {
  display: inline-block; max-width: 100%; align-self: flex-start; /* le surlignage s'arrête au dernier mot */
  background: linear-gradient(var(--fh-accent), var(--fh-accent)) no-repeat 0 50% / var(--hl, 0%) 100%;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.kw-copied {
  position: absolute; left: 50%; top: 50%; z-index: 4; margin: 0; translate: -50% 0; padding: 0 12px; height: 34px; display: flex; align-items: center;
  background: var(--fh-paper); color: var(--fh-bg); font: 500 12.5px/1 'Geist', sans-serif; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
  opacity: 0; pointer-events: none;
}
.kw-copied::before { content: '✓'; margin-right: 8px; }
.kw-page { position: absolute; left: 0; top: 0; width: 100%; padding: 24px 48px 32px; transform-origin: 0 0; color: var(--sd-ink); font: 400 15px/1.5 'Geist', sans-serif; text-align: left; text-transform: none; }
.kw-mast { display: flex; align-items: baseline; gap: 32px; margin-bottom: 24px; }
.kw-logo { font: 600 20px/1 'Geist', sans-serif; letter-spacing: -.02em; }
.kw-mast nav { display: flex; gap: 24px; font-size: 13px; color: var(--sd-ink-2); }
.kw-mast nav .is-on { color: var(--sd-ink); box-shadow: 0 2px 0 var(--sd-ink); }
.kw-search { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 8px 0 16px; background: #fff; border: 1px solid var(--sd-rule); }
.kw-icon { flex: none; width: 14px; height: 14px; border: 2px solid var(--sd-ink-2); border-radius: 999px; position: relative; }
.kw-icon::after { content: ''; position: absolute; right: -6px; bottom: -5px; width: 7px; height: 2px; background: var(--sd-ink-2); rotate: 45deg; }
.kw-field { flex: 1; position: relative; display: flex; align-items: center; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; }
.kw-typed { color: var(--sd-ink); }
.kw-caret { width: 2px; height: 20px; margin-left: 1px; background: var(--fh-accent); }
.kw-placeholder { position: absolute; left: 0; color: var(--sd-ink-2); }
.kw-go { flex: none; display: inline-flex; align-items: center; height: 36px; padding: 0 16px; background: var(--sd-ink); color: #f6f4ef; font: 500 13px/1 'Geist', sans-serif; }
.kw-count { margin: 24px 0 16px; font-size: 13px; color: var(--sd-ink-2); }
.kw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kw-item { position: relative; margin: 0; }
.kw-img { aspect-ratio: 16 / 10; background: center / cover no-repeat #000; }
.kw-item figcaption { margin-top: 8px; font-size: 12.5px; color: var(--sd-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Sélection : cadre régulier autour de l'image seule + pastille cochée. */
.kw-img { position: relative; }
.kw-item.is-pick .kw-img::after { content: ''; position: absolute; inset: -6px; border: 3px solid var(--fh-accent); opacity: var(--pick, 0); }
.kw-check { position: absolute; z-index: 1; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 999px; background: var(--fh-accent); opacity: var(--pick, 0); scale: calc(.6 + .4 * var(--pick, 0)); }
.kw-check::after { content: ''; position: absolute; left: 8px; top: 5px; width: 6px; height: 11px; border: solid var(--fh-bg); border-width: 0 2px 2px 0; rotate: 45deg; }
.kw-item:not(.is-pick) .kw-check { display: none; }
/* Plateau de téléchargement, qui monte depuis le bas de la fenêtre. */
.kw-cart { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 48px; background: var(--sd-ink); color: #f6f4ef; font: 400 13px/1 'Geist', sans-serif; text-align: left; text-transform: none; }
.kw-cart-count { font-weight: 500; }
.kw-dl { display: inline-flex; align-items: center; height: 36px; padding: 0 16px; background: var(--fh-accent); color: var(--fh-bg); font-weight: 500; }
.kw-cart-progress { flex: 1; height: 4px; background: rgba(246,244,239,.2); }
.kw-cart-progress i { display: block; height: 100%; width: var(--dl, 0%); background: var(--fh-accent); }
.kw-cart-status { min-width: 160px; font-variant-numeric: tabular-nums; color: rgba(246,244,239,.8); }

@media (max-width: 600px) {
  .kw-page { padding: 16px; }
  .kw-mast { margin-bottom: 16px; gap: 16px; }
  .kw-mast nav { display: none; }
  .kw-search { height: 44px; }
  .kw-field { font-size: 14px; }
  .kw-go { display: none; }
  .kw-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kw-item:nth-child(n+5) { display: none; }
  .kw-cart { padding: 0 16px; gap: 12px; height: 56px; flex-wrap: wrap; align-content: center; row-gap: 6px; }
  .kw-cart-count { display: none; }
  .kw-cart-progress { flex-basis: 100%; order: 3; }
  .kw-cart-status { min-width: 0; }
}
