/* Poster Factory — app layer in the language of the Artifact tool (supermega-artifact).
   Taken from its screens, not only its tokens: the 64 px header with no rule under it (.hdr), the Library head
   (title 30/500, count line, chip row), tiles that sit on the page without card chrome, and the item-detail overlay
   (.idetail: top bar, stage + side column, thumbnail rail). Controls in the side column are DialKit (dialkit.css). */
@font-face { font-family: "InterVariable"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../../assets/inter-latin-wght-normal.woff2") format("woff2"); }
html, body { height: 100%; margin: 0; }
body { background: var(--gray-background); color: var(--gray-1200); font-size: var(--text-sm); line-height: var(--leading-sm); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.pf { min-height: 100%; display: flex; flex-direction: column; }

/* ---- header (Artifact .hdr) */
.hdr { position: sticky; top: 0; z-index: var(--z-sticky); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--space-4); height: var(--nav-height); padding-inline: var(--space-4);
  background: color-mix(in srgb, var(--gray-background) 88%, transparent); backdrop-filter: blur(12px); }
.hdr-left, .hdr-right { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.hdr-right { justify-content: flex-end; }
.logo { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: var(--radius-lg); color: var(--gray-1200); }
.logo svg { width: 22px; height: 22px; transition: scale var(--dur-spring) var(--ease-spring), rotate var(--dur-spring) var(--ease-spring); }
@media (hover: hover) { .logo:hover svg { scale: .92; rotate: -8deg; } }
.pf-name { font-weight: var(--weight-medium); color: var(--gray-1200); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }

/* ---- page head and chip row (Artifact Library: .lib-head, .lens-row) */
.pf-main { flex: 1; width: 100%; max-width: 1640px; margin-inline: auto; padding: var(--space-6) var(--space-10) var(--space-24); }
.pf-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-8); margin-bottom: var(--space-10); flex-wrap: wrap; }
.pf-heading { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.pf-title { margin: 0; font-size: var(--text-3xl); line-height: var(--leading-3xl); font-weight: var(--weight-medium); letter-spacing: -0.02em; color: var(--gray-1200); text-wrap: balance; }
.pf-count { margin: 0; font-size: var(--text-sm); color: var(--gray-1000); font-variant-numeric: tabular-nums; }
.pf-controls { display: flex; align-items: center; gap: var(--space-4); }
.pf-word { font-size: var(--text-xs); color: var(--gray-900); }
.lens-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: calc(var(--space-6) * -1) 0 var(--space-10); }
.lens-word { font-size: var(--text-xs); color: var(--gray-900); margin-inline-end: var(--space-2); }
.lens-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding-inline: var(--space-3); border-radius: var(--radius-full); font-size: var(--text-13); color: var(--gray-1000); background: var(--gray-200); white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out); }
@media (hover: hover) { .lens-chip:hover { color: var(--gray-1200); background: var(--gray-300); } }
.lens-chip[aria-pressed="true"] { background: var(--gray-1200); color: var(--gray-100); }
.lens-chip .n { font-variant-numeric: tabular-nums; opacity: .55; }
.lens-chip:focus-visible, .pf-tile:focus-visible, .idetail-thumb:focus-visible { outline: 2px solid var(--gray-800); outline-offset: 2px; }
.seg-item { cursor: pointer; }

/* ---- tiles */
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); column-gap: clamp(20px, 2.4vw, 36px); row-gap: clamp(24px, 2.6vw, 40px); }
.pf-tile { position: relative; display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; text-align: left; border-radius: var(--radius-xl); }
.pf-tile.is-new { animation: tile-in 820ms var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 26ms); }
@keyframes tile-in { from { opacity: 0; scale: .94; filter: blur(8px); translate: 0 14px; } to { opacity: 1; scale: 1; filter: blur(0); translate: 0 0; } }
.pf-thumb { position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-xl); overflow: hidden; background: var(--gray-200); outline: 1px solid var(--img-outline); outline-offset: -1px;
  transition: scale 520ms var(--ease-spring), box-shadow var(--dur-base) var(--ease-out); }
.pf-thumb svg { display: block; width: 100%; height: 100%; }
@media (hover: hover) { .pf-tile:hover .pf-thumb { scale: 1.015; box-shadow: 0 18px 40px -22px rgb(0 0 0 / .45); } }
.pf-tile:active .pf-thumb { scale: .99; }
.pf-caption { display: flex; align-items: center; justify-content: center; gap: var(--space-2); min-width: 0; font-size: var(--text-13); line-height: var(--leading-13); color: var(--gray-1100); }
.pf-caption .meta { color: var(--gray-900); }
.pf-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.pf-dot.fail { background: var(--red-500); } .pf-dot.warn { background: var(--amber-500, #f99c00); } .pf-dot.ok { background: var(--green-500); }
.pf-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out); }
@media (hover: hover) { .pf-tile:hover .pf-tools { opacity: 1; } }
.pf-tile:focus-within .pf-tools { opacity: 1; }
.pf-tool { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgb(255 255 255 / .82); backdrop-filter: blur(12px); color: #202020; box-shadow: 0 0 0 1px rgb(0 0 0 / .06), 0 2px 6px rgb(0 0 0 / .12); transition: scale var(--dur-base) var(--ease-out), background var(--dur-fast) var(--ease-out); }
.pf-tool:hover { background: #fff; } .pf-tool:active { scale: .94; } .pf-tool[disabled] { opacity: .45; pointer-events: none; }
.pf-tool svg { width: 15px; height: 15px; }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2); padding: var(--space-24) var(--space-4); text-align: center; color: var(--gray-1000); font-size: var(--text-sm); }
.empty .btn { margin-top: var(--space-4); }

/* ---- detail overlay (Artifact .idetail) */
.idetail { position: fixed; inset: 0; z-index: var(--z-lightbox); display: flex; flex-direction: column; background: var(--gray-background); }
.idetail-top { display: flex; align-items: center; justify-content: space-between; height: var(--nav-height); padding-inline: var(--space-4); flex: none; }
.idetail-count { font-size: var(--text-sm); color: var(--gray-1000); font-variant-numeric: tabular-nums; padding-inline: var(--space-2); }
.idetail-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--space-8); padding: var(--space-2) var(--space-6) var(--space-4); }
.idetail-stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.idetail-frame { height: 100%; max-width: 100%; aspect-ratio: 4 / 5; border-radius: var(--radius-lg); overflow: hidden; outline: 1px solid var(--img-outline); outline-offset: -1px; box-shadow: 0 30px 60px -36px rgb(0 0 0 / .45); }
.idetail-frame svg { display: block; width: 100%; height: 100%; }
.idetail-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; }
.idetail-nav.is-prev { left: -8px; } .idetail-nav.is-next { right: -8px; }
@media (hover: hover) { .idetail-nav:not(:hover) { opacity: .7; } }
.idetail-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; scrollbar-width: none; padding-bottom: var(--space-4); }
.idetail-side::-webkit-scrollbar { display: none; }
.idetail-sub { margin: 0 0 var(--space-4); font-size: var(--text-13); line-height: 19px; color: var(--gray-1000); text-wrap: pretty; }
.idetail-rail { display: flex; gap: var(--space-2); justify-content: center; padding: var(--space-3) var(--space-6) var(--space-5); overflow-x: auto; scrollbar-width: none; flex: none; }
.idetail-thumb { flex: none; height: 48px; width: 38.4px; border-radius: var(--radius-sm); overflow: hidden; opacity: .45; outline: 1px solid var(--img-outline); outline-offset: -1px; transition: opacity var(--dur-fast) var(--ease-out); }
.idetail-thumb svg { display: block; width: 100%; height: 100%; }
.idetail-thumb[aria-current="true"], .idetail-thumb:hover { opacity: 1; }

/* ---- the DialKit panel, inline in the side column */
.pf-panel.dialkit-root { width: 100%; }
.pf-panel .dialkit-panel-header { position: sticky; top: 0; z-index: 3; background: var(--dial-glass-bg); padding-top: 2px; }
.pf-panel .dialkit-folder-root > .dialkit-panel-header > .dialkit-folder-header-top { cursor: default; }
.pf-panel .dialkit-toolbar-add svg { color: currentColor; }
.pf-panel .dialkit-toolbar-add { color: var(--dial-text-label); }
.pf-panel .dialkit-toolbar-add.dialkit-toolbar-primary { color: var(--dial-glass-bg); }
.pf-panel .dialkit-toolbar-add:active { scale: .9; transition: scale .15s cubic-bezier(.3,1.4,.5,1), background .15s; }
.pf-panel .dialkit-toolbar-add[disabled] { opacity: .35; pointer-events: none; }
.pf-panel .dialkit-color-value { cursor: pointer; }
.dialkit-select-dropdown, .dialkit-image-popover { background: var(--dial-pop-bg); border-color: transparent; font-family: var(--font-sans); font-feature-settings: var(--font-features); }
.dialkit-image-popover { width: 256px; }
.dialkit-select-option { text-wrap: pretty; }
.pf-rule { display: flex; align-items: flex-start; gap: 10px; min-height: var(--dial-row-height); padding: 9px 12px; box-sizing: border-box; border-radius: var(--dial-radius); background: var(--dial-surface); font-size: 13px; font-weight: 500; line-height: 18px; color: var(--dial-text-label); text-wrap: pretty; }
.pf-rule .pf-dot { margin-top: 6px; }

@media (max-width: 860px) { .pf-main { padding-inline: var(--space-4); } .idetail-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 44vh; gap: var(--space-4); } .idetail-rail { display: none; } .pf-name { display: none; } }
@media (prefers-reduced-motion: reduce) { .pf-tile.is-new { animation: none; } }

/* Regenerate is the panel's main action: a labelled, filled toolbar button. Download keeps its label too. */
.pf-panel .dialkit-toolbar-copy { justify-content: center; }
.pf-panel .dialkit-toolbar-copy svg { width: 16px; height: 16px; flex: none; }
.pf-panel .pf-regen { flex: 1; min-width: 0; color: var(--dial-glass-bg); }
.pf-panel .pf-regen:active, .pf-panel .dialkit-toolbar-copy:active { scale: .97; transition: scale .15s cubic-bezier(.3,1.4,.5,1), background .15s; }
.pf-panel .dialkit-toolbar-copy[disabled] { opacity: .35; pointer-events: none; }
.pf-regen-icon { display: inline-flex; }
.pf-regen-icon.spin { animation: pf-spin .5s cubic-bezier(.2,0,0,1); }
@keyframes pf-spin { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .pf-regen-icon.spin { animation: none; } }

.pf-credit { margin-top: var(--space-24); max-width: 62ch; font-size: var(--text-13); line-height: 19px; color: var(--gray-900); text-wrap: pretty; }
.pf-credit a { color: var(--gray-1100); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gray-600); }

/* ---- the street: picking tiles, the tray, the photograph */
.pf-pick { position: absolute; top: 8px; left: 8px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgb(0 0 0 / .35); box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / .9); color: transparent; opacity: 0; transition: opacity var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), scale var(--dur-base) var(--ease-out); }
.pf-pick svg { width: 14px; height: 14px; }
.pf-pick:active { scale: .9; }
@media (hover: hover) { .pf-tile:hover .pf-pick { opacity: 1; } }
.pf-tile:focus-within .pf-pick, .pf-pick[aria-checked="true"] { opacity: 1; }
.pf-pick[aria-checked="true"] { background: var(--gray-1200); color: var(--gray-100); box-shadow: 0 0 0 2px var(--gray-background); }
.pf-tile:has(.pf-pick[aria-checked="true"]) .pf-thumb { outline: 2px solid var(--gray-1200); outline-offset: 2px; }
@media (hover: none) { .pf-pick { opacity: 1; } }
.pf-tray { position: fixed; left: 50%; bottom: 24px; translate: -50% 0; z-index: var(--z-overlay); display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 16px; border-radius: var(--radius-full); background: var(--preview-bg); box-shadow: var(--shadow-custom), 0 12px 32px -12px rgb(0 0 0 / .35); animation: tray-in 350ms var(--ease-spring) both; }
@keyframes tray-in { from { opacity: 0; translate: -50% 12px; scale: .96; } }
.pf-tray-n { margin-right: 8px; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-panel .pf-wide { flex: 1; }
@media (prefers-reduced-motion: reduce) { .pf-tray { animation: none; } }

/* ---- the wall view on the home screen */
.pf-wall { display: flex; flex-direction: column; gap: var(--space-4); }
.pf-wall-stage { position: relative; width: 100%; border-radius: var(--radius-xl); overflow: hidden; background: var(--gray-200); outline: 1px solid var(--img-outline); outline-offset: -1px; cursor: pointer; }
.pf-wall-stage canvas { display: block; width: 100%; height: 100%; animation: wall-in 420ms var(--ease-out) both; }
@keyframes wall-in { from { opacity: .35; } }
.pf-wall-stage[data-busy="true"]:empty { animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.pf-wall-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.pf-wall-walls { display: flex; gap: var(--space-2); }
.pf-wall-thumb { width: 88px; aspect-ratio: 1400 / 949; border-radius: var(--radius-md); overflow: hidden; opacity: .5; outline: 1px solid var(--img-outline); outline-offset: -1px; transition: opacity var(--dur-fast) var(--ease-out); }
.pf-wall-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pf-wall-thumb:hover, .pf-wall-thumb[aria-pressed="true"] { opacity: 1; }
.pf-wall-thumb[aria-pressed="true"] { outline: 2px solid var(--gray-1200); outline-offset: 2px; }
.pf-wall-tools { display: flex; gap: var(--space-2); }
.pf-wall-patterns { margin: 0; }
.pf-wall-note { margin: 0; font-size: var(--text-13); color: var(--gray-1000); }
.pf-wall-note .lib-link { color: var(--gray-1200); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gray-600); }
.pf-head .pf-controls { flex-wrap: wrap; }
@media (prefers-reduced-motion: reduce) { .pf-wall-stage canvas { animation: none; } }

.pf-wall-credit a { color: var(--gray-1100); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gray-600); }

/* the wordmark: poster / factory, lowercase, two lines */
.logo.pf-logo { width: auto; height: 36px; padding-inline: 4px; }
.logo.pf-logo svg { width: 66px; height: 30px; }
@media (hover: hover) { .logo.pf-logo:hover svg { scale: 1; rotate: 0deg; } }
