/* The pixel item designer page: the tool on a parchment board, with the bag and the crafting menu
   in the game's own panel and slot art (art/ui in the game repo), then the steps and the FAQ.
   Built on catkraft.css's tokens; the art scale --u is 2 so every pixel of it stays whole. */

/* The tool, above the fold: a sky band with the heading, then the board. */
.tool { background: linear-gradient(var(--sky), var(--haze)); padding: 18px 0 30px; }
.tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-bottom: 14px; }
.tool-head h1 { font-size: clamp(14px, 1.7vw, 22px); color: var(--ink); text-shadow: 3px 3px 0 var(--sun); }
.tool-head p { flex-basis: 100%; margin: 0; font-size: 19px; }
.tool .tag { background: var(--wood); }

.designer { --u: 2; --s: 400px; background: var(--paper); margin: var(--px); padding: 16px 18px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
@supports (width: round(down, 1px, 1px)) { .designer { --s: round(down, clamp(288px, calc(100svh - 408px), 400px), 16px); } }
.designer .px { box-shadow: none; }
.designer button:not(.btn), .designer select, .designer input { font-family: "Rubik", system-ui, sans-serif; }
.designer img { image-rendering: pixelated; }
.designer .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Drawing side: tools, grid, palette, samples. */
.draw { display: grid; grid-template-columns: var(--s) 144px; width: calc(var(--s) + 14px + 144px); gap: 10px 14px; align-content: start; }
.tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.tools button, .alt { font: 600 15px/1.2 "Rubik", system-ui, sans-serif; color: var(--ink); background: var(--paper2); border: 3px solid var(--wood); border-radius: 0; min-height: 44px; min-width: 44px; padding: 8px 14px; cursor: pointer; flex: 1 1 0; }
.tools button:hover, .alt:hover, .samples button:hover { background: #fff; }
.tools button:disabled { opacity: .45; cursor: default; background: var(--paper2); }
.designer [aria-pressed="true"]:not(.swatch) { background: var(--sun); border-color: var(--ink); }
.designer canvas { width: var(--s); max-width: 100%; aspect-ratio: 1; image-rendering: pixelated; touch-action: none; cursor: crosshair; display: block; border: 3px solid var(--ink); }
.pal-col { display: grid; gap: 8px; align-content: start; }
.palette { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; }
.swatch { width: 44px; height: 44px; padding: 0; border: 3px solid var(--ink); background: var(--c); cursor: pointer; display: block; }
.swatch.rubber { background: repeating-conic-gradient(#6a5a4a 0 25%, #5a4a3c 0 50%) 0 0 / 16px 16px; position: relative; }
.swatch.rubber::after { content: ""; position: absolute; inset: 4px; background: linear-gradient(to top right, transparent calc(50% - 2px), #c23b22 calc(50% - 2px) calc(50% + 2px), transparent calc(50% + 2px)); }
.swatch[aria-pressed="true"] { outline: 3px solid #fff; outline-offset: -7px; box-shadow: 0 0 0 3px var(--sun); }
.swatch:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 3px #fff; }
.colour { margin: 0; font-size: 15px; line-height: 1.3; }
.sample-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.lbl { font-weight: 600; font-size: 15px; }
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.samples button { font: 500 14px/1.2 "Rubik", system-ui, sans-serif; color: var(--ink); background: var(--paper2); border: 3px solid var(--wood); border-radius: 0; min-height: 44px; padding: 6px 9px; cursor: pointer; }
.help { grid-column: 1 / -1; margin: 0; font-size: 14px; line-height: 1.4; color: var(--wood); }

/* Details side: name, recipe and price; the bag and crafting menu; the downloads. */
.details { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 20px; align-content: start; }
.form { display: grid; gap: 10px; align-content: start; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 10px; align-items: start; }
.field, .size { display: grid; gap: 4px; font-weight: 600; font-size: 15px; line-height: 1.3; }
.field .max { font-weight: 400; font-size: 13px; color: var(--wood); }
.designer input, .designer select { font: 500 16px "Rubik", system-ui, sans-serif; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 0; min-height: 44px; padding: 6px 10px; width: 100%; }
.designer input:focus-visible, .designer select:focus-visible { outline: 3px solid var(--turnip); outline-offset: 2px; }
.needs { border: 0; margin: 0; padding: 0; min-width: 0; }
.needs legend { font-weight: 600; font-size: 15px; padding: 0 0 4px; }
.need { display: grid; grid-template-columns: 1fr 64px; gap: 6px; margin-bottom: 6px; }
.need label { display: block; }

.previews { display: grid; gap: 4px; align-content: start; }
.cap, .bag p { margin: 0; font-weight: 600; font-size: 15px; line-height: 1.3; }
.bag p[data-bag-name] { font-weight: 400; margin-top: 4px; }
.slots { display: grid; grid-template-columns: repeat(5, calc(20px * var(--u))); gap: 4px; margin: 6px 0 0; }
.slot { width: calc(20px * var(--u)); height: calc(20px * var(--u)); display: grid; place-items: center; border: calc(4px * var(--u)) solid transparent; border-image: url(slot.png) 4 / calc(4px * var(--u)) stretch; }
.slot.lit { border-image-source: url(slot_lit.png); }
.slot img { width: calc(16px * var(--u)); height: calc(16px * var(--u)); margin: calc(-4px * var(--u)); }
.craft { position: relative; margin-top: calc(20px * var(--u)); border: solid transparent; border-width: calc(20px * var(--u)) calc(7px * var(--u)) calc(7px * var(--u)); border-image: url(panel_titled.png) 20 7 7 fill / calc(20px * var(--u)) calc(7px * var(--u)) calc(7px * var(--u)) stretch; padding: 0 2px 2px; font-size: 15px; line-height: 1.2; }
.craft::before { content: "Crafting"; position: absolute; left: 0; right: 0; top: calc(-20px * var(--u)); height: calc(20px * var(--u)); display: flex; align-items: center; padding-left: 4px; font: 400 11px "Press Start 2P", monospace; color: #fff; text-shadow: 2px 2px 0 var(--ink); }
.craft ul { list-style: none; margin: 0; padding: 0; }
.craft li, .craft .made { display: flex; align-items: center; gap: 6px; padding: 0 4px; min-height: calc(16px * var(--u)); }
.craft li b { margin-left: auto; }
.craft li.lit { background: var(--sun); outline: 2px solid var(--ink); outline-offset: -2px; font-weight: 600; }
.craft li i, .craft .made i { width: calc(16px * var(--u)); height: calc(16px * var(--u)); background: repeating-conic-gradient(#6a5a4a 0 25%, #5a4a3c 0 50%) 0 0 / 8px 8px; }
.craft img { width: calc(16px * var(--u)); height: calc(16px * var(--u)); flex: none; }
[data-craft-card] { margin-top: 6px; padding-top: 4px; border-top: 2px solid var(--wood); }
[data-craft-card] .made { display: none; }
[data-craft-card] ul li { min-height: 0; padding: 1px 4px; }
[data-craft-card] ul img { width: 16px; height: 16px; }
[data-craft-card] p { margin: 0; }
[data-craft-card] .none { padding: 2px 4px; color: var(--wood); }
[data-craft-card] .price { padding: 4px 4px 0; font-weight: 600; }

.acts { display: grid; grid-template-columns: 100px minmax(0, 1fr); align-items: end; gap: 12px 8px; margin-top: 2px; }
.acts [data-act="catkraft"], .acts .alt { grid-column: 1 / -1; }
.acts .btn { font-size: 11px; min-height: 48px; padding: 12px 10px; justify-content: center; margin: 0; }
.acts .btn::after { bottom: -6px; height: 4px; }
.acts .alt { min-height: 48px; }
.status { margin: 0; min-height: 1.4em; font-size: 15px; font-weight: 500; line-height: 1.4; }

@media (max-width: 1099px) {
  .designer { grid-template-columns: minmax(0, 1fr); --s: 480px; }
  .draw { grid-template-columns: minmax(0, 1fr); width: auto; }
  .draw canvas { width: min(100%, var(--s)); }
  .palette { grid-template-columns: repeat(6, 44px); }
  .tools button { flex: 1 1 28%; }
  /* The bag and crafting menu straight under the drawing, so the preview stays in sight. */
  .details { display: flex; flex-direction: column; }
  .details .previews { order: -1; }
}
@media (max-width: 640px) {
  .tool { padding-top: 14px; }
  .designer { padding: 12px; gap: 16px; }
  .details { grid-template-columns: minmax(0, 1fr); }
  .tool-head p { font-size: 18px; }
  .tool-head h1 { line-height: 1.6; }
}
@media (prefers-reduced-motion: reduce) { .designer * { transition: none; } }

/* How to use: four steps on cards, on the grass. */
.how { background: var(--grass); padding: 50px 0 56px; }
.steps { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.steps .card { margin: var(--px); padding: 22px 22px 24px; }
.steps .card h3 { font-size: 13px; line-height: 1.5; }
.steps .card p { font-size: 17px; line-height: 1.5; }
@media (max-width: 1099px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .steps { grid-template-columns: 1fr; } }

/* How items work: the home page's soil band. */
#items { padding: 56px 0; }
#items a:not(.btn) { color: #fff; font-weight: 600; }
#items .ticks li { font-size: 18px; }

/* The FAQ on parchment, with the same cards as the home page. */
.faq-light { background: var(--paper2); padding: 50px 0 56px; }
.faq-light .title { color: var(--ink); text-shadow: 3px 3px 0 var(--sun); }
.faq-light .answers { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 30px; }
.faq-light .card { margin: var(--px); padding: 20px 22px 22px; }
.faq-light .card h3 { font-size: 13px; line-height: 1.5; margin: 0 0 10px; }
.faq-light .card p { font-size: 16.5px; line-height: 1.5; }
@media (max-width: 1099px) { .faq-light .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .faq-light .answers { grid-template-columns: 1fr; } }

.download { padding: 56px 0; }
nav a[aria-current="page"], footer a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }

/* Short laptop screens: the same tool, a little less air, so it still fits under the header. */
@media (min-width: 1100px) and (max-height: 760px) {
  .tool { padding: 10px 0 18px; }
  .tool-head { margin-bottom: 8px; }
  .designer { padding: 12px 16px; }
  .need { margin-bottom: 4px; }
  .acts { gap: 8px; }
}
