/* ============================================================
   /cartas/ — Enciclopédia de Cartas (estilo "wiki" no tema do site)
   Prefixo wk- pra não colidir com o style.css
   ============================================================ */

.wk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* cores por raridade (a mítica é arco-íris) */
.wk-r-mitica { --rc: #ff3df2; }

/* ---------------- LAYOUT ---------------- */
.wk-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: 40px;
  padding-top: 40px;
  padding-bottom: 80px;
  align-items: start;
}

/* ---------------- BARRA LATERAL ---------------- */
.wk-side {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.wk-search { position: relative; }
.wk-search i, .wk-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--text-dim); pointer-events: none;
}
.wk-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 10px 12px 10px 36px;
}
.wk-search input::placeholder { color: var(--text-dim); }
.wk-search input:focus { outline: none; border-color: var(--red); }

.wk-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px 12px;
}
.wk-toc-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 10px 8px;
}
.wk-toc ol { list-style: none; margin: 0; padding: 0; }
.wk-toc ol ol { margin: 2px 0 4px 14px; border-left: 1px solid var(--border); }
.wk-toc a {
  display: flex; align-items: baseline; gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.wk-toc a:hover { color: var(--text); background: var(--surface-2); }
.wk-toc a.on { color: var(--text); background: var(--surface-2); box-shadow: inset 2px 0 0 var(--red); }
.wk-toc .n { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-dim); min-width: 22px; }
.wk-toc-count {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--text-dim);
}

/* ---------------- ARTIGO ---------------- */
.wk-article { min-width: 0; }

.wk-hatnote {
  display: block; position: relative; padding-left: 40px !important;
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 28px;
}
.wk-hatnote svg, .wk-hatnote i { position: absolute; left: 14px; top: 13px; width: 16px; height: 16px; }
.wk-hatnote a { color: var(--text); text-decoration: underline; text-decoration-color: var(--red); text-underline-offset: 3px; }

.wk-sec, .wk-rar { padding: 0; } /* anula o section { padding: 96px 0 } global */
.wk-sec { margin-bottom: 44px; scroll-margin-top: 84px; }
.wk-sec::after { content: ''; display: block; clear: both; }
.wk-sec h2 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.01em;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.wk-sec p, .wk-list li { color: var(--text-muted); margin-bottom: 12px; max-width: 74ch; }
.wk-sec p b, .wk-list b { color: var(--text); }
.wk-sec code, .wk-hatnote code {
  font-family: var(--font-mono); font-size: 0.85em;
  background: var(--surface-2); padding: 2px 6px; border-radius: 4px; color: var(--text);
}
.wk-list { list-style: disc; padding-left: 22px; margin-bottom: 14px; }
.wk-list li { margin-bottom: 8px; }
.wk-list li::marker { color: var(--red); }
.wk-note { font-size: 0.82rem; color: var(--text-dim) !important; margin-top: 10px; }

/* ---------------- INFOBOX (direita, igual wiki) ---------------- */
.wk-infobox {
  float: right;
  width: 280px;
  margin: 0 0 20px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.86rem;
}
.wk-info-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  text-align: center;
  padding: 12px 14px 4px;
  background: var(--surface-2);
}
.wk-info-sub {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0 14px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.wk-infobox table { width: 100%; border-collapse: collapse; }
.wk-infobox th, .wk-infobox td { padding: 8px 14px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.wk-infobox tr:first-child th, .wk-infobox tr:first-child td { border-top: 0; }
.wk-infobox th { width: 42%; font-weight: 500; color: var(--text-muted); }
.wk-infobox td { color: var(--text); word-break: break-word; }
.wk-infobox td code { font-size: 0.78em; }

.wk-info-carta { --rc: var(--red); border-top: 3px solid var(--rc); }

/* ---------------- SELO DE RARIDADE ---------------- */
.wk-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--rc);
  border: 1px solid color-mix(in srgb, var(--rc) 45%, transparent);
  background: color-mix(in srgb, var(--rc) 12%, transparent);
  padding: 2px 9px;
  border-radius: 100px;
}
.wk-badge.wk-r-mitica {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(90deg, #ff3b3b, #f59e0b, #3ddc84, #3b82f6, #a855f7, #ff3df2);
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}

/* ---------------- TABELAS ---------------- */
.wk-tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.wk-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.wk-table th, .wk-table td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--border); vertical-align: middle; }
.wk-table thead th {
  border-top: 0;
  background: var(--surface-2);
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.wk-table td { color: var(--text-muted); }
.wk-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.wk-rlink:hover .wk-badge { filter: brightness(1.2); }

.wk-bar-wrap { display: flex; align-items: center; gap: 10px; min-width: 150px; }
.wk-bar { flex: 1; height: 6px; background: var(--surface-2); border-radius: 100px; overflow: hidden; }
.wk-bar span { display: block; height: 100%; background: var(--rc); border-radius: 100px; }
.wk-bar span.wk-r-mitica { background: linear-gradient(90deg, #ff3b3b, #f59e0b, #3ddc84, #3b82f6, #a855f7, #ff3df2); }
.wk-bar-wrap > span { font-family: var(--font-mono); font-size: 0.8rem; min-width: 48px; text-align: right; color: var(--text); }

.wk-table-lista th button {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.wk-table-lista th button:hover, .wk-table-lista th button.on { color: var(--text); }
.wk-table-lista th[aria-sort="ascending"] button::after { content: '▲'; font-size: 0.6rem; color: var(--red); }
.wk-table-lista th[aria-sort="descending"] button::after { content: '▼'; font-size: 0.6rem; color: var(--red); }
.wk-table-lista th button:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 3px; }
.wk-th-thumb { width: 72px; }
.wk-td-thumb img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.wk-nome-link { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.wk-nome-link:hover { text-decoration-color: var(--red); }
.wk-empty-cell { text-align: center; padding: 28px 14px !important; }

/* ---------------- CATÁLOGO ---------------- */
.wk-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.wk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wk-chip {
  font-family: var(--font-mono); font-size: 0.76rem;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: 100px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.wk-chip:hover { border-color: var(--text-muted); color: var(--text); }
.wk-chip.on { color: var(--text); border-color: var(--rc, var(--red)); background: color-mix(in srgb, var(--rc, var(--red)) 14%, transparent); }
.wk-count { font-family: var(--font-mono); font-size: 0.76rem; color: var(--text-dim); }

.wk-rar { margin-top: 28px; scroll-margin-top: 84px; }
.wk-rar h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  padding-left: 12px;
  border-left: 3px solid var(--rc);
  margin-bottom: 6px;
}
.wk-rar h3 small { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); font-weight: 400; }
.wk-sec .wk-rar-desc { margin: 0 0 14px 15px; font-size: 0.88rem; }

.wk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

.wk-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.wk-card:hover, .wk-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--rc);
  box-shadow: 0 8px 28px -10px color-mix(in srgb, var(--rc) 55%, transparent);
}
.wk-card.wk-r-mitica:hover { border-color: #ff3df2; }
.wk-card-img { aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.wk-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.wk-card:hover .wk-card-img img { transform: scale(1.04); }
.wk-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.wk-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wk-num { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-dim); }
.wk-card h4 { font-family: var(--font-display); font-size: 1.02rem; line-height: 1.25; color: var(--text); }
.wk-card p {
  font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.wk-empty { text-align: center; padding: 48px 24px; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); margin-top: 20px; }

/* ---------------- ARTIGO DA CARTA (modal) ---------------- */
.wk-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; overflow-y: auto; }
.wk-modal[hidden] { display: none; }
.wk-backdrop { position: fixed; inset: 0; background: rgba(5, 7, 11, 0.82); backdrop-filter: blur(4px); }
.wk-dialog {
  position: relative;
  width: 100%; max-width: 940px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 32px 24px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.7);
  animation: wk-in 0.2s ease;
}
.wk-dialog:focus { outline: none; }
@keyframes wk-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.wk-close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-muted); cursor: pointer;
}
.wk-close:hover { color: var(--text); border-color: var(--text-muted); }
.wk-close svg { width: 18px; height: 18px; }

.wk-m-head { padding-bottom: 12px; margin-bottom: 20px; border-bottom: 1px solid var(--border); padding-right: 48px; }
.wk-m-kicker { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.wk-m-head h2 { font-family: var(--font-display); font-size: 2rem; letter-spacing: -0.01em; }

.wk-m-cols { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 28px; align-items: start; }
.wk-m-cols .wk-infobox { float: none; width: auto; margin: 0; }
.wk-m-main p { color: var(--text-muted); margin: 14px 0; }
.wk-m-main p b { color: var(--text); }

.wk-fig { position: relative; margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); aspect-ratio: 4 / 3; background: var(--surface-2); }
.wk-fig img { width: 100%; height: 100%; object-fit: cover; }
.wk-holo-fx { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; mix-blend-mode: color-dodge;
  background: linear-gradient(115deg, transparent 20%, rgba(255,59,59,0.55) 32%, rgba(245,158,11,0.55) 40%, rgba(61,220,132,0.55) 48%, rgba(59,130,246,0.55) 56%, rgba(168,85,247,0.55) 64%, transparent 78%);
  background-size: 250% 250%;
}
.wk-fig.holo .wk-holo-fx { opacity: 0.85; animation: wk-holo 3.2s ease-in-out infinite; }
.wk-fig.holo { border-color: #ff3df2; box-shadow: 0 0 34px -8px rgba(255,61,242,0.6); }
@keyframes wk-holo { 0% { background-position: 100% 0; } 50% { background-position: 0 100%; } 100% { background-position: 100% 0; } }

.wk-m-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.wk-m-actions .btn { padding: 8px 14px; font-size: 0.82rem; }
.wk-m-actions .btn svg { width: 14px; height: 14px; }

.wk-quote {
  margin: 18px 0 0;
  padding: 10px 16px;
  border-left: 3px solid var(--rc, var(--red));
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text);
}
.wk-veja h3 { font-family: var(--font-display); font-size: 1rem; margin: 22px 0 8px; }
.wk-veja ul { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; }
.wk-veja a { color: var(--text-muted); font-size: 0.86rem; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.wk-veja a:hover { color: var(--text); text-decoration-color: var(--red); }

.wk-m-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); }
.wk-navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-weight: 600; font-size: 0.9rem;
  max-width: 48%;
  transition: border-color 0.15s ease;
}
.wk-navlink:hover { border-color: var(--text-muted); }
.wk-navlink small { display: block; font-family: var(--font-mono); font-size: 0.68rem; font-weight: 400; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }
.wk-navlink.right { text-align: right; margin-left: auto; }
.wk-navlink svg { width: 18px; height: 18px; flex: none; color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .wk-fig.holo .wk-holo-fx { animation: none; background-position: 50% 50%; }
  .wk-card, .wk-card-img img { transition: none; }
}
