/* =========================================================================
   bitVoxel — voxel-native design system
   Handbuilt, blocky, atmospheric. Zero smoothness foreign to the world.
   ========================================================================= */

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--torch); color: #1a120a; }

/* ---- Tokens -------------------------------------------------------------- */
:root {
  /* Earth / stone / sky world palette */
  --grass:        #6aa84f;
  --grass-dark:   #4e7d3a;
  --dirt:         #7a5532;
  --dirt-dark:    #5b3e24;
  --stone:        #6f7783;
  --stone-mid:    #4a515c;
  --stone-dark:   #2d333c;
  --stone-deep:   #1b1f26;

  /* Weather accent moments */
  --snow:         #eef4f9;
  --snow-blue:    #c4d6e6;
  --rain:         #3a4a5c;
  --rain-light:   #6f8aa3;
  --sky-blue:     #7fb4e0;
  --torch:        #ffb347;
  --torch-bright: #ffd27d;
  --torch-deep:   #d97a1e;
  --torch-glow:   rgba(255, 157, 46, 0.35);
  --ember:        #ff8a3d;

  /* Ink / paper */
  --ink:          #14181f;
  --bone:         #ece4d3;     /* warm off-white text on dark */
  --bone-dim:     #a89f8c;
  --paper:        #e9e2d2;

  /* UI chrome base (deep stone) */
  --panel:        #20252e;
  --panel-2:      #2a313c;
  --line:         #11151b;
  --line-soft:    rgba(236, 228, 211, 0.12);

  /* Type */
  --display: "Pixelify Sans", monospace;
  --label:   "Silkscreen", monospace;
  --body:    "JetBrains Mono", ui-monospace, Menlo, monospace;

  /* Hard pixel shadow steps (no blur — voxel native) */
  --px: 4px;
  --shadow-block: 6px 6px 0 var(--line);
  --shadow-block-sm: 4px 4px 0 var(--line);

  /* Section sky (controlled live by JS day-night) */
  --maxw: 1180px;
}

/* ---- Base ---------------------------------------------------------------- */
html, body { background: var(--stone-deep); }
body {
  font-family: var(--body);
  color: var(--bone);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Fixed sky layer — JS shifts it through the day/night biome cycle */
#sky {
  position: fixed;
  inset: 0;
  z-index: -3;
  background: linear-gradient(180deg, #1b2a3f 0%, #2c4763 45%, #4a6b86 100%);
  transition: background 1.2s ease;
}
/* atmospheric vignette so content never floats on flat color */
#sky::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 0%, transparent 40%, rgba(0,0,0,0.35) 100%);
}

/* Weather canvas sits above sky, below content */
#weather {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
}

/* ---- Typography ---------------------------------------------------------- */
.display { font-family: var(--display); font-weight: 700; line-height: 0.98; letter-spacing: -0.01em; }
.label {
  font-family: var(--label); font-weight: 400; text-transform: uppercase;
  letter-spacing: 0.18em; font-size: 12px; line-height: 1.4;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.02; }

h1 { font-size: clamp(44px, 8vw, 104px); }
h2 { font-size: clamp(34px, 5vw, 60px); }
h3 { font-size: clamp(22px, 3vw, 30px); }

.lead { font-size: clamp(16px, 1.6vw, 19px); line-height: 1.75; max-width: 54ch; text-wrap: pretty; }
p { text-wrap: pretty; }
.muted { color: var(--bone-dim); }
.torchtext { color: var(--torch-bright); }

/* ---- Layout -------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }
.biome { position: relative; padding: clamp(96px, 14vh, 168px) 0; }
.biome-inner { position: relative; z-index: 2; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.eyebrow .chip { width: 12px; height: 12px; background: var(--torch); box-shadow: 2px 2px 0 var(--line); }

/* ---- Pixel-stepped terrain divider between biomes ------------------------ */
.strata { position: relative; height: 28px; width: 100%; z-index: 3; }
.strata svg { width: 100%; height: 100%; display: block; }

/* ---- Voxel button -------------------------------------------------------- */
.btn {
  --bg: var(--torch);
  --fg: #1c1206;
  font-family: var(--label); text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 24px;
  background: var(--bg); color: var(--fg);
  border: 3px solid var(--line);
  box-shadow: var(--shadow-block);
  position: relative;
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
  /* top/left inner highlight = beveled block top */
}
.btn::before {
  content: ""; position: absolute; inset: 0;
  border-top: 3px solid rgba(255,255,255,0.45);
  border-left: 3px solid rgba(255,255,255,0.25);
  border-bottom: 3px solid rgba(0,0,0,0.25);
  pointer-events: none;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 4px 4px 0 var(--line); }
.btn:active { transform: translate(6px, 6px); box-shadow: 0 0 0 var(--line); }
.btn.ghost { --bg: transparent; --fg: var(--bone); box-shadow: var(--shadow-block-sm); }
.btn.ghost::before { border-top-color: rgba(255,255,255,0.18); border-left-color: rgba(255,255,255,0.1); }
.btn.stone { --bg: var(--stone); --fg: var(--bone); }

/* ---- Blocky panel / card ------------------------------------------------- */
.panel {
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: var(--shadow-block);
  position: relative;
}
.panel.bevel::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border-top: 2px solid var(--line-soft);
  border-left: 2px solid var(--line-soft);
}

/* ---- Isometric voxel cube (decorative) ----------------------------------- */
.cube { --s: 34px; --c: var(--grass); width: var(--s); height: var(--s); position: relative; transform-style: preserve-3d; }
.cube i { position: absolute; width: var(--s); height: var(--s); }
.cube .top   { background: color-mix(in srgb, var(--c) 100%, white 26%); transform: rotateX(90deg) translateZ(calc(var(--s)/2)); }
.cube .left  { background: color-mix(in srgb, var(--c) 100%, black 8%);  transform: rotateY(-90deg) translateZ(calc(var(--s)/2)); }
.cube .right { background: color-mix(in srgb, var(--c) 100%, black 26%); transform: translateZ(calc(var(--s)/2)); }
.cube.iso { transform: rotateX(-24deg) rotateY(-45deg); }

/* ---- Pixel/voxel feature icon (built from blocks) ------------------------ */
.vicon { width: 56px; height: 56px; display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); gap: 2px; }
.vicon span { background: transparent; }
.vicon span.on { background: var(--torch); }
.vicon span.on.s { background: var(--bone); }

/* ---- Nav ----------------------------------------------------------------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(20, 24, 31, 0.72);
  backdrop-filter: blur(6px);
  border-bottom: 3px solid var(--line);
}
.nav .brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-size: 22px; font-weight: 700; }
.nav .brand .mark { width: 26px; height: 26px; flex: none; }
.nav .links { display: flex; align-items: center; gap: 26px; }
.nav .links a { font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--bone-dim); transition: color 120ms; }
.nav .links a:hover, .nav .links a.active { color: var(--torch-bright); }
.nav .links .navbtn { color: var(--ink); }

/* ---- Footer -------------------------------------------------------------- */
.foot { background: var(--stone-deep); border-top: 3px solid var(--line); padding: 56px 0 40px; position: relative; z-index: 4; }
.foot .row { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; align-items: flex-start; }
.foot .links { display: flex; gap: 22px; flex-wrap: wrap; }
.foot .links a { font-family: var(--label); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--bone-dim); }
.foot .links a:hover { color: var(--torch-bright); }
.foot .fine { color: var(--bone-dim); font-size: 12px; margin-top: 28px; }

/* ---- Utility ------------------------------------------------------------- */
.stack-3 > * + * { margin-top: 12px; }
.stack-5 > * + * { margin-top: 20px; }
.stack-8 > * + * { margin-top: 34px; }
.grid { display: grid; gap: 20px; }
.flex { display: flex; }
.row-gap { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.center { text-align: center; }
.tag {
  font-family: var(--label); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  padding: 6px 10px; border: 2px solid var(--line); background: var(--panel-2); color: var(--bone-dim);
}

/* fade-up on scroll */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity 600ms ease, transform 600ms ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 860px) {
  .nav .links { gap: 14px; }
  .nav .links a:not(.navbtn) { display: none; }
  .biome { padding: 80px 0; }
}
