/* Valheim Wiki — valheim.brandan.au
   Palette: charcoal wood, warm parchment, amber gold, mist blue */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=IM+Fell+English:ital@0;1&family=MedievalSharp&family=Source+Sans+3:wght@400;600;700&display=swap');

:root {
  --bg: #161210;
  --bg-deep: #0e0b09;
  --wood: #2a1f18;
  --wood-light: #3d2e24;
  --iron: #4a4540;
  --parchment: #e8d6b4;
  --parchment-dark: #d4c09a;
  --ink: #2a2218;
  --ink-soft: #4a3c2e;
  --amber: #c4923a;
  --gold: #daaf50;
  --gold-dim: #a87e2e;
  --mist: #7894a8;
  --fog: #b4bec8;
  --ember: #b44628;
  --success: #6b8f4e;
  --danger: #a33c2c;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0,0,0,.55);
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-title: "MedievalSharp", "Cinzel", serif;
  --font-body: "IM Fell English", "Georgia", serif;
  --font-ui: "Source Sans 3", system-ui, sans-serif;
  --max: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--parchment);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(196,146,58,.08), transparent 55%),
    linear-gradient(180deg, #1a1410 0%, var(--bg-deep) 40%, #12100e 100%);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.65;
  letter-spacing: .01em;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration: none; transition: color .2s; }
a:hover { color: #f0d078; }

/* NAV */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, rgba(14,11,9,.97), rgba(22,18,16,.92));
  border-bottom: 2px solid var(--gold-dim);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
  backdrop-filter: blur(8px);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 1rem;
  padding: .65rem 1.25rem; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: .65rem;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.15rem; color: var(--gold);
  letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap;
}
.brand img { width: 36px; height: 36px; }
.brand span { color: var(--parchment); font-weight: 400; font-size: .85rem; letter-spacing: .12em; }

.nav-toggle {
  display: none; margin-left: auto;
  background: var(--wood); border: 1px solid var(--amber);
  color: var(--gold); padding: .4rem .75rem;
  font-family: var(--font-ui); cursor: pointer; border-radius: 4px;
}
.nav-links {
  display: flex; flex-wrap: wrap; gap: .15rem .55rem;
  list-style: none; margin: 0; padding: 0; flex: 1;
  justify-content: flex-end;
}
.nav-links a {
  font-family: var(--font-ui); font-size: .78rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: var(--fog); padding: .35rem .5rem; border-radius: 4px;
  border: 1px solid transparent;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--gold); border-color: rgba(196,146,58,.35);
  background: rgba(196,146,58,.08);
}

/* HERO */
.hero {
  position: relative; min-height: 420px;
  display: flex; align-items: flex-end;
  background: var(--bg-deep) center/cover no-repeat;
  border-bottom: 3px solid var(--amber);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(14,11,9,.25) 0%, rgba(14,11,9,.55) 45%, rgba(14,11,9,.92) 100%);
}
.hero-content {
  position: relative; z-index: 1;
  max-width: var(--max); margin: 0 auto; width: 100%;
  padding: 3.5rem 1.5rem 2.5rem;
}
.hero h1 {
  font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700; margin: 0 0 .4rem; color: var(--gold);
  text-shadow: 0 2px 18px rgba(0,0,0,.8); letter-spacing: .06em;
}
.hero .tagline {
  font-family: var(--font-body); font-style: italic;
  font-size: 1.25rem; color: var(--parchment); max-width: 36em;
  margin: 0 0 1.25rem; text-shadow: 0 1px 8px rgba(0,0,0,.7);
}
.hero-meta {
  font-family: var(--font-ui); font-size: .85rem; color: var(--mist);
  letter-spacing: .06em; text-transform: uppercase;
}

/* LAYOUT */
.wrap { max-width: var(--max); margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page-banner {
  height: 200px; background: center/cover no-repeat;
  border-bottom: 2px solid var(--amber);
  position: relative;
}
.page-banner::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 20%, rgba(14,11,9,.85));
}
.page-title-block {
  max-width: var(--max); margin: -2.2rem auto 1.25rem;
  position: relative; z-index: 2; padding: 0 1.25rem 0.5rem;
}
.page-title-block h1 {
  font-family: var(--font-display); color: var(--gold);
  font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 .35rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.9);
}
.page-title-block .lead {
  color: var(--fog); font-style: italic; margin: 0; max-width: 42em;
}

/* CARDS / PARCHMENT */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem; margin: 1.75rem 0;
}
.card {
  background:
    linear-gradient(160deg, rgba(232,214,180,.97), rgba(212,192,154,.95));
  color: var(--ink);
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem 1.4rem;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform .2s, box-shadow .2s;
}
.card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid rgba(168,126,46,.35); border-radius: 6px;
  pointer-events: none;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 48px rgba(0,0,0,.6); }
.card h2, .card h3 {
  font-family: var(--font-display); color: var(--ink);
  margin: 0 0 .5rem; font-size: 1.15rem; letter-spacing: .04em;
}
.card p { margin: 0 0 .75rem; font-size: 1.05rem; }
.card a.more {
  font-family: var(--font-ui); font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; color: var(--ember);
}
.card a.more:hover { color: #c05030; }

.panel {
  background: linear-gradient(145deg, var(--wood), var(--wood-light));
  border: 1px solid var(--iron);
  border-top: 3px solid var(--amber);
  border-radius: var(--radius);
  padding: 1.5rem 1.6rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow);
}
.panel h2, .panel h3 {
  font-family: var(--font-display); color: var(--gold);
  margin-top: 0; letter-spacing: .05em;
}

.parchment {
  background:
    url("../images/generated/parchment-tex.jpg"),
    linear-gradient(160deg, #ebe0c4, #dcc9a0);
  background-blend-mode: multiply;
  color: var(--ink);
  border: 3px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 1.75rem 1.85rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow);
  position: relative;
}
.parchment::after {
  content: ""; position: absolute; top: 10px; right: 10px;
  width: 48px; height: 48px;
  background: url("../images/generated/corner-rune.png") center/contain no-repeat;
  opacity: .85;
}
.parchment h2, .parchment h3 {
  font-family: var(--font-display); color: #3a2a14;
  border-bottom: 1px solid rgba(168,126,46,.4);
  padding-bottom: .4rem; margin-top: 1.4rem;
}
.parchment h2:first-child, .parchment h3:first-child { margin-top: 0; }
.parchment ul, .parchment ol { padding-left: 1.3rem; }
.parchment li { margin: .35rem 0; }
.parchment strong { color: #5a3a12; }
.parchment a { color: #8a4018; font-weight: 600; }
.parchment a:hover { color: var(--ember); }

.divider {
  display: block; width: min(900px, 100%); height: 40px;
  margin: 1.5rem auto; background: url("../images/generated/divider.png") center/contain no-repeat;
}

/* TABLES */
.table-wrap { overflow-x: auto; margin: 1rem 0; }
table {
  width: 100%; border-collapse: collapse;
  font-family: var(--font-ui); font-size: .92rem;
}
th, td {
  padding: .65rem .75rem; text-align: left;
  border-bottom: 1px solid rgba(168,126,46,.35);
}
th {
  font-family: var(--font-display); color: var(--gold);
  letter-spacing: .04em; font-weight: 600;
  background: rgba(0,0,0,.25);
}
.parchment th { color: #5a3a12; background: rgba(90,58,18,.08); }
.parchment td { color: var(--ink); }
tr:hover td { background: rgba(196,146,58,.06); }

.tag {
  display: inline-block; font-family: var(--font-ui);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; padding: .2rem .5rem;
  border-radius: 3px; background: rgba(196,146,58,.2);
  color: var(--gold); border: 1px solid rgba(196,146,58,.4);
}
.parchment .tag { color: #6a4010; background: rgba(168,126,46,.15); }

.tip {
  border-left: 4px solid var(--amber);
  background: rgba(196,146,58,.1);
  padding: .85rem 1rem; margin: 1rem 0; border-radius: 0 6px 6px 0;
}
.parchment .tip { background: rgba(90,58,18,.08); color: var(--ink); }
.warn {
  border-left: 4px solid var(--ember);
  background: rgba(180,70,40,.12);
  padding: .85rem 1rem; margin: 1rem 0; border-radius: 0 6px 6px 0;
}

.breadcrumb {
  font-family: var(--font-ui); font-size: .8rem;
  color: var(--mist); margin-bottom: 1rem;
}
.breadcrumb a { color: var(--fog); }

/* FOOTER */
.site-footer {
  border-top: 2px solid var(--gold-dim);
  background: var(--bg-deep);
  padding: 2rem 1.25rem 2.5rem;
  text-align: center;
  font-family: var(--font-ui); font-size: .85rem; color: var(--mist);
}
.site-footer .mark { width: 48px; height: 48px; margin: 0 auto .75rem; }
.site-footer a { color: var(--gold); }

.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem;
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; width: 100%; flex-direction: column;
    background: var(--wood); padding: .75rem; border-radius: 6px;
  }
  .nav-links.open { display: flex; }
  .two-col { grid-template-columns: 1fr; }
  .hero { min-height: 320px; }
}

/* Utility */
.muted { color: var(--mist); font-size: .9rem; }
.center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.ornament {
  width: 100%; max-width: 800px; height: 48px; margin: 1rem auto;
  background: url("../images/generated/ornament-bar.png") center/contain no-repeat;
}


/* --- Post-review polish --- */
.hero { min-height: 480px; }
.hero-content { padding-bottom: 3rem; }
.nav-links a { white-space: nowrap; }
.card img { width: 100%; object-fit: cover; max-height: 120px; margin: .35rem 0 .75rem; border: 1px solid rgba(90,58,18,.25); }
.page-banner { height: 220px; box-shadow: inset 0 -40px 60px rgba(14,11,9,.5); }
.parchment { line-height: 1.7; }
.parchment li { margin: .45rem 0; }
.brand span { opacity: .75; }
@media (max-width: 960px) {
  .nav-links a { font-size: .72rem; padding: .3rem .4rem; }
}
.site-header .nav-inner { max-width: 1400px; }
main.wrap > .parchment:first-child { margin-top: 0; }

/* nav compact v2 */
.nav-links { gap: .1rem .35rem; max-width: 100%; }
.nav-links a { font-size: .7rem; padding: .28rem .42rem; }
.hero { min-height: 520px; background-position: center 40%; }
.brand { font-size: 1.05rem; }
@media (min-width: 1100px) {
  .nav-links { flex-wrap: wrap; justify-content: flex-end; }
}

/* hero-polish-v3 — post screenshot review */
.hero h1 { letter-spacing: .08em; }
.hero .tagline { max-width: 34em; font-size: clamp(1.05rem, 2.2vw, 1.3rem); }
.page-banner { height: 240px; }
.page-title-block h1 {
  background: linear-gradient(90deg, rgba(14,11,9,.75), rgba(14,11,9,.35), transparent);
  display: inline-block; padding: .15rem .6rem .15rem 0; border-radius: 4px;
}
.parchment { padding: 2rem 2.1rem 2.2rem; }
.parchment::after { width: 40px; height: 40px; opacity: .55; }
.card-grid { gap: 1.4rem; }
.nav-links {
  row-gap: .25rem;
  padding: .15rem 0;
}
.site-header { border-bottom-width: 1px; }
.site-header::after {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, transparent, var(--amber), var(--gold), var(--amber), transparent);
  opacity: .85;
}

.hero-cta { margin-top: 1.25rem; }
.hero-cta .more { font-size: 1.05rem; }

/* --- Mods dropdown + content polish --- */
.nav-links .has-dropdown { position: relative; list-style: none; }
.nav-links .has-dropdown > a.dropdown-toggle {
  cursor: pointer;
  display: inline-flex; align-items: center; gap: .25rem;
}
.nav-links .has-dropdown > a.dropdown-toggle::after {
  content: "▾"; font-size: .65em; opacity: .75;
}
.nav-dropdown {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 220px;
  background: linear-gradient(180deg, #2a1f18, #1a1410);
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  box-shadow: 0 12px 32px rgba(0,0,0,.65);
  padding: .45rem 0;
  z-index: 200;
  list-style: none; margin: 0;
}
.nav-dropdown li { margin: 0; }
.nav-dropdown a {
  display: block; padding: .45rem .9rem !important;
  font-size: .72rem !important; white-space: nowrap;
  border: none !important; border-radius: 0 !important;
  color: var(--fog) !important;
}
.nav-dropdown a:hover {
  background: rgba(196,146,58,.15) !important;
  color: var(--gold) !important;
}
.nav-dropdown .dd-label {
  font-family: var(--font-ui); font-size: .62rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber); padding: .55rem .9rem .2rem;
  opacity: .85; pointer-events: none;
}
.nav-links .has-dropdown:hover > .nav-dropdown,
.nav-links .has-dropdown:focus-within > .nav-dropdown,
.nav-links .has-dropdown.open > .nav-dropdown { display: block; }

@media (max-width: 760px) {
  .nav-links .has-dropdown { width: 100%; }
  .nav-dropdown {
    position: static; display: none;
    min-width: 0; width: 100%;
    box-shadow: none; border: none;
    background: rgba(0,0,0,.25); margin: .15rem 0 .35rem;
    border-radius: 4px;
  }
  .nav-links .has-dropdown.open > .nav-dropdown { display: block; }
  .nav-dropdown a { padding-left: 1.4rem !important; }
}

/* Server callout */
.server-box {
  border: 1px solid rgba(196,146,58,.45);
  border-left: 4px solid var(--gold);
  background: rgba(196,146,58,.08);
  padding: 1rem 1.15rem;
  margin: 1.25rem 0;
  border-radius: 0 8px 8px 0;
}
.parchment .server-box {
  background: rgba(90,58,18,.07);
  color: var(--ink);
  border-color: rgba(168,126,46,.45);
  border-left-color: #8a5a18;
}
.server-box strong.label {
  font-family: var(--font-ui); font-size: .72rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); display: block; margin-bottom: .35rem;
}
.parchment .server-box strong.label { color: #6a4010; }

.mod-meta {
  font-family: var(--font-ui); font-size: .82rem;
  color: var(--mist); margin: 0 0 1rem;
}
.parchment .mod-meta { color: var(--ink-soft); }
.mod-meta .tag { margin-right: .35rem; }

.toc-list { columns: 2; column-gap: 2rem; }
@media (max-width: 640px) { .toc-list { columns: 1; } }

.rarity-magic { color: #4a8fd4; }
.rarity-rare { color: #c9a227; }
.rarity-epic { color: #9b59c9; }
.rarity-legendary { color: #d4772a; }
.rarity-mythic { color: #c0395f; }
.rarity-ancient { color: #8b7355; }

.anchor-nav {
  display: flex; flex-wrap: wrap; gap: .4rem;
  margin: 1rem 0 1.5rem;
}
.anchor-nav a {
  font-family: var(--font-ui); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  padding: .3rem .65rem; border-radius: 4px;
  border: 1px solid rgba(196,146,58,.35);
  background: rgba(196,146,58,.08); color: var(--gold);
}
.parchment .anchor-nav a {
  color: #6a4010; border-color: rgba(90,58,18,.3);
  background: rgba(90,58,18,.06);
}
.anchor-nav a:hover { background: rgba(196,146,58,.2); }

.version-table td:nth-child(2),
.version-table th:nth-child(2) { white-space: nowrap; }

.dep-chip {
  display: inline-block; font-family: var(--font-ui);
  font-size: .65rem; font-weight: 700; letter-spacing: .04em;
  padding: .15rem .4rem; margin: .1rem; border-radius: 3px;
  background: rgba(120,148,168,.2); color: var(--mist);
  border: 1px solid rgba(120,148,168,.35);
}
.parchment .dep-chip { color: #3a4a58; background: rgba(90,58,18,.08); border-color: rgba(90,58,18,.25); }

h2[id], h3[id] { scroll-margin-top: 5rem; }

/* --- nav-stable-v4: identical single-row desktop nav --- */
.site-header .nav-inner {
  flex-wrap: nowrap;
  align-items: center;
  min-height: 56px;
  max-width: 1400px;
}
.nav-links {
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: .15rem .3rem;
  row-gap: 0;
  padding: 0;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
}
.nav-links > li { flex-shrink: 0; list-style: none; }
.nav-links a {
  font-size: .68rem;
  padding: .32rem .4rem;
  white-space: nowrap;
  /* Active border must not change layout width */
  border: 1px solid transparent;
  box-sizing: border-box;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--gold);
  border-color: rgba(196,146,58,.35);
  background: rgba(196,146,58,.08);
}
.nav-links .has-dropdown > a.dropdown-toggle::after {
  content: "▾";
  font-size: .65em;
  opacity: .75;
  margin-left: .15rem;
}
.nav-dropdown-more { left: auto; right: 0; min-width: 200px; }
.brand span { display: inline; }

@media (max-width: 1100px) and (min-width: 761px) {
  .brand span { display: none; } /* keep nav on one row mid widths */
  .nav-links a { font-size: .64rem; padding: .28rem .32rem; }
}

@media (max-width: 760px) {
  .site-header .nav-inner { flex-wrap: wrap; min-height: 0; }
  .nav-links {
    display: none;
    flex-wrap: nowrap;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    background: var(--wood);
    padding: .75rem;
    border-radius: 6px;
  }
  .nav-links.open { display: flex; }
  .nav-links .has-dropdown { width: 100%; }
  .nav-dropdown {
    position: static;
    display: none;
    min-width: 0;
    width: 100%;
    left: 0; right: auto;
    box-shadow: none;
    border: none;
    background: rgba(0,0,0,.25);
    margin: .15rem 0 .35rem;
    border-radius: 4px;
  }
  .nav-links .has-dropdown.open > .nav-dropdown { display: block; }
  .nav-dropdown a { padding-left: 1.4rem !important; }
}
