/* /image-keyword-generator (static/image-keyword-generator.html, filled by
   backend/core/image_demo.py). Loaded after app.css and public.css; colours are app tokens, so
   both themes follow. Every rule sits under .ikg (the @font-face blocks are the only exception).

   The page is a light table, the sibling of the video page's editing suite: a loupe showing the
   open photo on a neutral grey, a metadata panel beside it with what PixelKeyAI wrote, and a
   filmstrip underneath. Changing the photo is the one authored motion. Without JavaScript every
   photo is still reachable through its #photo-<slug> link (:target) and both keyword lists of a
   two-set result are shown, each under its own label. */

@font-face { font-family: "Geist"; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/geist-400.woff2) format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/geist-600.woff2) format("woff2"); }
@font-face { font-family: "Geist"; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/geist-700.woff2) format("woff2"); }
@font-face { font-family: "Geist Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/geist-mono-500.woff2) format("woff2"); }

.ikg {
  --ikg-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ikg-mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --ikg-ease: cubic-bezier(.16, 1, .3, 1);
  --ikg-chip-bg: rgba(var(--gold-rgb), .1);
  --ikg-chip-bd: rgba(var(--gold-rgb), .3);
  --ikg-chip-tx: var(--text);
  --ikg-accent: var(--gold);
  --ikg-on-accent: #000;
  /* The surround photographers judge a picture on: neutral dark grey in both themes. */
  --ikg-loupe: #161616;
  --ikg-dwell: 7s;
  width: 100%; max-width: var(--pk-max); box-sizing: border-box; margin: 0 auto; padding: 0 24px;
  font-family: var(--ikg-sans); color: var(--text);
}
[data-theme="light"] .ikg {
  --ikg-chip-bg: #f8eccf; --ikg-chip-bd: rgba(var(--gold-rgb), .4); --ikg-chip-tx: #6f560f;
  --ikg-accent: color-mix(in srgb, var(--gold) 62%, #000);
}
.ikg ::selection { background: rgba(var(--gold-rgb), .35); color: var(--text); }
.ikg :is(a, button, [role="button"]):focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
/* A FAQ item clips its overflow, so its question draws the ring inside. */
.ikg .faq-q:focus-visible { outline-offset: -2px; border-radius: 12px; }
.ikg .ikg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ikg h2 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; color: var(--text); }
.ikg picture { display: block; width: 100%; height: 100%; }

/* ── Hero: the promise, then the light table ── */
.ikg .ikg-hero { padding: 40px 0 16px; }
.ikg .ikg-intro { display: grid; gap: 24px; }
.ikg .ikg-crumbs { margin: -8px 0 8px; font-size: 13px; color: var(--muted); }
.ikg .ikg-crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); text-decoration: none; border: 0; }
.ikg .ikg-crumbs a:hover { color: var(--pk-link); }
.ikg .ikg-crumbs span { margin: 0 8px; }
.ikg h1 { margin: 0 0 16px; max-width: 24ch; font-size: clamp(2.2rem, 4.2vw, 3.4rem); font-weight: 700; line-height: 1.02;
  letter-spacing: -.03em; text-wrap: balance; color: var(--text); }
.ikg p[data-answer] { max-width: 60ch; margin: 0; font-size: 1.05rem; line-height: 1.6; color: var(--dim); }
.ikg .ikg-act { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.ikg .ikg-btn { display: inline-flex; align-items: center; min-height: 44px; box-sizing: border-box; padding: 12px 24px; border: 0; border-radius: 10px;
  background: var(--gold); color: var(--ikg-on-accent); font-size: 15px; font-weight: 600; text-decoration: none;
  transition: filter .15s, transform .15s var(--ikg-ease); }
.ikg .ikg-btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.ikg .ikg-btn:focus-visible { outline-color: var(--text); }
.ikg .ikg-quiet { padding: 8px 0; font-size: 15px; font-weight: 600; color: var(--pk-link); text-decoration: underline;
  text-decoration-color: rgba(var(--gold-rgb), .45); text-underline-offset: 4px; border: 0; }
.ikg .ikg-quiet:hover { text-decoration-color: currentColor; }
.ikg .ikg-terms { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }
@media (min-width: 1000px) {
  .ikg .ikg-intro { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; gap: 24px 48px; }
  .ikg .ikg-lead { display: contents; }
  .ikg .ikg-lead > :not(p) { grid-column: 1 / -1; }
  .ikg h1 { margin: 0; }
  .ikg .ikg-crumbs { margin-bottom: -16px; }
  .ikg .ikg-act { padding-bottom: 4px; }
}

/* ── The light table: loupe + metadata panel, the filmstrip below ── */
/* One grid for the open panel and the strip (stage and panels are display: contents), so the
   strip can sit right under the loupe: loupe, strip, then the metadata on a narrow screen. */
.ikg .ikg-light { display: grid; grid-template-columns: minmax(0, 1fr); margin-top: 24px; padding: 16px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--s1); }
.ikg .ikg-stage, .ikg .ikg-panel { display: contents; }
.ikg .ikg-loupe { grid-row: 1; }
.ikg .ikg-strip { grid-row: 2; }
.ikg .ikg-meta { grid-row: 3; min-width: 0; padding-top: 16px; }
/* Without JavaScript: the first photo shows; a #photo-<slug> link shows its own instead. */
.ikg .ikg-light:not(.ikg-js) .ikg-off:not(:target),
.ikg .ikg-light:not(.ikg-js) .ikg-stage:has(.ikg-panel:target) .ikg-panel:not(:target),
.ikg .ikg-light.ikg-js .ikg-off { display: none; }

.ikg .ikg-loupe { position: relative; align-self: start; margin: 0; overflow: hidden; aspect-ratio: 3 / 2; border-radius: 10px; background: var(--ikg-loupe); }
.ikg .ikg-loupe img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ikg .ikg-loupe figcaption { position: absolute; inset: auto 0 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  padding: 24px 12px 12px; background: linear-gradient(to top, rgba(0, 0, 0, .72), transparent); }
.ikg .ikg-file, .ikg .ikg-px { font: 500 12px/1.3 var(--ikg-mono); font-variant-numeric: tabular-nums; }
.ikg .ikg-loupe .ikg-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ikg .ikg-px { flex: none; margin-left: auto; }
/* Each on its own dark plate: the gradient alone is not enough over a pale photo. */
.ikg .ikg-loupe .ikg-file, .ikg .ikg-px { padding: 4px 8px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #fff; }

.ikg .ikg-meta { display: flex; flex-direction: column; align-items: flex-start; }
.ikg .ikg-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ikg .ikg-badge { padding: 4px 12px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--dim); }
.ikg .ikg-badge-ist { border-color: var(--ikg-chip-bd); background: var(--ikg-chip-bg); color: var(--ikg-chip-tx); }
.ikg .ikg-label { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
.ikg .ikg-n { font-variant-numeric: tabular-nums; }
.ikg .ikg-title { margin: 0 0 16px; font-size: 20px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; text-wrap: pretty; color: var(--text); }
.ikg .ikg-desc { margin: 0 0 16px; max-width: 62ch; font-size: 15px; line-height: 1.55; color: var(--dim); }
.ikg .ikg-kws { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ikg .ikg-kws li { padding: 4px 8px; border: 1px solid var(--ikg-chip-bd); border-radius: 8px; background: var(--ikg-chip-bg);
  font-size: 13px; line-height: 1.35; color: var(--ikg-chip-tx); }

/* The two sets of one run: a switch with the script, two labelled lists without it. */
.ikg .ikg-switch { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 16px; }
.ikg .ikg-switch[hidden] { display: none; }
.ikg .ikg-switch p { max-width: 62ch; margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }
.ikg .ikg-seg { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; }
.ikg .ikg-seg button { min-height: 32px; padding: 4px 16px; border: 1px solid transparent; border-radius: 8px; background: none;
  font: 600 13px var(--ikg-sans); color: var(--dim); cursor: pointer; transition: background-color .15s, color .15s; }
.ikg .ikg-seg button:hover { background: var(--s2); color: var(--text); }
.ikg .ikg-seg button[aria-pressed="true"] { border-color: var(--ikg-chip-bd); background: var(--ikg-chip-bg); color: var(--ikg-chip-tx); }
.ikg .ikg-set + .ikg-set { margin-top: 16px; }
.ikg .ikg-light.ikg-js .ikg-for { display: none; }
.ikg .ikg-light.ikg-js .ikg-set + .ikg-set { margin-top: 0; }

.ikg .ikg-kw-more { display: inline-flex; align-items: center; min-height: 32px; margin: 8px 0 0 -8px; padding: 4px 8px; border: 0; border-radius: 8px;
  background: none; font: 600 13px var(--ikg-sans); color: var(--pk-link); cursor: pointer; }
.ikg .ikg-kw-more:hover { background: var(--s2); }
.ikg .ikg-kw-more[hidden] { display: none; }
@media (max-width: 999px) {
  .ikg .ikg-light.ikg-js .ikg-panel:not(.ikg-all) .ikg-kws li:nth-child(n+17) { display: none; }
}

/* The filmstrip: every photo and the kind of photo it is. */
.ikg .ikg-strip { min-width: 0; padding: 16px 0 0; }
.ikg .ikg-strip-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 16px; }
.ikg .ikg-strip-head h2 { font-size: 15px; font-weight: 600; letter-spacing: 0; }
.ikg .ikg-strip-head p { margin: 0; font-size: 13px; color: var(--muted); }
.ikg .ikg-strip-list { display: grid; grid-auto-flow: column; grid-auto-columns: 120px; gap: 12px; margin: 0; padding: 4px 4px 8px;
  list-style: none; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: 4px; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.ikg .ikg-strip-list li { scroll-snap-align: start; }
.ikg .ikg-pick { display: block; border: 0; border-radius: 8px; text-decoration: none; color: var(--dim); }
.ikg .ikg-pick-frame { display: block; overflow: hidden; aspect-ratio: 3 / 2; border-radius: 8px; background: var(--ikg-loupe);
  outline: 2px solid transparent; outline-offset: 2px; transition: outline-color .2s; }
.ikg .ikg-pick-frame img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: .72; transition: opacity .2s, transform .4s var(--ikg-ease); }
.ikg .ikg-pick-frame.ikg-tall img { object-fit: contain; }
.ikg .ikg-pick-kind { display: block; margin-top: 8px; font-size: 12px; line-height: 1.3; }
.ikg .ikg-pick-bar { display: block; height: 2px; margin-top: 8px; border-radius: 2px; background: var(--ikg-accent); transform: scaleX(0); transform-origin: left; }
.ikg .ikg-pick:hover .ikg-pick-frame img { opacity: 1; transform: scale(1.03); }
.ikg .ikg-pick:hover { color: var(--text); }
.ikg .ikg-pick[aria-current="true"] { color: var(--text); font-weight: 600; }
.ikg .ikg-pick[aria-current="true"] .ikg-pick-frame { outline-color: var(--ikg-accent); }
.ikg .ikg-pick[aria-current="true"] .ikg-pick-frame img { opacity: 1; }
.ikg .ikg-pick[aria-current="true"] .ikg-pick-bar { transform: scaleX(1); }

/* Wide: the open panel's loupe and metadata and the filmstrip share one grid, so the strip sits
   under the loupe and the metadata runs down the right. */
@media (min-width: 1000px) {
  .ikg .ikg-light { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); grid-template-rows: auto 1fr; gap: 0 32px; padding: 24px; }
  .ikg .ikg-loupe { grid-column: 1; grid-row: 1; }
  .ikg .ikg-meta { grid-column: 2; grid-row: 1 / span 2; padding-top: 4px; }
  .ikg .ikg-kw-more { display: none; }
  .ikg .ikg-strip { grid-column: 1; grid-row: 2; padding-top: 24px; }
  .ikg .ikg-strip-list { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; padding: 4px 0 0; overflow: visible; }
}
/* Room for the whole strip on one line. */
@media (min-width: 1400px) {
  .ikg .ikg-strip-list { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
/* The filmstrip belongs in the first screen: tighter edges, and on a short window the loupe gives
   up some height (the photo stays whole on its grey). */
@media (min-width: 1000px) {
  .ikg .ikg-hero { padding-top: 24px; }
  .ikg .ikg-light { margin-top: 16px; padding: 16px; }
  .ikg .ikg-loupe { width: 100%; max-height: max(280px, calc(100vh - 560px)); }
  .ikg .ikg-strip { padding-top: 16px; }
}

/* While the table auto-advances, the open photo's bar fills over its dwell time. */
@keyframes ikg-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ikg .ikg-light.ikg-playing .ikg-pick[aria-current="true"] .ikg-pick-bar { animation: ikg-fill var(--ikg-dwell) linear both; }
.ikg .ikg-light.ikg-playing.ikg-hold .ikg-pick[aria-current="true"] .ikg-pick-bar { animation-play-state: paused; }

/* The change of photo: it comes up from the grey like a print under the enlarger, then its
   keywords follow in reading order. The set switch repeats only the keywords' arrival. */
@keyframes ikg-expose { from { opacity: 0; } to { opacity: 1; } }
@keyframes ikg-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ikg .ikg-panel.ikg-enter .ikg-loupe img { animation: ikg-expose .4s ease-out both; }
.ikg .ikg-panel.ikg-enter .ikg-meta > :not(.ikg-set) { animation: ikg-expose .4s var(--ikg-ease) both; }
.ikg .ikg-panel.ikg-enter .ikg-kws li,
.ikg .ikg-set.ikg-enter .ikg-kws li { animation: ikg-rise .45s var(--ikg-ease) both; animation-delay: calc(var(--i, 0) * 22ms + 120ms); }

/* ── Sections ── */
.ikg .ikg-sec { padding: 64px 0 0; }
.ikg .ikg-sub { max-width: 62ch; margin: 12px 0 24px; font-size: 15px; line-height: 1.6; color: var(--dim); }
.ikg .ikg-sub strong { font-weight: 600; color: var(--text); }

/* ── One shoot ── */
.ikg .ikg-shots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 16px; margin: 0; padding: 0; list-style: none; }
.ikg .ikg-shot { min-width: 0; }
.ikg .ikg-shot figure { margin: 0; }
.ikg .ikg-shot-img { overflow: hidden; aspect-ratio: 3 / 2; border-radius: 10px; background: var(--ikg-loupe); }
.ikg .ikg-shot-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.ikg .ikg-shot-img.ikg-tall img { object-fit: contain; }
.ikg .ikg-shot .ikg-file { display: block; margin-top: 8px; color: var(--muted); }
.ikg .ikg-shot-title { margin: 8px 0 12px; font-size: 15px; font-weight: 600; line-height: 1.35; text-wrap: pretty; color: var(--text); }
.ikg .ikg-rest { margin: 8px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (min-width: 700px) {
  .ikg .ikg-shots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
}

/* ── Agencies ── */
.ikg .ikg-agencies { display: grid; gap: 40px; }
.ikg .ikg-table-wrap { margin: 0 -4px; padding: 0 4px; overflow-x: auto; }
.ikg .ikg-table { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.ikg .ikg-table th, .ikg .ikg-table td { padding: 12px 16px 12px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.ikg .ikg-table thead th { padding-top: 0; font-size: 12px; font-weight: 400; color: var(--muted); }
.ikg .ikg-table tbody th { font-weight: 600; }
/* The agency link is 32px tall: centre the row so every cell sits on one line. */
.ikg .ikg-table tbody th, .ikg .ikg-table tbody td { vertical-align: middle; }
.ikg .ikg-table tbody th a { display: inline-flex; align-items: center; min-height: 32px; margin: -4px 0; color: var(--text);
  text-decoration: underline; text-decoration-color: var(--border2); text-underline-offset: 4px; border: 0; }
.ikg .ikg-table tbody th a:hover { color: var(--pk-link); text-decoration-color: currentColor; }
.ikg .ikg-table td { color: var(--dim); }
.ikg .ikg-notes { display: flex; flex-direction: column; gap: 24px; }
.ikg .ikg-note h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--text); }
.ikg .ikg-note p { margin: 0; max-width: 56ch; font-size: 15px; line-height: 1.6; color: var(--dim); }
.ikg .ikg-note a { color: var(--pk-link); text-decoration: underline; text-decoration-color: rgba(var(--gold-rgb), .45); text-underline-offset: 4px; border: 0; }
.ikg .ikg-note a:hover { text-decoration-color: currentColor; }
@media (min-width: 1000px) {
  .ikg .ikg-agencies { grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 64px; align-items: start; }
}
@media (max-width: 600px) {
  .ikg .ikg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .ikg .ikg-table, .ikg .ikg-table tbody, .ikg .ikg-table tr, .ikg .ikg-table th, .ikg .ikg-table td { display: block; }
  .ikg .ikg-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
  .ikg .ikg-table th, .ikg .ikg-table td { padding: 4px 0; border: 0; }
  .ikg .ikg-table tbody th { margin-bottom: 4px; }
  .ikg .ikg-table td::before { content: attr(data-label) ": "; color: var(--muted); }
}

/* ── FAQ (public.css draws the items) ── */
.ikg #faq h2 { margin-bottom: 24px; }
/* Without JavaScript nothing can open a question, so every answer shows. */
@media (scripting: none) {
  .ikg .faq-a { display: block; }
  .ikg .faq-arrow { display: none; }
  .ikg .faq-q { cursor: default; }
}

/* ── Close ── */
.ikg .ikg-close { margin-top: 72px; padding: 48px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.ikg .ikg-close h2 { font-size: clamp(1.9rem, 3.4vw, 2.8rem); letter-spacing: -.03em; }
.ikg .ikg-close p { margin: 12px 0 24px; font-size: 1.05rem; line-height: 1.6; color: var(--dim); }

/* ── Blog and tools ── */
.ikg .ikg-extra { padding-top: 48px; }
.ikg .ikg-extra h2 { margin: 0 0 16px; font-size: 1.15rem; letter-spacing: -.01em; }
.ikg .ikg-extra .pk-chips { margin-bottom: 8px; }
.ikg .ikg-extra .pk-grid + h2 { margin-top: 40px; }

@media (prefers-reduced-motion: reduce) {
  .ikg *, .ikg *::before, .ikg *::after { animation: none !important; transition: none !important; }
}
