/* TownTopia's shared look: every page links this file. It copies the mod's own
   screens (colours from MayorLook / StorageUi); 1 mod GUI pixel = 2 CSS px. */

@font-face {
  font-family: 'Pixelify Sans';
  src: url('/fonts/pixelify-sans-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --outer: #080808;
  --border: #454545;
  --border-hover: #666666;
  --panel: #202020;
  --panel-dark: #141414;
  --view: #111111;
  --row: #292929;
  --row-hover: #383838;
  --row-selected: #3c5641;
  --green: #3b4e3e;
  --green-hover: #4e6f53;
  --text: #f3f3f3;
  --muted: #aaaaaa;
  --dim: #7a7a7a;
  --accent: #6baf72;
  --gold: #e6d49a;
  --denied: #e07a6e;
  --link: #9ccb9c;
  --rule: #3b3b3b;
  --track: #333333;
  --thumb: #888888;
  --on: #30d158;
  --off: #71312e;
  --off-text: #ff453a;

  /* The pixel font is only for titles and the tab bars; everything else is plain text. */
  --pixel: 'Pixelify Sans', ui-monospace, monospace;
  --plain: Calibri, Carlito, 'Segoe UI', system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Anchor targets land below the sticky site bar. */
html { scroll-padding-top: 88px; }
html, body { margin: 0; }
body { min-height: 100vh; background: var(--panel-dark); color: var(--text); font: 17px/1.65 var(--plain); padding: 20px 16px 40px; }
/* The village, blurred like the menu background in Minecraft 1.21. A fixed layer
   rather than background-attachment: fixed, which phones ignore. */
body::before {
  content: ''; position: fixed; inset: -24px; z-index: -1;
  background: url('/img/bg-village-1.jpg') center / cover no-repeat;
  filter: blur(10px) brightness(.5);
}
::selection { background: var(--row-selected); color: var(--text); }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
a { color: var(--link); text-decoration-color: rgba(156, 203, 156, .4); text-underline-offset: 3px; }
a:hover { color: var(--text); text-decoration-color: currentColor; }
p { margin: 0 0 12px; }
h1 { font: 700 30px/1.1 var(--pixel); color: var(--gold); margin: 0 0 12px; }
h2 { font: 700 21px/1.2 var(--pixel); color: var(--gold); margin: 0 0 12px; }
h3 { font: 17px/1.3 var(--pixel); color: var(--text); margin: 20px 0 6px; }
strong, b { color: #fff; }
img.tex { image-rendering: pixelated; width: 32px; height: 32px; flex: none; }

/* The mod's scrollbar: 4 GUI px wide, square, no arrows. */
::-webkit-scrollbar { width: 8px; height: 8px; background: var(--track); }
::-webkit-scrollbar-thumb { background: var(--thumb); min-height: 36px; }
::-webkit-scrollbar-button { display: none; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-color: var(--thumb) var(--track); }
}

/* ---------- the site bar (same on every page) */
.sitebar {
  position: sticky; top: 0; z-index: 10; max-width: 1200px; margin: 0 auto 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  height: 60px; padding: 0 12px; background: var(--panel); border: 4px solid var(--outer);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .44);
}
.brand { display: flex; align-items: center; gap: 10px; font: 700 19px var(--pixel); color: var(--gold); text-decoration: none; }
.brand:hover { color: var(--gold); }
.sitenav { display: grid; grid-template-columns: repeat(6, 104px); gap: 4px; }
.seg {
  position: relative; display: grid; place-items: center; height: 36px; padding: 0 8px;
  background: var(--row); border: 2px solid var(--border); color: var(--muted);
  font: 16px var(--pixel); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.seg:hover { background: var(--row-hover); color: var(--text); }
.seg.on { background: var(--row-selected); color: var(--text); }
.seg.on::after, .tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }

/* ---------- buttons */
.btn-green, .btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  color: var(--text); font: 16px var(--plain); text-decoration: none; cursor: pointer;
}
.btn-green { border: 2px solid var(--accent); background: var(--green); }
.btn-green:hover { background: var(--green-hover); color: var(--text); }
.btn { background: var(--row); border: 2px solid var(--border); }
.btn:hover { background: var(--row-hover); border-color: var(--border-hover); color: var(--text); }
.sitebar .btn-green { justify-self: end; height: 36px; padding: 0 12px 0 4px; font-family: var(--pixel); }

/* ---------- windows */
.window {
  max-width: 1200px; margin: 0 auto; background: var(--panel); border: 4px solid var(--outer);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .44); padding: 0 16px 16px;
}
.titlebar { display: flex; align-items: center; gap: 10px; height: 56px; font: 700 19px var(--pixel); color: var(--gold); }
.titlebar a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }

/* ---------- small parts */
/* A key or an in-game button. */
.key {
  display: inline-block; font: 15px/1 var(--plain); color: var(--text); padding: 4px 7px 6px; background: var(--row);
  border: 2px solid var(--border-hover); box-shadow: inset 0 -3px 0 var(--border); vertical-align: 1px;
}
/* A chat command, in the chat box's colours. */
.cmd { font: 15px var(--plain); color: #e0e0e0; background: #000; border: 2px solid #a0a0a0; padding: 1px 7px; white-space: nowrap; }
/* The game's text field. */
.editbox {
  width: 100%; height: 32px; background: #000; border: 2px solid #a0a0a0; color: #e0e0e0;
  font: 16px var(--plain); padding: 0 8px; outline: none;
}
.editbox::placeholder { color: #707070; }
.editbox:focus { border-color: #fff; }

/* A tip: a strip of row colour with an accent edge; its first bold words are the label. */
.tip { margin: 18px 0; padding: 10px 14px 10px 18px; background: var(--row); box-shadow: inset 4px 0 0 var(--accent); }
.tip.warn { box-shadow: inset 4px 0 0 var(--denied); }
.tip > p { margin: 0; }
.tip > p > :is(strong, b):first-child { color: var(--gold); margin-right: 6px; }

/* A fold that starts closed. */
.fold { margin: 20px 0; }
.fold > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px;
  background: var(--row); border: 2px solid var(--border); font: 16px var(--plain); color: var(--text);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary:hover { background: var(--row-hover); border-color: var(--border-hover); }
.fold > summary::before { content: '+'; color: var(--accent); }
.fold[open] > summary::before { content: '-'; }
.fold ol { margin: 14px 0 0; padding-left: 26px; }
.fold ol li { margin: 6px 0; padding-left: 4px; }
.fold ol li::marker { color: var(--accent); font-weight: 700; }

/* A picture in a frame, with an optional caption. */
.pic { margin: 16px 0 0; background: var(--row); border: 2px solid var(--border); }
.pic img { display: block; width: 100%; height: auto; }
.pic figcaption { padding: 8px 12px; border-top: 2px solid var(--border); font: 15px/1.35 var(--plain); color: var(--muted); }

/* A data table: rows of row colour, no outer frame. */
table.rows { width: 100%; border-collapse: separate; border-spacing: 0 4px; font: 17px var(--plain); margin: 0 0 12px; }
table.rows th { text-align: left; font-weight: 400; font-size: 15px; color: var(--muted); padding: 0 14px; }
table.rows td { background: var(--row); padding: 9px 14px; vertical-align: top; }

.legal { max-width: 1200px; margin: 14px auto 0; font: 14px var(--plain); color: var(--dim); text-align: center; }
/* The footer: plain links over the legal line. */
.foot { max-width: 1200px; margin: 20px auto 0; text-align: center; }
.foot-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin: 0; }
.foot-links a { color: var(--muted); }
.foot .legal { margin-top: 8px; }

/* The game's hover box (site.js shows it for anything with data-tip). */
.mc-tip { position: fixed; z-index: 50; pointer-events: none; max-width: 460px; padding: 2px; background: rgba(16, 0, 16, .94); }
.mc-tip > div {
  padding: 4px 8px 6px; border: 2px solid;
  border-image: linear-gradient(rgba(80, 0, 255, .62), rgba(40, 0, 127, .62)) 1;
  font: 16px/1.4 var(--plain); color: #fff;
}
.mc-tip .sub { color: var(--muted); }

/* ---------- narrow windows and phones */
@media (max-width: 1000px) {
  html { scroll-padding-top: 124px; }
  .sitebar { grid-template-columns: 1fr auto; height: auto; padding: 10px 12px; gap: 10px; }
  .sitenav { grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  body { padding: 0 0 24px; }
  .sitebar { border-width: 0 0 4px; margin-bottom: 8px; }
  .sitenav { display: flex; overflow-x: auto; }
  .sitenav .seg { flex: none; padding: 0 12px; }
  .window { border-width: 4px 0; padding: 0 8px 8px; }
  .foot { padding: 0 16px; }
}
