/* /istock-keyword-generator (backend/core/istock_generator.py).
   Loaded after app.css, public.css and agency-generators.css: the page is the third of that family
   and keeps its tokens, CSV sheet, section rail, links and close. Only the result viewer, the
   two-list marking and the keyword examples are its own. Every colour is an app token, spacing is
   4/8/12/16/24/32/40 and card type 12/13/15/20 at 400 and 600 (DESIGN.md).
   Every selector starts with .agen or the script's .isg-js mark
   (tests/test_istock_generator_page.py scans for that).

   Without the script (no .isg-js) every result, both lists and every CSV row are visible. */

/* ── Hero: the name on the left, the offer on the right ── */
.agen .isg-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 32px 0; }
.agen .isg-hero > * { min-width: 0; }
.agen .isg-hero .agen-crumbs { grid-column: 1 / -1; margin: 0; }
.agen .isg-hero h1 { margin: 0; font-size: clamp(2.1rem, 3.4vw, 2.5rem); }
@media (min-width: 1400px) { .agen .isg-hero h1 { font-size: 3rem; } }
.agen .isg-hero .isg-mode { margin: 16px 0 0; font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text); }
@media (min-width: 1000px) {
  .agen .isg-hero { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 16px 48px; align-items: start; }
}

/* ── The viewer: pick a photo, read it as iStock reads it ── */
.agen .isg-view { margin: 0 0 16px; padding: 24px; scroll-margin-top: 72px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--s1); }
.agen .isg-view-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text); text-wrap: balance; }
.agen .isg-view-head p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }

.agen .isg-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0 24px; padding: 0; list-style: none; }
.agen .isg-strip li { min-width: 0; }
.agen .isg-pick { display: flex; align-items: center; gap: 12px; height: 100%; box-sizing: border-box; padding: 8px;
  border: 1px solid transparent; border-radius: 12px; background: var(--bg); font-size: 13px; font-weight: 600; line-height: 1.3;
  color: var(--dim); text-decoration: none; transition: background-color .15s, border-color .15s; }
.agen .isg-pick:hover { background: var(--s2); color: var(--text); }
.agen .isg-pick[aria-current="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, var(--bg)); color: var(--text); }
.agen .isg-pick picture { flex: none; }
.agen .isg-pick img { display: block; width: 64px; height: 48px; border-radius: 8px; object-fit: cover; }

.agen .isg-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; scroll-margin-top: 72px; }
.agen .isg-panel + .isg-panel { margin-top: 40px; }
.isg-js .agen .isg-panel { display: none; margin-top: 0; }
.isg-js .agen .isg-panel.is-open { display: grid; }
.agen .isg-panel > * { min-width: 0; }

/* The surround is a neutral dark grey in both themes, so a photo is judged against the same ground. */
.agen .isg-photo { position: relative; display: flex; justify-content: center; margin: 0; overflow: hidden; border-radius: 12px; background: #161616; }
.agen .isg-photo img { display: block; width: auto; height: auto; max-width: 100%; max-height: 520px; }
.agen .isg-photo figcaption { position: absolute; left: 8px; bottom: 8px; padding: 4px 8px; border-radius: 8px; background: rgba(0, 0, 0, .66);
  color: #fff; font: 12px/1.3 var(--agen-mono); }
@media (min-width: 900px) {
  .agen .isg-panel { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 32px; align-items: start; }
  .agen .isg-photo { position: sticky; top: 88px; }
  .agen .isg-photo img { max-height: min(560px, calc(100vh - 112px)); }
}

.agen .isg-title { margin: 0 0 4px; font-size: 20px; font-weight: 600; line-height: 1.3; color: var(--text); text-wrap: balance; }
.agen .isg-count { margin: 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agen .isg-desc { max-width: 65ch; margin: 24px 0 4px; font-size: 15px; line-height: 1.5; color: var(--text); }

/* The list switch only exists with the script; without it both lists show, each with its label. */
.agen .isg-seg { display: none; }
.isg-js .agen .isg-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; margin: 16px 0 0; padding: 4px; border-radius: 24px; background: var(--bg); }
.agen .isg-seg button { min-height: 32px; padding: 4px 16px; border: 1px solid transparent; border-radius: 999px; background: transparent;
  font-family: inherit; font-size: 13px; font-weight: 600; color: var(--dim); cursor: pointer; transition: background-color .15s; }
.agen .isg-seg button:hover { background: var(--s2); color: var(--text); }
.agen .isg-seg button[aria-pressed="true"] { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 16%, var(--bg)); color: var(--text); }
.agen .isg-seg button span { margin-left: 4px; font-weight: 400; font-variant-numeric: tabular-nums; }

.agen .isg-set { margin-top: 16px; }
.isg-js .agen[data-view="istock"] .isg-set[data-set="other"],
.isg-js .agen[data-view="other"] .isg-set[data-set="istock"] { display: none; }
.agen .isg-set-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin: 0 0 12px; }
.agen .isg-set-label { margin: 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.agen .isg-set-label b { margin-right: 4px; font-weight: 600; color: var(--text); }
.agen .isg-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0; font-size: 12px; color: var(--muted); }
.agen .isg-key { display: inline-flex; align-items: center; gap: 8px; }
.agen .isg-key::before { content: ""; width: 16px; height: 12px; box-sizing: border-box; border: 1px solid var(--muted); border-radius: 999px; }
.agen .isg-key-only::before { border-color: var(--agen-lit); background: color-mix(in srgb, var(--gold) 32%, transparent); }
.agen .isg-set[data-set="other"] .isg-key-only::before { border-style: dashed; background: transparent; }

/* Words only this list holds carry a second cue beside colour: a dot and weight on the iStock list,
   a dashed edge on the other. */
.agen .isg-kws { display: flex; flex-wrap: wrap; gap: 8px 4px; margin: 0; padding: 0; list-style: none; }
.agen .isg-kws li { display: inline-flex; align-items: center; gap: 8px; min-height: 26px; box-sizing: border-box; margin: 0; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; font-size: 13px; line-height: 1.25; color: var(--dim); }
.agen .isg-kws mark { padding: 0; background: transparent; color: inherit; }
.agen .isg-kws li.isg-only { border-color: var(--agen-chip-bd); background: var(--agen-chip-bg); font-weight: 600; color: var(--agen-chip-tx); }
.agen .isg-set[data-set="istock"] li.isg-only::before { content: ""; flex: none; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.agen .isg-set[data-set="other"] li.isg-only { border-style: dashed; border-color: var(--agen-lit); background: transparent; font-weight: 400; color: var(--text); }

/* The one authored moment: the marked words light up in reading order. */
@media (prefers-reduced-motion: no-preference) {
  .agen .isg-panel.isg-enter .isg-only { animation: isg-light .5s cubic-bezier(.16, 1, .3, 1) calc(.2s + var(--i, 0) * .035s) both; }
  .agen .isg-panel.isg-enter .isg-photo img { animation: isg-photo .45s ease-out both; }
}
@keyframes isg-light {
  from { border-color: var(--border); background: transparent; transform: translateY(2px); opacity: .45; }
}
@keyframes isg-photo {
  from { opacity: .3; }
}

/* ── CSV rows: one per photo, following the picker ── */
.agen .isg-sheet + .isg-sheet { margin-top: 16px; }
.isg-js .agen .isg-sheet { display: none; margin-top: 0; }
.isg-js .agen .isg-sheet.is-open { display: block; }

/* ── Keyword examples ── */
.agen .isg-ex { margin: 8px 0 0; }
.agen .isg-ex-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.agen .isg-ex-row:first-child { border-top: 0; padding-top: 0; }
.agen .isg-ex dt { font-size: 13px; font-weight: 600; line-height: 32px; color: var(--text); }
.agen .isg-ex dd { margin: 0; min-width: 0; }
.agen .isg-ex ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
/* The li is load-bearing: it outranks .pk-pub .section li a, which would colour and underline these. */
.agen .isg-ex li a { display: inline-flex; align-items: center; min-height: 32px; box-sizing: border-box; padding: 0 12px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--s1); font-size: 13px;
  color: var(--text); text-decoration: none; transition: border-color .15s; }
.agen .isg-ex li a:hover { border-color: var(--gold); color: var(--text); }
@media (min-width: 640px) {
  .agen .isg-ex-row { grid-template-columns: 160px minmax(0, 1fr); }
}

.agen .agen-sec > p { text-wrap: pretty; }
.agen .isg-seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 640px) {
  .agen .isg-hero { padding: 24px 0; }
  .agen .isg-view { padding: 16px 12px; }
  .agen .isg-pick { flex-direction: column; justify-content: flex-start; gap: 4px; padding: 4px; font-size: 12px; text-align: center; }
  .agen .isg-pick picture { width: 100%; }
  .agen .isg-pick img { width: 100%; height: auto; aspect-ratio: 4 / 3; }
  .agen .isg-photo img { max-height: 420px; }
}
