/* The Karelia free tools kit: what the tools under /free/ share on top of Karelia Image's stylesheet
   (/free/karelia-image/styles.css holds the tokens, the pixel frames, the drop stage, buttons and the reading sections). */

/* ------------------------------------------------------------------ result head and panels */
.result-lede { margin: -8px 0 22px; color: var(--muted); max-width: 46em; }
.result-lede strong { color: var(--text); font-weight: 600; }
.panel { --p: 6px; }
.panel > .px-in { --p: 6px; padding: clamp(16px, 2.6vw, 26px); }
.panel + .panel, .panel + .actions, .codebox + .codebox { margin-top: 18px; }
.panel h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -.01em; margin-bottom: 10px; }
.panel p + p { margin-top: 10px; }
.panel .dim { color: var(--muted); }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.wide-result { display: grid; gap: 18px; }

/* A read-out: the receipt's lines without the strike-through. */
.readout > .px-in { font-family: var(--mono); font-size: .86rem; line-height: 1.55; }
.readout .r-line .v { text-decoration: none; }
.readout .r-line .k { overflow-wrap: anywhere; }
.readout .r-line { grid-template-columns: minmax(0, 12em) minmax(0, 1fr); }
.readout .r-line.sens .v { color: var(--amber); }
.readout a { overflow-wrap: anywhere; }
.readout .r-group:first-child h3 { margin-top: 0; }
.verdict { font-family: var(--sans); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 600; letter-spacing: -.015em; line-height: 1.2; color: var(--text); }
.verdict.warn { color: var(--amber); }
.verdict.good { color: var(--accent); }
.verdict-sub { margin-top: 8px; color: var(--muted); font-family: var(--sans); font-size: 1rem; }
.tag { display: inline-block; color: var(--accent-ink); background: var(--amber); padding: 2px 8px; font-family: var(--mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.tag.green { background: var(--accent); }
.tag.grey { background: var(--line-strong); color: var(--text); }

/* All fields: a long two-column list that scrolls inside its panel. */
.fields { max-height: 30em; overflow: auto; margin-top: 4px; border-top: 1px dotted var(--line); }
.fields .r-line:last-child { border-bottom: 0; }
details.more > summary { cursor: pointer; list-style: none; color: var(--mint); text-decoration: underline; text-underline-offset: 3px; padding: 4px 0; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary:hover { color: var(--accent); }
details.more[open] > summary { margin-bottom: 8px; }

/* Text taken out of a file (a prompt, a workflow), with its own copy button. */
.codebox { --p: 4px; }
.codebox > .px-in { --p: 4px; padding: 14px 16px 16px; }
.codebox-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.codebox-head span { font-family: var(--mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.codebox pre { margin: 0; font: 400 .9rem/1.55 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 22em; overflow: auto; }
.minibtn { background: none; border: 0; padding: 2px 0; color: var(--mint); font: 400 .82rem var(--mono); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.minibtn:hover { color: var(--accent); }

/* ------------------------------------------------------------------ controls (the makers) */
.controls { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-family: var(--mono); font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.field > label b, .field > .label b { font-weight: 400; color: var(--accent); text-transform: none; letter-spacing: 0; }
.field .hint { color: var(--faint); font-size: .9rem; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 6px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 22px; margin-top: -8px; background: var(--accent); border: 0; border-radius: 0; }
input[type="range"]::-moz-range-thumb { width: 16px; height: 22px; background: var(--accent); border: 0; border-radius: 0; }
input[type="number"], input[type="text"], select { width: 100%; min-height: 44px; padding: 8px 12px; background: var(--bg-2); color: var(--text); border: 0; border-radius: 0; box-shadow: inset 0 0 0 1px var(--line-strong); font: 400 1rem var(--mono); }
input[type="number"]:focus-visible, input[type="text"]:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
input[type="color"] { width: 52px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { min-height: 40px; padding: 6px 12px; background: var(--bg-2); color: var(--muted); border: 0; box-shadow: inset 0 0 0 1px var(--line-strong); font: 400 .86rem var(--mono); cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: #00ff411f; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; color: var(--muted); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* The work area of a maker: the picture on a checkerboard, as large as it fits. */
.work { --p: 6px; }
.work > .px-in { --p: 6px; display: grid; place-items: center; min-height: 240px; padding: 10px; background:
  linear-gradient(45deg, #0f1612 25%, transparent 25%, transparent 75%, #0f1612 75%) 0 0 / 16px 16px,
  linear-gradient(45deg, #0f1612 25%, transparent 25%, transparent 75%, #0f1612 75%) 8px 8px / 16px 16px, var(--panel); }
.work canvas, .work img { max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.work .crisp { image-rendering: pixelated; }
/* A small picture shown large with hard pixel edges: the box is fixed and the picture is fitted inside it. */
.work canvas.fit, .work img.fit { width: 100%; height: 58vh; max-height: none; object-fit: contain; image-rendering: pixelated; }
/* A picture you draw on: the frame of the area being dragged lies over it. */
.draw-wrap { position: relative; display: inline-block; line-height: 0; max-width: 100%; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.pick-wrap { position: relative; display: inline-block; line-height: 0; max-width: 100%; cursor: crosshair; }
.draw-wrap .sel { position: absolute; border: 2px dashed var(--accent); background: #00ff4126; pointer-events: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.controls .actions { margin-top: 4px; }
.controls .note { color: var(--faint); font-size: .92rem; }
.controls .note strong { color: var(--muted); font-weight: 600; }
.stat { font-family: var(--mono); font-size: .86rem; color: var(--muted); display: grid; gap: 3px; }
.stat b { color: var(--text); font-weight: 400; }
.picked { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: .9rem; color: var(--muted); min-height: 36px; }
.picked i { display: block; width: 36px; height: 36px; box-shadow: inset 0 0 0 1px var(--line-strong); }
.work-cap { margin-top: 10px; color: var(--faint); font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; }
.maker { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: clamp(20px, 3.4vw, 44px); align-items: start; }

/* Colour swatches. */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.swatch { border: 0; padding: 0; background: var(--bg-2); color: var(--text); text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-strong); }
.swatch i { display: block; height: 64px; }
.swatch span { display: block; padding: 8px 10px 2px; font: 400 .9rem var(--mono); }
.swatch small { display: block; padding: 0 10px 8px; color: var(--faint); font: 400 .72rem var(--mono); }
.swatch:hover { box-shadow: inset 0 0 0 1px var(--accent); }

/* ------------------------------------------------------------------ the paid product box and the tool list */
.upsell { --p: 6px; margin-top: clamp(26px, 4vw, 44px); }
.upsell > .px-in { --p: 6px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: center; padding: clamp(18px, 3vw, 30px); background: linear-gradient(120deg, #0b100d, #0d1a12); }
.upsell h3 { font-size: 1.3rem; letter-spacing: -.015em; font-weight: 600; }
.upsell p { margin-top: 6px; color: var(--muted); max-width: 46em; }
.upsell .side { display: grid; gap: 10px; justify-items: start; }
.upsell .side a.more { font-size: .95rem; }
.toolgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.toolgrid a { --p: 3px; display: block; text-decoration: none; color: var(--text); }
.toolgrid a .px-in { --p: 3px; padding: 16px 18px; height: 100%; transition: background .15s; }
.toolgrid a:hover { background: var(--accent); }
.toolgrid a:hover .px-in { background: var(--panel-2); }
.toolgrid b { display: block; font-weight: 600; }
.toolgrid span { display: block; margin-top: 4px; color: var(--muted); font-size: .95rem; }
.toolgrid + .sub { margin-top: 36px; }
.prose { margin-top: 18px; max-width: 46em; color: var(--muted); }
.prose p + p { margin-top: 12px; }
.prose strong { color: var(--text); font-weight: 600; }
table.facts { margin-top: 22px; border-collapse: collapse; width: 100%; max-width: 54em; font-size: .98rem; }
table.facts th, table.facts td { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.facts th { color: var(--faint); font: 400 .74rem var(--mono); letter-spacing: .12em; text-transform: uppercase; }
table.facts td { color: var(--muted); }
table.facts td:first-child { color: var(--text); }

@media (max-width: 900px) {
  .maker { grid-template-columns: minmax(0, 1fr); }
  .upsell > .px-in { grid-template-columns: minmax(0, 1fr); }
  .toolgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .readout .r-line { grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); }
  .row2 { grid-template-columns: minmax(0, 1fr); }
}

.preview video { display: block; max-width: 100%; max-height: 100%; }
.preview img.crisp { image-rendering: pixelated; }
