/* ═══════════════════════════════════════════════════
   EXTINCTION ISLAND WIKI — style.css
   Wikia-style layout, warm editorial theme
═══════════════════════════════════════════════════ */

@font-face {
  font-family: 'Iowan Old Style';
  src: local('Iowan Old Style'), local('Iowan Old Style');
}

:root {
  /* Core palette — orange/yellow gradient world */
  --bg:           #f5a623;
  --bg-page:      #fdf0d5;
  --bg-surface:   #fce4b0;
  --bg-infobox:   #fff8ec;
  --bg-gradient:  linear-gradient(135deg, #f5a623 0%, #f7c94e 40%, #fde98a 100%);
  --border:       rgba(140,80,0,0.18);
  --border-light: rgba(140,80,0,0.10);

  /* Text */
  --text:         #ffffff;
  --text-body:    #1a0e00;
  --text-muted:   rgba(255,255,255,0.72);
  --text-dim:     rgba(255,255,255,0.42);

  /* Text on light surfaces */
  --text-surface:       #2a1500;
  --text-surface-muted: #6b4010;
  --text-surface-dim:   #b07030;

  /* Accent — deep brown/amber to contrast gradient */
  --accent:       #7a2e00;
  --accent-dim:   rgba(122,46,0,0.12);
  --accent-hover: #a04000;
  --link:         #7a2e00;
  --link-hover:   #a04000;

  /* Tribe colors — UNCHANGED */
  --vanua:        #3a8c6e;
  --vanua-light:  #6ecfaa;
  --kadavu:       #7a4fa3;
  --kadavu-light: #b891d8;
  --yasawa:       #c0712a;
  --yasawa-light: #e8a060;
  --ei-color:     #c0392b;
  --ei-light:     #e74c3c;

  /* Layout */
  --sidebar-w:    220px;
  --content-max:  860px;
  --topbar-h:     44px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 15px; }

body {
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── TOP BAR ── */
.wiki-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  background: rgba(90,30,0,0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 2px solid rgba(255,200,80,0.5);
  display: flex;
  align-items: center;
  padding: 0 1.2rem;
  gap: 1.5rem;
}

.wiki-topbar-title {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: 1.15rem;
  color: #ffd96a;
  text-decoration: none;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}

.wiki-topbar-title:hover { color: #ffe99a; }

.wiki-topbar-sep {
  width: 1px;
  height: 20px;
  background: rgba(255,200,80,0.25);
  flex-shrink: 0;
}

.wiki-topnav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  flex-wrap: wrap;
}

.wiki-topnav a {
  font-size: 0.8rem;
  color: rgba(255,220,130,0.75);
  text-decoration: none;
  padding: 0.3rem 0.7rem;
  border-radius: 2px;
  transition: all 0.15s;
  white-space: nowrap;
}

.wiki-topnav a:hover,
.wiki-topnav a.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.wiki-topnav a.active {
  color: #ffd96a;
}

/* ── PAGE SHELL ── */
.wiki-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

/* ── SIDEBAR ── */
.wiki-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-heading {
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0 1rem 0.5rem;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 0.3rem;
}

.sidebar-link {
  display: block;
  font-size: 0.82rem;
  color: rgba(80,30,0,0.75);
  text-decoration: none;
  padding: 0.32rem 1rem 0.32rem 1.2rem;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}

.sidebar-link:hover {
  color: var(--accent);
  background: rgba(255,255,255,0.25);
  border-left-color: rgba(122,46,0,0.3);
}

.sidebar-link.active {
  color: var(--accent);
  background: rgba(122,46,0,0.1);
  border-left-color: var(--accent);
}

.sidebar-sublink {
  display: block;
  font-size: 0.77rem;
  color: rgba(80,30,0,0.5);
  text-decoration: none;
  padding: 0.25rem 1rem 0.25rem 1.8rem;
  transition: all 0.15s;
}

.sidebar-sublink:hover { color: var(--link); }
.sidebar-sublink.aired { color: rgba(80,30,0,0.65); }

/* ── MAIN CONTENT ── */
.wiki-main {
  flex: 1;
  min-width: 0;
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.wiki-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

/* ── PAGE TITLE AREA ── */
.wiki-page-title {
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}

.wiki-page-title h1 {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: 2rem;
  font-weight: 400;
  color: var(--accent);
  line-height: 1.2;
}

.wiki-page-title .page-subtitle {
  font-size: 0.82rem;
  color: var(--text-surface-muted);
  margin-top: 0.3rem;
}

/* ── BREADCRUMB ── */
.wiki-breadcrumb {
  font-size: 0.75rem;
  color: var(--text-surface-dim);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.wiki-breadcrumb a { color: var(--link); text-decoration: none; }
.wiki-breadcrumb a:hover { text-decoration: underline; color: var(--link-hover); }
.wiki-breadcrumb span { color: var(--text-surface-dim); }

/* ── BODY TEXT ── */
.wiki-body p {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--text-body);
  margin-bottom: 1rem;
}

.wiki-body h2 {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
  margin: 1.8rem 0 0.8rem;
}

.wiki-body h3 {
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-surface);
  margin: 1.2rem 0 0.5rem;
}

/* ── INFOBOX ── */
.infobox {
  float: right;
  clear: right;
  margin: 0 0 1.2rem 1.5rem;
  width: 240px;
  background: var(--bg-infobox);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.infobox-title {
  background: var(--accent);
  color: #fff;
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: center;
  padding: 0.45rem 0.8rem;
  letter-spacing: 0.04em;
}

.infobox table {
  width: 100%;
  border-collapse: collapse;
}

.infobox td {
  padding: 0.35rem 0.7rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  line-height: 1.4;
}

.infobox td:first-child {
  font-weight: 600;
  color: var(--text-surface-muted);
  width: 45%;
  white-space: nowrap;
}

.infobox td:last-child {
  color: var(--text-body);
}

.infobox tr:last-child td { border-bottom: none; }

/* ── CAST TABLE ── */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 1rem 0 1.5rem;
}

.wiki-table th {
  background: rgba(122,46,0,0.1);
  color: var(--text-surface-muted);
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.wiki-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
  vertical-align: middle;
}

.wiki-table tr:hover td { background: rgba(255,255,255,0.3); }
.wiki-table tr:last-child td { border-bottom: none; }

.wiki-table td.num {
  color: var(--text-surface-dim);
  font-size: 0.75rem;
  width: 2rem;
}

.wiki-table td.name {
  font-weight: 600;
  color: var(--text-surface);
}

.wiki-table tr.voted-out td {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: rgba(192,57,43,0.6);
}

/* ── TRIBE HEADER COLORS — UNCHANGED ── */
.tribe-header-vanua  { background: var(--vanua) !important; color: #fff !important; }
.tribe-header-kadavu { background: var(--kadavu) !important; color: #fff !important; }
.tribe-header-yasawa { background: var(--yasawa) !important; color: #fff !important; }
.tribe-header-ei     { background: var(--ei-color) !important; color: #fff !important; }

/* ── NOTICE BOXES ── */
.wiki-notice {
  border-left: 3px solid var(--accent);
  background: rgba(122,46,0,0.08);
  padding: 0.7rem 1rem;
  margin: 1rem 0;
  font-size: 0.84rem;
  color: var(--text-surface-muted);
}

.wiki-notice.green {
  border-color: var(--vanua);
  background: rgba(58,140,110,0.1);
  color: #1a5c44;
}

.wiki-notice.red {
  border-color: var(--ei-color);
  background: rgba(192,57,43,0.08);
  color: #8a1a0a;
}

/* ── TAGS ── */
.tag {
  display: inline-block;
  font-size: 0.68rem;
  font-family: 'Gill Sans', 'Gill Sans MT', 'Trebuchet MS', sans-serif;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  vertical-align: middle;
  margin-left: 0.3rem;
  letter-spacing: 0.04em;
}

.tag.showmance { background: rgba(200,60,100,0.15); color: #a0183a; border: 1px solid rgba(200,60,100,0.3); }
.tag.winner    { background: rgba(122,46,0,0.12); color: var(--accent); border: 1px solid rgba(122,46,0,0.25); }
.tag.immune    { background: rgba(58,140,110,0.15); color: #1a6b4a; border: 1px solid rgba(58,140,110,0.3); }
.tag.elim      { background: rgba(192,57,43,0.12); color: #7a1a0a; border: 1px solid rgba(192,57,43,0.25); }
.tag.ei        { background: rgba(192,57,43,0.08); color: #902010; border: 1px solid rgba(192,57,43,0.2); }

/* ── EPISODE NAV ── */
.ep-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
  margin-top: 2rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.ep-nav-btn {
  font-size: 0.8rem;
  color: var(--link);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  transition: all 0.15s;
  background: rgba(255,255,255,0.35);
}

.ep-nav-btn:hover {
  color: var(--link-hover);
  border-color: var(--accent);
  background: rgba(255,255,255,0.55);
}

.ep-nav-btn.disabled {
  opacity: 0.25;
  pointer-events: none;
}

/* ── EPISODE LIST TABLE ── */
.ep-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  margin: 1rem 0;
}

.ep-list-table th {
  background: rgba(122,46,0,0.1);
  color: var(--text-surface-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 0.6rem 0.9rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}

.ep-list-table td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-body);
}

.ep-list-table tr:hover td { background: rgba(255,255,255,0.3); cursor: pointer; }
.ep-list-table tr:last-child td { border-bottom: none; }

.ep-list-table td.ep-num {
  color: var(--text-surface-dim);
  font-size: 0.75rem;
  width: 2.5rem;
}

.ep-list-table td.ep-title a {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.ep-list-table td.ep-title a:hover { text-decoration: underline; color: var(--link-hover); }

.ep-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ep-status.aired    { color: #1a6b4a; background: rgba(58,140,110,0.15); }
.ep-status.tba      { color: var(--text-surface-dim); background: rgba(0,0,0,0.07); }
.ep-status.upcoming { color: var(--accent); background: rgba(122,46,0,0.1); }

/* ── WIKI FOOTER ── */
.wiki-footer {
  background: rgba(90,30,0,0.88);
  border-top: 1px solid rgba(255,200,80,0.2);
  padding: 1.2rem 2rem;
  font-size: 0.75rem;
  color: rgba(255,220,130,0.55);
  text-align: center;
}

.wiki-footer a { color: rgba(255,220,130,0.55); text-decoration: none; }
.wiki-footer a:hover { color: rgba(255,220,130,0.85); text-decoration: underline; }

/* ── HERO BANNER (index only) ── */
.wiki-hero {
  background: rgba(90,30,0,0.15);
  border-bottom: 1px solid var(--border);
  padding: 3rem 2rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.wiki-hero::before {
  content: 'EXTINCTION ISLAND';
  position: absolute;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 10vw;
  color: rgba(122,46,0,0.07);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.1em;
}

.wiki-hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.wiki-hero h1 {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  color: var(--accent);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.wiki-hero p {
  font-family: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
  font-size: 0.95rem;
  color: rgba(80,30,0,0.75);
  max-width: 560px;
  line-height: 1.7;
}

.wiki-hero-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 1.2rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat-num {
  display: block;
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 1.6rem;
  color: var(--accent);
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-surface-dim);
}

/* ── SECTION CARDS (index) ── */
.wiki-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border-light);
  border: 1px solid var(--border);
  margin: 1.5rem 0;
}

.wiki-card {
  background: rgba(255,255,255,0.35);
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text-body);
  transition: background 0.15s;
}

.wiki-card:hover { background: rgba(255,255,255,0.55); }

.wiki-card-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.wiki-card h3 {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--text-surface);
  margin-bottom: 0.3rem;
}

.wiki-card p {
  font-size: 0.78rem;
  color: var(--text-surface-muted);
  line-height: 1.5;
}

/* ── CHALLENGE BLOCK ── */
.challenge-block {
  background: rgba(255,255,255,0.35);
  border: 1px solid var(--border);
  margin: 1rem 0 1.5rem;
  overflow: hidden;
}

.challenge-block-header {
  background: rgba(122,46,0,0.1);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.challenge-block-body {
  padding: 1rem;
}

.challenge-block-name {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 1.1rem;
  color: var(--text-surface);
  margin-bottom: 0.5rem;
}

.challenge-block-desc {
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--text-surface-muted);
  margin-bottom: 0.8rem;
}

.challenge-results-row {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid var(--border-light);
  padding-top: 0.7rem;
}

.challenge-result-line {
  display: flex;
  gap: 0.8rem;
  font-size: 0.82rem;
  align-items: center;
}

.cr-label {
  color: var(--text-surface-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 70px;
}

.cr-win  { color: var(--vanua); }
.cr-lose { color: var(--ei-color); }

/* ── TRIVIA LIST ── */
.trivia-list {
  list-style: none;
  margin: 0.5rem 0 1.5rem;
  border: 1px solid var(--border);
}

.trivia-list li {
  display: flex;
  gap: 0.8rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border-light);
  font-family: 'Iowan Old Style', 'Palatino Linotype', Palatino, serif;
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-surface-muted);
  background: rgba(255,255,255,0.2);
  transition: background 0.15s;
}

.trivia-list li:last-child { border-bottom: none; }
.trivia-list li:hover { background: rgba(255,255,255,0.38); }

.trivia-list li::before {
  content: '•';
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 0.05rem;
}

/* ── ELIM NOTICE ── */
.elim-notice {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(192,57,43,0.1);
  border: 1px solid rgba(192,57,43,0.3);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
}

.elim-notice-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.elim-notice-body {
  font-size: 0.85rem;
  color: #7a1a0a;
  line-height: 1.4;
}

.elim-notice-body strong {
  color: #5a1008;
  font-weight: 600;
}

/* ── NO-ELIM NOTICE ── */
.no-elim-notice {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(58,140,110,0.1);
  border: 1px solid rgba(58,140,110,0.3);
  padding: 0.8rem 1rem;
  margin: 1rem 0;
  font-size: 0.85rem;
  color: #1a6b4a;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .wiki-sidebar { display: none; }
  .infobox { float: none; width: 100%; margin: 0 0 1rem; }
}