/* GPT Image Studio — the generator (API key + prompt cards) beside the result
   card and the curated style gallery; the parameters live in the Options
   sheet (layout from styles/components/form.css). The prompt is an
   styles/components/editor.css pane; only the style chip, the result grid,
   the gallery and the lightbox are the page's own. */

/* Page title icon — gradient tile (no external webp dependency). */
.gis-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(145deg, #FF7AB6, #8B5CF6);
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
/* The generator leads the split; it only rides along (sticky) while the
   split is two columns, never over the gallery once it has wrapped. */
/* 380px keeps the style chip and Options beside the Prompt title; the split
   wraps once the detail would fall under --detail-min (container ≈ 880px). */
.gis-layout { --inspector-w: 380px; container-type: inline-size; }
@container (min-width: 880px) {
  .gis-generator { position: sticky; top: var(--space-4); }
}

/* ── API key ────────────────────────────────────────────────────────────── */
input.gis-key-input { font-size: 13px; }

/* ── Prompt ─────────────────────────────────────────────────────────────── */
.gis-style-chip { max-width: 160px; }

.gis-count { font-size: 12px; color: var(--text-muted); }

/* ── Result ─────────────────────────────────────────────────────────────── */
.gis-result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  /* In the wide column a lone 1024² render would balloon — cap a single result
     to a comfortable size; multi-image grids are allowed the full width. */
  max-width: 680px;
  margin-inline: auto;
}
.gis-result-grid.is-multi {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  max-width: none;
}

.gis-result-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-recessed);
  border: 1px solid var(--border);
}
.gis-result-item img { width: 100%; display: block; cursor: zoom-in; }
.gis-result-item.is-loading {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gis-result-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: var(--space-2);
  padding: var(--row-gap);
  background: linear-gradient(to top, rgba(0,0,0,0.72), transparent);
  opacity: 0;
  transition: opacity var(--duration-snap) var(--ease-standard);
}
.gis-result-item:hover .gis-result-overlay,
.gis-result-item:focus-within .gis-result-overlay { opacity: 1; }

/* ── Gallery ────────────────────────────────────────────────────────────── */
.gis-search-wrap { position: relative; display: flex; align-items: center; flex: 1 1 100%; }
.gis-search-icon { position: absolute; left: 11px; color: var(--text-muted); pointer-events: none; }
#gallery-search {
  width: 100%;
  padding: 9px 14px 9px 34px;
  font-size: 14px;
  border-radius: var(--radius-md);
  -webkit-appearance: none;
  appearance: none;
}
#gallery-search::-webkit-search-cancel-button { -webkit-appearance: none; }

.gis-gallery-body { --gap: var(--space-6); }

.gis-cat { display: flex; flex-direction: column; gap: var(--space-3); }
.gis-cat-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: 0 var(--inset);
}
.gis-cat-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.gis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-4);
}

/* Style card */
.gis-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform var(--duration-snap) var(--ease-out), box-shadow var(--duration-snap) var(--ease-out), border-color var(--duration-snap) var(--ease-standard);
}
.gis-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}
.gis-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft-strong), var(--shadow-2);
}

.gis-card-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-recessed);
  overflow: hidden;
  cursor: zoom-in;
}
.gis-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--duration-default) var(--ease-out);
}
.gis-card:hover .gis-card-thumb img { transform: scale(1.04); }

/* Placeholder when a sample hasn't been generated (yet) */
.gis-card-thumb.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #FF7AB6, #8B5CF6);
  color: rgba(255,255,255,0.92);
}
.gis-card-thumb.is-missing img { display: none; }
.gis-thumb-tag {
  position: absolute;
  top: 8px; left: 8px;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--scrim);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  letter-spacing: 0.01em;
}

.gis-card-body { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--row-pad-y) var(--inset); flex: 1; }
.gis-card-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.gis-card-blurb { font-size: 11.5px; color: var(--text-muted); line-height: 1.45; flex: 1; }

.gis-card-actions { display: flex; gap: var(--space-2); padding-top: var(--space-2); }
.gis-card-actions .btn { flex: 1; justify-content: center; }
.gis-use-btn { flex: 2 !important; }

/* ── Lightbox ───────────────────────────────────────────────────────────── */
.gis-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  background: var(--scrim-strong);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.gis-lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-3);
  object-fit: contain;
}
.gis-lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  width: 40px; height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--duration-snap) var(--ease-standard);
}
.gis-lightbox-close:hover { background: rgba(255,255,255,0.28); }
