/* ==========================================================================
   Digitales Fundbüro – Grundschule Kastanienallee
   Öffentliche Oberfläche in Online-Shop-Optik · Mobile First · ohne Framework
   ========================================================================== */

:root {
  --green: #587C43;        /* Kastaniengrün */
  --green-d: #46653A;      /* dunkles Grün: Hover, kleine grüne Schrift */
  --green-soft: #EEF3EA;
  --brown: #68472E;        /* Kastanienbraun */
  --brown-d: #4A321F;      /* Fließtext, Titel */
  --cream: #FFF4D9;        /* Creme */
  --cream-soft: #FFF9EC;
  --line: #EEDFBD;
  --white: #FFFFFF;
  --muted: #7A6352;

  --radius: 18px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 2px rgba(74, 50, 31, .06), 0 4px 14px rgba(74, 50, 31, .07);
  --shadow-md: 0 2px 4px rgba(74, 50, 31, .06), 0 14px 32px rgba(74, 50, 31, .14);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --font: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 160px; }
html.has-sheet { overflow: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--cream);
  color: var(--brown-d);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
a { color: var(--green-d); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { width: 1.15em; height: 1.15em; flex: none; }

.container {
  width: 100%; max-width: 1240px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.print-only { display: none; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--brown); color: var(--white); padding: 10px 16px; border-radius: 999px;
  font-weight: 700; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 8px; }

/* ---------- Kopfzeile ---------- */
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 12px; padding-bottom: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; }
.brand-logo img { width: 56px; height: auto; transition: transform .4s var(--ease); }
.brand:hover .brand-logo img { transform: rotate(-10deg); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text { padding-left: 2px; }
.brand-name { font-size: 1.3rem; font-weight: 800; color: var(--brown); letter-spacing: -.01em; }
.brand-school { font-size: .8rem; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-link {
  flex: none; font-size: .85rem; font-weight: 700; color: var(--brown); text-decoration: none;
  padding: 8px 14px; border-radius: 999px; background: rgba(255, 255, 255, .6); border: 1.5px solid var(--line);
  transition: background .2s, border-color .2s;
}
.topbar-link:hover { background: var(--white); border-color: var(--green); }

/* ---------- Einleitung ---------- */
.hero { display: flex; align-items: flex-end; gap: 8px; padding-top: 10px; padding-bottom: 0; }
.hero-text { flex: 1; padding-bottom: 16px; }
.hero-mascot { flex: none; align-self: flex-end; margin-right: -4px; }
.hero-mascot img {
  width: auto; height: 132px; transform-origin: 50% 100%;
  animation: wave 4s ease-in-out 1s infinite; filter: drop-shadow(0 6px 8px rgba(74, 50, 31, .18));
}
.hero h1 {
  font-size: clamp(1.55rem, 6vw, 2.5rem); line-height: 1.15; font-weight: 800;
  color: var(--brown); letter-spacing: -.02em; max-width: 16ch;
}
.hero p { margin-top: 6px; color: var(--muted); font-weight: 600; max-width: 46ch; }

/* ---------- Such- und Filterleiste (bleibt oben) ---------- */
.sticky-sentinel { height: 1px; }
.filterbar {
  position: sticky; top: 0; z-index: 20;
  padding: 10px 0 2px;
  background: rgba(255, 244, 217, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  transition: box-shadow .25s;
}
.filterbar.is-stuck { box-shadow: 0 10px 18px -14px rgba(74, 50, 31, .45); }

.search {
  position: relative; display: flex; align-items: center;
  height: 54px; padding: 0 8px 0 18px;
  background: var(--white); border: 1.5px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s;
}
.search:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(88, 124, 67, .18), var(--shadow-sm); }
.search-icon { width: 22px; height: 22px; color: var(--green); }
.search input {
  flex: 1; min-width: 0; height: 100%; padding: 0 10px;
  border: 0; outline: 0; background: transparent; font-size: 1.0625rem; font-weight: 600;
}
.search input::placeholder { color: #A08C79; font-weight: 500; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border: 0; border-radius: 50%; background: var(--cream); color: var(--brown); cursor: pointer;
}
.search-clear:hover { background: var(--line); }
.search-clear .i { width: 18px; height: 18px; }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 12px 16px 10px; scrollbar-width: none;
  max-width: 1240px; margin: 0 auto;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px 0 13px;
  border-radius: 999px; border: 1.5px solid var(--line); background: var(--white);
  color: var(--brown); font-weight: 700; font-size: .95rem; text-decoration: none; white-space: nowrap;
  transition: background .2s, border-color .2s, color .2s, transform .15s;
}
.chip .i { width: 19px; height: 19px; color: var(--green); transition: color .2s; }
.chip:hover { border-color: var(--green); }
.chip:active { transform: scale(.96); }
.chip.is-active { background: var(--green); border-color: var(--green); color: var(--white); box-shadow: 0 4px 12px -4px rgba(70, 101, 58, .6); }
.chip.is-active .i { color: var(--white); }

/* ---------- Werkzeugleiste ---------- */
.shop { padding-top: 6px; padding-bottom: 48px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.count { color: var(--muted); font-weight: 600; font-size: .95rem; }
.count strong { color: var(--brown-d); font-weight: 800; }
.sort { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.sort label { color: var(--muted); font-weight: 600; }
.sort select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding: 8px 34px 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  font-weight: 700; color: var(--brown); font-size: 16px;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2368472E' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
}
.sort select:hover { border-color: var(--green); }
.sort-submit { padding: 8px 12px; border-radius: 999px; border: 0; background: var(--green); color: var(--white); font-weight: 700; }
.js .sort-submit { display: none; }

/* ---------- Produktraster ---------- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.card-item { animation: rise .45s var(--ease) both; }
.card-item:nth-child(2) { animation-delay: .04s; }
.card-item:nth-child(3) { animation-delay: .08s; }
.card-item:nth-child(4) { animation-delay: .12s; }
.card-item:nth-child(5) { animation-delay: .16s; }
.card-item:nth-child(6) { animation-delay: .2s; }
.card-item:nth-child(n+7) { animation-delay: .24s; }

.card {
  display: flex; flex-direction: column; height: 100%;
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  color: inherit; text-decoration: none; box-shadow: var(--shadow-sm);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.card:focus-visible { outline-offset: 4px; border-radius: var(--radius); }
.card:active { transform: scale(.985); }

.card-media, .detail-media {
  position: relative; display: grid; place-items: center; overflow: hidden;
  color: var(--tone, var(--brown));
  background: radial-gradient(circle at 50% 38%, #FFFFFF 0%, var(--tone-bg, #F3EBDD) 72%);
}
.card-media { aspect-ratio: 1 / 1; }
.media-art { transition: transform .45s var(--ease); }
.ill { width: 70%; height: 70%; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .12)); }
img.media-art { width: 100%; height: 100%; object-fit: cover; }

.tone-1 { --tone: #3E6FB0; --tone-bg: #E3ECF7; }
.tone-2 { --tone: #C8463D; --tone-bg: #F8E4E1; }
.tone-3 { --tone: #7A8088; --tone-bg: #EBEDEF; }
.tone-4 { --tone: #587C43; --tone-bg: #E6EFDF; }
.tone-5 { --tone: #E0A526; --tone-bg: #FBF0D6; }
.tone-6 { --tone: #2A9D9A; --tone-bg: #DDF1F0; }
.tone-7 { --tone: #9B4F9E; --tone-bg: #F3E3F2; }
.tone-8 { --tone: #8A5A3B; --tone-bg: #F2E6DA; }
.tone-photo { background: #F3EBDD; }
.tone-0 { --tone: #87A274; --tone-bg: #F1E8D3; }
.ill-icon { width: 42%; height: 42%; }

.badge {
  position: absolute; top: 10px; left: 10px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px 4px 7px; border-radius: 999px;
  background: var(--green); color: var(--white);
  font-size: .75rem; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 3px 8px rgba(70, 101, 58, .35);
}
.badge .i { width: 13px; height: 13px; }
.badge--static { position: static; font-size: .85rem; padding: 6px 13px 6px 9px; box-shadow: none; }
.badge--static .i { width: 15px; height: 15px; }

.card-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 11px 12px 14px; }
.card-cat { display: flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--green-d); }
.card-cat .i { width: 15px; height: 15px; }
.card-title {
  font-size: 1rem; line-height: 1.25; font-weight: 800; color: var(--brown-d);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em;
}
.card-date { display: flex; align-items: center; gap: 5px; margin-top: auto; padding-top: 4px; font-size: .8rem; font-weight: 600; color: var(--muted); }
.card-date .i { width: 15px; height: 15px; }

@media (hover: hover) {
  .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
  .card:hover .media-art { transform: scale(1.06); }
}

.all-clear { text-align: center; padding: 32px 16px; color: var(--muted); font-weight: 700; }

/* ---------- Leerer Zustand, Service, Fußzeile ---------- */
.empty { text-align: center; padding: 36px 16px 20px; }
.empty-mascot img { width: auto; height: 150px; margin: 0 auto 12px; transform-origin: 50% 100%; animation: wobble 2.4s ease-in-out infinite; }
.empty h2 { font-size: 1.3rem; font-weight: 800; color: var(--brown); }
.empty p { color: var(--muted); margin: 6px 0 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: var(--green); color: var(--white); font-weight: 800; text-decoration: none;
  transition: background .2s, transform .15s;
}
.btn:hover { background: var(--green-d); }
.btn:active { transform: scale(.97); }

.service {
  display: flex; align-items: center; gap: 16px; margin-top: 36px; padding: 18px 20px;
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.service-mascot { flex: none; }
.service-mascot img { width: auto; height: 92px; }
.service h2 { font-size: 1.1rem; font-weight: 800; color: var(--brown); }
.service p { color: var(--brown-d); font-size: .95rem; margin-top: 2px; }

.footer { padding: 8px 0 40px; text-align: center; color: var(--muted); font-size: .85rem; font-weight: 600; }
.footer-links { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--brown); }

/* ---------- Detailansicht (gemeinsam für Fenster und Seite) ---------- */
.detail-media { aspect-ratio: 1 / 1; max-height: 56vh; width: 100%; }
.detail-media .ill { width: 62%; height: 62%; }
.detail-info { padding: 18px 20px 28px; }
.detail-cat {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 10px; border-radius: 999px;
  background: var(--green-soft); color: var(--green-d); font-weight: 700; font-size: .85rem;
}
.detail-cat .i { width: 16px; height: 16px; }
.detail-title { margin: 10px 0 10px; font-size: clamp(1.45rem, 5vw, 2rem); line-height: 1.2; font-weight: 800; color: var(--brown-d); letter-spacing: -.01em; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin: 18px 0; }
.fact { padding: 11px 14px; border-radius: 14px; background: var(--cream-soft); border: 1px solid #F4E8CC; }
.fact dt { display: flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.fact dt .i { width: 15px; height: 15px; color: var(--green); }
.fact dd { margin: 3px 0 0; font-weight: 800; color: var(--brown-d); }

.detail-subhead { font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.detail-desc p { font-size: 1.05rem; line-height: 1.6; }

.pickup {
  display: flex; gap: 12px; margin-top: 20px; padding: 16px;
  border-radius: 16px; background: var(--green-soft); border: 1px solid #D5E2CB;
}
.pickup-icon { width: 24px; height: 24px; color: var(--green-d); margin-top: 1px; }
.pickup-title { font-weight: 800; color: var(--brown-d); margin-bottom: 2px; }
.pickup p { font-size: .95rem; }

/* Detailseite (direkter Link) */
.page-detail { padding-top: 8px; padding-bottom: 40px; max-width: 1040px; }
.back-link {
  display: inline-flex; align-items: center; gap: 4px; margin: 4px 0 14px; padding: 8px 14px 8px 8px;
  border-radius: 999px; background: var(--white); border: 1.5px solid var(--line);
  color: var(--brown); font-weight: 700; text-decoration: none; font-size: .95rem;
}
.back-link:hover { border-color: var(--green); }
.back-link .i { width: 20px; height: 20px; }
.detail-card { background: var(--white); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-md); }

.not-found { text-align: center; padding-top: 48px; padding-bottom: 64px; }
.notfound-mascot img { width: auto; height: 180px; margin: 0 auto 16px; }
.not-found h1 { font-size: 1.6rem; font-weight: 800; color: var(--brown); }
.not-found p { color: var(--muted); margin: 8px 0 22px; }

/* ---------- Detailfenster (Bottom Sheet / Dialog) ---------- */
.sheet {
  padding: 0; margin: 0; border: 0; background: transparent;
  width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden;
}
.sheet::backdrop { background: rgba(43, 29, 19, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet[open]::backdrop { animation: fade .25s ease both; }
.sheet-panel {
  position: fixed; left: 0; right: 0; bottom: 0; top: max(4vh, 24px);
  display: flex; flex-direction: column;
  background: var(--white); border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden; box-shadow: 0 -10px 40px rgba(43, 29, 19, .25);
}
.sheet[open] .sheet-panel { animation: sheet-up .38s var(--ease) both; }
.sheet-panel::before {
  content: ""; position: absolute; top: 8px; left: 50%; z-index: 3; width: 44px; height: 5px;
  margin-left: -22px; border-radius: 99px; background: rgba(255, 255, 255, .85); box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.sheet-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-bottom: env(safe-area-inset-bottom); }
.sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 4;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .94); color: var(--brown); box-shadow: 0 2px 10px rgba(43, 29, 19, .2);
  transition: transform .15s, background .2s;
}
.sheet-close:hover { background: var(--white); transform: scale(1.06); }
.sheet-close .i { width: 22px; height: 22px; }


/* ---------- Fotos ---------- */
img.media-art.photo, .detail-media .gallery { position: absolute; inset: 0; width: 100%; height: 100%; }
img.media-art.photo { object-fit: cover; }
.detail-media img.media-art.photo { object-fit: contain; background: #F3EBDD; }
.detail-media .gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.detail-media .gallery::-webkit-scrollbar { display: none; }
.detail-media .gallery img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; background: #F3EBDD; }
.gallery-count {
  position: absolute; right: 12px; bottom: 12px; padding: 4px 10px; border-radius: 99px;
  background: rgba(43, 29, 19, .65); color: #fff; font-size: .78rem; font-weight: 800; pointer-events: none;
}
.card:hover img.media-art.photo { transform: scale(1.04); }

/* ---------- Animationen ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%); } }
@keyframes wave { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-4deg); } 86% { transform: rotate(3deg); } 93% { transform: rotate(-2deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-6deg); } 75% { transform: rotate(6deg); } }

.date-label, .hide-sm, .sort label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Tablet ---------- */
@media (min-width: 600px) {
  .container { padding-left: 24px; padding-right: 24px; }
  .chips { padding-left: 24px; padding-right: 24px; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .card-body { padding: 14px 16px 16px; }
  .card-title { font-size: 1.05rem; }
  .hero { padding-top: 18px; }
  .hero-text { padding-bottom: 24px; }
  .hero-mascot img { height: 170px; }
  .date-label, .hide-sm, .sort label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .hide-sm { white-space: pre; }
}

/* ---------- Desktop und Tablet quer/hoch ab 760 px ---------- */
@media (min-width: 760px) {
  .chips { flex-wrap: wrap; overflow: visible; }
  .search { max-width: 720px; }
  .brand-logo img { width: 68px; }
  .hero-mascot { margin-right: 48px; }
  .hero-mascot img { height: 210px; }
  .detail { display: grid; grid-template-columns: 1.05fr 1fr; align-items: stretch; }
  .detail-media { max-height: none; height: 100%; min-height: 460px; }
  .detail-info { padding: 36px 36px 36px 32px; align-self: center; }

  .sheet-panel {
    top: 50%; left: 50%; right: auto; bottom: auto;
    width: min(980px, 92vw); max-height: 88vh;
    border-radius: var(--radius-lg); transform: translate(-50%, -50%);
  }
  .sheet[open] .sheet-panel { animation: pop-in .3s var(--ease) both; }
  .sheet-panel::before { display: none; }
  .sheet-scroll { max-height: 88vh; }
}

@media (min-width: 1100px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; }
}

/* ---------- Weniger Bewegung ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
