/*
 * Thimbly – Standard-Theme „base“
 * Farben, Ecken und Schrift kommen als CSS-Variablen aus den Shop-Einstellungen (Admin › Design).
 * Ziel: WCAG 2.1 AA – Kontraste werden beim Speichern geprüft, Fokus ist immer sichtbar.
 */

:root {
    --color-primary: #8a4b22;
    --color-on-primary: #ffffff;
    --color-bg: #fbf8f4;
    --color-surface: #ffffff;
    --color-text: #1f1b16;
    --color-muted: color-mix(in srgb, var(--color-text) 72%, var(--color-bg));
    --color-border: color-mix(in srgb, var(--color-text) 18%, var(--color-bg));
    --color-error: #b3261e;
    --color-success: #1e6b3a;
    --radius: 6px;
    --font-body: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    --space: 1rem;
    --container: 72rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
}

img { max-width: 100%; height: auto; display: block; border-radius: var(--radius); }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .75em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem); }
h2 { font-size: 1.3rem; }

a { color: var(--color-primary); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }

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

.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
    position: absolute; left: var(--space); top: -4rem; z-index: 10;
    padding: .6rem 1rem; background: var(--color-primary); color: var(--color-on-primary);
    border-radius: var(--radius);
}
.skip-link:focus { top: var(--space); }

.container { width: min(100% - 2 * var(--space), var(--container)); margin-inline: auto; }

.muted { color: var(--color-muted); }
.small { font-size: .875rem; }

/* Kopf und Fuß */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.site-header__inner { display: flex; flex-wrap: wrap; gap: var(--space); align-items: center; justify-content: space-between; padding-block: 1rem; }
.brand { display: flex; flex-direction: column; text-decoration: none; color: var(--color-text); }
.brand__name { font-weight: 700; font-size: 1.25rem; }
.brand__tagline { font-size: .875rem; color: var(--color-muted); }

.nav { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; align-items: center; }
.nav a { text-decoration: none; padding: .5rem .25rem; display: inline-block; }
.nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; }
.nav--small a { font-size: .9375rem; }

.cart-counter { display: inline-flex; gap: .4rem; align-items: center; }
.badge {
    min-width: 1.5rem; padding: 0 .4rem; border-radius: 999px; text-align: center;
    background: var(--color-primary); color: var(--color-on-primary); font-size: .8125rem; line-height: 1.5rem;
}

.site-main { padding-block: 2rem 4rem; }
.site-main:focus { outline: none; }

.site-footer { border-top: 1px solid var(--color-border); background: var(--color-surface); padding-block: 1.5rem; }
.site-footer__inner { display: flex; flex-wrap: wrap; gap: var(--space); justify-content: space-between; align-items: center; }
.site-footer p { margin: 0; }

/* Bausteine */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.button, button[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: 2.75rem; padding: .6rem 1.25rem;
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
    color: var(--color-on-primary); background: var(--color-primary);
    border: 2px solid var(--color-primary); border-radius: var(--radius);
}
.button:hover, button[type="submit"]:hover { filter: brightness(1.08); }
.button:disabled, button:disabled { opacity: .55; cursor: not-allowed; }
.button--large { min-height: 3.25rem; font-size: 1.0625rem; }
.button--block { width: 100%; }
.button--link {
    min-height: 2.75rem; padding: .25rem .5rem; font: inherit; cursor: pointer;
    background: none; border: 0; color: var(--color-primary); text-decoration: underline;
}

.error, .field__error { color: var(--color-error); font-weight: 600; }
.field__error { display: block; font-size: .9375rem; margin-top: .25rem; }

.notice { border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.5rem; border: 1px solid var(--color-border); background: var(--color-surface); }
.notice--success { border-left: 6px solid var(--color-success); }
.notice h1 { margin-bottom: .25em; }

/* Formulare */
fieldset { margin: 0 0 1.25rem; min-width: 0; }
legend { font-weight: 700; font-size: 1.125rem; padding: 0 .25rem; }
.field { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .9rem; }
.field--inline { flex-direction: row; align-items: center; gap: .6rem; margin: 0; }
.field-row { display: grid; grid-template-columns: minmax(6rem, 1fr) 3fr; gap: 0 1rem; }
label { font-weight: 600; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="search"], select, textarea {
    font: inherit; color: var(--color-text); background: var(--color-surface);
    min-height: 2.75rem; padding: .5rem .75rem; width: 100%;
    border: 1px solid color-mix(in srgb, var(--color-text) 45%, var(--color-bg)); border-radius: var(--radius);
}
.field--inline input { width: 5.5rem; }
[aria-invalid="true"] { border-color: var(--color-error) !important; border-width: 2px !important; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; margin: .75rem 0; }
.check input, .choice input { width: 1.25rem; height: 1.25rem; margin-top: .2rem; accent-color: var(--color-primary); flex: none; }
.choice {
    display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: start;
    font-weight: 400; padding: .75rem; margin-bottom: .5rem;
    border: 1px solid var(--color-border); border-radius: var(--radius); cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.choice__label { display: flex; flex-direction: column; }
.choice__price { font-weight: 600; white-space: nowrap; }

/* Startseite */
.hero { padding-block: 1rem 2rem; max-width: 46rem; }
.lead { font-size: 1.25rem; color: var(--color-muted); }
.highlights { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.highlights li { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1rem 1.25rem; }

/* Produkte */
.product-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.product-card { display: flex; flex-direction: column; gap: .5rem; padding: .75rem; }
.product-card__link { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .6rem; }
.product-card__link:hover .product-card__title { text-decoration: underline; }
.product-card__title { font-weight: 600; font-size: 1.0625rem; }
.product-card__placeholder { display: block; aspect-ratio: 4 / 3; border-radius: var(--radius); background: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface)); }

.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 0 0 1.5rem; font-size: .9375rem; }
.breadcrumbs li + li::before { content: "/"; margin-right: .5rem; color: var(--color-muted); }

.product { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 52rem) { .product { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.product__media { display: grid; gap: 1rem; }

.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin: .5rem 0; }
.price__current { font-size: 1.375rem; }
.price__old { color: var(--color-muted); }
.price__lowest { flex-basis: 100%; color: var(--color-muted); }
.variant-picker select { max-width: 22rem; }
.add-to-cart { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-top: 1rem; }
.status { min-height: 1.6em; }

.prose { max-width: 46rem; }
.prose h2 { margin-top: 1.5em; }
.prose table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.prose th, .prose td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid color-mix(in srgb, var(--color-text) 15%, transparent); vertical-align: top; }
.prose code { overflow-wrap: anywhere; }

/* Hilfe der Plattform */
.help-search { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: 1.5rem 0; }
.help-search input { flex: 1 1 16rem; }
.help-list { list-style: none; padding: 0; display: grid; gap: 1rem; max-width: 46rem; }
.help-list p { margin: .2rem 0 0; }

/* Warenkorb */
.cart-lines { list-style: none; padding: 0; margin: 0 0 1.5rem; display: grid; gap: 1rem; }
.cart-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.cart-line__info { display: flex; flex-direction: column; gap: .2rem; }
.cart-line__title { font-weight: 600; font-size: 1.125rem; }
.cart-line__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.line-total { font-size: 1.125rem; }
.cart-summary { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; text-align: right; }
.subtotal { font-size: 1.25rem; margin: 0; }

/* Kasse */
.checkout { display: grid; gap: 1.5rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) {
    .checkout { grid-template-columns: 1.5fr 1fr; align-items: start; }
    .checkout__summary { position: sticky; top: 1rem; }
}
.summary-lines { list-style: none; padding: 0; margin: 0 0 1rem; }
.summary-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--color-border); }
.totals { display: grid; grid-template-columns: 1fr auto; gap: .3rem 1rem; margin: 0 0 .5rem; }
.totals dd { margin: 0; text-align: right; }
.totals__grand { font-weight: 700; font-size: 1.1875rem; padding-top: .4rem; border-top: 1px solid var(--color-border); }

/* Bestellung */
.columns { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); margin-bottom: 1.5rem; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.details dt { font-weight: 600; }
.details dd { margin: 0; font-variant-numeric: tabular-nums; }
address { font-style: normal; }

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

/* Konfigurator (Produkttypen mit Formular) */
.configurator__form { display: flex; flex-direction: column; gap: 1rem; }
.config-choice { border: 0; padding: 0; margin: 0; }
.config-choice legend { padding: 0; margin-bottom: .5rem; }
.config-choice__group { margin: .75rem 0 .35rem; font-size: .875rem; font-weight: 600; color: var(--color-muted); }
.tiles { display: flex; flex-wrap: wrap; gap: .5rem; }
.tile { position: relative; display: flex; flex-direction: column; gap: .1rem; cursor: pointer; font-weight: 400;
    padding: .6rem .9rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.tile input, .swatch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile:has(input:checked) { border-color: var(--color-primary); box-shadow: inset 0 0 0 1px var(--color-primary); }
.tile:has(input:focus-visible), .swatch:has(input:focus-visible) { outline: 3px solid var(--color-primary); outline-offset: 2px; }
.tile__hint { font-size: .8125rem; color: var(--color-muted); }
.swatches { display: flex; flex-wrap: wrap; gap: .6rem; }
.swatch { position: relative; display: flex; flex-direction: column; align-items: center; gap: .25rem; cursor: pointer; width: 4rem; font-weight: 400; }
.swatch__color { width: 3rem; height: 3rem; border-radius: 50%; border: 1px solid var(--color-border); }
.swatch:has(input:checked) .swatch__color { box-shadow: 0 0 0 3px var(--color-surface), 0 0 0 5px var(--color-primary); }
.swatch__label { font-size: .75rem; text-align: center; line-height: 1.2; }
.price-box { display: flex; flex-direction: column; gap: .4rem; }
.price-box details summary { cursor: pointer; color: var(--color-primary); }

/* Kundenkonto */
.narrow { max-width: 30rem; }
.narrow form { display: flex; flex-direction: column; gap: .25rem; margin-bottom: 1rem; }
.account-nav { margin: 0 0 1.5rem; border-bottom: 1px solid var(--color-border); }
.account-nav form { margin: 0; }
.account-forms { display: grid; gap: 1.5rem; max-width: 36rem; }
.discount-code { margin-bottom: .75rem; }
.discount-code input { width: 12rem; }
