:root {
  color-scheme: light;
  --paper: #f5f3eb;
  --surface: #fdfcf7;
  --ink: #242921;
  --muted: #575e52;
  --line: #d7d9cd;
  --green: #354a3b;
  --green-hover: #23362b;
  --light-green: #e5ece2;
  --rust: #85452c;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 0; }
button, input, select, textarea { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
a { color: inherit; }
h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.035em; line-height: 1.08; }
h1, h2, h3, p { margin: 0; }
p { line-height: 1.55; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.primary, .quiet, .download, .status {
  min-height: 44px;
  border-radius: .32rem;
  padding: .57rem .92rem;
  border: 1px solid transparent;
  font-size: .94rem;
  font-weight: 650;
  text-decoration: none;
  line-height: 1.35;
}
.primary { background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: var(--green-hover); }
.primary span { margin-right: .3rem; font-size: 1.12em; }
.quiet { background: transparent; color: var(--green); }
.quiet:hover { background: var(--light-green); }
.danger { color: var(--rust); }
.danger:hover { background: #f4e6df; }

input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #bfc5b6;
  background: var(--surface);
  border-radius: .32rem;
  padding: .65rem .76rem;
  min-height: 44px;
}
select {
  appearance: none;
  padding-right: 2rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: calc(100% - 1.08rem) 55%, calc(100% - .83rem) 55%;
  background-size: .25rem .25rem;
  background-repeat: no-repeat;
}
input::placeholder { color: var(--muted); }
textarea { resize: vertical; line-height: 1.45; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--green); }

.brand-mark {
  display: inline-block;
  flex: none;
  vertical-align: middle;
  width: 2.18rem;
  aspect-ratio: 1;
  overflow: hidden;
  mix-blend-mode: multiply;
}
.brand-mark img { display: block; width: 100%; height: 100%; transform: scale(1.23); }
.workshop-photo {
  background: #31352d url("./werkstatt.webp") center 52% / cover no-repeat;
  min-width: 0;
}

.login-page { min-height: 100dvh; display: grid; align-items: center; padding: clamp(1rem, 5vw, 4rem); }
.login-shell {
  width: min(100%, 70rem);
  margin: auto;
  display: grid;
  grid-template-columns: minmax(19rem, .88fr) 1.12fr;
  min-height: min(34rem, 85dvh);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .55rem;
  overflow: hidden;
  box-shadow: 0 20px 61px #2429210e;
}
.login-content { align-self: center; padding: clamp(1.6rem, 5vw, 4.4rem); }
.login-content .brand-mark { width: 3.15rem; margin-bottom: 1.6rem; }
.login-content h1 { font-size: clamp(2.5rem, 5vw, 4.45rem); overflow-wrap: anywhere; }
.login-form { margin-top: 2.1rem; display: grid; gap: .65rem; }
.login-form label { font-weight: 650; font-size: .94rem; }
.login-form .primary { margin-top: .38rem; }

.topbar { border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-inner {
  width: min(calc(100% - 3rem), 77rem);
  min-height: 4.25rem;
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.38rem;
  font-weight: 600;
}
.workspace { width: min(calc(100% - 3rem), 77rem); margin: 0 auto; padding: clamp(1.8rem, 5vw, 4.2rem) 0 4rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.8rem; }
.page-heading h1 { font-size: clamp(2.55rem, 6.2vw, 5.05rem); }

.status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem clamp(.5rem, 2.5vw, 1.65rem);
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}
.status-tabs button {
  display: inline-flex;
  align-items: center;
  gap: .46rem;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  min-height: 3rem;
  padding: .45rem .16rem .68rem;
  font-weight: 650;
  color: var(--muted);
}
.status-tabs button[aria-pressed=true] { color: var(--green-hover); border-bottom-color: var(--green); }
.status-tabs span {
  font-size: .81rem;
  min-width: 1.68rem;
  line-height: 1.55;
  border-radius: 1rem;
  padding: 0 .35rem;
  text-align: center;
  background: #e9e8de;
}
.status-tabs [aria-pressed=true] span { background: var(--light-green); }
.filters {
  display: grid;
  grid-template-columns: minmax(8rem, 1fr) minmax(10rem, .65fr) minmax(10rem, .56fr) max-content;
  gap: .7rem;
  margin-bottom: 1.3rem;
  align-items: center;
}
.filters .quiet { justify-self: end; }
.state-message { color: var(--muted); padding: 1.1rem 0; }
.empty {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  min-height: 22rem;
  border: 1px solid var(--line);
  border-radius: .45rem;
  background: var(--surface);
  overflow: hidden;
}
.empty-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1rem;
  padding: clamp(1.5rem, 5vw, 4.2rem);
}
.empty h2 { font-size: clamp(1.8rem, 4vw, 3.3rem); }
.empty p { max-width: 26rem; color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--line); background: var(--surface); border-radius: .42rem; overflow: hidden; min-width: 0; }
.card-preview {
  display: grid;
  place-items: center;
  background: #e9e8df;
  padding: clamp(.75rem, 2vw, 1.45rem);
  width: 100%;
  aspect-ratio: 5 / 4;
  border: 0;
}
.card-preview:hover { background: #e0e3d8; }
.card-preview:focus-visible { outline-offset: -4px; }
.card-preview img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.card-content { padding: .95rem 1.05rem; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem; margin-bottom: .5rem; }
.category-label { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.stars { color: var(--rust); letter-spacing: .08em; white-space: nowrap; }
.card h2 { font-size: clamp(1.3rem, 3vw, 1.75rem); overflow-wrap: anywhere; }
.card-title { border: 0; background: none; text-align: left; padding: 0; font: inherit; color: var(--ink); }
.card-title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .24em; }
.card-footer { display: flex; align-items: center; margin-top: .75rem; }
.status { border-color: var(--line); background: var(--surface); color: var(--green); }
.status:hover { border-color: var(--green); }
.status.printed { background: var(--light-green); border-color: transparent; }
.status.printed::before { content: "✓ "; }

dialog {
  border: 1px solid var(--line);
  border-radius: .55rem;
  padding: clamp(1rem, 3vw, 1.75rem);
  width: min(33rem, calc(100% - 2rem));
  max-width: none;
  max-height: min(92dvh, 58rem);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 22px 90px #151f1850;
}
dialog::backdrop { background: #181e18a8; }
dialog.wide { width: min(63rem, calc(100% - 2rem)); }
.dialog-heading { display: flex; align-items: center; gap: 1rem; justify-content: space-between; margin-bottom: 1rem; }
.dialog-heading h2 { font-size: clamp(1.65rem, 4vw, 2.5rem); }
.dialog-heading .quiet { padding-inline: .55rem; }
.wide .motif-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; }
.motif-preview {
  display: grid;
  place-items: center;
  min-height: 10rem;
  padding: 1rem;
  border-radius: .35rem;
  background: #e9e8df;
}
.motif-preview img { display: block; max-width: 100%; max-height: min(53dvh, 28rem); object-fit: contain; }
.mirrored { transform: scaleX(-1); }
.motif-media { text-align: center; }
.motif-media .quiet { margin-top: .35rem; }
form#motif-form { display: grid; align-content: start; gap: .86rem; min-width: 0; }
.stack { display: grid; gap: .32rem; font-size: .93rem; font-weight: 650; min-width: 0; }
.stack input, .stack select, .stack textarea { font-weight: 400; font-size: 1rem; }
.stack small, .subtle { font-size: .86rem; color: var(--muted); font-weight: 400; }
.check { display: flex; align-items: center; gap: .55rem; min-height: 2.25rem; font-size: .96rem; }
#orientation { margin-top: .4rem; }
input[type=file] { padding: .6rem; }
input::file-selector-button {
  border: 0;
  color: var(--green);
  background: var(--light-green);
  border-radius: .2rem;
  padding: .32rem .48rem;
  margin-right: .65rem;
  cursor: pointer;
  font: inherit;
}
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; }
.download-section { border-top: 1px solid var(--line); padding-top: .85rem; }
.download-section h3 { font-size: 1rem; font-weight: 700; margin-bottom: .55rem; }
.downloads { display: flex; flex-wrap: wrap; gap: .42rem; margin-bottom: .55rem; }
.download { display: inline-grid; place-items: center; border-color: #99a396; color: var(--green-hover); }
.download:hover { background: var(--light-green); }
.form-actions { display: flex; gap: .55rem; justify-content: flex-end; }
.form-error { color: #8e2a24; font-size: .94rem; }
.category-list { list-style: none; padding: 0; margin: 0 0 1.3rem; border-top: 1px solid var(--line); }
.category-list li { display: flex; justify-content: space-between; align-items: center; gap: .8rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.category-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .55rem; margin: .4rem 0; }
.toast {
  position: fixed;
  z-index: 2;
  inset: auto 1rem 1rem auto;
  max-width: calc(100% - 2rem);
  padding: .75rem 1rem;
  border-radius: .4rem;
  color: #fff;
  background: var(--green-hover);
  box-shadow: 0 6px 25px #18231b35;
}

@media (max-width: 58rem) {
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 39rem) {
  .topbar-inner, .workspace { width: calc(100% - 2rem); }
  .login-shell, .empty { grid-template-columns: 1fr; min-height: auto; }
  .login-shell .workshop-photo { aspect-ratio: 2 / 1; }
  .empty .workshop-photo { aspect-ratio: 2.25 / 1; }
  .wide .motif-layout { grid-template-columns: 1fr; gap: .85rem; }
  .motif-preview { min-height: 6rem; padding: .45rem; }
  .motif-preview img { max-height: min(30dvh, 14rem); }
  .filters { gap: .45rem; }
  .search-label { grid-column: 1 / -1; }
  .filters .quiet { grid-column: 1 / -1; justify-self: start; padding-left: 0; }
}
@media (max-width: 30rem) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .form-columns { grid-template-columns: 1fr; }
}
