/* Havenfall site — design system.
   Palette sampled from the game's title screen and loader (see dev/DESIGN.md). */

:root {
  --night: #0d0b08;
  --soil: #1b1410;
  --soil-2: #241a13;
  --soil-3: #2e2118;
  --cream: #e8e0cf;
  --cream-dim: #c9bda3;
  --gold: #d8b15a;
  --gold-hi: #e8c66a;
  --amber: #b48546;
  --outline: #3a1e0c;
  --grass: #45734c;
  --grass-deep: #2f5236;
  --dusk-deep: #322a54;
  --dusk-mid: #5c4171;
  --dusk-rose: #ae6878;
  --leaf-red: #a83232;
  --danger: #c25b4a;
  --maxw: 1080px;
}

@font-face {
  font-family: 'Raven Classic';
  src: url('assets/fonts/raven-classic-hd.ttf') format('truetype');
  font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 120px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--soil);
  color: var(--cream);
  font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.06rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.px { image-rendering: pixelated; image-rendering: crisp-edges; }

h1, h2, h3, .display {
  font-family: 'Raven Classic', 'Trebuchet MS', system-ui, sans-serif;
  font-weight: 400;
  color: var(--gold);
  line-height: 1.2;
  letter-spacing: 0.02em;
}

a { color: var(--gold-hi); text-decoration-color: rgba(216, 177, 90, 0.4); text-underline-offset: 3px; }
a:hover { color: #f4d98c; }

img { max-width: 100%; height: auto; }

::selection { background: var(--amber); color: var(--night); }

/* ---------- header ---------- */

.site-head {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 11, 8, 0.92);
  border-bottom: 2px solid var(--outline);
  backdrop-filter: blur(4px);
}
.site-head .bar {
  max-width: var(--maxw); margin: 0 auto; padding: 0.55rem 1.25rem;
  display: flex; align-items: center; gap: 1.4rem;
}
.head-logo { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.head-logo .word {
  font-family: 'Raven Classic', 'Trebuchet MS', sans-serif;
  font-size: 1.7rem; color: var(--gold); letter-spacing: 0.04em;
}
.head-logo:hover .word { color: var(--gold-hi); }
.head-nav { display: flex; gap: 1.2rem; margin-left: auto; flex-wrap: wrap; }
.head-nav a {
  font-size: 0.92rem; letter-spacing: 0.05em; text-decoration: none; color: var(--cream-dim);
  padding: 0.2rem 0.1rem;
}
.head-nav a:hover { color: var(--gold-hi); }
.head-nav a[aria-current="page"] { color: var(--gold); border-bottom: 2px solid var(--gold); }

.btn-play {
  font-family: 'Raven Classic', 'Trebuchet MS', sans-serif;
  display: inline-block; text-decoration: none;
  background: var(--gold); color: var(--night);
  border: 3px solid var(--outline);
  box-shadow: inset 0 -4px 0 rgba(58, 30, 12, 0.35), inset 0 3px 0 rgba(255, 255, 255, 0.25);
  padding: 0.5rem 1.3rem 0.6rem;
  font-size: 1.12rem; line-height: 1.1; white-space: nowrap;
}
.btn-play:hover { background: var(--gold-hi); color: var(--night); }
.btn-play:active { box-shadow: inset 0 3px 0 rgba(58, 30, 12, 0.3); transform: translateY(1px); }
.btn-play.big { font-size: 1.5rem; padding: 0.85rem 2.2rem 1rem; }

/* ---------- hero ---------- */

.hero {
  position: relative; overflow: hidden;
  min-height: 94vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  border-bottom: 3px solid var(--outline);
}
.hero-bg {
  position: absolute; inset: -12% 0 0 0; z-index: -2;
  background: url('assets/brand/bg_scene.png') center bottom / cover no-repeat;
  image-rendering: pixelated;
  will-change: transform;
}
.hero-shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 46% 34% at 50% 64%, rgba(13, 11, 8, 0.5), transparent 72%),
    linear-gradient(to bottom, rgba(13,11,8,0.25), rgba(13,11,8,0) 30%, rgba(13,11,8,0) 70%, rgba(13,11,8,0.55));
}
.hero-logo { width: min(560px, 82vw); height: auto; position: relative; }
.hero-logo-wrap { position: relative; display: inline-block; }
.hero-sheen {
  position: absolute; inset: 0; width: 100%; height: 100%;
  background: url('assets/brand/logo_sheen.png') center / contain no-repeat;
  opacity: 0; animation: sheen 7s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sheen { 0%, 86%, 100% { opacity: 0; } 90% { opacity: 0.5; } 94% { opacity: 0; } }
@media (max-width: 900px) {
  .hero-shade {
    background:
      radial-gradient(ellipse 62% 44% at 50% 66%, rgba(13, 11, 8, 0.62), transparent 76%),
      linear-gradient(to bottom, rgba(13,11,8,0.25), rgba(13,11,8,0) 30%, rgba(13,11,8,0) 70%, rgba(13,11,8,0.55));
  }
}

.hero-tag {
  margin-top: 1.1rem; font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  color: var(--cream); text-shadow: 0 2px 8px rgba(13, 11, 8, 0.8);
  max-width: 34em; padding: 0 1rem;
}
.hero-cta { margin-top: 1.8rem; display: flex; flex-direction: column; align-items: center; gap: 0.55rem; }
.hero-cta .sub { font-size: 0.92rem; color: var(--cream); text-shadow: 0 1px 6px rgba(13,11,8,0.9); }

.leaf { position: absolute; top: -60px; z-index: 1; pointer-events: none; opacity: 0.9; animation: fall linear infinite; }
@keyframes fall {
  0%   { transform: translate3d(0, -8vh, 0) rotate(0deg); }
  100% { transform: translate3d(-14vw, 108vh, 0) rotate(300deg); }
}
@media (prefers-reduced-motion: reduce) {
  .leaf, .hero-sheen { animation: none !important; display: none; }
  .mon-sprite { animation: none !important; }
}

/* ---------- sections ---------- */

.strip { padding: 4.5rem 1.25rem; }
.strip > .inner { max-width: var(--maxw); margin: 0 auto; }
.strip h2 { font-size: clamp(2.2rem, 5vw, 3rem); margin-bottom: 0.4rem; }
.strip .lede { color: var(--cream-dim); max-width: 46em; }

.strip-night { background: var(--night); }
.strip-soil { background: var(--soil); }
.strip-soil2 { background: var(--soil-2); }
.strip-dusk {
  background: linear-gradient(180deg, var(--dusk-deep) 0%, var(--dusk-mid) 55%, var(--dusk-rose) 130%);
  border-top: 3px solid var(--outline); border-bottom: 3px solid var(--outline);
}

.kicker {
  color: var(--amber);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  display: block; margin-bottom: 0.5rem;
}

.quiet-quote {
  font-style: italic; font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  color: var(--cream); text-align: center; max-width: 30em; margin: 0 auto;
}
.quiet-quote .who { display: block; font-style: normal; font-size: 0.85rem; color: var(--cream-dim); margin-top: 0.7rem; }

/* alternating art/text rows */
.row { display: flex; align-items: center; gap: 2.5rem; margin-top: 3rem; }
.row:nth-child(even) { flex-direction: row-reverse; }
.row .art { flex: 0 0 44%; text-align: center; }
.row .copy { flex: 1; }
.row .copy h3 { font-size: 1.9rem; margin-bottom: 0.5rem; }
.row .copy p + p { margin-top: 0.7rem; }
.facts { margin-top: 0.9rem; padding: 0; list-style: none; color: var(--cream-dim); font-size: 0.97rem; }
.facts li { padding-left: 1.1rem; position: relative; }
.facts li::before { content: ''; position: absolute; left: 0; top: 0.55em; width: 7px; height: 7px; background: var(--amber); }
@media (max-width: 760px) {
  .row, .row:nth-child(even) { flex-direction: column; gap: 1.2rem; }
  .row .art { flex-basis: auto; }
}

.pframe {
  display: inline-block; background: var(--soil-3);
  border: 3px solid var(--outline);
  box-shadow: 0 0 0 2px var(--amber), 0 0 0 5px var(--outline);
  padding: 14px;
}
.pframe img { display: block; }
.pframe.group img { display: inline-block; vertical-align: bottom; margin: 0 8px; }

/* ---------- raid half ---------- */

.imperative {
  font-family: 'Raven Classic', sans-serif;
  font-size: clamp(1.6rem, 4.4vw, 2.6rem);
  color: var(--gold); text-align: center; letter-spacing: 0.1em;
}
.rules3 { display: flex; gap: 1.6rem; justify-content: center; margin-top: 2.4rem; flex-wrap: wrap; }
.rule {
  flex: 1 1 240px; max-width: 320px; text-align: center;
  background: rgba(27, 20, 16, 0.55); border: 3px solid var(--outline); padding: 1.4rem 1.1rem;
}
.rule img { height: 72px; width: auto; }
.rule b { display: block; font-family: 'Raven Classic', sans-serif; color: var(--gold-hi); font-size: 1.6rem; margin: 0.6rem 0 0.25rem; font-weight: 400; }
.rule span { color: var(--cream-dim); font-size: 0.95rem; }

/* zone cards */
.zones { margin-top: 2.6rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.zone { position: relative; border: 3px solid var(--outline); box-shadow: 0 0 0 2px var(--amber); overflow: hidden; }
.zone.wide { grid-column: 1 / -1; }
.zone img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 7; }
.zone.wide img { aspect-ratio: 21 / 7; }
.zone .plate {
  position: absolute; left: 0; bottom: 0; right: 0;
  padding: 2.4rem 1.1rem 0.75rem;
  background: linear-gradient(to top, rgba(13, 11, 8, 0.92), transparent);
  display: flex; align-items: baseline; gap: 0.8rem; flex-wrap: wrap;
}
.zone .plate b { font-family: 'Raven Classic', sans-serif; font-weight: 400; color: var(--cream); font-size: 1.6rem; white-space: nowrap; }
.zone .plate i { font-style: normal; color: var(--cream-dim); font-size: 0.86rem; flex: 1 1 100%; line-height: 1.35; }
.zone.wide .plate i { flex: 0 1 auto; margin-left: auto; text-align: right; }
.risk { color: var(--gold); letter-spacing: 0.18em; font-size: 0.8rem; white-space: nowrap; }
.risk.high { color: #d2664f; }
@media (max-width: 700px) { .zones { grid-template-columns: 1fr; } .zone img, .zone.wide img { aspect-ratio: 16 / 8; } }

/* monster strip on landing + bestiary cards */
.mon-sprite { display: inline-block; background-repeat: no-repeat; image-rendering: pixelated; }

.mon-parade { display: flex; align-items: flex-end; justify-content: center; gap: 2.6rem; flex-wrap: wrap; margin-top: 2.2rem; }
.mon-parade figure { text-align: center; }
.mon-parade figcaption { font-size: 0.85rem; color: var(--cream-dim); margin-top: 0.4rem; }

/* ---------- faq ---------- */

.faq { max-width: 46em; margin: 2rem auto 0; }
.faq details { border: 3px solid var(--outline); background: var(--soil-2); margin-top: 0.8rem; }
.faq summary {
  cursor: pointer; list-style: none; padding: 0.85rem 1.1rem;
  font-family: 'Raven Classic', sans-serif; color: var(--gold-hi); font-size: 1.45rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: '+'; color: var(--amber); margin-right: 0.65rem; }
.faq details[open] summary::before { content: '\2013'; }
.faq .a { padding: 0 1.1rem 1rem; color: var(--cream-dim); }

/* dev note */
.devnote { max-width: 42em; margin: 0 auto; border-left: 4px solid var(--amber); padding-left: 1.4rem; }
.devnote .sig { margin-top: 0.9rem; font-family: 'Raven Classic', sans-serif; color: var(--gold); }

/* ---------- footer ---------- */

.site-foot { background: var(--night); border-top: 3px solid var(--outline); padding: 2.2rem 1.25rem 2.6rem; }
.site-foot .inner { max-width: var(--maxw); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; }
.site-foot .cols { display: flex; gap: 2.2rem; flex-wrap: wrap; margin-left: auto; }
.site-foot a { color: var(--cream-dim); text-decoration: none; }
.site-foot a:hover { color: var(--gold-hi); }
.site-foot .fine { width: 100%; color: #8a7f6b; font-size: 0.85rem; }
.site-foot .vine { height: 64px; width: auto; opacity: 0.5; }

/* ---------- content pages (guide / bestiary / almanac / quests) ---------- */

.page-hero {
  position: relative;
  padding: 4.2rem 1.25rem 2.6rem;
  border-bottom: 3px solid var(--outline);
  background: linear-gradient(180deg, var(--dusk-deep), rgba(13, 11, 8, 0.94) 90%), url('assets/brand/bg_scene.png') center 20% / cover no-repeat;
  image-rendering: auto;
}
.page-hero .inner { max-width: var(--maxw); margin: 0 auto; }
.page-hero h1 { font-size: clamp(2.8rem, 7vw, 4rem); }
.page-hero p { color: var(--cream-dim); max-width: 46em; margin-top: 0.5rem; }

.content { max-width: var(--maxw); margin: 0 auto; padding: 2.6rem 1.25rem 4rem; }
.content h2 { font-size: 2.3rem; margin: 2.6rem 0 0.8rem; }
.content h2:first-child { margin-top: 0; }
.content h3 { font-size: 1.7rem; margin: 1.8rem 0 0.5rem; color: var(--gold-hi); }
.content p + p { margin-top: 0.7rem; }
.content .note { color: var(--cream-dim); font-size: 0.95rem; border-left: 3px solid var(--amber); padding-left: 0.9rem; margin-top: 0.9rem; }

/* sticky in-page toc */
.toc {
  position: sticky; top: 61px; z-index: 40;
  background: rgba(27, 20, 16, 0.96); border-bottom: 2px solid var(--outline);
  padding: 0.45rem 1.25rem; font-size: 0.92rem;
}
.toc .inner { max-width: var(--maxw); margin: 0 auto; display: flex; gap: 1.1rem; flex-wrap: wrap; }
.toc a { text-decoration: none; color: var(--cream-dim); }
.toc a:hover { color: var(--gold-hi); }

/* data tables */
.dtable { width: 100%; border-collapse: collapse; margin-top: 1rem; font-size: 0.97rem; }
.dtable th {
  text-align: left; font-weight: 600; text-transform: uppercase;
  color: var(--amber); font-size: 0.78rem; letter-spacing: 0.12em;
  border-bottom: 2px solid var(--outline); padding: 0.4rem 0.6rem;
}
.dtable td { padding: 0.45rem 0.6rem; border-bottom: 1px solid rgba(58, 30, 12, 0.55); vertical-align: middle; }
.dtable tr:hover td { background: rgba(180, 133, 70, 0.07); }
.dtable .ico { width: 34px; }
.dtable .ico img { display: block; width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.tscroll { overflow-x: auto; }
.tscroll .dtable { min-width: max-content; }
.tscroll .dtable-fit { min-width: 0; }

.chip {
  display: inline-block; font-size: 0.78rem; line-height: 1;
  padding: 0.28rem 0.5rem; border: 2px solid var(--outline);
  background: var(--soil-3); color: var(--cream-dim); white-space: nowrap;
}
.chip.spring { color: #9fd08c; } .chip.summer { color: #ffd76e; }
.chip.fall { color: #f0a35e; } .chip.winter { color: #a9cbe8; }
.chip.rare { color: #7ec8f2; } .chip.epic { color: #c99df5; }
.chip.legendary { color: var(--gold-hi); } .chip.uncommon { color: #9fd08c; }

/* bestiary cards */
.mon-card {
  display: flex; gap: 1.8rem; align-items: flex-start;
  border: 3px solid var(--outline); box-shadow: 0 0 0 2px var(--amber);
  background: var(--soil-2); padding: 1.5rem; margin-top: 2rem;
}
.mon-card .stage {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, var(--soil-3), var(--night) 78%);
  border: 3px solid var(--outline); min-width: 216px; min-height: 216px;
}
.mon-card.boss .stage { border-color: var(--amber); }
.mon-card h3 { margin: 0 0 0.2rem; font-size: 2rem; }
.mon-card .role { color: var(--cream-dim); font-size: 0.95rem; margin-bottom: 0.8rem; }
.mon-stats { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; margin: 0.6rem 0 0.9rem; padding: 0; list-style: none; }
.mon-stats li { font-size: 0.92rem; color: var(--cream-dim); }
.mon-stats b { color: var(--gold-hi); font-weight: 600; font-size: 1.02rem; margin-right: 0.3rem; }
.mon-card .counter { border-left: 3px solid var(--grass); padding-left: 0.9rem; margin-top: 0.8rem; color: var(--cream); font-size: 0.98rem; }
.mon-card .counter b { color: #9fd08c; }
.loot-line { margin-top: 0.9rem; font-size: 0.95rem; color: var(--cream-dim); }
.loot-line b { color: var(--gold-hi); font-weight: 600; }
.badge-boss, .badge-elite {
  display: inline-block; font-family: 'Raven Classic', sans-serif; font-size: 0.8rem;
  letter-spacing: 0.16em; padding: 0.25rem 0.6rem; border: 2px solid var(--outline);
  vertical-align: 0.35em; margin-left: 0.6rem;
}
.badge-boss { background: var(--leaf-red); color: var(--cream); }
.badge-elite { background: var(--dusk-mid); color: var(--cream); }
@media (max-width: 700px) { .mon-card { flex-direction: column; } .mon-card .stage { align-self: center; } }

/* phase timeline for bosses */
.phases { margin-top: 1rem; padding-left: 0; list-style: none; }
.phases li { position: relative; padding: 0.4rem 0 0.4rem 1.6rem; border-left: 3px solid var(--amber); margin-left: 0.4rem; }
.phases li::before { content: ''; position: absolute; left: -7px; top: 0.85em; width: 11px; height: 11px; background: var(--gold); border: 2px solid var(--outline); }
.phases b { color: var(--gold-hi); }

/* quest trails */
.trail { margin-top: 1.4rem; padding-left: 0; list-style: none; }
.trail > li { position: relative; padding: 0 0 1.4rem 2rem; border-left: 3px solid var(--outline); margin-left: 0.55rem; }
.trail > li:last-child { border-left-color: transparent; }
.trail > li::before {
  content: ''; position: absolute; left: -10px; top: 0.35em;
  width: 12px; height: 12px; background: var(--amber); border: 3px solid var(--outline);
}
.trail b.qname { font-family: 'Raven Classic', sans-serif; font-weight: 400; color: var(--gold-hi); font-size: 1.55rem; }
.trail .giver { color: var(--cream-dim); font-size: 0.88rem; margin-left: 0.5rem; }
.trail .obj { display: block; margin-top: 0.15rem; }
.trail .reward { display: block; color: var(--cream-dim); font-size: 0.93rem; margin-top: 0.15rem; }
.trail .reward b { color: var(--gold); font-weight: 600; }

/* almanac crop rows */
.crop-row { display: flex; gap: 1.6rem; align-items: center; border-bottom: 1px solid rgba(58,30,12,0.55); padding: 1.1rem 0; }
.crop-row .strip-img { flex: 0 0 auto; }
.crop-row .strip-img img { height: 80px; width: auto; image-rendering: pixelated; }
.crop-row .meta { flex: 1; }
.crop-row .meta b { font-family: 'Raven Classic', sans-serif; font-weight: 400; font-size: 1.55rem; color: var(--gold-hi); margin-right: 0.6rem; }
.crop-row .meta .nums { color: var(--cream-dim); font-size: 0.95rem; margin-top: 0.25rem; }
.crop-row .meta .flavor { font-style: italic; color: var(--cream-dim); font-size: 0.92rem; margin-top: 0.3rem; }
@media (max-width: 640px) { .crop-row { flex-direction: column; align-items: flex-start; gap: 0.6rem; } }

.animal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.2rem; margin-top: 1.2rem; }
.animal-card { border: 3px solid var(--outline); background: var(--soil-2); padding: 1rem; text-align: center; }
.animal-card img { height: 84px; width: auto; image-rendering: pixelated; }
.animal-card b { display: block; font-family: 'Raven Classic', sans-serif; font-weight: 400; color: var(--gold-hi); font-size: 1.45rem; margin-top: 0.3rem; }
.animal-card .sub { color: var(--cream-dim); font-size: 0.9rem; }

/* npc directory */
.npc-card { border: 3px solid var(--outline); background: var(--soil-2); padding: 1.2rem 1.4rem; margin-top: 1.4rem; }
.npc-card h3 { margin: 0 0 0.2rem; }
.npc-card .hours { color: var(--cream-dim); font-size: 0.9rem; }

/* inline icon */
.ii { display: inline-block; width: 22px; height: 22px; vertical-align: -5px; margin-right: 4px; object-fit: contain; image-rendering: pixelated; }

/* controls table keys */
kbd {
  font-family: inherit; font-size: 0.88rem; color: var(--cream);
  background: var(--soil-3); border: 2px solid var(--outline);
  box-shadow: inset 0 -2px 0 var(--outline); padding: 0.1rem 0.45rem; white-space: nowrap;
}

.center { text-align: center; }
.mt2 { margin-top: 2rem; }
.vine-tl { position: absolute; top: 0; left: 0; width: 80px; opacity: 0.85; pointer-events: none; }
.vine-tr { position: absolute; top: 0; right: 0; width: 80px; opacity: 0.85; transform: scaleX(-1); pointer-events: none; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--gold); color: var(--night); padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

@media (max-width: 700px) {
  .site-head { position: static; }
  .site-head .bar { flex-wrap: wrap; gap: 0.4rem 1rem; padding-bottom: 0.4rem; }
  .head-nav { order: 3; flex-basis: 100%; justify-content: center; margin-left: 0; gap: 1rem; }
  .btn-play { margin-left: auto; }
  .toc { top: 0; }
  html { scroll-padding-top: 60px; }
}

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

.anim-toggle {
  display: inline-block; margin-left: 1rem; padding: 0.15rem 0.55rem;
  background: none; border: 2px solid var(--outline); color: #8a7f6b;
  font: inherit; font-size: 0.82rem; cursor: pointer;
}
.anim-toggle:hover { color: var(--gold-hi); border-color: var(--amber); }

body.anim-paused .mon-sprite,
body.anim-paused .leaf,
body.anim-paused .hero-sheen { animation-play-state: paused; }
