/* FABLINGS - mid-century field guide. DIRECTION.md is the contract:
   paper/ink/ember/stamp, Fredoka + IBM Plex Serif + IBM Plex Mono, zero
   radius on structure, 1px rules and 3px double rules, dense, light. The
   roundness lives in the creatures. */

:root {
  --paper: #f4ecdb;
  --paper-2: #efe3c8;
  --ink: #221d17;
  --ember: #c8451b;
  --stamp: #2b4c7e;
  --rule: 1px solid var(--ink);
}

* { box-sizing: border-box; margin: 0; }

html { background: var(--paper); }

body {
  font-family: "IBM Plex Serif", Georgia, serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3 { font-family: "Fredoka", Georgia, serif; font-weight: 600; }
h1 { font-size: 64px; line-height: 1; letter-spacing: 2px; }
h2 { font-size: 40px; margin: 0 0 12px; }
.mono, td.num, .price, .drip-num { font-family: "IBM Plex Mono", monospace; }
small, .cap { font-size: 13px; }

a { color: var(--stamp); }

/* frame */
.sheet { max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; }
.sheet.narrow { max-width: 860px; }

/* single-column hero */
.hero { border-bottom: 3px double var(--ink); padding: 30px 0 16px; text-align: center; }
.hero p { max-width: 560px; margin: 10px auto; }
.hero-sprites img { width: 88px; height: 88px; image-rendering: pixelated; }
.links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin: 14px 0; font-family: "IBM Plex Mono", monospace; font-size: 14px; }
.links a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--ember); padding-bottom: 2px; }
.links a:hover { color: var(--ember); }

.upcoming img { width: 34px; height: 34px; image-rendering: pixelated; border: var(--rule); margin-left: 4px; vertical-align: middle; }

/* the tax meter */
.chartwrap { width: 100%; }
.chartwrap iframe { width: 100%; height: 380px; border: 1px solid var(--line); border-radius: 8px; background: #111; }
.swapbox { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.swapbox input[type="number"] { flex: 1; min-width: 0; font-family: "IBM Plex Mono", monospace; font-size: 18px; padding: 8px; background: transparent; border: 1px solid var(--line); border-radius: 6px; color: inherit; }


header.masthead {
  border-bottom: 3px double var(--ink);
  padding: 28px 0 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.masthead .kicker { font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }

/* the drip bar: the 2-second heartbeat, doubles as the masthead rule */
.dripbar { height: 10px; border: var(--rule); background: var(--paper-2); margin: 10px 0 0; position: relative; }
.dripbar > i { display: block; height: 100%; background: var(--ember); width: 0%; }
.dripline { display: flex; justify-content: space-between; font-size: 13px; padding-top: 4px; }
.dripline .ready { color: var(--ember); font-weight: 600; }

/* layout: fixed left rail + content */
.frame { display: grid; grid-template-columns: 168px 1fr; gap: 24px; align-items: start; }
nav.rail {
  position: sticky; top: 0; padding: 16px 0;
  border-right: var(--rule);
  font-family: "IBM Plex Mono", monospace; font-size: 13px;
}
nav.rail a { display: block; padding: 6px 8px; color: var(--ink); text-decoration: none; border-bottom: 1px solid transparent; }
nav.rail a:hover { color: var(--ember); }
nav.rail .wallet { margin-top: 18px; border-top: var(--rule); padding-top: 10px; word-break: break-all; }

main { min-width: 0; }
section { border-bottom: 3px double var(--ink); padding: 28px 0; }
section:last-child { border-bottom: 0; }

/* ruled tables */
table { border-collapse: collapse; width: 100%; margin: 10px 0; }
th, td { border: var(--rule); padding: 5px 9px; text-align: left; font-size: 14px; }
th { font-family: "IBM Plex Mono", monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; background: var(--paper-2); }
td.num { text-align: right; }

/* the signature element: catalog plates */
.plates { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; margin-top: 14px; }
.plate {
  border: 3px double var(--ink);
  padding: 10px;
  background: var(--paper);
  display: flex; flex-direction: column; gap: 6px;
}
.plate img { width: 100%; image-rendering: pixelated; border: var(--rule); background: var(--paper-2); }
.plate .no { font-family: "IBM Plex Mono", monospace; font-size: 12px; }
.plate .nm { font-family: "Fredoka", Georgia, serif; font-size: 17px; }
.plate .parts { font-size: 13px; min-height: 2.6em; }
.plate.affordable { outline: 2px solid var(--ember); outline-offset: -6px; }

/* order form controls */
button {
  font-family: "IBM Plex Mono", monospace; font-size: 14px;
  background: var(--ink); color: var(--paper);
  border: var(--rule); padding: 9px 14px; cursor: pointer;
}
button.primary { background: var(--ember); border-color: var(--ink); }
button.ghost { background: var(--paper); color: var(--ink); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button, input, select { border-radius: 0; }
input[type="number"] { font-family: "IBM Plex Mono", monospace; width: 64px; padding: 8px; border: var(--rule); background: var(--paper); }

.element-pick { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.element-pick label {
  border: var(--rule); padding: 8px; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; gap: 4px; width: 108px; background: var(--paper);
}
.element-pick input { display: none; }
.element-pick label:has(input:checked) { outline: 3px solid var(--ember); }
.element-pick img { width: 72px; height: 72px; margin: 0 auto; image-rendering: pixelated; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.note { font-size: 13px; border-left: 3px solid var(--ember); padding: 4px 10px; margin: 10px 0; }
.stampline { color: var(--stamp); font-family: "IBM Plex Mono", monospace; font-size: 13px; }

/* inventory + vault grids */
.inv { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.inv label { border: var(--rule); padding: 4px; width: 84px; text-align: center; font-size: 11px; font-family: "IBM Plex Mono", monospace; cursor: pointer; background: var(--paper); }
.inv label img { width: 64px; height: 64px; image-rendering: pixelated; display: block; }
.inv input { display: none; }
.inv label:has(input:checked) { outline: 3px solid var(--stamp); }

/* tx status lines: idle / sign / pending / settled / failed */
.status { font-family: "IBM Plex Mono", monospace; font-size: 13px; min-height: 1.4em; margin-top: 6px; }
.status.err { color: var(--ember); }
.status.ok { color: var(--stamp); }

/* stamp animation on a landed transaction */
@keyframes stamp { 0% { transform: scale(1.6); opacity: 0; } 60% { transform: scale(0.95); opacity: 1; } 100% { transform: scale(1); } }
.stamped { animation: stamp 240ms ease-out; }

dialog { border: 3px double var(--ink); background: var(--paper); padding: 18px; max-width: 460px; }
dialog::backdrop { background: rgba(34, 29, 23, 0.4); }

@media (max-width: 720px) {
  .frame { grid-template-columns: 1fr; }
  nav.rail { position: static; border-right: 0; border-bottom: var(--rule); display: flex; flex-wrap: wrap; gap: 2px; }
  h1 { font-size: 44px; }
  h2 { font-size: 28px; }
  /* wide tables scroll inside themselves; the page never scrolls sideways */
  table { display: block; overflow-x: auto; }
  .mono, td.mono { overflow-wrap: anywhere; }
}
