/* ==========================================================================
   Cyberfantasy display mode — Witcher 3 bestiary-inspired layout for the
   creature viewer. Only active when #viewer-section has .mode-fantasy;
   the grid/browse view is unaffected by display mode.

   Column split matches the reference: 1/6 nav rail, 2/6 portrait, 3/6 info.

   This mode has its own dark/light pair (dark-gold "witcher book at night"
   vs. cream parchment "witcher book by daylight") scoped entirely to
   #viewer-section.mode-fantasy, independent of the --gold/--bg-* tokens
   the rest of the site uses. Text still uses the shared --ink/--ink-dim/
   --ink-faint tokens, which already flip correctly with the site theme.
   ========================================================================== */

#viewer-section.mode-fantasy {
  --ff-bg-a: rgba(20, 18, 16, 0.9);
  --ff-bg-b: rgba(10, 9, 8, 0.96);
  --ff-radial: rgba(202, 169, 107, 0.06);
  --ff-frame-bg: #0c0b0a;
  --ff-noimg-bg: #14120f;
  --ff-gold: #caa96b;
  --ff-gold-dim: #8a7346;
  --ff-gold-glow: 0 0 14px rgba(202, 169, 107, 0.5), 0 0 3px rgba(202, 169, 107, 0.8);
  --ff-on-gold: #14120f;
  --ff-arrow-bg: rgba(10, 9, 8, 0.55);
}
:root[data-theme="light"] #viewer-section.mode-fantasy {
  --ff-bg-a: #f6eeda;
  --ff-bg-b: #ecdfbe;
  --ff-radial: rgba(138, 90, 31, 0.12);
  --ff-frame-bg: #e0d2ab;
  --ff-noimg-bg: #e8dbb9;
  --ff-gold: #8a5a1f;
  --ff-gold-dim: #ab8a52;
  --ff-gold-glow: 0 0 14px rgba(138, 90, 31, 0.3), 0 0 3px rgba(138, 90, 31, 0.5);
  --ff-on-gold: #fbf3e0;
  --ff-arrow-bg: rgba(246, 238, 218, 0.7);
}

#viewer-section.mode-fantasy .viewer-nav { display: none; }

/* Full-bleed breakout: ignore <main>'s max-width/padding so the fantasy
   viewer spans the entire viewport width, edge to edge, like the reference. */
#viewer-section.mode-fantasy {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.viewer.viewer-fantasy {
  display: grid;
  /* dedicated 56px gutter columns for the paging arrows, so they never
     sit on top of sidebar/info content — just flank it */
  grid-template-columns: 56px 1fr 2fr 3fr 56px;
  grid-auto-rows: 1fr;
  position: relative;
  min-height: 86vh;
  background:
    radial-gradient(ellipse at 50% 0%, var(--ff-radial), transparent 55%),
    linear-gradient(180deg, var(--ff-bg-a), var(--ff-bg-b));
  border: none;
}
.viewer.viewer-fantasy::before,
.viewer.viewer-fantasy::after {
  display: none;
}

/* ---------- Edge paging arrows ---------- */
.ff-arrow {
  align-self: center;
  justify-self: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(202,169,107,0.5);
  background: var(--ff-arrow-bg);
  color: var(--ff-gold);
  font-family: var(--font-ui);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 5;
  opacity: 0.7;
  transition: all .18s ease;
}
.ff-arrow:hover { opacity: 1; box-shadow: var(--ff-gold-glow); border-color: var(--ff-gold); transform: scale(1.08); }
.ff-arrow:disabled { opacity: 0.15; cursor: not-allowed; box-shadow: none; }

/* ---------- Sidebar / nav rail ---------- */
.ff-sidebar {
  border-right: 1px solid rgba(202,169,107,0.25);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  overflow-y: auto;
}
.ff-back {
  align-self: flex-start;
  font-family: var(--font-ui);
  font-size: 10.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.ff-back:hover { color: var(--ff-gold); }
.ff-sidebar-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(202,169,107,0.25);
}
.ff-cat-icon {
  width: 26px; height: 26px;
  border: 1px solid var(--ff-gold-dim);
  color: var(--ff-gold);
  display: grid; place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}
.ff-cat-name {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink);
}
.ff-sidebar-list { display: flex; flex-direction: column; }
.ff-item {
  padding: 9px 8px;
  font-size: 12.5px;
  color: var(--ink-faint);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
}
.ff-item:hover { color: var(--ink); border-left-color: rgba(202,169,107,0.4); background: rgba(202,169,107,0.05); }
.ff-item.active {
  color: var(--ff-gold);
  border-left-color: var(--ff-gold);
  background: rgba(202,169,107,0.09);
  font-weight: 600;
}

/* ---------- Portrait column ---------- */
.ff-portrait {
  border-right: 1px solid rgba(202,169,107,0.2);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ff-frame {
  flex: 1;
  background: var(--ff-frame-bg);
  border: 1px solid rgba(202,169,107,0.3);
  position: relative;
  overflow: hidden;
  min-height: 340px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.8);
}
.ff-frame img { width: 100%; height: 100%; object-fit: cover; filter: saturate(0.9) contrast(1.05); }
.ff-frame .no-img {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  font-family: var(--font-ui);
  color: var(--ink-faint);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 16px;
  background:
    repeating-linear-gradient(45deg, rgba(202,169,107,0.05) 0 10px, transparent 10px 20px),
    var(--ff-noimg-bg);
}
.ff-frame .no-img .glyph {
  font-family: var(--font-display);
  font-size: 54px;
  color: var(--ff-gold-dim);
  display: block;
  margin-bottom: 8px;
}
.ff-weak-row { text-align: center; }
.ff-weak-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ff-gold-dim);
  margin-bottom: 10px;
}
.ff-weak-icons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.ff-weak-icon {
  width: 40px; height: 40px;
  border: 1px solid rgba(202,169,107,0.4);
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px;
  color: var(--ff-gold);
  background: rgba(202,169,107,0.06);
  position: relative;
}
.ff-weak-icon[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #0c0b0a;
  border: 1px solid var(--ff-gold-dim);
  color: #eae8e4;
  font-size: 10.5px;
  padding: 5px 8px;
  white-space: nowrap;
  z-index: 6;
}
.ff-weak-more { color: var(--ink-faint); font-size: 11px; }

/* ---------- Info column ---------- */
.ff-info {
  padding: 30px 40px;
  height: 100%;
  overflow-y: auto;
}
.ff-eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ff-gold);
  margin-bottom: 8px;
}
.ff-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 36px;
  color: var(--ink);
  letter-spacing: .5px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.ff-tech {
  font-size: 12.5px;
  color: var(--ink-faint);
  font-style: italic;
  margin-bottom: 18px;
}
.ff-statline {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 12px 0;
  margin-bottom: 20px;
  border-top: 1px solid rgba(202,169,107,0.2);
  border-bottom: 1px solid rgba(202,169,107,0.2);
  font-size: 11.5px;
  color: var(--ink-dim);
}
.ff-statline b { color: var(--ff-gold); }

.ff-body p.lore-text {
  font-family: 'Georgia', var(--font-display);
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-dim);
  margin-bottom: 20px;
}
.ff-section { margin-bottom: 24px; }
.ff-section-title {
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ff-gold);
  border-bottom: 1px solid rgba(202,169,107,0.2);
  padding-bottom: 6px;
  margin-bottom: 12px;
}
.ff-info .variation-chip { border-color: var(--ff-gold); color: var(--ff-gold); }
.ff-info .variation-chip:hover { background: var(--ff-gold); color: var(--ff-on-gold); box-shadow: var(--ff-gold-glow); }
.ff-info .weakness-list li { border-color: var(--ff-gold-dim); color: var(--ink-dim); }
.ff-info .notes-box { border-color: rgba(202,169,107,0.3); }
.ff-info .notes-box .signature { color: var(--ff-gold-dim); }

@media (max-width: 980px) {
  .viewer.viewer-fantasy { grid-template-columns: 1fr; grid-auto-rows: auto; min-height: 0; }
  .ff-sidebar { border-right: none; border-bottom: 1px solid rgba(202,169,107,0.25); height: auto; max-height: 220px; }
  .ff-info { height: auto; }
  .ff-portrait { border-right: none; border-bottom: 1px solid rgba(202,169,107,0.2); }
  .ff-frame { min-height: 240px; }
  .ff-arrow {
    position: fixed;
    top: auto;
    bottom: 18px;
    transform: none;
    width: 46px; height: 46px;
    font-size: 22px;
    z-index: 60;
  }
  .ff-arrow:hover { transform: scale(1.08); }
  .ff-arrow-left { left: 18px; }
  .ff-arrow-right { right: 18px; }
}
