/* PrimitiveCraft landing page. A Minecraft-style UI drawn entirely in CSS, with the mod's own block textures.
   No Mojang art or fonts: Pixelify Sans (OFL) for the pixel type, Chakra Petch (OFL) for Thai. */
:root {
  --pixel: 'Pixelify Sans', 'Chakra Petch', ui-monospace, system-ui, sans-serif;
  --ink: #ffffff;
  --ink-dim: #c9c4bb;
  --shadow: #3f3f3f;
  --panel: #c6c6c6;
  --panel-hi: #ffffff;
  --panel-lo: #555555;
  --slot: #8b8b8b;
  --slot-lo: #373737;
  --gold: #ffff55;
  --aqua: #55ffff;
  --purple: #ff55ff;
  --green: #55ff55;
  --red: #ff5555;
  --gray: #aaaaaa;
  --dirt: #241812;
  --frost: #bcd3e6;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; overflow-x: clip; }
body {
  margin: 0;
  font-family: var(--pixel);
  font-size: 18px;
  line-height: 1.45;
  color: var(--ink);
  background-color: var(--dirt);
  background-image: linear-gradient(rgba(10, 6, 4, 0.62), rgba(10, 6, 4, 0.62)), url(../assets/blocks/peat.png);
  background-size: auto, 64px 64px;
  image-rendering: pixelated;
  overflow-x: clip;
}
html[lang="th"] body { line-height: 1.7; }
canvas { image-rendering: auto; display: block; }
img { image-rendering: pixelated; }
a { color: var(--aqua); }
h1, h2, h3, .mc-btn, .tooltip, .title { text-shadow: 2px 2px 0 var(--shadow); }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 56px; padding: 0 16px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  transition: background 0.25s;
}
.topbar.solid { background: rgba(14, 10, 8, 0.92); box-shadow: 0 2px 0 #000, 0 4px 0 rgba(255, 255, 255, 0.06); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 20px; text-shadow: 2px 2px 0 var(--shadow); }
.brand img { width: 28px; height: 28px; }
.topbar nav { display: flex; gap: 18px; margin-left: auto; }
.topbar nav a { color: var(--ink); text-decoration: none; text-shadow: 2px 2px 0 var(--shadow); }
.topbar nav a:hover { color: var(--gold); }
@media (max-width: 860px) { .topbar nav { display: none; } .lang-toggle { margin-left: auto; } }

/* ---------- Minecraft-style buttons ---------- */
.mc-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 6px 18px;
  font: 500 20px/1.1 var(--pixel); color: var(--ink); text-decoration: none; cursor: pointer;
  background: #6d6d6d;
  border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #a9a9a9, inset -2px -4px 0 #4b4b4b;
  user-select: none;
}
.mc-btn:hover, .mc-btn:focus-visible { background: #7a7a8f; border-color: #fff; outline: none; color: #ffffa0; }
.mc-btn:active { box-shadow: inset 2px 2px 0 #4b4b4b, inset -2px -2px 0 #8a8a8a; }
.mc-btn[disabled] { cursor: default; color: #a0a0a0; background: #2c2c2c; box-shadow: none; border-color: #000; text-shadow: none; }
.mc-btn.small { min-height: 34px; padding: 4px 12px; font-size: 16px; }
.mc-btn.on { background: #4f6b3a; box-shadow: inset 2px 2px 0 #7ea35d, inset -2px -4px 0 #34472a; }
.mc-btn.green { background: #3f7a2a; box-shadow: inset 2px 2px 0 #6fbb4a, inset -2px -4px 0 #2a5419; }
.mc-btn.green[disabled] { background: #2f4a26; color: #b9d3a8; box-shadow: inset 2px 2px 0 #4e7a3c, inset -2px -4px 0 #1f3318; }
.mc-btn.wide { width: 100%; }

.mc-input {
  font: 18px var(--pixel); color: var(--ink);
  background: #000; border: 2px solid #a0a0a0; padding: 6px 10px; min-width: 0;
}
.mc-input:focus { outline: none; border-color: #fff; }

/* ---------- title screen ---------- */
.hero { position: relative; height: 100vh; min-height: 620px; overflow: hidden;
  background: linear-gradient(#6f97c0 0%, #a9c6de 45%, var(--frost) 70%, #e9f1f7 100%); }
#hero3d { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.45) 100%); }
.hero-inner { position: relative; z-index: 2; height: 100%; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 48px; padding: 72px 16px 72px; }
.logo-wrap { position: relative; text-align: center; }
.logo {
  margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0 0.18em;
  font: 700 clamp(46px, 10.5vw, 132px)/0.95 var(--pixel); letter-spacing: 0.02em;
  background: url(../assets/blocks/travertine.png) 0 0 / 0.5em 0.5em, #bdb39a;
  background-blend-mode: multiply;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent;
  text-shadow: none;
  filter: drop-shadow(3px 0 0 #2a2119) drop-shadow(-3px 0 0 #2a2119) drop-shadow(0 -3px 0 #2a2119)
          drop-shadow(0 4px 0 #6f5d45) drop-shadow(0 4px 0 #4b3e2e) drop-shadow(0 3px 0 #2a2119)
          drop-shadow(6px 8px 0 rgba(0, 0, 0, 0.35));
}
.logo span:last-child {
  background: url(../assets/blocks/great_tusk.png) 0 0 / 0.5em 0.5em, #e3d6b4;
  background-blend-mode: multiply;
  -webkit-background-clip: text; background-clip: text;
}
.ribbon {
  display: inline-block; margin-top: 14px; padding: 4px 18px;
  font: 600 clamp(14px, 2vw, 22px) var(--pixel); letter-spacing: 0.25em; color: #fff;
  background: #5b3a26; border: 2px solid #1d120b;
  box-shadow: inset 0 2px 0 #8a5c3d, inset 0 -3px 0 #3d2618, 4px 4px 0 rgba(0, 0, 0, 0.35);
  text-shadow: 2px 2px 0 #2a1a10;
}
html[lang="th"] .ribbon { letter-spacing: 0.06em; }
.splash {
  position: absolute; right: -2%; bottom: 18%;
  font: 600 clamp(14px, 2.2vw, 26px) var(--pixel); color: var(--gold); white-space: nowrap;
  text-shadow: 2px 2px 0 #3f3f00;
  transform-origin: center;
  animation: splash 0.55s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes splash { from { transform: translateX(40%) rotate(-18deg) scale(0.93); } to { transform: translateX(40%) rotate(-18deg) scale(1.06); } }
@media (max-width: 700px) { .splash { right: 50%; bottom: -34px; } }
.menu { width: min(420px, 100%); display: flex; flex-direction: column; gap: 10px; }
.menu .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-foot { position: absolute; z-index: 2; inset: auto 0 0 0; display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 16px; font-size: 15px; color: #fff; text-shadow: 2px 2px 0 var(--shadow); flex-wrap: wrap; }

/* ---------- sections ---------- */
.section { position: relative; padding: 88px 16px 72px; max-width: 1240px; margin: 0 auto; }
.section.dark { max-width: none; padding-left: max(16px, calc((100% - 1208px) / 2)); padding-right: max(16px, calc((100% - 1208px) / 2));
  background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)), url(../assets/blocks/permafrost.png);
  background-size: auto, 64px 64px; border-top: 4px solid #000; border-bottom: 4px solid #000; }
.title { margin: 0 0 10px; text-align: center; font: 700 clamp(30px, 5vw, 52px)/1.1 var(--pixel); }
.lead { max-width: 760px; margin: 0 auto 36px; text-align: center; color: var(--ink-dim); font-size: 19px; }

/* stats: XP-style numbers */
.stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 34px; margin: 0 0 40px; }
.stat { text-align: center; }
.stat b { display: block; font: 700 44px/1 var(--pixel); color: #80ff20;
  text-shadow: 2px 0 0 #000, -2px 0 0 #000, 0 2px 0 #000, 0 -2px 0 #000, 3px 3px 0 #000; }
.stat span { color: var(--ink-dim); font-size: 16px; }

/* inventory panels */
.panel {
  background: var(--panel); color: #3f3f3f; border: 2px solid #000;
  box-shadow: inset 4px 4px 0 var(--panel-hi), inset -4px -4px 0 var(--panel-lo);
  padding: 16px;
}
.slot {
  position: relative; display: grid; place-items: center; aspect-ratio: 1;
  background: var(--slot); box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 #fff;
  border: 0; padding: 4px; cursor: pointer;
}
.slot img { width: 100%; height: 100%; object-fit: contain; image-rendering: auto; }
.slot:hover::after, .slot:focus-visible::after { content: ""; position: absolute; inset: 2px; background: rgba(255, 255, 255, 0.5); }
.slot:focus-visible { outline: none; }
.slot.selected { box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 #fff, 0 0 0 2px #fff; }
.slot .loading { width: 40%; height: 40%; background: #9c9c9c; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* features */
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.feature { display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: start; }
.feature .slot { width: 64px; cursor: default; }
.feature h3 { margin: 0 0 4px; font-size: 20px; color: #3f3f3f; text-shadow: none; }
.feature p { margin: 0; font-size: 16px; color: #3a3a3a; }

/* ---------- bosses ---------- */
.bosses { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.boss { display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.55); border: 2px solid #000;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08); }
.bossbar { padding: 12px 14px 10px; text-align: center; }
.bossbar .name { font-size: 18px; color: #fff; text-shadow: 2px 2px 0 var(--shadow); }
.bossbar .bar { height: 10px; margin-top: 6px; border: 2px solid #000; background: #2a2a2a; position: relative; }
.bossbar .bar i { position: absolute; inset: 0; background: var(--c, #e85dd0);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -2px 0 rgba(0, 0, 0, 0.35); }
.bossbar .bar i::after { content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, 0.35) calc(10% - 2px) 10%); }
.boss canvas { width: 100%; height: 300px; cursor: grab;
  background: radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0) 70%); }
.boss-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.replaces { align-self: flex-start; font-size: 15px; color: var(--gold); background: rgba(0, 0, 0, 0.5); padding: 2px 8px; border: 2px solid #3d3d00; }
.boss-body .tag { font-size: 19px; color: #fff; margin: 0; }
.boss-body ul { margin: 0; padding-left: 18px; color: var(--ink-dim); font-size: 16px; }
.boss-body .mc-btn { margin-top: auto; align-self: flex-start; }

/* ---------- bestiary ---------- */
.bestiary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; align-items: start; }
@media (max-width: 980px) { .bestiary { grid-template-columns: 1fr; } }
.inventory { padding: 12px 14px 16px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: -4px 0 10px; }
.tab { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; font: 16px var(--pixel); color: #3f3f3f;
  background: #b4b4b4; border: 2px solid #000; cursor: pointer;
  box-shadow: inset 2px 2px 0 #fff, inset -2px -2px 0 #6f6f6f; }
.tab img, .tab .loading { width: 30px; height: 30px; image-rendering: auto; }
.tab .count { color: #6a6a6a; font-size: 14px; }
.tab[aria-selected="true"] { background: var(--panel); box-shadow: inset 2px 2px 0 #fff, inset -2px 0 0 #6f6f6f; transform: translateY(2px); }
.tab:focus-visible { outline: 2px solid #fff; }
.inv-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.inv-title { flex: 1; font-size: 18px; color: #3f3f3f; }
.inv-head .mc-input { width: 46%; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 4px; }
.grid .empty { grid-column: 1 / -1; padding: 30px; text-align: center; color: #555; }

.detail { padding: 12px; position: sticky; top: 68px; }
@media (max-width: 980px) { .detail { position: static; } }
.stage { position: relative; background: #000; border: 2px solid #000;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff; }
.stage canvas { width: 100%; height: 360px; cursor: grab;
  background: radial-gradient(ellipse at 50% 30%, #6e8aa3, #2c3a47 70%, #1b232b); }
.stage.water canvas { background: radial-gradient(ellipse at 50% 15%, #3f8fb0, #164a6b 60%, #0a2236); }
.stage.boss canvas { background: radial-gradient(ellipse at 50% 30%, #6d5a7a, #2d2233 70%, #140e18); }
.stage.plant canvas { background: radial-gradient(ellipse at 50% 30%, #6f8a5e, #2e3a28 70%, #171d14); }
.stage-tools { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

.info { padding: 14px 6px 4px; color: #3f3f3f; }
.info h3 { margin: 0; font-size: 28px; line-height: 1.1; text-shadow: none; }
.info .sci { color: #555; font-style: italic; margin: 6px 0 8px; font-size: 16px; }
.info .tagline { margin: 0 0 12px; font-size: 18px; color: #2c2c2c; }
.nametag { display: inline-block; padding: 2px 10px 4px; background: rgba(16, 0, 16, 0.94); border: 2px solid #28007f;
  box-shadow: inset 0 0 0 1px #5000ff; text-shadow: 2px 2px 0 #3f3f3f; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge { font-size: 14px; color: #fff; background: #555; border: 2px solid #000; padding: 1px 8px; text-shadow: 1px 1px 0 #000; }
.badge.group { background: #6b4b2f; }
.badge.rung { background: #3a5a7a; }
.badge.replaces { background: #7a3a3a; }
.statrows { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 16px; }
.statrows dt { color: #555; }
.statrows dd { margin: 0; color: #222; }
.hearts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 1px; vertical-align: middle; }
.hearts i { width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 9' shape-rendering='crispEdges'%3E%3Cpath fill='%23000' d='M1 1h3v1h1V1h3v1h1v3H8v1H7v1H6v1H5v1H4V8H3V7H2V6H1V5H0V2h1z'/%3E%3Cpath fill='%23e02020' d='M1 2h3v1h1V2h3v3H7v1H6v1H5v1H4V7H3V6H2V5H1z'/%3E%3Cpath fill='%23ff8a8a' d='M2 2h1v1H2z'/%3E%3C/svg%3E") center / contain no-repeat; }
.hearts i.half { clip-path: inset(0 50% 0 0); }
.hearts .more { margin-left: 6px; color: #555; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .cols { grid-template-columns: 1fr; } }
.cols h4 { margin: 0 0 6px; font-size: 17px; color: #3f3f3f; }
.cols ul { margin: 0; padding-left: 18px; font-size: 15px; color: #2c2c2c; }
.cols li { margin-bottom: 6px; }
.cmd { margin-top: 12px; font-size: 14px; color: #555; }
.cmd code { color: #222; background: #b0b0b0; padding: 1px 6px; font-family: var(--pixel); }

/* ---------- deep time ---------- */
.timeline-wrap { overflow-x: auto; padding-bottom: 12px; scrollbar-color: #6d6d6d #1b1b1b; }
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); min-width: 1820px;
  border: 2px solid #000; background: rgba(0, 0, 0, 0.5); }
.period { display: flex; flex-direction: column; border-right: 2px solid #000; min-height: 300px; }
.period:last-child { border-right: 0; }
.period header { padding: 8px 8px 6px; background: var(--c); color: #1d1d1d; border-bottom: 2px solid #000;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.2); }
.period header b { display: block; font-size: 17px; }
.period header span { font-size: 13px; }
.period .icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 3px; padding: 8px; align-content: start; }
.period .icons .slot { padding: 2px; }
.period .note { padding: 10px; font-size: 14px; color: var(--ink-dim); }

/* ---------- download ---------- */
.download { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .download { grid-template-columns: 1fr; } }
.paper h3 { margin: 4px 0 8px; color: #3f3f3f; text-shadow: none; font-size: 22px; }
.pixel-list { margin: 0 0 18px; padding-left: 22px; color: #2c2c2c; font-size: 17px; }
.pixel-list li { margin-bottom: 6px; }
.dl-box { display: flex; flex-direction: column; gap: 12px; }
.dl-box .mc-btn { min-height: 64px; font-size: 24px; }
.hint { margin: 0; color: var(--ink-dim); text-align: center; }
.tip { background: rgba(0, 0, 0, 0.55); border: 2px solid #000; padding: 14px; }
.tip-title { color: var(--gold); margin-bottom: 6px; text-shadow: 2px 2px 0 #3f3f00; }
.tip code { display: block; font-family: var(--pixel); color: #fff; background: #000; padding: 8px 10px; border: 2px solid #555; overflow-x: auto; }
.tip p { margin: 8px 0 0; color: var(--ink-dim); font-size: 15px; }

/* ---------- footer, tooltip ---------- */
.footer { padding: 34px 16px 40px; text-align: center; background: rgba(0, 0, 0, 0.6); border-top: 4px solid #000; color: var(--ink-dim); font-size: 15px; }
.footer p { margin: 4px 0; }
.footer .legal { font-size: 13px; color: #8f8a83; letter-spacing: 0.04em; }
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 300px;
  padding: 6px 9px 7px; font-size: 16px; line-height: 1.35; color: #fff;
  background: rgba(16, 0, 16, 0.94); border: 2px solid #28007f; box-shadow: inset 0 0 0 2px #5000ff, 0 0 0 2px rgba(16, 0, 16, 0.94);
}
.tooltip .t-name { font-size: 17px; }
.tooltip .t-sub { color: var(--gray); font-size: 14px; }
.tooltip .t-group { color: #5555ff; font-size: 14px; font-style: italic; }
.r-common { color: #fff; }
.r-uncommon { color: var(--gold); }
.r-rare { color: var(--aqua); }
.r-epic { color: var(--purple); }

@media (prefers-reduced-motion: reduce) { .splash { animation: none; transform: translateX(40%) rotate(-18deg); } html { scroll-behavior: auto; } }
@media (max-width: 560px) {
  body { font-size: 17px; }
  .section { padding-top: 72px; padding-bottom: 56px; }
  .stage canvas { height: 300px; }
  .inv-head { flex-wrap: wrap; }
  .inv-head .mc-input { width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); }
}

/* 1.0.0: copyable commands, the checksum line, the English name under a Thai one */
.cmd code, .tip code { cursor: copy; position: relative; }
.cmd code[data-copied]::after, .tip code[data-copied]::after {
  content: attr(data-copied); position: absolute; left: 0; top: -26px; white-space: nowrap;
  background: #000; color: #fff; padding: 2px 6px; font-size: 12px; border: 1px solid #555;
}
.hash { margin: 0; color: var(--ink-dim); font-size: 12px; text-align: center; word-break: break-all; }
.hash code { font-size: 11px; color: var(--ink-dim); }
.info .sci .en-name { display: block; font-style: normal; color: #777; font-size: 14px; }
/* 183 creatures: the inventory scrolls inside itself; on phones the tabs scroll sideways */
.grid { max-height: 560px; overflow-y: auto; align-content: start; padding-right: 2px; }
@media (max-width: 980px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .tab { flex: none; }
  .grid { max-height: 296px; }
}
