@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2-variations"), url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("fonts/karla-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Karla";
  src: url("fonts/karla-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --paper: #eceee7;
  --card: #f8f8f4;
  --ink: #25231f;
  --muted: #5d5b53;
  --moss: #3b4a31;
  --moss-dark: #2b3723;
  --mustard: #e4bd4c;
  --berry: #8a2a4d;
  --line: #c8cbbf;
  --display: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --body: "Karla", "Helvetica Neue", Arial, sans-serif;
  --wrap: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--body);
}
img { max-width: 100%; display: block; }
a { color: var(--moss); text-underline-offset: 3px; }
a:hover { color: var(--moss-dark); }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; line-height: 1.1; margin: 0 0 .5em; font-variation-settings: "SOFT" 100, "WONK" 1; }
p { margin: 0 0 1em; }
small { color: var(--muted); font-weight: 400; }

.wrap { width: min(var(--wrap), 100% - 2.5rem); margin-inline: auto; }
.narrow { max-width: 680px; }

/* Kopfzeile */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.head-row { display: flex; align-items: center; gap: 1.5rem; min-height: 64px; }
.brand { font-family: var(--display); font-size: 1.35rem; font-variation-settings: "SOFT" 100, "WONK" 1; color: var(--ink); text-decoration: none; margin-right: auto; }
.head-nav { display: flex; gap: 1.25rem; align-items: center; }
.head-nav a { color: var(--ink); text-decoration: none; }
.head-nav a:hover { text-decoration: underline; }
.head-nav form { margin: 0; }
.cart-btn {
  font: inherit; font-weight: 700; color: var(--paper); background: var(--moss);
  border: 0; border-radius: 999px; padding: .45rem .55rem .45rem 1rem; display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
}
.cart-btn:hover { background: var(--moss-dark); }
.cart-count { background: var(--paper); color: var(--moss); border-radius: 999px; min-width: 1.6rem; padding: 0 .4rem; text-align: center; font-size: .9rem; line-height: 1.6rem; }

/* Einstieg */
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 3rem; align-items: end; padding: 4.5rem 0 3.5rem; }
.hero-title { font-size: clamp(2.4rem, 5.6vw, 4.6rem); font-weight: 400; letter-spacing: -.01em; margin: 0; max-width: 15ch; }
.hero-text { font-size: 1.125rem; max-width: 40ch; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; border-top: 1px solid var(--line); }
.steps li { counter-increment: s; display: flex; gap: .9rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); font-family: var(--display); color: var(--moss); width: 1ch; }

/* Maschenreihe als Trenner zwischen den Bereichen */
.collection { padding: 3rem 0 1rem; scroll-margin-top: 64px; }
.collection::before {
  content: ""; display: block; height: 14px; margin-bottom: 2.5rem; opacity: .55;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='14' viewBox='0 0 16 14'%3E%3Cpath d='M1 2c2 3 4 8 7 10M15 2c-2 3-4 8-7 10' fill='none' stroke='%233b4a31' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x left center / 16px 14px;
}
.collection-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.collection-head h2 { font-size: clamp(2rem, 4vw, 3rem); margin: 0; }
.collection-meta { color: var(--muted); margin: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3rem 2rem; }

/* Ein Stück mit Anhänger-Etikett */
.piece { position: relative; display: flex; flex-direction: column; }
.piece-photo {
  position: relative; padding: 0; border: 0; background: var(--card); cursor: zoom-in;
  aspect-ratio: 4 / 5; overflow: hidden; border-radius: 3px; width: 100%;
}
.piece-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.piece-photo:hover img { transform: scale(1.03); }

.piece .label {
  left: 14px;
  /* Etikett hängt an der unteren Kante des Fotos */
  transform: translateY(-50%) rotate(var(--tilt, -1deg));
  transform-origin: 18px 50%;
  position: relative; align-self: flex-start; margin-bottom: -.6rem; z-index: 1;
}
.label-nr {
  display: inline-block; position: relative;
  background: var(--mustard); color: var(--ink);
  font-family: var(--display); font-size: 1.35rem; font-weight: 600; font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72;
  padding: .3rem .9rem .3rem 2.1rem;
  clip-path: polygon(14px 0, 100% 0, 100% 100%, 14px 100%, 0 50%);
}
.label-nr::before {
  /* Loch für den Faden */
  content: ""; position: absolute; left: 15px; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 1.5px rgba(37,35,31,.35);
}

.piece-body { padding-top: .2rem; display: flex; flex-direction: column; flex: 1; }
.piece-title { font-size: 1.3rem; margin-bottom: .3rem; }
.piece-desc { color: var(--muted); font-size: .98rem; margin-bottom: .9rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.piece-buy { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.price { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.state-note { color: var(--muted); font-size: .95rem; }

.is-sold .piece-photo img, .is-reserved .piece-photo img { filter: grayscale(.75) contrast(.9); opacity: .7; }
.is-sold .label-nr { background: #d6d2c4; }
.is-sold .price { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.stamp {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) rotate(-9deg);
  font-family: var(--display); font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 600; color: var(--berry);
  border: 3px solid var(--berry); outline: 1px solid var(--berry); outline-offset: 3px;
  padding: .15rem 1rem; background: rgba(248,248,244,.88); border-radius: 4px; letter-spacing: .02em;
}
.stamp-soft { color: var(--moss); border-color: var(--moss); outline-color: var(--moss); }

.piece-empty { border: 1.5px dashed var(--line); border-radius: 3px; aspect-ratio: 4 / 5; }
.empty-inner { height: 100%; display: grid; place-items: center; text-align: center; padding: 1.5rem; color: var(--muted); font-family: var(--display); font-size: 1.15rem; font-variation-settings: "SOFT" 100, "WONK" 1; }

/* Knöpfe */
.btn {
  font: inherit; font-weight: 700; display: inline-block; text-decoration: none; cursor: pointer;
  background: var(--moss); color: #fff; border: 0; border-radius: 999px; padding: .65rem 1.25rem; line-height: 1.2;
}
.btn:hover { background: var(--moss-dark); color: #fff; }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-add.is-in { background: transparent; color: var(--moss); box-shadow: inset 0 0 0 1.5px var(--moss); }
.btn-small { padding: .45rem 1rem; font-size: .95rem; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--moss); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn.danger { color: var(--berry); }
.icon-btn { background: none; border: 0; padding: .4rem; color: var(--ink); cursor: pointer; border-radius: 50%; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

.about { padding: 4rem 0 3rem; max-width: 680px; margin-left: max(1.25rem, (100% - var(--wrap)) / 2); }
.about h2 { font-size: 2rem; }

.notice { padding: .9rem 1.1rem; border-radius: 4px; margin: 1.5rem 0; }
.notice-error { background: #f3dde4; color: #5e1430; border-left: 4px solid var(--berry); }
.notice-ok { background: #e0e7d6; color: var(--moss-dark); border-left: 4px solid var(--moss); }

/* Warenkorb */
dialog { border: 0; padding: 0; color: var(--ink); }
dialog::backdrop { background: rgba(37, 35, 31, .45); }
.cart {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(460px, 100%);
  background: var(--card);
}
.cart[open] { animation: slide-in .28s ease-out; }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.cart-inner { padding: 1.25rem 1.5rem 2rem; }
.cart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cart-head h2 { margin: 0; font-size: 1.7rem; }
.cart-items { list-style: none; margin: 0 0 1.25rem; padding: 0; }
.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: .9rem; align-items: center; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 80px; object-fit: cover; border-radius: 2px; }
.cart-item p { margin: 0; }
.ci-title { font-weight: 700; line-height: 1.25; }
.ci-nr { color: var(--muted); font-size: .92rem; }
.ci-right { text-align: right; }
.ci-price { font-variant-numeric: tabular-nums; }
.ci-right .link-btn { font-size: .9rem; }
.cart-empty { color: var(--muted); }

fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; }
legend { font-weight: 700; margin-bottom: .4rem; padding: 0; }
.choice { display: flex; font-weight: 400; align-items: center; gap: .6rem; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 4px; margin-bottom: .4rem; cursor: pointer; background: #fff; }
.choice span { margin-left: auto; color: var(--muted); }
.choice:has(input:checked) { border-color: var(--moss); box-shadow: inset 0 0 0 1px var(--moss); }
input[type="radio"], input[type="checkbox"] { accent-color: var(--moss); width: 1.1rem; height: 1.1rem; margin: 0; }

.fields, .stack, .upload-form { display: grid; gap: .85rem; }
label { display: block; font-size: .95rem; font-weight: 700; }
label > input:not([type="radio"]):not([type="checkbox"]), label > textarea { display: block; margin-top: .3rem; }
label small { font-weight: 400; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), textarea {
  font: 400 1rem/1.4 var(--body); color: var(--ink); background: #fff;
  border: 1px solid #b7baae; border-radius: 4px; padding: .6rem .7rem; width: 100%;
}
input:focus-visible, textarea:focus-visible { outline: 2px solid var(--moss); outline-offset: 0; border-color: var(--moss); }
.row { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check > span { display: block; }
.check input { margin-top: .2rem; flex: none; }
.address[hidden] { display: none; }

.totals { margin: 1.5rem 0 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.totals p { display: flex; justify-content: space-between; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.totals .total { font-weight: 700; font-size: 1.2rem; margin-top: .5rem; }
.btn-pay { width: 100%; padding: .9rem; font-size: 1.1rem; }
.pay-note { color: var(--muted); font-size: .9rem; margin-top: .75rem; }

/* Grosses Foto */
.zoom { max-width: min(860px, 94vw); max-height: 94dvh; background: var(--card); border-radius: 4px; overflow: auto; }
.zoom img { width: 100%; max-height: 78dvh; object-fit: contain; background: #fff; }
.zoom-text { padding: 1rem 1.25rem .5rem; }
.zoom-title { font-family: var(--display); font-size: 1.4rem; margin-bottom: .3rem; }
.zoom-close { position: absolute; right: .5rem; top: .5rem; background: var(--card); }

/* Bestellseite */
.page { padding: 3.5rem 0 4rem; }
.page h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.order-code { color: var(--muted); margin-bottom: .5rem; }
.twint-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 4px; margin: 1.5rem 0; overflow: hidden; }
.twint-box > div { background: #fff; padding: 1rem 1.1rem; }
.tb-label { color: var(--muted); font-size: .9rem; margin: 0 0 .2rem; }
.tb-value { font-family: var(--display); font-size: 1.6rem; margin: 0; font-variant-numeric: tabular-nums; }
.tb-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.order-sub { font-size: 1.4rem; margin-top: 2.5rem; }
.order-lines { list-style: none; padding: 0; margin: 0 0 1.5rem; border-top: 1px solid var(--line); }
.order-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.order-lines .total { font-weight: 700; }
.legal h2 { font-size: 1.35rem; margin-top: 2rem; }

/* Fusszeile */
.site-foot { border-top: 1px solid var(--line); margin-top: 3rem; padding: 2rem 0; color: var(--muted); font-size: .95rem; }
.foot-grid { display: flex; flex-wrap: wrap; gap: 1rem 3rem; align-items: flex-start; }
.foot-grid p { margin: 0; }
.foot-name { color: var(--ink); font-family: var(--display); font-size: 1.1rem; }
.foot-grid nav { display: flex; gap: 1.25rem; }
.foot-copy { margin-left: auto !important; }

/* Verwaltung */
.admin-main { padding: 2rem 0 3rem; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 1.5rem; margin-bottom: 1.5rem; }
.panel h1 { font-size: 1.8rem; }
.panel h2 { font-size: 1.5rem; display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; }
.panel h2 small { font-family: var(--body); font-size: .95rem; }
.narrow-panel { max-width: 440px; margin: 3rem auto; }
.tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.tabs a { padding: .5rem 1rem; border-radius: 999px; text-decoration: none; color: var(--ink); border: 1px solid var(--line); }
.tabs a[aria-current] { background: var(--moss); color: #fff; border-color: var(--moss); }
.badge { background: var(--mustard); color: var(--ink); border-radius: 999px; padding: 0 .45rem; font-size: .85rem; font-weight: 700; }
.upload-form { max-width: 560px; }
.cat-pick { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.cat-pick legend { width: 100%; }
.cat-pick .choice { margin: 0; }
.photo-pick input { font: inherit; padding: .5rem; border: 1.5px dashed #b7baae; border-radius: 4px; background: #fff; }
.form-actions { display: flex; gap: 1.25rem; align-items: center; }
.admin-list, .order-list { list-style: none; padding: 0; margin: 0; }
.admin-item { display: grid; grid-template-columns: 72px 1fr auto; gap: 1rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--line); }
.admin-item img { width: 72px; height: 90px; object-fit: cover; border-radius: 2px; }
.ai-title { font-weight: 700; margin: 0 0 .2rem; }
.ai-meta { margin: 0; color: var(--muted); font-size: .95rem; }
.ai-actions { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; justify-content: flex-end; align-items: center; margin: 0; font-size: .95rem; }
.pill { display: inline-block; font-size: .82rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: #e3e4dc; color: var(--ink); margin: 0; }
.pill-available { background: #dbe5cf; color: var(--moss-dark); }
.pill-reserved, .pill-offen { background: #f4e3ae; }
.pill-sold, .pill-bezahlt { background: #ead3dc; color: #5e1430; }
.pill-konflikt { background: var(--berry); color: #fff; }
.order-card { border-top: 1px solid var(--line); padding: 1rem 0; }
.order-card.is-done, .order-card.status-storniert, .order-card.status-abgelaufen { opacity: .6; }
.oc-head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: .4rem; }
.oc-code { font-weight: 700; margin: 0; }
.oc-date { font-weight: 400; color: var(--muted); margin-left: .5rem; }
.order-card p { margin-bottom: .4rem; }
.oc-addr { color: var(--muted); }
.order-card .ai-actions { justify-content: flex-start; margin-top: .6rem; }

/* Kleinere Bildschirme */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 2rem; padding: 3rem 0 2.5rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 2.5rem 1.25rem; }
}
@media (max-width: 640px) {
  .head-nav a { display: none; }
  .brand { font-size: 1.15rem; white-space: nowrap; }
  .admin .head-nav a { display: inline; }
  .piece-title { font-size: 1.1rem; }
  .label-nr { font-size: 1.1rem; padding-left: 1.8rem; }
  .piece-desc { display: none; }
  .piece-buy { flex-direction: column; align-items: flex-start; gap: .5rem; }
  .piece-buy .btn { width: 100%; text-align: center; padding: .6rem .5rem; }
  .collection-head { flex-direction: column; gap: .25rem; }
  .twint-box { grid-template-columns: 1fr; }
  .admin-item { grid-template-columns: 56px 1fr; }
  .admin-item img { width: 56px; height: 70px; }
  .admin-item .ai-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .foot-copy { margin-left: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
