/* WEILL 1911 – redbox-Stil gemäss angenommenem Layout (Revision 01.10.2026). Keine externen Ressourcen. */
@font-face { font-family: Redbox; src: url('/static/fonts/Redbox-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Redbox; src: url('/static/fonts/Redbox-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: RedboxCondensed; src: url('/static/fonts/Redbox-Condensed-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: RedboxCondensed; src: url('/static/fonts/Redbox-Condensed-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  --red: #c20027; --ink: #111; --muted: #5f5f5f; --line: #e4e4e4; --soft: #f7f7f7; --bg: #fff;
  --font: Redbox, Arial, Helvetica, sans-serif; --cond: RedboxCondensed, 'Arial Narrow', Arial, 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: 17px; line-height: 1.55; }
img { max-width: 100%; }
a { color: var(--red); overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff; padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; top: 8px; }

/* Kopf */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 22px 30px 18px; border-bottom: 3px solid var(--red); }
.brand { display: flex; align-items: center; }
.logo { width: 155px; height: auto; display: block; }
.project-tag { font-family: var(--cond); font-size: 24px; margin-left: 26px; border-left: 1px solid var(--line); padding-left: 26px; white-space: nowrap; }
.account { text-align: right; font-size: 13px; color: var(--muted); }
.account-mail { display: block; }
.link-button { border: 0; background: none; padding: 3px 0; color: var(--ink); text-decoration: underline; font-size: inherit; }
.menu-button { display: none; background: #fff; border: 1px solid var(--line); padding: 8px 14px; min-height: 44px; font-size: 14px; }
.inline { display: inline; }
.preview-banner { background: #fff4d6; border-bottom: 1px solid #e8c766; padding: 10px 30px; font-size: 14px; }

/* Gerüst */
.shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); max-width: 1440px; margin: 0 auto; }
.side-nav { padding: 28px 16px; border-right: 1px solid var(--line); }
.side-nav small { display: block; font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; margin: 0 12px 14px; }
.side-nav a { display: block; padding: 10px 12px; font-size: 15px; color: var(--ink); text-decoration: none; border-left: 2px solid transparent; line-height: 1.3; }
.side-nav a:hover { background: var(--soft); }
.side-nav a.active { background: var(--soft); color: var(--red); border-left-color: var(--red); }
.nav-minor { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--line); }
.nav-logout { padding: 6px 12px; font-size: 15px; }
.content { min-width: 0; padding: 30px 36px 48px; max-width: 1200px; }
.public-main { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.site-footer { border-top: 1px solid var(--line); padding: 16px 30px; color: var(--muted); font-size: 12px; }

/* Typografie */
h1, h2, h3 { font-family: var(--cond); font-weight: 400; line-height: 1.1; margin: 0; }
h1 { font-size: 44px; margin-bottom: 8px; }
h2 { font-size: 31px; margin: 40px 0 14px; }
h3 { font-size: 24px; margin: 8px 0; }
p { margin: 10px 0 16px; max-width: 72ch; }
.lead { font-size: 18px; }
.kicker { font-size: 11px; letter-spacing: 1.7px; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.kicker a { color: var(--muted); }
.muted { color: var(--muted); }
.meta { font-size: 13px; color: var(--muted); }
.small-note { font-size: 12px; color: var(--muted); margin-top: 26px; }
code { font-size: 12px; background: var(--soft); padding: 1px 4px; }

/* Bilder: immer Originalseitenverhältnis, kein Zuschnitt, keine Verzerrung */
.figure { margin: 0 0 22px; }
.figure img, .hero img { display: block; width: 100%; height: auto; object-fit: contain; background: var(--soft); }
.figure figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.badge-type { display: inline-block; font-size: 10px; letter-spacing: 1px; text-transform: uppercase; border: 1px solid var(--line); padding: 0 6px; margin-right: 4px; color: var(--ink); }
.hero { margin: 0 0 22px; }
.zoomable { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.protected-img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.gallery-narrow { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.status-badge { display: inline-block; border: 1px solid var(--red); color: var(--red); font-size: 13px; padding: 3px 10px; white-space: nowrap; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 24px 0 12px; padding: 18px 0; }
.facts-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fact b { display: block; font-family: var(--cond); font-size: 30px; font-weight: 400; line-height: 1.15; }
.fact span { display: block; font-size: 13px; color: var(--muted); }
.fact .fact-sub { font-size: 12px; }
.fact .fact-src { font-size: 12px; margin-top: 4px; }
.metric { border-top: 1px solid var(--line); padding: 18px 0; display: flex; gap: 30px; justify-content: space-between; align-items: baseline; }
.metric b { font-family: var(--cond); font-size: 36px; font-weight: 400; white-space: nowrap; }
.metric small { display: block; font-size: 13px; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 28px; }
.action { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid var(--ink); background: #fff; color: var(--ink); padding: 9px 18px; font-size: 15px; text-decoration: none; }
.action:hover { background: var(--soft); }
.action.primary { background: var(--red); border-color: var(--red); color: #fff; }
.action.primary:hover { background: #a10020; }
.action.danger, button.danger { border-color: var(--red); color: var(--red); background: #fff; }
.text-link { color: var(--red); font-size: 15px; }
.editorial { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 30px; align-items: start; }
.editorial p { font-size: 15px; }
.note { border-left: 2px solid var(--red); padding: 10px 16px; margin: 18px 0; background: var(--soft); font-size: 14px; max-width: 900px; }
.note p { margin: 6px 0; }
.note-strong { font-size: 15px; }
.note-error { border-left-color: #8a0000; background: #fdecee; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.section-links { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; margin: 26px 0; }
.section-links a { border-bottom: 1px solid var(--line); padding: 16px 0; font-family: var(--cond); font-size: 22px; color: var(--ink); text-decoration: none; }
.section-links a:hover { color: var(--red); }
.map-box { background: var(--soft); border: 1px solid #ddd; padding: 24px; margin: 16px 0; }
.map-frame iframe { width: 100%; aspect-ratio: 4 / 3; max-height: 520px; border: 0; display: block; margin-top: 12px; }

/* Filter, Tabellen */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.filters button { background: #fff; border: 1px solid var(--line); padding: 7px 12px; font-size: 14px; min-height: 40px; }
.filters button.selected { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-label { font-size: 12px; color: var(--muted); margin-left: 6px; }
.table-wrap { overflow-x: auto; margin: 8px 0 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 400; color: var(--muted); font-size: 12px; background: var(--soft); }
tbody th { color: var(--ink); font-size: 14px; background: none; }
td, th { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }

/* Dokumentliste */
.doc-list { border-top: 1px solid var(--line); }
.doc-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px 100px; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.doc-title { color: var(--ink); text-decoration: none; font-size: 16px; }
.doc-title:hover { color: var(--red); text-decoration: underline; }
.doc-row small { display: block; font-size: 12px; color: var(--muted); }
.rowstate { font-size: 12px; color: var(--muted); }
.view-link { text-align: right; font-size: 15px; padding: 10px 0; }
.doc-search { background: var(--soft); padding: 16px; margin: 18px 0; }
.doc-search label { display: block; font-size: 13px; margin-bottom: 4px; }
.doc-search input[type=search] { width: 100%; padding: 10px; border: 1px solid #aaa; min-height: 44px; }
.doc-search-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-top: 12px; }
.doc-search select { min-height: 44px; padding: 8px; border: 1px solid #aaa; background: #fff; display: block; }
.doc-group h2 { font-size: 24px; margin-top: 30px; }

/* Login */
.login { max-width: 460px; margin: 60px auto 80px; }
.login h1, .contact h1 { font-size: 38px; }
.login label, .admin-form label { display: block; font-size: 14px; margin: 16px 0 6px; }
.login input, .admin-form input:not([type=checkbox]), .admin-form select, .admin-form textarea, .editor-form input:not([type=checkbox]), .editor-form select, .editor-form textarea {
  width: 100%; border: 1px solid #999; padding: 11px; background: #fff; font-size: 16px; min-height: 44px; }
.login .action { width: 100%; justify-content: center; margin-top: 18px; }
.inline-form { margin-top: 16px; font-size: 14px; }
.contact { max-width: 720px; margin: 40px auto 70px; }

/* Dokumentbetrachter */
.viewer { border: 1px solid var(--line); margin-top: 18px; background: #fff; }
.viewer:fullscreen { display: flex; flex-direction: column; }
.viewer-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; background: var(--soft); padding: 8px; font-size: 14px; border-bottom: 1px solid var(--line); }
.viewer-bar button { background: #fff; border: 1px solid var(--line); padding: 6px 11px; min-height: 40px; min-width: 40px; }
.viewer-bar .sep { flex: 1; }
.page-select input { width: 64px; padding: 6px; border: 1px solid #aaa; min-height: 40px; }
.zoom-label { min-width: 52px; text-align: center; font-size: 13px; }
.viewer-body { display: grid; grid-template-columns: 150px minmax(0, 1fr); height: min(78vh, 900px); }
.viewer:fullscreen .viewer-body { height: auto; flex: 1; }
.viewer-body.no-thumbs { grid-template-columns: minmax(0, 1fr); }
.viewer-body.no-thumbs .viewer-thumbs { display: none; }
.viewer-thumbs { overflow-y: auto; border-right: 1px solid var(--line); padding: 8px; background: var(--soft); }
.viewer-thumbs button { display: block; width: 100%; border: 2px solid transparent; background: #fff; padding: 3px; margin-bottom: 8px; font-size: 11px; color: var(--muted); }
.viewer-thumbs button.current { border-color: var(--red); color: var(--ink); }
.viewer-thumbs img { display: block; width: 100%; height: auto; }
.viewer-stage { position: relative; overflow: hidden; background: #e9e9e9; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.viewer-stage:active { cursor: grabbing; }
.viewer-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; background: #fff; box-shadow: 0 0 0 1px #ccc; }
.viewer-canvas img { position: absolute; display: block; pointer-events: none; -webkit-user-drag: none; image-rendering: auto; }
.viewer-status { position: absolute; left: 12px; bottom: 12px; background: rgba(255,255,255,.92); padding: 4px 10px; font-size: 12px; }
.viewer-status:empty { display: none; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; -webkit-user-drag: none; }
.lightbox button { position: absolute; top: 12px; right: 12px; background: #fff; border: 0; padding: 10px 16px; min-height: 44px; }

/* Administration */
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 22px; border-bottom: 1px solid var(--line); }
.admin-tabs a { padding: 8px 12px; font-size: 14px; color: var(--ink); text-decoration: none; border-bottom: 2px solid transparent; }
.admin-tabs a.active { color: var(--red); border-bottom-color: var(--red); }
.small-tabs a { font-size: 13px; padding: 6px 9px; }
.admin-table { font-size: 13px; }
.admin-table td, .admin-table th { padding: 8px; }
.admin-actions form { margin: 2px 0 6px; }
button.small { font-size: 12px; padding: 5px 9px; background: #fff; border: 1px solid #bbb; margin: 2px 2px 2px 0; min-height: 32px; }
.inline-edit { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.inline-edit input, .inline-edit select { padding: 6px; border: 1px solid #aaa; min-height: 34px; font-size: 13px; }
.w-num { width: 80px; }
.admin-form { max-width: 720px; }
.admin-form .action { margin-top: 18px; }
.editor-form fieldset { border: 1px solid var(--line); padding: 12px 14px; margin: 14px 0; }
.editor-form label { display: block; font-size: 13px; margin: 10px 0 4px; }
.editor-form .check, .check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.src-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0; }
.admin-thumb { max-width: 240px; height: auto; display: block; margin-bottom: 8px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; font-size: 13px; margin-bottom: 14px; }
.filter-form select, .filter-form input { display: block; padding: 6px; border: 1px solid #aaa; min-height: 36px; }
.danger-zone { border: 1px solid #f0c0c8; padding: 14px; margin-top: 12px; }
.print-block { display: none; }

/* Mobil */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .site-header { padding: 14px 16px; }
  .logo { width: 118px; }
  .project-tag { font-size: 19px; margin-left: 14px; padding-left: 14px; }
  .account { display: none; }
  .menu-button { display: block; }
  .shell { display: block; }
  .side-nav { display: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 16px 16px; }
  .side-nav.open { display: block; }
  .side-nav a { padding: 12px; min-height: 44px; }
  .content { padding: 22px 16px 40px; }
  .public-main { padding: 0 16px; }
  .preview-banner { padding: 10px 16px; }
  h1 { font-size: 34px; } h2 { font-size: 27px; }
  .title-row { display: block; }
  .facts, .facts-compact { grid-template-columns: 1fr 1fr; gap: 18px; }
  .fact b { font-size: 25px; }
  .editorial, .gallery, .gallery-narrow, .split, .section-links { grid-template-columns: 1fr; }
  .metric { display: block; }
  .metric b { display: block; margin-top: 6px; font-size: 30px; }
  .doc-row { grid-template-columns: minmax(0, 1fr) 84px; gap: 6px 10px; }
  .doc-row .rowstate { grid-column: 1; }
  .doc-row .view-link, .doc-row > :last-child { grid-column: 2; grid-row: 1 / 3; align-self: center; }
  .filters button { min-height: 44px; }
  .site-footer { padding: 16px; }
  /* Tabellen als gestapelte Listen statt winziger Tabellen */
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack, table.stack tbody, table.stack tr, table.stack td, table.stack tbody th { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); margin: 0 0 10px; padding: 6px 10px; }
  table.stack td, table.stack tbody th { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.stack td::before, table.stack tbody th::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; }
  table.stack tbody th { font-family: var(--cond); font-size: 18px; }
  .viewer-body { grid-template-columns: minmax(0, 1fr); height: 70vh; }
  .viewer-thumbs { display: none; }
  .viewer-body.show-thumbs .viewer-thumbs { display: block; position: absolute; z-index: 5; width: 130px; height: 70vh; }
  .viewer-body { position: relative; }
  .viewer-bar button[data-act=fitwidth], .viewer-bar button[data-act=fitpage] { font-size: 12px; }
  .src-row { grid-template-columns: 1fr; }
}

/* Druck: geschützte Bilder und vertrauliche Bereiche ausblenden (Bedienbeschränkung, kein technischer Schutz). */
@media print {
  .app .shell, .app .site-header, .app .site-footer, .lightbox, .preview-banner { display: none !important; }
  .print-block { display: block !important; font-family: Arial, sans-serif; font-size: 16pt; padding: 40px; }
  img { display: none !important; }
}
