/* Fundus – Gestaltung angelehnt an neu.jeremia-werk.de */

/* Optional: Schriftdateien der Website in /public/fonts/ ablegen (siehe README). Fehlen sie, greift die Ersatzschrift. */
@font-face { font-family: 'Causten Round'; src: url('/fonts/CaustenRound-Medium.woff2') format('woff2'); font-weight: 400 500; font-display: swap; }
@font-face { font-family: 'Causten Round'; src: url('/fonts/CaustenRound-Bold.woff2') format('woff2'); font-weight: 600 800; font-display: swap; }

:root {
  --bg: #F2F1EC;
  --stone: #E0DED4;
  --surface: #FFFFFF;
  --ink: #292927;
  --muted: #5E5D58;
  --line: #CFCDC2;
  --line-strong: #9C9A90;
  --blue: #005298;
  --blue-dark: #003E73;
  --danger: #B3261E;
  --radius: 2px;
  --font: 'Causten Round', ui-rounded, 'SF Pro Rounded', 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; font-weight: 500; }
a { color: var(--blue); }
a:hover { color: var(--blue-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

h1, h2, h3 { margin: 0; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; line-height: 1.2; }

/* ---------- Kopfzeile ---------- */
.topbar { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 3px solid #333; padding-top: env(safe-area-inset-top); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: 0 0 auto; }
.brand img { width: 34px; height: 34px; }
.brand span { font-weight: 800; font-size: 19px; letter-spacing: 2px; text-transform: uppercase; }
.search { flex: 1 1 320px; min-width: 0; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.search:focus-within { border-color: var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 16px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.avatar { width: 44px; height: 44px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--stone); font-weight: 800; cursor: pointer; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.btn-primary:hover { background: #000; color: #fff; }
.btn-primary:disabled { background: var(--line); border-color: var(--line); color: #77756F; cursor: not-allowed; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-block { width: 100%; min-height: 50px; }
.btn-link { background: none; border: 0; padding: 8px 0; color: var(--blue); font-weight: 700; cursor: pointer; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; flex: 0 0 auto; }
.icon-btn:hover { border-color: var(--ink); }

/* ---------- Filter ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 18px 24px 120px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 14px; }
.seg { display: flex; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 3px; }
.seg button { min-height: 36px; padding: 0 14px; border: 0; background: transparent; border-radius: var(--radius); cursor: pointer; font-size: 14px; color: #3A3936; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 400px; min-width: 0; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-size: 14px; color: #3A3936; white-space: nowrap; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.chip small { opacity: .65; margin-left: 4px; font-weight: 500; }
.resultbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }

/* ---------- Raster ---------- */
.grid { display: flex; gap: 14px; align-items: flex-start; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tile { position: relative; display: block; width: 100%; padding: 0; border: 0; background: var(--stone); cursor: zoom-in; overflow: hidden; border-radius: var(--radius); color: #fff; text-align: left; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .badge { position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 700; border-radius: var(--radius); }
.tile .state { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; padding: 12px; text-align: center; }
.tile .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 32px 10px 10px; background: linear-gradient(to top, rgba(0,0,0,.7), rgba(0,0,0,0)); opacity: 0; transition: opacity .15s; font-size: 13px; }
.tile .meta strong { display: block; font-size: 14px; }
.tile:hover .meta, .tile:focus-visible .meta { opacity: 1; }
.empty { padding: 72px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty h2 { color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.more { display: flex; justify-content: center; margin-top: 24px; }

.fab { display: none; }

/* ---------- Dialoge ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); max-width: min(1100px, calc(100vw - 32px)); width: 100%; max-height: calc(100dvh - 32px); }
dialog::backdrop { background: rgba(41,41,39,.55); }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 20px 0; }
.dlg-body { padding: 20px; }
.detail { display: flex; flex-wrap: wrap; }
.detail-media { flex: 999 1 520px; min-width: 0; background: var(--stone); display: flex; align-items: center; justify-content: center; min-height: 240px; }
.detail-media img, .detail-media video { width: 100%; max-height: calc(100dvh - 120px); object-fit: contain; background: #1b1b1a; }
.detail-side { flex: 1 1 300px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.kicker { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.detail-title { font-size: 22px; margin-top: 4px; word-break: break-word; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; word-break: break-word; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.field label { display: block; font-weight: 700; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 13px; margin: -2px 0 8px; }
.input { width: 100%; height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: 16px; }
.input:focus { outline: none; border-color: var(--ink); }
.tagbox { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 50px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: text; }
.tagbox:focus-within { border-color: var(--ink); }
.tagbox input { flex: 1 1 120px; min-width: 0; height: 34px; border: 0; outline: none; background: transparent; font-size: 16px; }
.tagpill { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 6px 0 10px; border: 0; border-radius: var(--radius); background: var(--ink); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.suggest button { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); color: #3A3936; font-size: 14px; cursor: pointer; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 44px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.dropzone.over { border-color: var(--blue); background: #F5F8FB; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.thumbs .t { position: relative; aspect-ratio: 1; background: var(--stone); overflow: hidden; border-radius: var(--radius); }
.thumbs .t img, .thumbs .t video { width: 100%; height: 100%; object-fit: cover; }
.thumbs .t span { position: absolute; left: 4px; bottom: 4px; right: 4px; font-size: 10px; background: rgba(0,0,0,.6); color: #fff; padding: 1px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-list { display: flex; flex-direction: column; gap: 12px; }
.prog { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.prog .name { flex: 1; min-width: 0; }
.prog .name div:first-child { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.prog .name div:first-child span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--line); border-radius: var(--radius); overflow: hidden; }
.bar > div { height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.bar.err > div { background: var(--danger); }
.note { color: var(--muted); font-size: 14px; }
.error { color: var(--danger); font-size: 14px; font-weight: 600; }
.menu { min-width: 260px; max-width: 360px; }
.menu .dlg-body { display: flex; flex-direction: column; gap: 8px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: var(--radius); font-size: 14px; z-index: 100; max-width: calc(100vw - 32px); box-shadow: 0 6px 18px rgba(0,0,0,.2); }

/* ---------- Anmelde-Seiten ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 24px; }
.auth-card .logo { width: 64px; height: 64px; }
.auth-card h1 { font-size: 28px; letter-spacing: 3px; }
.auth-card p { margin: 6px 0 0; color: var(--muted); }
.divider { display: flex; align-items: center; gap: 12px; color: #77756F; font-size: 13px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Admin ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; }

/* ---------- Handy ---------- */
@media (max-width: 720px) {
  .topbar-inner { padding: 10px 14px 12px; gap: 10px; }
  .brand { flex: 1 1 auto; }
  .search { order: 3; flex-basis: 100%; }
  .top-actions .upload-btn { display: none; }
  .page { padding: 12px 10px 120px; }
  .filters { flex-wrap: nowrap; overflow-x: auto; margin: 0 -10px 10px; padding: 0 10px 4px; scrollbar-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .chips { flex-wrap: nowrap; flex: 0 0 auto; }
  .seg { flex: 0 0 auto; }
  .grid, .col { gap: 8px; }
  .tile .meta { display: none; }
  .fab { display: inline-flex; position: fixed; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 20; height: 56px; padding: 0 22px 0 18px; box-shadow: 0 6px 18px rgba(41,41,39,.3); }
  dialog { max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border: 0; }
  dialog.sheet { height: auto; max-height: 92dvh; inset: auto 0 0 0; margin: 0; border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .detail-media img, .detail-media video { max-height: 60dvh; }
}
