/* ==========================================================================
   Secondhandbox.de – zentrales Stylesheet
   Gestaltungsidee: das gut kuratierte Ladenlokal, nicht der Tech-Marktplatz.
   Gealtertes Papier, Leder, Holz. Ruhige, gestaffelte Bewegung.
   ========================================================================== */

/* -- Web Fonts (selbst gehostet, keine externen Requests) -- */

@font-face {
    font-family: 'Bitter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('fonts/bitter.woff2') format('woff2');
}
@font-face {
    font-family: 'Bitter';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/bitter-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/lora.woff2') format('woff2');
}
@font-face {
    font-family: 'Lora';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/lora-italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Caveat';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('fonts/caveat.woff2') format('woff2');
}

/* -- Design-Tokens -- */

:root {
    --font-display: 'Bitter', Georgia, 'Times New Roman', serif;
    --font-body: 'Lora', Georgia, 'Times New Roman', serif;
    --font-hand: 'Caveat', 'Segoe Script', cursive;

    --color-paper: #f4ecd8;
    --color-paper-dark: #e9ddc2;
    --color-paper-darker: #ddcda8;
    --color-ink: #2b2118;
    --color-walnut: #5c4a35;

    --forest: #3c4736;
    --forest-deep: #2a3226;
    --forest-soft: #6b7a5e;
    --color-header-bg: var(--forest);

    --color-bordeaux: #7a2530;
    --color-bordeaux-dark: #5e1c25;
    --color-moss: #3f5233;
    --color-moss-dark: #2f3d26;
    --color-ochre: #d99a2b;
    --color-ochre-text: #7a5012;

    --color-text: var(--color-ink);
    --color-text-muted: var(--color-walnut);
    --color-link: var(--color-bordeaux);
    --color-link-hover: var(--color-bordeaux-dark);
    --color-border: var(--color-paper-darker);

    --shadow-soft: 0 8px 24px -12px rgba(43, 33, 24, 0.35);
    --shadow-lift: 0 14px 32px -14px rgba(43, 33, 24, 0.45);

    --radius: 6px;
    --radius-lg: 14px;

    --container-width: 1180px;

    --font-scale: 1;
}

:root[data-contrast="high"] body {
    background-image: none;
}

:root[data-contrast="high"] {
    --color-paper: #ffffff;
    --color-paper-dark: #f2f2f2;
    --color-paper-darker: #d9d9d9;
    --color-ink: #000000;
    --color-walnut: #1a1a1a;
    --color-header-bg: #000000;

    --color-bordeaux: #6b0f1a;
    --color-bordeaux-dark: #4a0a12;
    --color-moss: #1f3a1a;
    --color-moss-dark: #142611;
    --color-ochre-text: #5c3d00;

    --shadow-soft: none;
    --shadow-lift: none;
}

/* -- Reset & Grundlagen -- */

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

html {
    font-size: calc(16px * var(--font-scale));
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--color-paper);
    background-image: url('../images/paper-texture.webp');
    background-repeat: repeat;
    background-size: 340px;
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

#main {
    flex: 1 0 auto;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--color-ink);
    line-height: 1.15;
    margin: 0 0 0.6em;
    letter-spacing: 0.01em;
}

h1 { font-size: clamp(2.1rem, 1.6rem + 2vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 1.35rem + 1vw, 2.15rem); font-weight: 700; }
h3 { font-size: 1.3rem; font-weight: 600; }
h4 { font-size: 1.1rem; font-weight: 600; }

p { margin: 0 0 1.1em; }

a {
    color: var(--color-link);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 3px;
}
a:hover { color: var(--color-link-hover); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -3rem;
    background: var(--color-ink);
    color: var(--color-paper);
    padding: 0.7em 1.2em;
    border-radius: var(--radius);
    z-index: 1000;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 1rem;
}

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

.container {
    width: 100%;
    max-width: var(--container-width);
    margin-inline: auto;
    padding-inline: 1.25rem;
}

/* -- Kopfbereich -- */

.site-header {
    background: var(--color-header-bg);
    border-bottom: 3px solid var(--color-bordeaux);
}

.site-header__inner {
    max-width: var(--container-width);
    margin-inline: auto;
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--color-paper);
}
.brand:hover { color: var(--color-paper); }
.brand__mark { border-radius: 50%; flex-shrink: 0; }
.brand__name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3rem;
    letter-spacing: 0.02em;
}
.brand__dot { color: var(--color-ochre); }

.nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1.5px solid var(--color-paper-darker);
    color: var(--color-paper);
    padding: 0.5em 0.9em;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
}
.nav-toggle:hover {
    background: var(--forest-deep);
}
.nav-toggle::before {
    content: "≡";
    font-size: 1.2em;
    line-height: 1;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
}
.main-nav a {
    color: var(--color-paper);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1rem;
    padding-bottom: 0.2em;
    border-bottom: 2px solid transparent;
    transition: border-color 0.15s ease;
}
.main-nav a:hover,
.main-nav a[aria-current="page"] {
    border-bottom-color: var(--color-ochre);
    color: var(--color-paper);
}

.site-footer nav a:hover {
    border-bottom-color: var(--color-ochre);
}

@media (max-width: 780px) {
    .nav-toggle { display: inline-flex; }
    .main-nav {
        display: none;
        width: 100%;
        order: 3;
    }
    .main-nav--open { display: block; }
    .main-nav ul {
        flex-direction: column;
        gap: 0.25rem;
        padding: 1rem 0 0.5rem;
        border-top: 1px solid var(--forest-soft);
        margin-top: 0.75rem;
    }
    .site-header__inner { flex-wrap: wrap; }
}
@media (min-width: 781px) {
    .nav-toggle { display: none; }
    .main-nav { display: block !important; }
}

/* -- Reveal-Animationen: gestaffeltes, ruhiges Erscheinen -- */

@keyframes reveal-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

.reveal {
    animation: reveal-up 0.7s ease-out both;
}
.reveal--1 { animation-delay: 0.05s; }
.reveal--2 { animation-delay: 0.15s; }
.reveal--3 { animation-delay: 0.25s; }
.reveal--4 { animation-delay: 0.35s; }
.reveal--5 { animation-delay: 0.45s; }
.reveal--6 { animation-delay: 0.55s; }

/* -- Buttons -- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    padding: 0.75em 1.5em;
    border-radius: var(--radius);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn--primary {
    background: var(--color-bordeaux);
    color: #fff;
    box-shadow: var(--shadow-soft);
}
.btn--primary:hover { background: var(--color-bordeaux-dark); color: #fff; }

.btn--ghost {
    background: transparent;
    border-color: var(--color-ink);
    color: var(--color-ink);
}
.btn--ghost:hover { background: var(--color-ink); color: var(--color-paper); }

.btn--block { width: 100%; justify-content: center; }

/* -- Sektionen & Karten -- */

.section {
    padding: clamp(2.5rem, 2rem + 2vw, 4.5rem) 0;
}
.section--alt {
    background: var(--color-paper-dark);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.section-heading {
    max-width: 46rem;
    margin-bottom: 2rem;
}
.section-heading__eyebrow {
    font-family: var(--font-hand);
    font-size: 1.5rem;
    color: var(--color-bordeaux);
    display: inline-block;
    margin-bottom: -0.3rem;
}

.hero {
    padding: clamp(3rem, 2.2rem + 3vw, 5.5rem) 0 clamp(2.5rem, 2rem + 2vw, 4rem);
    position: relative;
}
.hero__grid {
    display: grid;
    gap: 2.5rem;
    align-items: center;
}
@media (min-width: 900px) {
    .hero__grid { grid-template-columns: 1.1fr 0.9fr; }
}
.hero__eyebrow {
    font-family: var(--font-hand);
    font-size: 1.7rem;
    color: var(--color-bordeaux);
}
.hero__lede {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    max-width: 38rem;
}
.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1.5rem;
}
.hero__actions--center { justify-content: center; }
.hero__figure {
    position: relative;
    border: 10px solid var(--color-paper);
    outline: 1px solid var(--color-border);
    box-shadow: var(--shadow-lift);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: rotate(-1.5deg);
}
.hero__figure img { border-radius: calc(var(--radius-lg) - 6px); }

.category-list {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}
.category-card {
    background: var(--color-paper);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-ink);
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease;
    display: block;
}
.category-card:hover { transform: translateY(-3px); color: var(--color-ink); }
.category-card__label {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    margin-top: 0.4rem;
}
.category-card__tag {
    font-family: var(--font-hand);
    font-size: 1.3rem;
    color: var(--color-bordeaux);
}

.product-grid {
    display: grid;
    gap: 1.75rem;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    list-style: none;
    margin: 0;
    padding: 0;
}

.product-grid__item {
    height: 100%;
}
.product-grid__item[hidden] {
    display: none;
}

.product-card {
    background: var(--color-paper);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    color: inherit;
    text-decoration: none;
}
.product-card:hover,
.product-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lift);
    color: inherit;
}
.product-card__media {
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
    background: var(--color-paper-dark);
    border-bottom: 1px solid var(--color-border);
}
.product-card__media picture,
.product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.product-card__body {
    padding: 1.1rem 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-card__location {
    font-family: var(--font-hand);
    color: var(--color-bordeaux);
    font-size: 1.15rem;
}
.product-card__title {
    margin: 0.15rem 0 0.5rem;
    font-size: 1.2rem;
}
.product-card__excerpt {
    color: var(--color-text-muted);
    font-size: 0.97rem;
    flex-grow: 1;
}
.product-card__cta {
    margin-top: 0.9rem;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--color-link);
}
.product-card:hover .product-card__cta,
.product-card:focus-visible .product-card__cta {
    color: var(--color-link-hover);
}

.section-cta { margin-top: 2rem; }

/* -- Kategorie-Filter -- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 2rem;
}
.filter-bar button {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--color-paper);
    border: 1.5px solid var(--color-walnut);
    color: var(--color-walnut);
    padding: 0.5em 1.1em;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.filter-bar button[aria-pressed="true"] {
    background: var(--color-bordeaux);
    border-color: var(--color-bordeaux);
    color: #fff;
}
.filter-bar button:hover { background: var(--color-paper-dark); }
.filter-bar button[aria-pressed="true"]:hover { background: var(--color-bordeaux-dark); }

/* -- Produktdetail -- */

.product-detail {
    display: grid;
    gap: 2.5rem;
}
@media (min-width: 860px) {
    .product-detail { grid-template-columns: 1fr 1fr; align-items: start; }
}
.product-detail__figure {
    border: 10px solid var(--color-paper);
    outline: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    overflow: hidden;
}
.product-detail__figure img { border-radius: calc(var(--radius-lg) - 6px); }
.product-detail__meta {
    font-family: var(--font-hand);
    font-size: 1.4rem;
    color: var(--color-bordeaux);
}
.product-detail__tag {
    display: inline-block;
    background: var(--color-ochre);
    color: var(--color-ink);
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.25em 0.8em;
    border-radius: 999px;
    margin-bottom: 0.75rem;
}

.breadcrumbs {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}
.breadcrumbs ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
}
.breadcrumbs li:not(:last-child)::after {
    content: "›";
    margin-left: 0.4rem;
    color: var(--color-walnut);
}
.breadcrumbs a { color: var(--color-text-muted); }

#interest-note {
    margin-top: 1.25rem;
    padding: 1rem 1.2rem;
    background: var(--color-paper-dark);
    border-left: 4px solid var(--color-bordeaux);
    border-radius: var(--radius);
}

/* -- Exposé -- */

.expose-seal {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--color-ink);
    color: var(--color-paper);
    font-family: var(--font-display);
    font-weight: 700;
    padding: 0.6em 1.2em;
    border-radius: 999px;
    margin-bottom: 1.5rem;
}
.expose-seal__dot { width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--color-ochre); }

.fact-list {
    list-style: none;
    margin: 2rem 0;
    padding: 0;
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.fact-list li {
    background: var(--color-paper);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
}
.fact-list strong {
    display: block;
    font-family: var(--font-display);
    color: var(--color-bordeaux);
    margin-bottom: 0.2rem;
}

/* -- Formulare -- */

.form {
    max-width: 40rem;
}
.form-field {
    margin-bottom: 1.4rem;
}
.form-field label {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: 0.4rem;
}
.form-field input,
.form-field textarea {
    width: 100%;
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.7em 0.9em;
    border: 1.5px solid var(--color-walnut);
    border-radius: var(--radius);
    background: var(--color-paper);
    color: var(--color-ink);
}
.form-field textarea { min-height: 9rem; resize: vertical; }
.form-field input:focus,
.form-field textarea:focus {
    border-color: var(--color-bordeaux);
}
.form-field--error input,
.form-field--error textarea {
    border-color: var(--color-bordeaux);
}
.form-field__error {
    color: var(--color-bordeaux);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

.hp-field {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.alert {
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-family: var(--font-body);
}
.alert--success {
    background: #eef2e9;
    border: 1.5px solid var(--color-moss);
    color: var(--color-moss-dark);
}
.alert--error {
    background: #f6e9e7;
    border: 1.5px solid var(--color-bordeaux);
    color: var(--color-bordeaux-dark);
}
.alert ul { margin: 0.4em 0 0; padding-left: 1.2em; }

/* -- Footer -- */

.site-footer {
    background: var(--color-header-bg);
    color: var(--color-paper);
    margin-top: 3rem;
    border-top: 3px solid var(--color-bordeaux);
}
.site-footer__inner {
    max-width: var(--container-width);
    margin-inline: auto;
    padding: 2rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
    justify-content: space-between;
    align-items: center;
}
.site-footer__brand { font-size: 0.95rem; }
.site-footer__brand span { color: #c9b389; display: block; font-size: 0.85rem; }
.site-footer nav ul {
    list-style: none;
    display: flex;
    gap: 1.25rem;
    margin: 0;
    padding: 0;
}
.site-footer nav a {
    color: var(--color-paper);
    border-bottom: 2px solid transparent;
    padding-bottom: 0.15em;
    transition: border-color 0.15s ease;
}
.site-footer__note {
    width: 100%;
    font-size: 0.85rem;
    color: #c9b389;
    margin: 0;
}
.site-footer__note a { color: var(--color-paper); }

/* -- Barrierefreiheit-Widget -- */

.a11y-widget {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 900;
}
.a11y-toggle {
    background: var(--color-ink);
    color: var(--color-paper);
    border: 2px solid var(--color-ochre);
    border-radius: 50%;
    width: 3.2rem;
    height: 3.2rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-lift);
}
.a11y-panel {
    position: absolute;
    right: 0;
    bottom: 3.8rem;
    width: min(17rem, calc(100vw - 2rem));
    background: var(--color-paper);
    border: 1.5px solid var(--color-walnut);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lift);
    padding: 1.1rem;
}
.a11y-panel__group + .a11y-panel__group {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}
.a11y-panel__label {
    display: block;
    font-family: var(--font-display);
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.a11y-panel__row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.a11y-panel button {
    font-family: var(--font-body);
    background: var(--color-paper-dark);
    border: 1.5px solid var(--color-walnut);
    border-radius: var(--radius);
    padding: 0.4em 0.8em;
    cursor: pointer;
}
.a11y-panel button[aria-pressed="true"] {
    background: var(--color-bordeaux);
    border-color: var(--color-bordeaux);
    color: #fff;
}
#font-scale-display {
    font-family: var(--font-body);
    min-width: 3.4em;
    text-align: center;
}

/* -- Stats-Dashboard -- */

.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: var(--color-paper);
}
.stats-table th, .stats-table td {
    text-align: left;
    padding: 0.6em 0.8em;
    border-bottom: 1px solid var(--color-border);
}
.stats-table th { font-family: var(--font-display); }

/* -- 404 -- */

.error-page {
    text-align: center;
    padding: 4rem 0;
}
.error-page__code {
    font-family: var(--font-hand);
    font-size: 5rem;
    color: var(--color-bordeaux);
    line-height: 1;
}
