/* FudliGames — Valheim landing page: a fjord you walk into.
 *
 * One number drives the scene: --v, set by scene.js from scroll position.
 * 0 is a misty dusk at the water's edge, 1 is clear polar night with the
 * northern light out. Mist, aurora, stars and the ridge parallax all read that
 * single property, so when the light looks wrong there is one place to look.
 *
 * Written phone first: the base rules are the 360–430 px layout, and the
 * min-width queries add the wide layout on top.
 */

:root {
  --v: 0;

  --ink: #eef3f8;
  --ink-soft: #b4c2d0;
  --ink-dim: #8c9bad;

  --ember: #ffb257;        /* the longhouse fire: every call to action */
  --ember-deep: #f29c3b;
  --ember-ink: #2a1703;
  --aurora: #6fe6bd;       /* the northern light: live things, highlights */
  --aurora-deep: #46c99a;

  --night: #060a12;
  --panel: #0b1119;
  --panel-solid: #0e1621;
  --line: rgba(200, 222, 240, 0.10);
  --line-strong: rgba(200, 222, 240, 0.20);

  --maxw: 1180px;
  --radius: 14px;
  --radius-lg: 22px;

  --display: "Bricolage Grotesque", "Inter Tight", system-ui, sans-serif;
  --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--night);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--aurora); outline-offset: 3px; border-radius: 6px; }
:focus:not(:focus-visible) { outline: none; }

.wrap { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(18px, 4vw, 40px); }

/* ==========================================================================
   The fjord. Fixed behind everything; the page scrolls over it.
   ========================================================================== */
.fjord { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.fjord-dusk, .fjord-night { position: absolute; inset: 0; }
.fjord-dusk { background: linear-gradient(180deg, #16263c 0%, #1e3450 42%, #2b4a66 72%, #35587a 100%); }
.fjord-night {
  opacity: var(--v);
  background: linear-gradient(180deg, #04070e 0%, #081222 45%, #0c1a2c 78%, #0f2033 100%);
}

/* Northern light: two ribbons and a row of rays, drawn as SVG and stretched
   over the sky. No blur filter, so a phone composites one cheap layer instead
   of blurring half the screen. */
.aurora { position: absolute; inset: 0 0 30% 0; opacity: calc(0.3 + var(--v) * 0.7); mix-blend-mode: screen; }
.aurora svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.au { transform-box: fill-box; transform-origin: center; }
.au-1 { animation: aurora-drift 28s ease-in-out infinite alternate; }
.au-2 { animation: aurora-drift 37s ease-in-out infinite alternate-reverse; }
.au-3 { animation: aurora-rays 23s ease-in-out infinite alternate; }
@keyframes aurora-drift {
  0% { transform: translateX(-4%) scaleY(1); opacity: 0.8; }
  50% { opacity: 1; }
  100% { transform: translateX(4%) scaleY(1.08); opacity: 0.85; }
}
@keyframes aurora-rays {
  0% { transform: translateX(-6%); opacity: 0.5; }
  100% { transform: translateX(6%); opacity: 1; }
}

.stars { position: absolute; inset: 0 0 35% 0; opacity: calc(var(--v) * 0.95); }
.stars i { position: absolute; width: 2px; height: 2px; border-radius: 50%; background: #e8f1ff; opacity: 0.85; }

/* Ridges: three low-poly SVG silhouettes, each sinking a little further as you
   scroll, which reads as walking up from the shore. */
.ridge { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46vh; will-change: transform; filter: brightness(calc(1 - var(--v) * 0.4)); }
.ridge svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ridge-far { transform: translateY(calc(var(--v) * 14px)); }
.ridge-mid { transform: translateY(calc(var(--v) * 30px)); }
.ridge-near { transform: translateY(calc(var(--v) * 52px)); }

/* Water, with the light of the sky laid on it. */
.water {
  position: absolute; left: 0; right: 0; bottom: 0; height: 15vh;
  background: linear-gradient(180deg, #11263a 0%, #0a1726 55%, #060c16 100%);
}
.water::before {
  content: ""; position: absolute; inset: 0;
  background:
    repeating-linear-gradient(180deg, rgba(111, 230, 189, 0.16) 0 1px, transparent 1px 7px),
    linear-gradient(90deg, transparent 18%, rgba(111, 230, 189, 0.22) 50%, transparent 82%);
  opacity: calc(0.2 + var(--v) * 0.8);
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.9), transparent 70%);
}

/* Mist: wide soft bands over the water that thin out and settle as --v grows. */
.mist { position: absolute; left: -20%; right: -20%; height: 22vh; will-change: transform, opacity; }
.mist i {
  position: absolute; inset: 0; display: block;
  background: radial-gradient(50% 60% at 50% 60%, rgba(196, 212, 228, 0.55) 0%, rgba(196, 212, 228, 0.18) 40%, transparent 72%);
}
.mist-1 { bottom: 9vh; opacity: calc(0.95 - var(--v) * 0.72); transform: translateY(calc(var(--v) * 26px)); }
.mist-1 i { animation: mist-drift 48s ease-in-out infinite alternate; }
.mist-2 { bottom: 2vh; height: 18vh; opacity: calc(0.85 - var(--v) * 0.55); transform: translateY(calc(var(--v) * 14px)); }
.mist-2 i { animation: mist-drift 62s ease-in-out infinite alternate-reverse; }
.mist-3 { bottom: 20vh; height: 16vh; opacity: calc(0.6 - var(--v) * 0.6); transform: translateY(calc(var(--v) * 40px)); }
.mist-3 i { animation: mist-drift 55s ease-in-out infinite alternate; }
@keyframes mist-drift { from { translate: -5% 0; } to { translate: 5% 0; } }

/* ==========================================================================
   Chrome
   ========================================================================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: rgba(6, 10, 18, 0.42);
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.nav.is-condensed { background: rgba(6, 10, 18, 0.86); border-bottom-color: var(--line); }
.nav-inner { display: flex; align-items: center; gap: 18px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; font-size: 17px; }
.brand .logo { width: 26px; height: 26px; }
.nav-links { display: none; gap: 22px; font-size: 14.5px; color: var(--ink-soft); }
.nav-links a:hover { color: var(--aurora); }
.nav-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.nav-right .txt-link { font-size: 14.5px; color: var(--ink-soft); }
.nav-right .txt-link:hover { color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px 18px; border-radius: 11px; border: 1px solid transparent;
  font-weight: 600; font-size: 14.5px; cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s;
}
.btn-ember { background: var(--ember); color: var(--ember-ink); box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.7); }
.btn-ember:hover { background: var(--ember-deep); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: rgba(6, 10, 18, 0.35); }
.btn-ghost:hover { border-color: var(--aurora); color: var(--aurora); }
.btn-lg { padding: 14px 24px; font-size: 15.5px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }

.h-display { font-family: var(--display); font-weight: 800; letter-spacing: -0.025em; line-height: 0.98; font-size: clamp(36px, 10.4vw, 80px); margin: 0 0 18px; }
.h-2 { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.04; font-size: clamp(28px, 7vw, 52px); margin: 0 0 16px; }
.h-3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; font-size: clamp(20px, 5vw, 26px); }
.hl { color: var(--aurora); }
.lead { color: var(--ink-soft); font-size: clamp(15.5px, 1.7vw, 18px); max-width: 50ch; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.actions .btn { flex: 1 1 auto; }

.chapter { position: relative; z-index: 2; padding: clamp(64px, 10vw, 140px) 0; }
.chapter-head { max-width: 720px; margin-bottom: clamp(32px, 5vw, 54px); }

/* Chapters after the hero carry their own scrim: the sky behind them goes from
   dusk blue to near-black, and text should not depend on where it lands. */
.chapter-dark::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, transparent, rgba(5, 8, 14, 0.84) 8%, rgba(5, 8, 14, 0.84) 92%, transparent);
}
.hero .h-display, .hero .lead { text-shadow: 0 2px 24px rgba(4, 8, 14, 0.6); }

/* ==========================================================================
   Hero: the shore, the longhouse, the fire
   ========================================================================== */
.hero { padding-top: 14px; padding-bottom: clamp(56px, 8vw, 110px); }
.hero-inner { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: center; }
.hero-stage { position: relative; height: clamp(230px, 62vw, 300px); perspective: 1000px; }
.hero-stage svg {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden;
  /* The headland fades into the fjord instead of ending in a hard rectangle. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent), linear-gradient(180deg, #000 72%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent), linear-gradient(180deg, #000 72%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}
.svg-num { font: 600 13px var(--mono); fill: var(--aurora); }
.svg-mono { font: 600 12px var(--mono); fill: #eef3f8; }
.hero-copy { padding-top: 6px; }
.hero-hint { margin-top: 26px; font-size: 13px; color: var(--ink-dim); }

/* The longhouse door and hearth: one warm light that breathes. */
.fire-glow { animation: breathe 3.4s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes breathe { 0%, 100% { opacity: 0.55; transform: scale(1); } 50% { opacity: 0.95; transform: scale(1.12); } }
.smoke { animation: smoke 7s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.smoke-2 { animation-delay: -2.4s; }
.smoke-3 { animation-delay: -4.8s; }
@keyframes smoke {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  15% { opacity: 0.55; }
  100% { opacity: 0; transform: translate(10px, -46px) scale(1.5); }
}
.raven { animation: glide 18s linear infinite; }
.raven-2 { animation-duration: 23s; animation-delay: -9s; }
@keyframes glide { from { transform: translate(-40px, 10px); } to { transform: translate(560px, -24px); } }
.water-shimmer { animation: shimmer 6s ease-in-out infinite; }
@keyframes shimmer { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.8; } }

/* ==========================================================================
   What you get: five facts, each with its own small scene
   ========================================================================== */
.facts { display: flex; flex-direction: column; gap: clamp(18px, 3vw, 28px); max-width: 960px; }
.fact {
  display: grid; grid-template-columns: 1fr; gap: 14px; align-items: center;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #0a1019;
}
.fact-body { max-width: 50ch; }
.fact-art { width: 100%; max-width: 300px; margin: 0 auto; }
.fact-art svg { width: 100%; height: auto; }
.fact h3 { margin-bottom: 8px; }
.fact p { color: var(--ink-soft); font-size: 15px; }
.fact p + p { margin-top: 8px; }
.fact code { font-family: var(--mono); font-size: 0.92em; color: var(--aurora); background: rgba(111, 230, 189, 0.08); padding: 1px 6px; border-radius: 6px; }

/* ==========================================================================
   Calculator
   ========================================================================== */
.calc { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.calc-controls {
  padding: 20px; border-radius: var(--radius-lg);
  border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; gap: 24px;
}
.calc-out {
  padding: 20px; border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 178, 87, 0.28);
  background: linear-gradient(180deg, #1d1d22, #0e1621 42%);
  display: flex; flex-direction: column; gap: 16px;
}

.calc-tiers { display: grid; grid-template-columns: 1fr; gap: 10px; }
.calc-tier {
  position: relative; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 13px;
  border: 1px solid var(--line); background: #10171f;
  transition: border-color 0.18s, background 0.18s, transform 0.18s;
}
.calc-tier:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.calc-tier.is-active { border-color: rgba(255, 178, 87, 0.55); background: #1f1e1e; }
.calc-tier b { display: block; font-size: 16px; margin-bottom: 3px; }
.calc-tier.is-active b { color: var(--ember); }
.tier-note { display: block; font-size: 12.5px; color: var(--ink-soft); line-height: 1.45; }
.tier-art { width: 44px; height: 44px; }
.tier-art svg { width: 100%; height: 100%; }
.calc-tier .flame { opacity: 0.25; transition: opacity 0.3s; }
.calc-tier.is-active .flame { opacity: 1; }

.calc-field { display: flex; flex-direction: column; gap: 9px; }
.calc-field[hidden] { display: none; }
.calc-field label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; color: var(--ink-soft); }
.calc-val { font-size: 15.5px; color: var(--ember); font-weight: 700; font-variant-numeric: tabular-nums; }
.calc-field small { font-size: 12.5px; color: var(--ink-dim); }
.calc-field input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 999px; outline: none;
  background: rgba(200, 222, 240, 0.16); cursor: pointer;
}
.calc-field input[type="range"]:focus-visible { outline-offset: 10px; }
.calc-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%; background: var(--ember);
  border: 3px solid var(--panel-solid); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}
.calc-field input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--ember);
  border: 3px solid var(--panel-solid); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.calc-out-title { font-size: 14px; color: var(--ink-soft); }
.calc-price { display: flex; align-items: baseline; gap: 8px; }
.calc-price b { display: inline-block; font-family: var(--display); font-size: clamp(34px, 9vw, 46px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.calc-price span { font-size: 14px; color: var(--ink-soft); }
.calc-price.is-bumped b { animation: bump 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes bump { 0% { transform: scale(1); } 38% { transform: scale(1.07); } 100% { transform: scale(1); } }
.calc-rate { font-size: 13px; color: var(--ink-dim); }

.calc-break { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.calc-break li { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--ink-soft); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.calc-break li:last-child { border-bottom: none; padding-bottom: 0; }
.calc-break b { color: var(--ink); font-variant-numeric: tabular-nums; font-size: 13.5px; }

.calc-hint { font-size: 13px; line-height: 1.5; color: var(--ink-soft); padding: 12px 14px; border-radius: 10px; background: #16272d; border: 1px solid rgba(111, 230, 189, 0.22); }
.calc-hint:empty { display: none; }
.calc-included { font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }

/* ==========================================================================
   Two ways to keep the fire
   ========================================================================== */
.hosts { display: grid; grid-template-columns: 1fr; gap: 16px; }
.host {
  position: relative; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #080d16;
}
.host.is-lit { border-color: rgba(255, 178, 87, 0.3); }
.host-stage { position: relative; height: clamp(170px, 44vw, 220px); }
.host-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.host-body { padding: 4px 22px 26px; }
.host-state { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }
.host h3 { margin-bottom: 8px; }
.host p { font-size: 14.5px; color: var(--ink-soft); }
.host ul { list-style: none; display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.host li { font-size: 13.5px; color: var(--ink-soft); padding-left: 18px; position: relative; }
.host li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-dim); }
.host.is-lit li::before { background: var(--ember); }
.dot { width: 8px; height: 8px; flex: none; display: inline-block; border-radius: 50%; }
.dot.on { background: var(--aurora); }
.dot.off { background: var(--ink-dim); }

/* ==========================================================================
   Joining
   ========================================================================== */
.join { display: grid; grid-template-columns: 1fr; gap: 22px; align-items: center; }
.join-art { width: 100%; max-width: 420px; margin: 0 auto; }
.join-art svg { width: 100%; height: auto; }
.join ol { list-style: none; display: flex; flex-direction: column; gap: 14px; counter-reset: none; }
.join li { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; font-size: 15px; color: var(--ink-soft); }
.join li .rune { width: 26px; height: 26px; }
.join li b { color: var(--ink); font-weight: 600; }
.join .lead { margin-bottom: 20px; }

/* ==========================================================================
   CTA, footer
   ========================================================================== */
.cta {
  position: relative; overflow: hidden; text-align: center;
  padding: 40px 20px;
  border: 1px solid rgba(255, 178, 87, 0.26); border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #1d1c20, #070b13 55%);
}
.cta .lead { margin: 0 auto; }
.cta .actions { justify-content: center; }
.cta .actions .btn { flex: 0 1 auto; }

.footer { position: relative; z-index: 2; border-top: 1px solid var(--line); padding: 32px 0 44px; background: rgba(4, 7, 12, 0.88); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.footer-brand { display: flex; align-items: center; gap: 9px; font-family: var(--display); font-weight: 700; }
.footer-brand img { width: 22px; height: 22px; }
.footer p { font-size: 13px; color: var(--ink-dim); flex: 1 1 320px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13.5px; color: var(--ink-soft); }
.footer-links a:hover { color: var(--aurora); }

/* ==========================================================================
   Motion, and its off switch
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  html.fx-armed [data-reveal] { opacity: 0; }
}
[data-magnetic] { will-change: transform; }

/* ==========================================================================
   Wider screens
   ========================================================================== */
@media (min-width: 640px) {
  .actions .btn { flex: 0 1 auto; }
  .nav-inner { gap: 28px; height: 64px; }
  .nav-links { display: flex; }
  .calc-tiers { grid-template-columns: 1fr 1fr; }
  .hosts { grid-template-columns: 1fr 1fr; }
  .cta { padding: 56px 40px; }
  .fact { grid-template-columns: 220px 1fr; gap: 26px; }
  .fact:nth-child(even) { grid-template-columns: 1fr 220px; }
  .fact:nth-child(even) .fact-art { order: 2; }
  .fact-art { max-width: none; margin: 0; }
}
@media (min-width: 900px) {
  .hero { padding-top: clamp(30px, 5vw, 70px); }
  .hero-inner { grid-template-columns: 1.02fr 0.98fr; gap: clamp(28px, 5vw, 64px); min-height: 72vh; }
  .hero-stage { height: clamp(300px, 36vw, 460px); order: 2; }
  .hero-copy { padding-top: 0; }
  .calc { grid-template-columns: 1.12fr 0.88fr; gap: 18px; }
  .calc-controls, .calc-out { padding: 30px; }
  .cta { padding: 70px 60px; }
  .calc-out { position: sticky; top: 92px; }
  .join { grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 64px); }
  .join-art { max-width: none; }
  .fact { grid-template-columns: 260px 1fr; gap: 36px; }
  .fact:nth-child(even) { grid-template-columns: 1fr 260px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .aurora i, .mist i, .stars i, .fire-glow, .smoke, .raven, .water-shimmer, .calc-price.is-bumped b { animation: none !important; }
  .smoke { opacity: 0.3; }
  html.fx-armed [data-reveal] { opacity: 1 !important; }
}
