/* ══════════════════════════════════════════════════════════════
   styles.css  —  Outfit Reference Viewer
   ══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background:
    linear-gradient(rgba(255,255,255,0.08), rgba(255,255,255,0.08)),
    url('ENDFIELD.png') center center / cover fixed;
  min-height: 100vh;
  padding: 10px;
}

/* ── Layout ───────────────────────────────────────────────── */
.container {
  max-width: 1800px;
  margin: 0 auto;
  background: transparent;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
  display: flex;
  min-height: calc(100vh - 20px);
}

.specs-side {
  flex: 0 0 44%;
  padding: 36px 40px;
  overflow-y: auto;
  max-height: calc(100vh - 20px);
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.images-side {
  flex: 1;
  padding: 36px 32px;
  background: rgba(240,244,248,0.14);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  max-height: calc(100vh - 20px);
  position: relative;
}

/* ── Sections container — single column ──────────────────── */
.sections-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.section.full-width { grid-column: 1 / -1; }

/* ── Typography ───────────────────────────────────────────── */
h1 {
  color: #C0392B;
  margin-bottom: 8px;
  font-size: 1.9em;
  text-shadow: 0 1px 4px rgba(255,255,255,0.8), 0 0 12px rgba(255,255,255,0.6);
}

.subtitle {
  color: #444;
  margin-bottom: 26px;
  font-size: 0.95em;
  line-height: 1.6;
  text-shadow: 0 1px 3px rgba(255,255,255,0.9), 0 0 8px rgba(255,255,255,0.7);
}

/* ── TL;DR box ────────────────────────────────────────────── */
.tldr-box {
  background: rgba(220,238,255,0.82);
  border-left: 4px solid #3d8ed4;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 6px;
  font-size: 0.93em;
  line-height: 1.7;
  color: #2c3e50;
}

.tldr-box strong {
  color: #1a5fa8;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

/* ── Section cards ────────────────────────────────────────── */
.section {
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(255,255,255,0.62);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, opacity 0.25s, transform 0.15s;
  cursor: pointer;
  border: 2px solid transparent;
}

.section:hover {
  background: rgba(255,245,245,0.78);
  border-color: #C0392B;
  transform: translateX(4px);
}

.section.highlighted {
  background: rgba(255,240,238,0.82);
  border-color: #C0392B;
  box-shadow: 0 4px 12px rgba(192,57,43,0.2);
}

.section.hidden  { display: none; }

.section.dimmed {
  opacity: 0.22;
  pointer-events: none;
  filter: grayscale(0.25);
}

.section h2 {
  color: #9B2335;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.section h3 {
  color: #C0392B;
  margin: 14px 0 8px 0;
  font-size: 1.02em;
}

.section ul { margin-left: 18px; line-height: 1.9; }
.section p  { line-height: 1.9; color: #444; margin-bottom: 10px; }

/* ── Option + Warning boxes ───────────────────────────────── */
.options {
  background: rgba(255,251,220,0.82);
  padding: 13px 16px;
  border-radius: 8px;
  margin: 10px 0;
  border-left: 4px solid #D4A017;
}

.warning-box {
  background: rgba(255,243,180,0.82);
  border-left: 4px solid #ffc107;
  padding: 12px 14px;
  margin: 10px 0;
  border-radius: 5px;
}

/* ── Ref tags — default state ─────────────────────────────── */
.ref-tag {
  display: inline-block;
  background: #fff0ee;
  color: #C0392B;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.83em;
  font-weight: 600;
  margin: 2px 3px;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.12s;
}

/*
 * ref-tag-self-lit:
 *   Applied to the tag itself when it is hovered.
 *   Blue — distinct from the red section/image hover system.
 */
.ref-tag-self-lit {
  background: #1a6fc4 !important;
  color: white !important;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(26,111,196,0.35);
}

/* ── Images grid ──────────────────────────────────────────── */
.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 15px;
  align-content: start;
}

.images-grid.filtered         { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.images-grid.filtered-two     { grid-template-columns: repeat(2, 1fr); }
.images-grid.filtered-one     { grid-template-columns: 1fr; }
.images-grid.filtered-preview { grid-template-columns: 1fr; }

/* ── Image cards ──────────────────────────────────────────── */
.image-card {
  background: rgba(255,255,255,0.72);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s, opacity 0.2s;
  cursor: zoom-in;
  position: relative;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

/*
 * highlighted: red — triggered by section hover or image card hover.
 * Means "this image belongs to the section you're looking at".
 */
.image-card.highlighted {
  border: 3px solid #C0392B;
  box-shadow: 0 0 20px rgba(192,57,43,0.45);
  transform: scale(1.03);
}

/*
 * ref-highlighted: gold — triggered ONLY by hovering a ref-tag in the text.
 * Distinct colour so the artist immediately knows the source is the text, not a section.
 */
.image-card.ref-highlighted {
  border: 3px solid #c8860a;
  box-shadow: 0 0 22px rgba(200,134,10,0.55);
  transform: scale(1.04);
}

.image-card.dimmed {
  opacity: 0.3;
  pointer-events: none;
}

.image-card img {
  width: 100%;
  height: 220px;
  object-fit: contain;
  border-radius: 8px;
  background: #f8f9fa;
  display: block;
}

.image-card.enlarged img {
  height: 320px;
}

.image-card.preview img {
  height: auto;
  max-height: 65vh;
  min-height: 300px;
  object-fit: contain;
}

/* ── Number badge (top-left of every card) ───────────────── */
.num-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #C0392B;
  color: white;
  font-size: 0.75em;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.03em;
  z-index: 5;
  pointer-events: none;
  user-select: none;
}

.image-label {
  text-align: center;
  margin-top: 10px;
  font-weight: 600;
  color: #C0392B;
  font-size: 0.88em;
  line-height: 1.4;
}

/* ── Section count badge ──────────────────────────────────── */
.section-badge {
  text-align: center;
  margin-top: 5px;
  font-size: 0.76em;
  color: #999;
  font-style: italic;
}

/* ── "Used in" footer ─────────────────────────────────────── */
.used-in-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 4px;
  border-top: 1px solid #f0e0e0;
  margin-top: 10px;
}

.used-in-label {
  font-size: 0.78em;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.used-in-tag {
  display: inline-block;
  background: #fff0ee;
  color: #C0392B;
  border: 1px solid #f0c0b8;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.80em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  font-family: inherit;
}

.used-in-tag:hover {
  background: #C0392B;
  color: white;
  border-color: #C0392B;
  transform: translateY(-1px);
}

/* ── Preview overlay buttons ──────────────────────────────── */
.preview-overlay {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.preview-btn {
  background: rgba(20,20,20,0.75);
  color: #fff;
  border: none;
  padding: 7px 13px;
  border-radius: 18px;
  cursor: pointer;
  font-size: 0.82em;
  font-weight: 600;
  transition: background 0.2s, transform 0.15s;
  backdrop-filter: blur(4px);
  font-family: inherit;
}

.preview-btn:hover {
  background: #C0392B;
  transform: translateY(-1px);
}

/* ── Close / reset button ─────────────────────────────────── */
.close-btn {
  position: sticky;
  top: 0;
  background: #C0392B;
  color: white;
  border: none;
  padding: 10px 22px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(192,57,43,0.4);
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  margin-bottom: 18px;
  display: none;
  z-index: 100;
  font-family: inherit;
}

.close-btn:hover {
  background: #9B2335;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(192,57,43,0.6);
}

.close-btn.visible { display: inline-block; }

/* ── Lightbox modal ───────────────────────────────────────── */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 36px;
  color: white;
  font-size: 38px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s;
  user-select: none;
}

.modal-close:hover { color: #D4A017; }
