/* Wiki — warm cream DA matching the v2 site
 *
 * Pages use the v2 header / drawer / footer / modal shells (provided
 * by styles-v2.css). This file only scopes the wiki body layout :
 * sidebar nav, article main, command lists, callouts, equipment
 * table. All surfaces are cream with brown borders, titles in
 * Markup display font, body text in burnt sienna.
 */

body.wiki-body {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.55) 0, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(232, 179, 120, 0.40) 0, transparent 60%),
    linear-gradient(180deg, #fff7e6 0%, #f5d3a3 100%);
  background-attachment: fixed;
  color: #5a3624;
  font-family: "Montserrat", sans-serif;
  font-weight: 400;
  min-height: 100vh;
}

/* Markup font is always rendered in UPPERCASE everywhere it shows up
   in the wiki — per user feedback this gives the display copy a
   consistent stamped/poster vibe. */
.wiki-hero h1,
.wiki-hero-eyebrow,
.wiki-nav-title,
.wiki-main h1,
.wiki-main h2,
.wiki-home-card h3,
.wiki-home-card::before,
.armor-row .armor-name,
.armor-tier {
  text-transform: uppercase;
}

/* ─── LAYOUT SHELL ─────────────────────────────────────────────── */
.wiki-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  /* Wider shell — sidebar hugs the left, article gets the full extra
     width so the armor table has room for every column. */
  max-width: 1380px;
  margin: 0 auto;
  padding: 110px 32px 80px;
  position: relative;
}
@media (min-width: 880px) {
  .wiki-shell {
    /* Sidebar narrower + pinned far left + bigger gap so it sits as
     a distinct rail rather than crowding the article. */
    grid-template-columns: 220px 1fr;
    gap: 64px;
    padding-left: 24px;
  }
}

/* ─── DECORATIVE FOLIAGE ───────────────────────────────────────
 * Only a single fixed palm at the bottom-left corner of guide
 * pages, under the sticky sidebar. Plants (.wiki-decor) removed
 * per latest feedback. */
.wiki-palm-fixed {
  position: fixed;
  /* Nudged further left + a hair lower per latest feedback. */
  bottom: -7vw;
  left: -8vw;
  width: clamp(260px, 28vw, 460px);
  pointer-events: none;
  z-index: 1;
  transform-origin: 50% bottom;
  animation: wikiSway 5.4s ease-in-out infinite 0.3s;
}
@keyframes wikiSway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate( 3deg); } }
@media (max-width: 880px) {
  .wiki-palm-fixed { width: 36vw; max-width: 240px; opacity: 0.7; }
}
/* Keep the old selectors as a no-op for safety in case any HTML
   still ships with them. */
.wiki-decor--left, .wiki-decor--right { display: none !important; }

.wiki-back {
  color: #8a6a4f;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
  transition: color 180ms ease, transform 180ms ease;
}
.wiki-back:hover { color: var(--bubble-color); transform: translateX(-2px); }

/* ─── SIDEBAR NAV ──────────────────────────────────────────────── */
.wiki-nav {
  background: #fff7e6;
  border: 2px solid #c89b6e;
  border-radius: 20px;
  padding: 22px 18px;
  align-self: start;
  position: sticky;
  top: 110px;
  z-index: 2;
  box-shadow: 0 14px 28px -22px rgba(122, 88, 64, 0.4);
}
.wiki-nav-title {
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--bubble-color);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
  text-align: center;
  border-bottom: 1px dashed rgba(200, 155, 110, 0.4);
  padding-bottom: 12px;
}
.wiki-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  margin: 0;
}
@media (max-width: 879px) {
  .wiki-nav ul { flex-direction: row; flex-wrap: wrap; gap: 6px; }
}
.wiki-nav a {
  display: flex !important;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  color: #6b3a23;
  text-decoration: none !important;
  font-size: 14px;
  font-weight: 700;
  transition: background 220ms ease, color 220ms ease;
  position: relative;
}
.wiki-nav a::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 0;
  height: 20px;
  border-radius: 2px;
  background: var(--bubble-color);
  transform: translateY(-50%);
  transition: width 240ms cubic-bezier(.4, 0, .2, 1);
}
.wiki-nav a:hover { background: rgba(245, 211, 163, 0.5); }
.wiki-nav a.active {
  background: rgba(200, 125, 100, 0.18);
  color: var(--bubble-color);
}
.wiki-nav a.active::before { width: 3px; }
/* Icons hidden per latest feedback — sidebar is text-only. */
.wiki-nav-icon { display: none; }

/* ─── ARTICLE MAIN ─────────────────────────────────────────────── */
.wiki-main {
  min-width: 0;
  animation: wikiFadeUp 0.6s cubic-bezier(.4, 0, .2, 1) both;
}
@keyframes wikiFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.wiki-main h1 {
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  color: var(--bubble-color);
  letter-spacing: 0.01em;
  line-height: 1;
  margin: 0 0 14px;
  text-shadow: 3px 3px 0 rgba(200, 125, 100, 0.10);
}
.wiki-main .subtitle {
  color: #6b3a23;
  font-weight: 400;
  margin: 0 0 36px;
  font-size: 16px;
  line-height: 1.6;
  max-width: 640px;
}
.wiki-main .subtitle strong { color: var(--bubble-color); font-weight: 700; }
.wiki-main h2 {
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 30px;
  color: var(--bubble-color);
  letter-spacing: 0.01em;
  margin: 40px 0 16px;
  padding-top: 22px;
  border-top: 1px dashed rgba(200, 155, 110, 0.4);
  line-height: 1;
}
.wiki-main h2:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }
.wiki-main h3 {
  font-size: 18px;
  margin: 26px 0 10px;
  color: #5a3624;
  font-weight: 700;
}
.wiki-main p {
  margin: 0 0 14px;
  color: #6b3a23;
  font-weight: 400;
  line-height: 1.65;
  font-size: 14.5px;
}
.wiki-main ul,
.wiki-main ol {
  margin: 0 0 18px 24px;
  color: #6b3a23;
  font-weight: 400;
}
.wiki-main li {
  margin-bottom: 6px;
  line-height: 1.55;
}
.wiki-main code {
  background: rgba(255, 247, 230, 0.7);
  border: 1.5px solid #d9b896;
  padding: 2px 8px;
  border-radius: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.9em;
  color: var(--bubble-color);
  font-weight: 700;
}
.wiki-main strong { color: var(--bubble-color); font-weight: 700; }
.wiki-main em { font-style: italic; color: #6b3a23; }
.wiki-main a {
  color: var(--bubble-color);
  text-decoration: underline;
  text-decoration-color: rgba(200, 125, 100, 0.4);
  transition: text-decoration-color 180ms ease;
}
.wiki-main a:hover { text-decoration-color: var(--bubble-color); }

/* ─── CALLOUTS ─────────────────────────────────────────────────── */
.example {
  background: rgba(245, 211, 163, 0.5);
  border-left: 3px solid var(--bubble-color);
  padding: 14px 18px;
  margin: 18px 0;
  border-radius: 0 12px 12px 0;
  color: #6b3a23;
}
.example::before {
  content: "💡 EXEMPLE";
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--bubble-color);
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}
.example p:last-child { margin-bottom: 0; }

.warn {
  background: rgba(232, 116, 74, 0.10);
  border-left: 3px solid #e8744a;
  padding: 14px 18px;
  margin: 18px 0;
  border-radius: 0 12px 12px 0;
  color: #6b3a23;
}
.warn::before {
  content: "⚠️ ATTENTION";
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #c46b2a;
  letter-spacing: 0.18em;
  margin-bottom: 6px;
}

/* ─── COMMAND LIST ─────────────────────────────────────────────── */
.cmd-list {
  background: #fff7e6;
  border: 2px solid #c89b6e;
  border-radius: 14px;
  padding: 4px 0;
  margin: 20px 0;
  overflow: hidden;
}
.cmd-list .cmd {
  display: grid;
  grid-template-columns: minmax(200px, auto) 1fr;
  gap: 18px;
  padding: 13px 22px;
  border-bottom: 1px dashed rgba(200, 155, 110, 0.4);
  align-items: baseline;
  transition: background 180ms ease;
}
.cmd-list .cmd:last-child { border-bottom: none; }
.cmd-list .cmd:hover { background: rgba(245, 211, 163, 0.45); }
@media (max-width: 560px) {
  .cmd-list .cmd { grid-template-columns: 1fr; gap: 6px; }
}
.cmd .cmd-syntax {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--bubble-color);
  font-size: 14px;
  font-weight: 700;
}
.cmd .cmd-desc {
  color: #6b3a23;
  font-size: 14px;
  font-weight: 400;
}

/* ─── WIKI HOME : HERO + CHAPTERS GRID ────────────────────────── */
.wiki-hero {
  text-align: center;
  padding: 20px 0 40px;
  position: relative;
  z-index: 2;
}
.wiki-hero-image {
  display: block;
  margin: 0 auto;
  /* Reduced by 60% per user — was clamp(280, 60vw, 720) → now
     clamp(112, 24vw, 290). */
  max-width: 290px;
  width: clamp(112px, 24vw, 290px);
  height: auto;
}

/* Chapter cards — designed as numbered "guidebook" entries */
.wiki-home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 16px;
  position: relative;
  z-index: 2;
}
@media (min-width: 720px) {
  .wiki-home-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

.wiki-home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #fff7e6;
  border: 2px solid #c89b6e;
  border-radius: 22px;
  padding: 30px 28px 26px;
  color: #5a3624;
  /* Higher-specificity .wiki-main a rule would otherwise re-apply
     the underline. Force none + bake against future :hover overrides. */
  text-decoration: none !important;
  overflow: hidden;
  transition:
    border-color 320ms ease,
    transform 320ms cubic-bezier(.4, 0, .2, 1);
}
/* Tag with the chapter number in the top-right corner — feels like
   a real field guide entry. Number set via inline `data-num`. */
.wiki-home-card::before {
  content: attr(data-num);
  position: absolute;
  top: 18px;
  right: 22px;
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 42px;
  color: rgba(200, 125, 100, 0.25);
  line-height: 1;
  transition: color 320ms ease, transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}
.wiki-home-card-icon {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: rgba(245, 211, 163, 0.6);
  border: 1.5px solid rgba(200, 155, 110, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  color: var(--bubble-color);
  transition:
    background 280ms ease,
    color 280ms ease,
    transform 380ms cubic-bezier(.34, 1.56, .64, 1);
}
.wiki-home-card-icon svg { width: 30px; height: 30px; }
.wiki-home-card h3 {
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  color: var(--bubble-color);
  margin: 0 0 6px;
  font-size: 30px;
  letter-spacing: 0.01em;
  line-height: 1;
}
.wiki-home-card p {
  color: #6b3a23;
  font-size: 14px;
  font-weight: 400;
  margin: 0 0 18px;
  line-height: 1.55;
  max-width: 90%;
}
.wiki-home-card-arrow {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--bubble-color);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: gap 280ms ease;
}
.wiki-home-card-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform 320ms cubic-bezier(.34, 1.56, .64, 1);
}
.wiki-home-card:hover {
  transform: translateY(-6px);
  border-color: var(--bubble-color);
}
.wiki-home-card:hover::before {
  color: rgba(200, 125, 100, 0.5);
  transform: scale(1.05) rotate(-3deg);
}
.wiki-home-card:hover .wiki-home-card-icon {
  background: var(--bubble-color);
  color: #fff;
  transform: rotate(-6deg) scale(1.08);
}
.wiki-home-card:hover .wiki-home-card-arrow { gap: 12px; }
.wiki-home-card:hover .wiki-home-card-arrow svg { transform: translateX(4px); }

/* ─── ENTRY ANIMATION : stagger fade-up on load ────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .wiki-hero       { animation: wikiFadeUp 0.7s cubic-bezier(.4, 0, .2, 1) both; }
  .wiki-home-card  { animation: wikiFadeUp 0.7s cubic-bezier(.4, 0, .2, 1) both; opacity: 0; }
  .wiki-home-card:nth-child(1) { animation-delay: 0.10s; }
  .wiki-home-card:nth-child(2) { animation-delay: 0.20s; }
  .wiki-home-card:nth-child(3) { animation-delay: 0.30s; }
  .wiki-home-card:nth-child(4) { animation-delay: 0.40s; }
  .wiki-home-card:nth-child(5) { animation-delay: 0.50s; }
}
@keyframes wikiFadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── ARMOR COMPARISON TABLE ────────────────────────────────────
 * Real <table> layout : rows are armors, columns are stats. Cells
 * are tinted via the per-row --tier-accent custom property so the
 * eye can scan tier progression by colour. The first column holds
 * a chestplate render (Steve composited with the armor's layer-1
 * texture) — tilted 6° via CSS as the user requested. */
.armor-table-wrap {
  width: 100%;
  /* No max-width cap — the table fills the article column so every
     stat column is visible without horizontal scroll on desktop. */
  margin: 24px 0 36px;
  border: 2px solid #c89b6e;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 12px 28px -22px rgba(122, 88, 64, 0.4);
}
.armor-table-scroll {
  overflow-x: auto;
  scrollbar-color: var(--bubble-color) rgba(0,0,0,0.05);
}
.armor-table {
  width: 100%;
  /* Tightened to claim less space between stat columns. */
  min-width: 720px;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff7e6;
  font-size: 11.5px;
}
.armor-table thead th { padding: 8px 1px; font-size: 12px; }
.armor-table tbody td { padding: 3px 1px; }
.armor-table thead th:nth-child(n+3),
.armor-table tbody td:nth-child(n+3) { padding-left: 0; padding-right: 0; }
.armor-table thead th:nth-child(n+3) { padding-top: 8px; }
.armor-table thead th {
  background: rgba(200, 125, 100, 0.15);
  color: var(--bubble-color);
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 6px;
  text-align: center;
  border-bottom: 2px solid #c89b6e;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  /* Tilted column labels save a lot of horizontal space — every
     stat column can be ~30 px narrower at the same readability. */
  height: 110px;
  vertical-align: bottom;
}
.armor-table thead th .th-rot {
  display: inline-block;
  transform: rotate(-50deg) translateY(-4px);
  transform-origin: bottom left;
  margin-left: 12px;
  white-space: nowrap;
}
.armor-table thead th:first-child,
.armor-table thead th:nth-child(2) {
  text-align: left;
  padding-left: 18px;
  vertical-align: middle;
}
.armor-table thead th:first-child .th-rot,
.armor-table thead th:nth-child(2) .th-rot { transform: none; margin-left: 0; }
.armor-table tbody td {
  padding: 3px 2px;
  border-bottom: 1px dashed rgba(200, 155, 110, 0.35);
  color: #6b3a23;
  vertical-align: middle;
  text-align: center;
  font-weight: 700;
  background: #fff7e6;
  transition: background 220ms ease;
}
.armor-table tbody td:first-child { padding-left: 10px; padding-right: 2px; }
.armor-table tbody tr:last-child td { border-bottom: none; }
.armor-table tbody tr:hover td { background: rgba(245, 211, 163, 0.45); }
.armor-table tbody tr {
  --tier-accent: #C87D64;
}

/* Image cell : transparent — no fond, no clip. The 3D canvas owns its
   own bounds and any helmet plume / pauldron is free to extend right
   to the canvas edge without being cropped by a container border. */
.armor-cell-img {
  width: 110px;
  height: 150px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  overflow: visible;
  flex: 0 0 auto;
}
.armor-cell-img canvas,
.armor-cell-img img {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,0.15));
  display: block;
}

/* Name cell : Markup name on top + tier label below.
   Per latest feedback all text in the table shares the same brown
   colour — the tier accent now lives ONLY on the left edge strip
   + the image spotlight, not the typography. */
.armor-cell-name-block { text-align: left; line-height: 1.15; }
.armor-cell-name {
  display: block;
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 19px;
  color: var(--bubble-color);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.armor-cell-tier {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(107, 58, 35, 0.55);
}

/* Numeric stat cell : big Markup number + small unit, both brown */
.armor-num {
  font-family: "Markup", "Montserrat", sans-serif;
  font-weight: 400;
  font-size: 19px;
  color: var(--bubble-color);
  letter-spacing: 0.01em;
  display: inline-block;
  line-height: 1;
}
.armor-num-suffix {
  font-family: "Montserrat", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: rgba(107, 58, 35, 0.55);
  margin-left: 2px;
}

/* Yes/no glyph cells — uniform brown for the checkmark fill */
.armor-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bubble-color);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}
.armor-no {
  color: rgba(107, 58, 35, 0.20);
  font-size: 15px;
  font-weight: 900;
}

/* Tier strip on the left edge of each row, colored by --tier-accent
   (this is the ONLY place the accent shows up in the table) */
.armor-table tbody td:first-child { position: relative; }
.armor-table tbody td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--tier-accent);
}

/* Craft column : small icon button that opens the recipe modal. */
.armor-craft-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(245, 211, 163, 0.55);
  border: 1.5px solid rgba(200, 155, 110, 0.5);
  color: var(--bubble-color);
  cursor: pointer;
  transition:
    background 220ms ease,
    border-color 220ms ease,
    transform 220ms cubic-bezier(.34, 1.56, .64, 1);
}
.armor-craft-btn:hover {
  background: var(--bubble-color);
  border-color: var(--bubble-color);
  color: #fff;
  transform: scale(1.08);
}
.armor-craft-btn svg { width: 18px; height: 18px; }

/* Craft modal — reuses the dl-modal chrome but tuned for recipes. */
.craft-modal-grid {
  display: inline-grid;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(3, 64px);
  gap: 6px;
  margin: 0 auto;
  padding: 16px;
  background: #c89b6e;
  border-radius: 10px;
}
.craft-cell {
  background: rgba(255, 247, 230, 0.85);
  border: 2px inset rgba(122, 88, 64, 0.3);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #6b3a23;
  text-align: center;
  padding: 4px;
  image-rendering: pixelated;
}
.craft-cell img { width: 100%; height: 100%; image-rendering: pixelated; }
.craft-result-arrow {
  display: inline-flex;
  align-items: center;
  margin: 0 12px;
  color: var(--bubble-color);
  font-size: 32px;
  font-weight: 900;
}
.craft-modal-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
}
.craft-result {
  width: 88px;
  height: 88px;
  border-radius: 12px;
  background: rgba(245, 211, 163, 0.6);
  border: 2px solid #c89b6e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}
.craft-result img { width: 100%; height: auto; image-rendering: pixelated; }
.craft-recipe-note {
  text-align: center;
  font-size: 13px;
  color: #6b3a23;
  font-weight: 400;
  margin: 8px 0 0;
}

@media (max-width: 760px) {
  .armor-table { font-size: 11.5px; min-width: 720px; }
  .armor-cell-img { width: 64px; height: 90px; }
  .armor-cell-name { font-size: 15px; }
  .armor-num { font-size: 16px; }
  .armor-craft-btn { width: 30px; height: 30px; }
}
