/* The free tools on /tools: the hub's cards and what every tool is built
   from, on the site's tokens and in the sizing guide's style (sizing.css):
   white cards on chalk, segmented choices, colour swatches, fields, a
   slider, a drop zone, results with Copy, and the Minecraft server list as a
   friend sees it. Each tool's own parts are in css/tools/…. */

/* ---------- The hub ---------- */

/* Cards keep one width and centre as a group, so a row that isn't full
   stays balanced. */
.tool-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 380px)); justify-content: center; gap: 16px; margin-top: 8px; }
.tool-tile { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--twine); border-radius: var(--radius); background: var(--white); color: var(--ink); transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), border-color 0.2s; }
.tool-tile:hover { text-decoration: none; transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tool-tile:active { transform: scale(0.98); transition-duration: 0.08s; }
.tool-tile-art { display: grid; place-items: center; height: 148px; margin-bottom: 18px; border-radius: 14px; background: var(--muted); overflow: hidden; }
.tool-tile-art img { width: 112px; height: 112px; image-rendering: pixelated; }
.tool-tile h3 { font-size: 20px; letter-spacing: -0.02em; line-height: 1.25; }
.tool-tile p { margin: 6px 0 16px; color: var(--sage); font-size: 15px; line-height: 1.5; }
.tool-tile .link-arrow { margin-top: auto; font-size: 14px; }
@media (max-width: 639.98px) {
  .tool-tiles { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .tool-tile { display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 14px; padding: 14px; }
  .tool-tile-art { grid-row: 1 / span 3; height: 88px; margin: 0; }
  .tool-tile-art img { width: 64px; height: 64px; }
  .tool-tile h3 { font-size: 17px; }
  .tool-tile p { margin: 4px 0 8px; font-size: 14.5px; }
}

/* ---------- A tool on its page ---------- */

.tool-hero { padding-bottom: 88px; }
.tool-hero .lead { max-width: 820px; }
.tool-hero .meta { margin-bottom: 36px; }
.tool { color: var(--ink); font-size: 15px; line-height: 1.45; text-align: left; }
.tool-nojs { display: none; max-width: 640px; margin: 0 auto; padding: 16px 20px; border: 1px solid var(--twine); border-radius: 14px; background: var(--white); color: var(--sage); font-size: 15px; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 20px; align-items: start; }
.tool-card { display: flex; flex-direction: column; min-width: 0; padding: 20px; border: 1px solid var(--twine); border-radius: 16px; background: var(--white); box-shadow: 0 1px 2px rgb(29 33 28 / 0.04); }
.tool-card-title { margin: 0 0 16px; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.tool-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.tool-card-head .tool-card-title { margin: 0; }
.tool-foot { margin: auto 0 0; padding-top: 14px; border-top: 1px solid var(--twine); color: var(--sage); font-size: 12.5px; line-height: 1.45; }
.tool-panel { display: flex; flex-direction: column; gap: 18px; }
.tool-panel[hidden] { display: none; }
.tool-controls { gap: 18px; }
.tool-controls > .tool-card-title { margin-bottom: 0; }
/* Beside longer controls, the preview stays in view while they scroll. */
@media (min-width: 961px) { .tool-preview { position: sticky; top: calc(var(--header) + 16px); } }
@media (max-width: 960px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 639.98px) {
  .tool-hero { padding-bottom: 56px; }
  .tool-hero .meta { margin-bottom: 24px; }
  .tool-card { padding: 16px; }
}

/* Fields: a label over a control, and a hint under it. */
.tool-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.tool-field > legend, .tool-label { margin: 0; padding: 0; font-size: 14px; font-weight: 600; line-height: 20px; }
.tool-field > legend { margin-bottom: 8px; }
.tool-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tool-row > .tool-input { flex: 1; }
.tool-hint { margin: 0; color: var(--sage); font-size: 13px; line-height: 18px; }
.tool-input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border: 1px solid var(--input); border-radius: 10px; background: var(--white); color: var(--ink); font: inherit; font-size: 16px; box-shadow: 0 1px 2px rgb(29 33 28 / 0.05); transition: border-color 0.12s, box-shadow 0.12s; }
.tool-input:hover { border-color: #c4c6ba; }
.tool-input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgb(21 128 61 / 0.18); }
.tool-input[aria-invalid] { border-color: #c2410c; }
.tool-input-mono { font-family: var(--mono); font-size: 15px; }
.tool-input-short { width: 112px; flex: none; }
textarea.tool-input { height: auto; min-height: 88px; padding: 10px 12px; line-height: 1.5; resize: vertical; }

/* Segmented choices: radios in a track, as in the sizing guide. */
.tool .segments { position: relative; display: flex; padding: 2px; border: 1px solid #ecece7; border-radius: 10px; background: var(--muted); }
.tool .segments input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.tool .segments label { display: flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 6px; min-width: 0; min-height: 34px; padding: 0 10px; border-radius: 8px; color: var(--sage); font-size: 14px; white-space: nowrap; cursor: pointer; transition: color 0.12s, background-color 0.12s, box-shadow 0.12s, scale 0.12s; }
.tool .segments label:hover { color: var(--ink); }
.tool .segments label:active { scale: 0.98; }
.tool .segments input:checked + label { background: var(--white); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(29 33 28 / 0.1), 0 0 0 1px rgb(29 33 28 / 0.04); }
.tool .segments input:focus-visible + label { outline: 2px solid var(--green); outline-offset: 1px; }
.tool .segments input:disabled + label { color: #a3a69c; cursor: not-allowed; }
@media (max-width: 639.98px) { .tool .segments label { min-height: 40px; font-size: 15px; } }

/* Colour swatches: radios drawn as chips, then a hex field. */
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.swatch { position: relative; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; cursor: pointer; transition: scale 0.12s, box-shadow 0.12s; }
.swatch:hover { scale: 1.08; }
.swatch:active { scale: 0.94; }
.swatch .chip { width: 26px; height: 26px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgb(29 33 28 / 0.14); }
.swatches input:checked + .swatch { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--green); }
.swatches input:focus-visible + .swatch { outline: 2px solid var(--ring); outline-offset: 3px; }
.chip-none { background: linear-gradient(135deg, transparent calc(50% - 1.5px), #c2410c calc(50% - 1.5px), #c2410c calc(50% + 1.5px), transparent calc(50% + 1.5px)), var(--white); }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row .tool-input { width: 116px; flex: none; font-family: var(--mono); font-size: 15px; }
.color-now { width: 28px; height: 28px; flex: none; border-radius: 8px; box-shadow: inset 0 0 0 1px rgb(29 33 28 / 0.14); }
@media (max-width: 639.98px) { .swatch { width: 38px; height: 38px; } .swatch .chip { width: 32px; height: 32px; } }

/* The palette the tools share. */
.c-grass { background: #3f9b3a; } .c-forest { background: #1f5f2c; } .c-lime { background: #8cc63f; }
.c-sky { background: #3b8fd9; } .c-ocean { background: #1f4e9c; } .c-night { background: #1c2340; }
.c-violet { background: #7b44c9; } .c-rose { background: #d6508f; } .c-crimson { background: #c23a32; }
.c-amber { background: #e8871e; } .c-gold { background: #f2c230; } .c-stone { background: #7d7f7a; }
.c-charcoal { background: #262825; } .c-snow { background: #f4f4f0; } .c-white { background: #ffffff; } .c-black { background: #151515; }

/* A slider, drawn like the dashboard's. */
.tool-range { width: 100%; height: 28px; margin: 0; background: none; cursor: pointer; appearance: none; -webkit-appearance: none; }
.tool-range:focus { outline: none; }
.tool-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--green) 0 var(--fill, 0%), var(--muted) var(--fill, 0%)); box-shadow: inset 0 0 0 1px #e1e2da; }
.tool-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--muted); box-shadow: inset 0 0 0 1px #e1e2da; }
.tool-range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--green); }
.tool-range::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; border: 0; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgb(29 33 28 / 0.3), 0 0 0 1px rgb(29 33 28 / 0.08); appearance: none; -webkit-appearance: none; transition: scale 0.12s; }
.tool-range::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgb(29 33 28 / 0.3), 0 0 0 1px rgb(29 33 28 / 0.08); }
.tool-range:active::-webkit-slider-thumb { scale: 1.1; }
.tool-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--ring), 0 1px 3px rgb(29 33 28 / 0.3); }
.tool-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--ring), 0 1px 3px rgb(29 33 28 / 0.3); }
.range-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; gap: 12px; }
.range-value { color: var(--sage); font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }

/* A switch, drawn like the dashboard's: a checkbox inside its label, the
   words on the left and the track on the right. */
.tool-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.tool-switch-text { min-width: 0; font-size: 14px; font-weight: 500; line-height: 20px; }
.tool-switch-text small { display: block; color: var(--sage); font-size: 13px; font-weight: 400; line-height: 18px; }
.tool-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.tool-switch-track { position: relative; flex: none; width: 34px; height: 20px; border-radius: 10px; background: var(--input); transition: background-color 0.15s; }
.tool-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 8px; background: var(--white); box-shadow: 0 1px 2px rgb(29 33 28 / 0.22); transition: translate 0.2s var(--ease-out), width 0.12s; }
.tool-switch:hover .tool-switch-track { background: #c9cbc0; }
.tool-switch input:checked + .tool-switch-track { background: var(--green); }
.tool-switch input:checked + .tool-switch-track::after { translate: 14px 0; }
.tool-switch:active .tool-switch-track::after { width: 19px; }
.tool-switch:active input:checked + .tool-switch-track::after { translate: 11px 0; }
.tool-switch input:focus-visible + .tool-switch-track { outline: 2px solid var(--ring); outline-offset: 2px; }
@media (max-width: 639.98px) {
  .tool-switch-track { width: 42px; height: 24px; border-radius: 12px; }
  .tool-switch-track::after { width: 20px; height: 20px; border-radius: 10px; }
  .tool-switch input:checked + .tool-switch-track::after { translate: 18px 0; }
  .tool-switch:active .tool-switch-track::after { width: 24px; }
  .tool-switch:active input:checked + .tool-switch-track::after { translate: 14px 0; }
}

/* A drop zone for a file. */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 148px; padding: 20px; border: 1.5px dashed var(--input); border-radius: 14px; background: var(--warm); color: var(--sage); font-size: 14px; text-align: center; transition: border-color 0.15s, background-color 0.15s; }
.drop.is-over { border-color: var(--green); background: var(--green-soft); color: var(--green-text); }
/* Once a file is open, the zone shrinks to a row for choosing another. */
.drop.has-file { flex-direction: row; justify-content: space-between; min-height: 0; padding: 10px 10px 10px 14px; text-align: left; }
.drop.has-file .tool-hint { display: none; }
.drop-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop .btn { min-height: 40px; }
.drop p { margin: 0; }

/* Actions at the bottom of a card. */
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.tool-actions .btn { min-height: 44px; }
.tool-actions .fine { margin: 0; }
.btn .icon-check, .btn.is-copied .icon-copy { display: none; }
.btn.is-copied .icon-check { display: block; color: var(--green); }
.btn-primary.is-copied .icon-check { color: var(--white); }
.btn-ghost { background: none; color: var(--sage); border-color: transparent; }
.btn-ghost:hover { color: var(--ink); background: var(--muted); }

/* Results: a dark block with its own Copy, one per format. */
.tool-result { margin: 0; border-radius: 14px; background: var(--console); color: var(--console-text); overflow: hidden; }
.tool-result-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 6px 6px 14px; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.tool-result-title { margin: 0; color: #c9ccc1; font-size: 13px; font-weight: 600; }
.tool-result pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-all; }
.tool-result pre:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
/* Copy on a result: the guides' code Copy, under its own name, since
   site.js rewrites the code Copy beside a list of tabs. */
.tool-copy { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid rgb(255 255 255 / 0.16); border-radius: 8px; background: rgb(255 255 255 / 0.06); color: var(--white); font: 600 13px var(--sans); cursor: pointer; transition: background-color 0.12s, scale 0.1s; }
.tool-copy:hover { background: rgb(255 255 255 / 0.12); }
.tool-copy:active { scale: 0.96; }
.tool-copy .icon { width: 13px; height: 13px; }
.tool-copy .icon-check, .tool-copy.is-copied .icon-copy { display: none; }
.tool-copy.is-copied .icon-check { display: block; color: #86d46a; }
.tool-results { display: flex; flex-direction: column; gap: 12px; }

/* The Minecraft server list, as a friend sees the server in it. Drawn in
   the game's colours on a dark panel, with the system font (never Mojang's
   art or font). */
.mc-list { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; column-gap: 12px; align-items: start; padding: 10px; border-radius: 12px; background: #1b1a17; color: #fff; font-family: var(--mono); font-size: 14px; line-height: 18px; }
.mc-list-icon { width: 64px; height: 64px; image-rendering: pixelated; background: #2a2926; }
.mc-list-text { min-width: 0; padding-top: 2px; }
.mc-list-name { display: block; overflow: hidden; color: #fff; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; text-shadow: 2px 2px 0 #3f3f3f; }
.mc-list-motd { display: block; margin-top: 4px; min-height: 36px; color: #aaa; white-space: pre; overflow: hidden; text-shadow: 2px 2px 0 #2a2a2a; }
.mc-list-side { display: flex; align-items: center; gap: 8px; padding-top: 2px; color: #aaa; font-variant-numeric: tabular-nums; text-shadow: 2px 2px 0 #2a2a2a; }
.mc-bars { display: flex; align-items: flex-end; gap: 1px; height: 14px; }
.mc-bars i { width: 3px; background: #3fd83f; box-shadow: 1px 1px 0 #0f360f; }
.mc-bars i:nth-child(1) { height: 3px; } .mc-bars i:nth-child(2) { height: 5px; } .mc-bars i:nth-child(3) { height: 8px; } .mc-bars i:nth-child(4) { height: 11px; } .mc-bars i:nth-child(5) { height: 14px; }
@media (max-width: 639.98px) {
  .mc-list { grid-template-columns: 48px minmax(0, 1fr) auto; column-gap: 10px; font-size: 12px; line-height: 15px; }
  .mc-list-icon { width: 48px; height: 48px; }
  .mc-list-motd { min-height: 30px; }
}

/* How to use the result: steps beside a short list of what goes wrong. */
.tool-how { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.tool-how-title { margin: 0 0 10px; font-size: 19px; letter-spacing: -0.02em; }
.tool-how .steps .step:first-child { padding-top: 4px; }
.tool-how code, .tool-prose code { padding: 1px 5px; border-radius: 5px; background: var(--muted); font-size: 0.9em; }
.tool-checks { list-style: none; }
.tool-checks li { padding: 14px 0; border-top: 1px solid var(--twine); }
.tool-checks li:last-child { border-bottom: 1px solid var(--twine); }
.tool-checks strong { display: block; font-size: 16px; letter-spacing: -0.01em; }
.tool-checks span { color: var(--sage); font-size: 15px; line-height: 1.55; }
@media (max-width: 1023.98px) { .tool-how { grid-template-columns: minmax(0, 1fr); gap: 32px; } }

/* In Playkeeper: what the dashboard does instead, with the install command. */
.tool-pk { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 56px; align-items: center; }
.tool-pk .section-sub { margin-bottom: 24px; }
/* A link in a sentence is underlined, not told apart by its colour alone. */
.tool-pk .section-sub a, .tool-checks span a, .tool-note a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.tool-pk .install { max-width: 560px; }
.tool-pk .hero-actions { margin-top: 16px; }
.tool-pk-art { display: grid; place-items: center; }
.tool-pk-art .cardshot { width: 100%; }
.tool-pk-art .cardshot img { border: 1px solid var(--twine); border-radius: 14px; box-shadow: var(--shadow-lg); }
@media (max-width: 1023.98px) { .tool-pk { grid-template-columns: minmax(0, 1fr); gap: 32px; } .tool-pk-art { max-width: 560px; } }
@media (max-width: 639.98px) { .tool-pk .hero-actions .btn { width: 100%; min-height: 52px; font-size: 16px; } }

/* A phone keeps the result and its main action at hand while the controls
   scroll: a bar at the bottom once the preview is out of view. */
.tool-dock { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40; display: none; align-items: center; gap: 12px; padding: 8px 8px 8px 10px; border: 1px solid var(--twine); border-radius: 16px; background: rgb(255 255 255 / 0.96); box-shadow: var(--shadow-lg); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); translate: 0 calc(100% + 24px); transition: translate 0.24s var(--ease-out); }
.tool-dock.is-shown { translate: none; }
.tool-dock .btn { margin-left: auto; min-height: 44px; }
.tool-dock-text { min-width: 0; overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.3; white-space: nowrap; text-overflow: ellipsis; }
.tool-dock-text small { display: block; overflow: hidden; color: var(--sage); font-size: 12.5px; font-weight: 400; text-overflow: ellipsis; }
@media (max-width: 639.98px) { .tool-dock { display: flex; } }

@media (prefers-reduced-motion: reduce) {
  .tool-tile:hover { transform: none; }
  .tool *, .tool *::before, .tool *::after, .tool-dock { transition-duration: 0.01ms !important; }
}
