/* img.gallenkamp.org -- plain CSS, system fonts, no external resources.
   Bump ?v= in index.html after every change: static-cache.conf caches CSS for 12 months. */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #5c5c57;
  --line: #d9d6cc;
  --accent: #1f5f4a;
  --accent-text: #ffffff;
  --warn-bg: #fff4d6;
  --warn-text: #5a4300;
  --err: #a32d2d;
  --focus: #1a56c4;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161716;
    --surface: #1f2120;
    --text: #ecece6;
    --muted: #a6a69d;
    --line: #34372f;
    --accent: #5fbf9b;
    --accent-text: #0e1b15;
    --warn-bg: #3a3118;
    --warn-text: #f0dca0;
    --err: #ff8a8a;
    --focus: #8ab4ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

header, main, footer {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 16px;
}

header { padding-top: 32px; }
h1 { margin: 0 0 .25rem; font-size: 1.9rem; line-height: 1.2; }
header p { margin: 0; color: var(--muted); max-width: 46rem; }
h2 { margin: 2.25rem 0 .75rem; font-size: 1.25rem; }
h3 { margin: 0 0 .5rem; font-size: 1rem; }
.lane-note { color: var(--muted); font-weight: 400; font-size: .9rem; }
.help { color: var(--muted); max-width: 46rem; margin-top: 0; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: 6px;
}
.skip:focus { left: 8px; z-index: 10; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* guide */
.guide {
  margin-top: 1.5rem; padding: .25rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.guide summary { cursor: pointer; font-weight: 600; padding: .5rem 0; }
.guide h3 { margin: 1rem 0 .35rem; }
.guide ol, .guide ul { padding-left: 1.25rem; }
.guide li + li { margin-top: .25rem; }
.guide dt { font-weight: 600; margin-top: .5rem; }
.guide dd { margin: .1rem 0 0 0; }
.guide table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.guide th, .guide td { text-align: left; padding: .3rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide > :last-child { margin-bottom: 1rem; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }

/* parameter line */
.params { display: block; margin-top: 1rem; font-weight: 600; }
.params input {
  display: block; width: 100%; margin-top: .3rem; padding: .5rem .6rem;
  font: 1rem/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
.params input[aria-invalid="true"] { border-color: var(--err); }
.params-error { color: var(--err); margin: .35rem 0 0; }

/* drop zone */
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .25rem; min-height: 9rem; padding: 1.5rem; text-align: center; cursor: pointer;
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.drop-title { font-weight: 600; font-size: 1.1rem; }
.drop-sub { color: var(--muted); font-size: .9rem; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* image cards */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.cards:empty::before { content: attr(data-empty); color: var(--muted); }
.card {
  display: grid; grid-template-columns: 72px 1fr auto; gap: .75rem; align-items: start;
  padding: .75rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.thumb, .thumb-ph {
  width: 72px; height: 72px; border-radius: 6px; object-fit: cover; background: var(--bg);
}
.thumb-ph { display: grid; place-items: center; color: var(--muted); font-size: .75rem; }
.card-name { font-weight: 600; overflow-wrap: anywhere; }
.card-line { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.card-result { font-size: .95rem; margin-top: .25rem; overflow-wrap: anywhere; }
.card-result .saved { color: var(--accent); font-weight: 600; }
.card-error { color: var(--err); font-size: .95rem; margin-top: .25rem; }
.card-notes { color: var(--muted); font-size: .85rem; }
.card-warn {
  margin-top: .35rem; padding: .35rem .6rem; border-radius: 6px; font-size: .9rem;
  background: var(--warn-bg); color: var(--warn-text);
}

.recommend {
  margin: .75rem 0 0; padding: .6rem .8rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}

/* step lanes */
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 40rem) { .lanes { grid-template-columns: 1fr; } }

.steps {
  list-style: none; margin: 0; padding: .5rem; min-height: 9rem;
  display: flex; flex-direction: column; gap: .5rem;
  background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius);
}
.lane-active .steps { border-color: var(--accent); border-style: solid; }
.steps:empty::before { content: attr(data-empty); color: var(--muted); padding: .5rem; }

.chip {
  display: flex; gap: .5rem; align-items: center; justify-content: space-between;
  padding: .6rem .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  cursor: grab;
}
.chip:active { cursor: grabbing; }
.chip.ghost { opacity: .4; }
.chip-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.chip-title { font-weight: 600; }
.chip-desc { color: var(--muted); font-size: .88rem; }
.chip-ctl { display: flex; gap: .25rem; flex-shrink: 0; }

select, input[type="number"] {
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: .2rem .4rem; margin-left: .25rem;
}
select { max-width: 100%; }
input[type="number"] { width: 6.5rem; }
.custom-size { display: flex; flex-wrap: wrap; gap: .5rem; }
.custom-size[hidden] { display: none; }

button, .button {
  font: inherit; cursor: pointer; border-radius: 8px; padding: .5rem .9rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  text-decoration: none; display: inline-block; line-height: 1.3;
}
button:hover, .button:hover { border-color: var(--accent); }
button.primary, .button.download { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.button.download { margin-top: .5rem; }
.button[hidden] { display: none; }
.actions .button.download { margin-top: 0; }
button[hidden] { display: none; }
button.quiet { border-color: transparent; background: transparent; color: var(--muted); }
button:disabled { opacity: .55; cursor: not-allowed; }
.chip-ctl button, .card > button { min-width: 2.25rem; min-height: 2.25rem; padding: .25rem .5rem; }
/* up/down only make sense inside the active lane */
#inactive .up, #inactive .down { display: none; }

.hint {
  margin: .75rem 0 0; padding: .6rem .8rem; border-radius: var(--radius);
  background: var(--warn-bg); color: var(--warn-text);
}

.hint-line { display: block; }
.hint-line + .hint-line { margin-top: .35rem; }

.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
.status { min-height: 1.5em; margin: .75rem 0 0; }
.status.error { color: var(--err); }
.quota { color: var(--muted); font-size: .9rem; margin: .25rem 0 0; }

footer { padding-top: 2.5rem; padding-bottom: 2rem; color: var(--muted); font-size: .9rem; }
footer a { color: inherit; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
