/* Civborn landing page. Palette and frames come from the game's UI kit
   (client/src/play/ui/kit/style.ts and play-assets/ui/frames). Pixel art is always drawn
   at an integer scale with image-rendering: pixelated; the painted illustrations are
   resampled normally. */

@font-face { font-family: "Civ Title"; src: url("/m/JacquardaBastarda9.597b0d1c.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Civ Pixel"; src: url("/m/PixelifySans.85b23258.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #1a1117; --bg: #2a1f22; --well: #1c1418; --text: #e8dcbc; --dim: #c7b59c;
  --title: #f9bf4f; --parch-ink: #2e1c2a; --warn: #f08a2e; --danger: #ef7a62; --good: #98a95c;
  --focus: #fdeb9c; --brass: #b8862f;
  --title-font: "Civ Title", Georgia, serif;
  --body-font: "Civ Pixel", "Trebuchet MS", system-ui, sans-serif;
  --wrap: 1180px;
  --gap: clamp(16px, 3vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; color: var(--text); font-family: var(--body-font); font-size: 18px; line-height: 1.6;
  background-color: var(--well);
  /* Stone floor: two offset grids of faint pixel lines plus a warm vignette. */
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(249, 191, 79, .07), transparent 60%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 2px, transparent 2px 48px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 96px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .018) 0 4px, transparent 4px 8px);
  overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
.px { image-rendering: pixelated; }
a { color: var(--title); }
a:hover { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
strong { color: var(--title); font-weight: 600; }
.parchment strong { color: #6b2e1e; }
h1, h2, h3 { font-family: var(--title-font); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; color: var(--title); text-shadow: 3px 3px 0 var(--ink); }
/* Jacquarda Bastarda 9 sits on a 9 px grid: sizes are multiples of 9. */
h2 { font-size: 36px; }
h3 { font-size: 27px; }
@media (min-width: 768px) { h2 { font-size: 54px; } }
@media (min-width: 1440px) { h2 { font-size: 63px; } }
p { margin: 0 0 1em; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--title); color: var(--ink); padding: 8px 14px; }
.skip:focus { top: 8px; }

.wrap { width: min(var(--wrap), 100% - 2 * var(--gap)); margin-inline: auto; }
.center { text-align: center; }
.fine { color: var(--dim); font-size: 15px; }
.kicker { font-size: 15px; letter-spacing: .18em; text-transform: uppercase; color: var(--brass); margin: 0 0 .4em; }
.kicker::before, .kicker::after { content: ""; display: inline-block; width: 18px; height: 3px; background: currentColor; vertical-align: middle; margin: 0 10px; }
.lead { font-size: 19px; color: var(--dim); max-width: 760px; }
.sec-head { text-align: center; margin-bottom: clamp(28px, 5vw, 56px); }
.sec-head .lead { margin-inline: auto; }

/* Frames of the game kit (2x files, drawn at half size = one art pixel per CSS px). */
.wood {
  border-style: solid; border-width: 22px; border-image: url("/m/panel_wood.14b06f7f.png") 80 fill / 40px repeat;
  image-rendering: pixelated; padding: 6px; color: var(--text);
}
.parchment {
  border-style: solid; border-width: 22px; border-image: url("/m/panel_parchment.e92029b4.png") 60 fill / 30px repeat;
  image-rendering: pixelated; color: var(--parch-ink); padding: 8px 10px;
}
.parchment h3 { color: #5a2a22; text-shadow: none; }
.parchment em { color: #5a2a22; }

/* Buttons: the kit's wooden button, pressed on :active. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--title-font); color: #3a2414; text-decoration: none; text-shadow: 1px 1px 0 rgba(255, 230, 170, .45);
  border-style: solid; border-width: 14px 22px; border-image: url("/m/button_normal.4fd62771.png") 16 28 fill / 16px 28px stretch;
  image-rendering: pixelated; font-size: 27px; line-height: 1; padding: 4px 6px; min-height: 56px;
  transition: transform .12s ease;
}
.btn:hover { color: #241406; border-image-source: url("/m/button_hover.46978b8f.png"); transform: translateY(-2px); }
.btn:active { border-image-source: url("/m/button_pressed.a27739e5.png"); transform: translateY(1px); }
.btn-lg { font-size: 36px; min-height: 76px; border-width: 18px 30px; padding: 4px 10px; }
.btn-sm { font-size: 18px; min-height: 44px; border-width: 10px 16px; padding: 2px 4px; }
@media (prefers-reduced-motion: reduce) { .btn, .btn:hover, .btn:active { transform: none; transition: none; } }

.ig {
  display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none;
  background: var(--ink); border: 3px solid var(--brass); box-shadow: inset 0 0 0 3px #3b2a22, 4px 4px 0 rgba(0, 0, 0, .5);
  padding: 8px; min-height: 44px; min-width: 44px; justify-content: center;
}
.ig:hover { color: var(--title); border-color: var(--title); }
.ig-lg { padding: 12px 16px; font-size: 18px; }
.ig svg { image-rendering: pixelated; flex: none; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  padding: 8px max(var(--gap), env(safe-area-inset-left)); background: rgba(26, 17, 23, .92);
  border-bottom: 3px solid #3b2a22; box-shadow: 0 3px 0 var(--ink);
  backdrop-filter: blur(6px);
}
.top-brand { display: flex; align-items: center; gap: 10px; color: var(--title); text-decoration: none; font-family: var(--title-font); font-size: 27px; margin-right: auto; }
.top-nav { display: flex; gap: 4px; }
.top-nav a { color: var(--text); text-decoration: none; padding: 8px 10px; font-size: 16px; }
.top-nav a:hover { color: var(--title); }
.top-menu { display: none; font: inherit; color: var(--text); background: var(--ink); border: 3px solid #5b4030; padding: 6px 12px; min-height: 44px; cursor: pointer; }
@media (max-width: 1099px) {
  .top-menu { display: block; }
  .top-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; background: var(--ink); border-bottom: 3px solid #3b2a22; padding: 8px var(--gap) 16px; }
  .top-nav.open { display: flex; }
  .top-nav a { padding: 12px 4px; font-size: 18px; border-bottom: 1px solid #3b2a22; }
}
@media (max-width: 479px) {
  .top { gap: 8px; }
  .top-brand span { display: none; }
  .ig-sm { display: none; }
}

/* Hero */
.hero { position: relative; min-height: min(100svh, 980px); display: grid; place-items: center; overflow: hidden; isolation: isolate; text-align: center; padding: 64px var(--gap) 96px; }
.hero-bg { position: absolute; inset: -6% 0; z-index: -2; will-change: transform; }
.hero-bg picture, .hero-img { width: 100%; height: 100%; }
.hero-img { object-fit: cover; object-position: 50% 55%; }
/* On narrow screens the crop keeps the open Shelter and the Apprentices leaving it. */
@media (max-width: 767px) { .hero-img { object-position: 8% 60%; } }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background:
  radial-gradient(ellipse at 50% 42%, rgba(28, 20, 24, .78) 0%, rgba(28, 20, 24, .35) 45%, transparent 70%),
  linear-gradient(180deg, rgba(28, 20, 24, .55) 0%, transparent 25%, transparent 70%, var(--well) 100%); }
.hero-inner { max-width: 760px; }
.hero-logo { margin: 0 auto 8px; width: max-content; }
.hero-logo img { width: 192px; height: auto; margin-inline: auto; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, .55)); }
@media (min-width: 420px) { .hero-logo img { width: 384px; } }
@media (min-width: 1400px) and (min-height: 860px) { .hero-logo img { width: 576px; } }
.tagline { font-family: var(--title-font); font-size: 36px; color: var(--title); text-shadow: 3px 3px 0 var(--ink); margin: 0 0 .3em; line-height: 1.1; }
@media (min-width: 768px) { .tagline { font-size: 45px; } }
.hero-sub { font-size: 20px; text-shadow: 2px 2px 0 var(--ink); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: center; margin: 24px 0 16px; }
.hero-note { color: var(--text); font-size: 16px; text-shadow: 2px 2px 0 var(--ink); }
.hero-down { position: absolute; bottom: 20px; left: 50%; translate: -50% 0; width: 44px; height: 44px; display: grid; place-items: center; }
.hero-down span { width: 18px; height: 18px; border-right: 4px solid var(--title); border-bottom: 4px solid var(--title); rotate: 45deg; animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 50% { translate: 0 6px; } }
@media (prefers-reduced-motion: reduce) { .hero-down span { animation: none; } }

/* Section dividers: ornamented brass rod over a pixel crenellation line. */
.divider { position: relative; display: grid; place-items: center; height: 54px; margin: 8px 0; }
.divider::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 9px; translate: 0 -50%;
  background:
    linear-gradient(var(--brass), var(--brass)) 0 3px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #5b4030 0 12px, transparent 12px 24px) 0 0 / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 12px, #5b4030 12px 24px) 0 6px / 100% 3px no-repeat;
  opacity: .8; }
.divider img { position: relative; width: 320px; max-width: 92vw; height: auto; }
@media (max-width: 359px) { .divider img { width: 160px; } }

/* Sections */
.sec { position: relative; padding: clamp(48px, 8vw, 104px) 0; }
.sec-lore, .sec-beta { background: linear-gradient(180deg, transparent, rgba(0, 0, 0, .28) 12%, rgba(0, 0, 0, .28) 88%, transparent); }
.two { display: grid; gap: var(--gap); align-items: center; }
@media (min-width: 960px) { .two { grid-template-columns: 1.1fr 1fr; } }
.pillars { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.card { display: flex; gap: 14px; align-items: flex-start; }
.card img { flex: none; }
.card h3 { font-size: 27px; margin-bottom: .2em; }
.card p { margin: 0; font-size: 17px; color: var(--dim); }

/* Lore */
.chronicle { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(28px, 5vw, 56px); counter-reset: chap; position: relative; }
@media (min-width: 900px) {
  .chronicle::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; translate: -50% 0;
    background: repeating-linear-gradient(180deg, var(--brass) 0 12px, transparent 12px 20px); opacity: .5; }
}
.chap { display: grid; gap: 18px; align-items: center; position: relative; }
@media (min-width: 900px) {
  .chap { grid-template-columns: 1fr 1fr; gap: 64px; }
  .chap:nth-child(even) .chap-art { order: 2; }
}
.chap-art { margin: 0; position: relative; justify-self: center; max-width: 360px; width: 100%; }
.chap-art img, .step figure img, .gcard figure img { width: 100%; height: auto; border: 4px solid #3b2a22; box-shadow: 0 0 0 3px var(--ink), 8px 8px 0 rgba(0, 0, 0, .45); }
.chap-art img { aspect-ratio: 3 / 4; object-fit: cover; }
.when { font-size: 15px; letter-spacing: .12em; text-transform: uppercase; color: #7a4a2a; margin-bottom: .2em; }
.chap-text p:last-child { margin-bottom: 0; }
.seal { position: absolute; left: 10px; bottom: 10px; background: var(--ink); color: var(--title); border: 2px solid var(--brass); font-size: 13px; letter-spacing: .06em; padding: 3px 8px; text-transform: uppercase; }
.seal-real { color: #c9dd8a; border-color: var(--good); }
.doors { margin: clamp(40px, 7vw, 80px) auto 0; text-align: center; }
.doors-frame { display: inline-block; max-width: 100%; border-style: solid; border-width: 22px; border-image: url("/m/panel_wood.14b06f7f.png") 80 / 40px repeat; image-rendering: pixelated; background: var(--ink); }
.doors-frame img { width: 640px; height: auto; }
@media (min-width: 1440px) { .doors-frame img { width: 1280px; } }
@media (max-width: 719px) { .doors-frame img { width: 100%; } }
.doors figcaption { color: var(--dim); margin-top: 14px; font-size: 16px; }
.doors .seal { position: static; display: inline-block; margin-left: 8px; }
.tips { list-style: none; padding: 0; margin: 40px auto 0; display: grid; gap: 14px; max-width: 980px; }
@media (min-width: 768px) { .tips { grid-template-columns: repeat(3, 1fr); } }
.tips li { font-family: var(--title-font); font-size: 27px; color: var(--title); text-align: center; padding: 18px; border-top: 3px solid #3b2a22; border-bottom: 3px solid #3b2a22; text-shadow: 2px 2px 0 var(--ink); line-height: 1.25; }

/* How it works */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; }
@media (min-width: 600px) { .steps { grid-template-columns: repeat(2, 1fr); } }
/* Seven steps: four over three, the last row centred. */
@media (min-width: 1100px) {
  .steps { display: flex; flex-wrap: wrap; justify-content: center; }
  .step { flex: 0 0 calc((100% - 3 * 28px) / 4); }
}
.step { background: rgba(26, 17, 23, .7); border: 3px solid #3b2a22; box-shadow: inset 0 0 0 3px var(--ink), 6px 6px 0 rgba(0, 0, 0, .4); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.step figure { margin: 0; position: relative; }
.step figure img, .step video { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; height: auto; }
@media (max-width: 599px) { .step figure img, .step video { aspect-ratio: 4 / 3; } }
.step video { border: 4px solid #3b2a22; box-shadow: 0 0 0 3px var(--ink); background: var(--ink); }
.step-ico { float: right; margin: -6px 0 4px 8px; width: 48px; height: 48px; }
@media (min-width: 600px) { .step-ico { width: 64px; height: 64px; } }
.step h3 { font-size: 27px; }
.step p { font-size: 16px; color: var(--dim); margin: 0; }

/* Beta */
.beta-grid { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 1024px) { .beta-grid { grid-template-columns: 400px 1fr; } }
.checklist { list-style: none; margin: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 2px dashed rgba(46, 28, 42, .25); font-size: 17px; }
.checklist li:last-child { border-bottom: 0; }
.checklist img { width: 48px; height: 48px; flex: none; }
.clips, .stories { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .clips { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 640px) { .stories { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .clips { grid-template-columns: repeat(5, 1fr); } }
.clip { margin: 0; position: relative; }
.clip video { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; background: var(--ink); border: 4px solid #3b2a22; box-shadow: 0 0 0 3px var(--ink), 6px 6px 0 rgba(0, 0, 0, .4); }
.clip figcaption { text-align: center; font-size: 15px; color: var(--dim); margin-top: 8px; }
.sec-beta .center, #bastidores .center { margin-top: 40px; }

/* Complete game */
.gallery { display: grid; gap: 24px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .gallery { grid-template-columns: repeat(3, 1fr); } }
.gcard { display: flex; flex-direction: column; gap: 12px; }
.gcard figure { margin: 0; position: relative; }
.gcard figure img { aspect-ratio: 4 / 3; object-fit: cover; }
.gcard .gtext { padding: 0 4px; }
.gcard .gtext p { font-size: 16px; color: var(--dim); margin: 0; }
.gcard-wide { grid-column: 1 / -1; }
@media (min-width: 900px) { .gcard-wide { display: grid; grid-template-columns: 1.6fr 1fr; align-items: center; gap: 24px; } }
.gcard-wide figure img { aspect-ratio: 3 / 2; }
.gcard-wide .gtext p { color: var(--parch-ink); }
.journey { margin: clamp(40px, 6vw, 72px) auto 0; max-width: 880px; }
.journey h3 { text-align: center; }
.journey ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: j; }
.journey li { counter-increment: j; position: relative; padding: 10px 0 10px 56px; border-bottom: 2px solid #3b2a22; }
.journey li::before { content: counter(j); position: absolute; left: 0; top: 4px; width: 44px; font-family: var(--title-font); font-size: 36px; color: var(--brass); text-align: center; }

/* Roadmap */
.road { list-style: none; margin: 0; padding: 0; display: grid; gap: 28px; position: relative; }
@media (min-width: 900px) {
  .road { grid-template-columns: repeat(3, 1fr); }
  .road::before { content: ""; position: absolute; top: 64px; left: 8%; right: 8%; height: 6px; background: repeating-linear-gradient(90deg, var(--brass) 0 18px, transparent 18px 30px); opacity: .6; }
}
.phase { position: relative; background: #1d1419; border: 3px solid #3b2a22; box-shadow: inset 0 0 0 3px var(--ink), 6px 6px 0 rgba(0, 0, 0, .4); padding: 26px 20px 20px; }
.phase.now { border-color: var(--brass); }
.phase > img { margin: 0 auto 8px; background: var(--ink); border: 3px solid var(--brass); padding: 6px; width: 82px; height: 82px; position: relative; }
.phase h3 { text-align: center; }
.phase ul { margin: 0; padding-left: 20px; }
.phase li { font-size: 16px; color: var(--dim); margin-bottom: 6px; }
.phase li::marker { color: var(--brass); }
.phase-tag { position: absolute; top: 12px; right: 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; padding: 2px 8px; border: 2px solid #5b4030; color: var(--dim); }
.now .phase-tag { color: var(--ink); background: var(--good); border-color: var(--good); }

/* Final call */
.final { position: relative; overflow: hidden; isolation: isolate; text-align: center; padding: clamp(80px, 14vw, 180px) var(--gap); margin-top: clamp(32px, 6vw, 64px); }
.final-bg { position: absolute; inset: 0; z-index: -2; }
.final-bg img { width: 100%; height: 100%; object-fit: cover; }
.final::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 50%, rgba(28, 20, 24, .55), rgba(28, 20, 24, .88) 70%), linear-gradient(180deg, var(--well), transparent 20%, transparent 80%, var(--well)); }
.final p { font-size: 20px; text-shadow: 2px 2px 0 var(--ink); }
.final .btn { margin-top: 12px; }
.nf-emblem { margin: 0 auto 16px; width: 108px; height: auto; }
.final-inner > p .btn { margin: 8px; }

/* Footer */
.foot { border-top: 3px solid #3b2a22; background: var(--ink); padding: 40px 0 calc(40px + env(safe-area-inset-bottom)); font-size: 15px; color: var(--dim); }
.foot-in { display: grid; gap: 20px; align-items: center; }
@media (min-width: 900px) { .foot-in { grid-template-columns: auto 1fr auto; } .foot-credits { grid-column: 1 / -1; } }
.foot p { margin: 0; }
.foot-title { font-family: var(--title-font); font-size: 27px; color: var(--title); }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot-links a { padding: 10px 0; display: inline-block; }
.foot-credits { border-top: 1px solid #3b2a22; padding-top: 16px; display: grid; gap: 4px; }

/* Loading screen: only while html.loading (set by boot.js). */
.loader { display: none; }
.loading body { overflow: hidden; }
.loading .loader, .loader.fading { display: grid; }
.loader { position: fixed; inset: 0; z-index: 90; place-items: center; padding: var(--gap); background-color: var(--well);
  background-image: radial-gradient(ellipse at 50% 40%, rgba(249, 191, 79, .1), transparent 60%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 2px, transparent 2px 48px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .16) 0 2px, transparent 2px 96px); }
.loader.fading { opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.loader-box { width: min(440px, 100%); text-align: center; border-style: solid; border-width: 22px;
  border-image: url("/m/panel_wood.14b06f7f.png") 80 fill / 40px repeat; image-rendering: pixelated; padding: 12px 14px 8px; }
.loader-emblem { width: 108px; height: auto; margin: 0 auto 6px; }
.loader-title { font-family: var(--title-font); font-size: 36px; color: var(--title); text-shadow: 3px 3px 0 var(--ink); margin: 0 0 8px; line-height: 1.1; }
.loader-tip { font-size: 15px; color: var(--dim); margin: 0 0 16px; min-height: 3em; }
.loader-bar { height: 24px; background: var(--ink); border: 3px solid var(--brass); box-shadow: inset 0 0 0 3px #3b2a22; padding: 3px; }
.loader-fill { display: block; height: 100%; width: 0; transition: width .15s linear;
  background: repeating-linear-gradient(90deg, var(--title) 0 9px, #e0a43a 9px 12px); }
.loader-pct { font-size: 14px; color: var(--dim); margin: 8px 0 0; }
@media (prefers-reduced-motion: reduce) { .loader.fading, .loader-fill { transition: none; } }

/* Ember particles behind the content. */
.embers { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; }

/* Scroll reveal: only hidden when the script runs and motion is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; translate: 0 28px; transition: opacity .7s ease, translate .7s ease; }
  .js .reveal.in { opacity: 1; translate: 0 0; }
  .js .chap.reveal:nth-child(odd) .chap-art { translate: -24px 0; transition: translate .9s ease; }
  .js .chap.reveal:nth-child(even) .chap-art { translate: 24px 0; transition: translate .9s ease; }
  .js .chap.reveal.in .chap-art { translate: 0 0; }
}
