/* ═══════════════════════════════════════════════════════════════
   KEPTFOLIO — "Publish a website from Lightroom" signature hero
   Small Lightroom galleries pane → hero-scale browser frame with
   a live mini portfolio site, five real Keptfolio styles, and a
   one-shot Re-publish moment. Loads after /css/product.css.
   ═══════════════════════════════════════════════════════════════ */

/* hero grid rebalance: the browser frame IS the hero */
@media (min-width: 1081px) {
  .kf-hero .p-hero-inner { grid-template-columns: minmax(19rem, 0.62fr) 1.48fr; }
}
.kf-hero .p-hero-stage::after {
  background:
    radial-gradient(60% 46% at 68% 44%, rgba(232 163 61 / 0.07), transparent 70%),
    radial-gradient(50% 40% at 20% 80%, rgba(111 194 178 / 0.045), transparent 70%);
}

/* ── Demo frame: LR pane | flow | browser ─────────────────────── */
.kf-demo {
  display: grid; grid-template-columns: minmax(11.5rem, 0.42fr) auto 1fr;
  gap: 0.9rem; align-items: center;
}

/* ── Lightroom galleries pane ─────────────────────────────────── */
.kf-lr {
  background: var(--carbon-2); border: 1px solid var(--line); border-radius: 5px;
  padding: 1rem 1rem 0.9rem;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.kf-lr-head { color: var(--dim); font-size: 0.56rem; letter-spacing: 0.2em; }
.kf-galleries { list-style: none; margin: 0; padding: 0; }
.kf-galleries li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 0.8rem;
  padding: 0.5rem 0.1rem;
  font-size: 0.62rem; letter-spacing: 0.12em; color: var(--silver);
  border-top: 1px solid var(--line-soft);
}
.kf-galleries li:last-child { border-bottom: 1px solid var(--line-soft); }
.kf-galleries .kf-g-count { color: var(--dim); font-variant-numeric: tabular-nums; transition: color 0.4s; }
.kf-galleries li.is-active .kf-g-name::after { content: ' ●'; color: var(--safelight); font-size: 0.5rem; }
.kf-demo.is-published .kf-galleries li.is-active .kf-g-name::after { color: var(--teal); }

.kf-queue { position: relative; border-radius: 3px; overflow: hidden; border: 1px solid var(--line); }
.kf-queue img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; transition: filter 0.5s; }
.kf-queue-badge {
  position: absolute; top: 0.45rem; right: 0.45rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.22rem 0.55rem; border-radius: 999px;
  background: rgba(13 11 8 / 0.78); border: 1px solid rgba(255 92 57 / 0.45);
  color: var(--safelight); font-size: 0.5rem; letter-spacing: 0.18em;
  transition: opacity 0.5s;
}
.kf-queue-badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--safelight);
  animation: rec-pulse 1.6s ease-in-out infinite;
}
.kf-demo.is-published .kf-queue-badge { opacity: 0; }
.kf-demo.is-published .kf-queue img { filter: saturate(0.85) brightness(0.9); }

.kf-btn { width: 100%; padding: 0.7rem 1rem; font-size: 0.62rem; }
.kf-btn:disabled { cursor: default; transform: none; }
.kf-btn.is-busy { background: var(--carbon-3); color: var(--dim); }
.kf-btn.is-done { background: var(--teal); color: var(--carbon); }
@media (hover: hover) {
  .kf-btn.is-done:hover { background: var(--teal); }
}

.kf-progress {
  min-height: 1.1em; margin: 0;
  color: var(--dim); font-size: 0.54rem; letter-spacing: 0.16em;
  font-variant-numeric: tabular-nums;
}
.kf-progress.is-live { color: var(--safelight); }
.kf-progress.is-build { color: var(--amber); }
.kf-progress.is-done { color: var(--teal); }

/* ── Flow connector ───────────────────────────────────────────── */
.kf-flow { display: grid; gap: 0.55rem; justify-items: center; align-content: center; }
.kf-flow-line { width: 1px; height: 30px; background: var(--line); }
.kf-flow-arrow { color: var(--dim); font-size: 0.72rem; }

/* ── Browser frame + mini site (ported from the homepage demo) ── */
.demo-kept { border: 1px solid var(--line); border-radius: 5px; overflow: hidden; background: var(--carbon-2); min-width: 0; }
.kept-chrome {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--line-soft);
  font-size: 0.6rem; color: var(--dim);
}
.kept-dots { display: inline-flex; gap: 5px; }
.kept-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--carbon-3); }
.kept-url { margin: 0 auto; letter-spacing: 0.14em; }
.kept-live { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--teal); }
.rec {
  width: 7px; height: 7px; border-radius: 50%; background: var(--safelight);
  display: inline-block; animation: rec-pulse 1.6s ease-in-out infinite;
}
@keyframes rec-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.kept-live .rec { background: var(--teal); }
.kept-site { padding: 1.4rem 1.5rem 1.15rem; transition: background 0.6s, color 0.6s; }
.kept-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; transition: border-color 0.6s; }
.kept-logo { font-size: 1.05rem; }
.kept-head nav { display: flex; gap: 1rem; font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.62; }
.kept-hero { overflow: hidden; margin-bottom: 0.6rem; transition: outline-color 0.6s; }
.kept-hero img { width: 100%; aspect-ratio: 16 / 8.2; object-fit: cover; object-position: 50% 28%; display: block; transition: filter 0.6s; }

/* gallery row grows from 2-up to 3-up on publish (flex-grow tween) */
.kept-row { display: flex; gap: 0.6rem; }
.kept-row img {
  flex: 1 1 0; min-width: 0; width: 100%;
  aspect-ratio: 4 / 3; object-fit: cover;
  transition: filter 0.6s;
}
.kept-row .kf-incoming {
  flex: 0 0 0%; margin-left: -0.6rem; opacity: 0;
  transition: flex-grow 0.7s var(--ease-inout), margin-left 0.7s var(--ease-inout);
}
.kept-row .kf-incoming.is-in { flex-grow: 1; margin-left: 0; }
.kept-row .kf-incoming.is-placed { opacity: 1; }

.kept-foot {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.5rem; letter-spacing: 0.2em; opacity: 0.55;
  font-variant-numeric: tabular-nums;
}

.kept-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.75rem 0.9rem; border-top: 1px solid var(--line-soft);
}
.kept-bar-label { color: var(--dim); font-size: 0.58rem; letter-spacing: 0.24em; }
.kept-themes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.kept-themes button {
  font-family: var(--f-mono); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.35rem 0.8rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--dim); transition: color 0.3s, border-color 0.3s, background 0.3s;
}
@media (hover: hover) {
  .kept-themes button:hover { color: var(--silver); }
}
.kept-themes button.is-on { color: var(--carbon); background: var(--amber); border-color: var(--amber); }

/* ── The five real Keptfolio styles ───────────────────────────── */
/* FRAME - exhibition catalog: centered title, matted plates */
.demo-kept[data-theme="frame"] .kept-site { background: #F6F3EC; color: #191611; }
.demo-kept[data-theme="frame"] .kept-head { flex-direction: column; align-items: center; gap: 0.4rem; }
.demo-kept[data-theme="frame"] .kept-logo {
  font-family: var(--f-display); font-weight: 520; font-size: 0.82rem;
  letter-spacing: 0.32em; text-transform: uppercase;
}
.demo-kept[data-theme="frame"] .kept-hero { outline: 1px solid rgba(25 22 17 / 0.16); outline-offset: 3px; margin: 0.35rem 0.35rem 0.95rem; }
.demo-kept[data-theme="frame"] .kept-row { padding: 0 0.35rem; }
.demo-kept[data-theme="frame"] .kept-row img { outline: 1px solid rgba(25 22 17 / 0.16); outline-offset: 3px; }
.demo-kept[data-theme="frame"] .kept-site img { filter: saturate(0.96); }

/* PRESS - bold magazine: big nameplate, ruled masthead */
.demo-kept[data-theme="press"] .kept-site { background: #F1EDE3; color: #17140F; }
.demo-kept[data-theme="press"] .kept-head { border-bottom: 2px solid currentColor; padding-bottom: 0.5rem; align-items: center; }
.demo-kept[data-theme="press"] .kept-logo {
  font-family: var(--f-display); font-weight: 640; font-size: 1.42rem;
  letter-spacing: -0.03em; text-transform: uppercase;
}
.demo-kept[data-theme="press"] .kept-site img { filter: contrast(1.06) saturate(1.02); }

/* FOLIO - quiet and literary: elegant italics */
.demo-kept[data-theme="folio"] .kept-site { background: #F5F1E8; color: #2A251C; }
.demo-kept[data-theme="folio"] .kept-logo { font-family: var(--f-display); font-style: italic; font-weight: 430; font-size: 1.15rem; }
.demo-kept[data-theme="folio"] .kept-head nav { text-transform: lowercase; font-style: italic; letter-spacing: 0.08em; }
.demo-kept[data-theme="folio"] .kept-site img { filter: sepia(0.08) saturate(0.88); }

/* REEL - cinematic dark: letterspaced caps, slow-drifting cover */
.demo-kept[data-theme="reel"] .kept-site { background: #0B0B0D; color: #EDEAE4; }
.demo-kept[data-theme="reel"] .kept-logo { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.3em; text-transform: uppercase; }
.demo-kept[data-theme="reel"] .kept-site img { filter: saturate(1.06) contrast(1.05); }
.demo-kept[data-theme="reel"] .kept-hero img { animation: kf-reel-pan 16s ease-in-out infinite alternate; }
@keyframes kf-reel-pan { from { transform: scale(1); } to { transform: scale(1.07) translateX(-1.5%); } }

/* ATLAS - expedition journal: mono captions, dashed rules */
.demo-kept[data-theme="atlas"] .kept-site { background: #E8E1D1; color: #262019; }
.demo-kept[data-theme="atlas"] .kept-logo { font-family: var(--f-mono); font-size: 0.7rem; letter-spacing: 0.26em; text-transform: uppercase; }
.demo-kept[data-theme="atlas"] .kept-head { border-bottom: 1px dashed rgba(38 32 25 / 0.4); padding-bottom: 0.45rem; }
.demo-kept[data-theme="atlas"] .kept-site img { filter: sepia(0.14) saturate(0.9); }

/* ── Flying clone (created in JS during the publish moment) ───── */
.kf-fly {
  position: fixed; z-index: 90; pointer-events: none;
  object-fit: cover; border-radius: 3px;
  box-shadow: 0 18px 50px rgba(0 0 0 / 0.45);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .kf-demo { grid-template-columns: 1fr; gap: 0.7rem; }
  .kf-flow { grid-auto-flow: column; }
  .kf-flow-line { width: 30px; height: 1px; }
  .kf-flow-arrow { transform: rotate(90deg); }
  .kf-lr { flex-direction: column; }
  .kf-queue img { aspect-ratio: 16 / 7; }
}
@media (max-width: 480px) {
  .kept-site { padding: 1.1rem 1rem 0.9rem; }
  .kept-head nav { gap: 0.7rem; }
  .kept-bar { gap: 0.6rem; }
  .demo-kept[data-theme="press"] .kept-logo { font-size: 1.15rem; }
}

/* ── Reduced motion: settle everything instantly ──────────────── */
@media (prefers-reduced-motion: reduce) {
  .kept-site, .kept-row .kf-incoming, .kept-row img, .kf-queue img,
  .kf-queue-badge, .kf-galleries .kf-g-count { transition: none; }
  .rec, .kf-queue-badge::before { animation: none; }
  .demo-kept[data-theme="reel"] .kept-hero img { animation: none; }
}

/* cover cinemagraph (lazy, desktop-only, reduced-motion-guarded) */
.kept-hero { position: relative; }
.kept-hero video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 28%;
  opacity: 0; transition: opacity 1.2s;
}
