/* ColourLex – Weltkatalog (welt.html, werk.html) und der Hinweis-Block auf paintings.html.
   Baut auf style.css (Katalog, Filter, Karten) und detail.css (Werkseite) auf. */

/* ---------- Hinweis-Block auf paintings.html ---------- */
.welt-banner-wrap { padding-top: var(--s4); }
.welt-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s4); border-radius: 12px; background: var(--night); color: var(--night-text);
  border-left: 6px solid var(--vermilion);
}
.welt-banner .eyebrow { margin-bottom: 6px; }
.welt-banner-title { font-family: var(--font-display); font-size: clamp(1.25rem, 2.6vw, 1.75rem); line-height: 1.25; max-width: 34em; }
.welt-banner .btn { flex: none; }

/* ---------- Erkennen ---------- */
.welt-identify { padding-top: var(--s4); }
.identify-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s4); background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px;
}
.btn-xl { padding: 18px 34px; min-height: 60px; font-size: 19px; font-weight: 600; }
.btn-xl svg { width: 26px; height: 26px; flex: none; }
.identify-side { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 260px; }
.identify-note { color: var(--ink-2); font-size: 15px; line-height: 1.5; max-width: 46ch; }
.identify-box .link-button { align-self: flex-start; padding-left: 0; }
.identify-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.identify-out { margin-top: var(--s3); }
.identify-out:empty { display: none; }
.identify-status { display: flex; align-items: center; gap: 14px; color: var(--ink-2); }
.photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; }
.spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--vermilion); animation: welt-spin .8s linear infinite;
}
@keyframes welt-spin { to { transform: rotate(360deg); } }
.welt-msg { padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--vermilion); border-radius: 8px; background: var(--paper); color: var(--ink); }
.welt-msg .btn { margin-top: 12px; }

.match-head { display: flex; align-items: center; gap: 14px; margin-bottom: var(--s2); }
.match-head h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.2; overflow-wrap: anywhere; }
.match-main {
  display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: var(--s3); align-items: center;
  padding: var(--s3); border: 1px solid var(--line); border-radius: 12px; background: var(--paper);
  color: var(--ink); text-decoration: none; transition: border-color .3s ease;
}
.match-main:hover { border-color: var(--ink); }
.match-img { width: 100%; max-height: 340px; object-fit: contain; border-radius: 6px; background: var(--paper-2); }
.match-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.match-body h3 { font-size: 1.6rem; overflow-wrap: anywhere; }
.match-painter { font-size: 1.05rem; }
.match-body .card-meta { margin: 0; }
.match-others-title { margin: var(--s3) 0 var(--s1); font: 500 12px/1.4 var(--font-body); text-transform: uppercase; letter-spacing: .14em; color: var(--ink-2); }
.match-others { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.match-others .card-body { padding: 12px; gap: 6px; }
.match-others h3 { font-size: .98rem; }

/* ---------- Suche ---------- */
.welt-search { padding-top: var(--s5); padding-bottom: 96px; }
.welt-search > h2 { margin-bottom: var(--s3); }
.analyse-toggle { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.analyse-toggle[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.welt-grid { transition: opacity .2s ease; }
.welt-grid.is-loading { opacity: .45; }
.welt-more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: var(--s4); }
.welt-more:empty { display: none; }
.welt-more .welt-msg { width: 100%; }

.welt-card .card-img { aspect-ratio: 4 / 3; object-fit: contain; background: #e3dbcc; }
.welt-card .card-media { background: #e3dbcc; }
.welt-card .card-img:hover { transform: none; }
.welt-card h3 { font-size: 1.12rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.welt-card .card-body { gap: 6px; }
.welt-card .card-kicker { letter-spacing: .1em; }
.welt-card .card-meta { margin: 0; }
.no-img { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; background: #e3dbcc; color: var(--ink-2); font-size: 13px; text-align: center; padding: 8px; }
.badge {
  position: absolute; top: 10px; right: 10px; padding: 3px 10px; border-radius: 999px;
  background: var(--vermilion); color: #fff; font: 600 11px/1.5 var(--font-body); letter-spacing: .04em;
}
.badge-inline { position: static; display: inline-block; }

/* Facetten: ein Block fuer Desktop-Karte und Handy-Sheet */
.welt-facets .sheet-head, .welt-facets .sheet-foot { display: none; }
.welt-facets .facets-body { display: flex; flex-direction: column; gap: var(--s3); }
@media (max-width: 819px) {
  .welt-facets { display: none; }
  .welt-facets.is-open {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 50; margin: 0; padding: 0;
    border: 0; border-radius: 0; gap: 0; overflow-y: auto; overscroll-behavior: contain; background: var(--paper);
  }
  .welt-facets.is-open .sheet-head, .welt-facets.is-open .sheet-foot { display: flex; }
  .welt-facets.is-open .sheet-foot { margin-top: auto; }
  .welt-facets .facets-body { padding: 16px; gap: 20px; }
  .welt-facets .facet-group { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .welt-facets:focus { outline: none; }
  .identify-box { padding: var(--s3); }
  .btn-xl { width: 100%; }
  .match-main { grid-template-columns: 1fr; }
  .welt-banner { padding: var(--s3); }
  .welt-banner .btn { width: 100%; }
}

/* ---------- Werkseite ---------- */
.werk-head h1 { font-size: clamp(2rem, 4.6vw, 3.6rem); overflow-wrap: anywhere; }
.werk-image a { display: block; }
.werk-image img { width: 100%; height: auto; max-height: 82vh; object-fit: contain; border-radius: 10px; background: var(--paper-2); }
.werk-image .hint a, .werk-credit a { color: inherit; }
.werk-noimg { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--paper-2); color: var(--ink-2); }
.painting-grid aside .btn { margin-top: 16px; }
.painting-grid aside .muted { margin: 20px 0 0; }
.pigment-grid .pg-count { margin: 0; font-size: 12px; line-height: 1.3; color: var(--ink-2); }
.pigment-grid .pg-swatch { display: block; width: 100%; aspect-ratio: 400 / 284; background: var(--swatch); }
.analysis-list { margin: 12px 0 0; font-size: 14px; color: var(--ink-2); }
.analysis-list a { color: var(--vermilion); }
.chip-link { text-decoration: none; }
.chip-link:hover { border-color: var(--ink); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.painting-grid .chip-row + .h3 { margin-top: 28px; }

.where { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 240px); gap: var(--s5); align-items: center; }
.where-name { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; line-height: 1.25; }
.where p { margin: 4px 0 0; }
.where .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.where .links a { font: 500 13px/1 var(--font-body); padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; }
.where .links a:hover { border-color: var(--ink); }
.where-globe {
  position: relative; aspect-ratio: 1 / 1; width: 100%; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 35% 30%, #1d2733, #0e141b); border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .3);
}
.where-globe canvas { display: block; width: 100%; height: 100%; border-radius: 50%; }
.werk-about { margin-top: var(--s5); }
.werk-about h2, .werk-where h2 { font-family: Fraunces, serif; font-weight: 300; font-size: clamp(1.6rem, 2.6vw, 2.2rem); margin: 0 0 16px; }
.werk-about .src { font-size: 13px; color: var(--ink-2); margin: -4px 0 20px; }
.werk-about .src a { color: inherit; }
.werk-sources { font-size: 13px; color: var(--ink-2); padding-bottom: 48px; }
.werk-sources a { color: inherit; }
.werk-state { padding: 96px 0; text-align: center; }
.werk-state .btn { margin: 8px 6px 0; }
.werk-state p { max-width: 40em; margin: 0 auto 8px; }

@media (max-width: 819px) {
  .where { grid-template-columns: 1fr; gap: var(--s3); }
  .where-globe { max-width: 240px; margin: 0 auto; }
}

/* ---------- Filter-Panel (welt-filter.js): Gruppen, Pigment-Auswahl, Farbpunkte ---------- */
.welt-facets details.facet-group > summary { gap: 8px; }
.facet-active { margin-left: auto; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; color: var(--vermilion); }
.pigment-pick { margin-top: 10px; }
.pigment-select {
  display: block; width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 255, 255, .6); color: var(--ink); font: 16px/1.4 var(--font-body);
}
.pigment-select:focus-visible { outline: 2px solid var(--ultramarine); outline-offset: 2px; }
.mode-chips { margin-top: 10px; }
.swatch-dot { display: inline-block; flex: none; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .25); }
.globe-link { margin-left: auto; min-height: 44px; padding: 8px 18px; }
@media (min-width: 820px) {
  .welt-facets .facets-body { display: block; column-width: 300px; column-gap: 32px; }
  .welt-facets .facets-body > .facet-group { break-inside: avoid; margin-bottom: 8px; }
}

/* ---------- Globus mit Weltkatalog (globe.html) ---------- */
.globe-filter-wrap { padding-top: var(--s4); }
.globe-note { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.legend-welt { background: #3a86b4; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; max-height: 56vh; overflow-y: auto; }
.site-grid:empty { display: none; }
.site-grid .welt-card h3 { font-size: .95rem; -webkit-line-clamp: 2; }
.site-grid .card-body { padding: 10px; }
.site-more, .site-link { margin-top: 12px; }
.site-more:empty { display: none; }
.site-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; max-height: 52vh; overflow-y: auto; }
.site-item {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--ink); cursor: pointer; text-align: left; font: 500 14px/1.3 var(--font-body);
}
.site-item small { color: var(--ink-2); font-weight: 400; white-space: nowrap; }
.site-item:hover, .site-item:focus-visible { border-color: var(--ink); outline: none; }
.detail-related .welt-card .card-img { aspect-ratio: 4 / 3; object-fit: contain; }

/* Handy: Kacheln des Weltkatalogs zweispaltig */
@media (max-width: 560px) {
  .welt-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .welt-grid .welt-card h3 { font-size: 1rem; -webkit-line-clamp: 3; }
  .welt-grid .welt-card .card-body { padding: 12px; }
  .welt-grid .welt-card .card-kicker { font-size: 11px; letter-spacing: .06em; }
  .welt-grid .badge { top: 6px; right: 6px; padding: 2px 8px; font-size: 10px; }
}

/* ---------- Filter als Seitenblatt (Globus, ab 820 px): Globus bleibt links sichtbar ---------- */
.facets-drawer .welt-facets { display: none; }
@media (min-width: 820px) {
  .facets-drawer .welt-facets.is-open {
    display: flex; flex-direction: column; position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); margin: 0; padding: 0;
    border: 0; border-left: 1px solid var(--line); border-radius: 0; gap: 0; overflow-y: auto; overscroll-behavior: contain;
    background: var(--paper); box-shadow: -14px 0 40px rgba(0, 0, 0, .22);
  }
  .facets-drawer .welt-facets.is-open .sheet-head, .facets-drawer .welt-facets.is-open .sheet-foot { display: flex; }
  .facets-drawer .welt-facets.is-open .sheet-foot { margin-top: auto; }
  .facets-drawer .welt-facets .facets-body { display: flex; flex-direction: column; column-width: auto; gap: 20px; padding: 16px 20px; }
  .facets-drawer .welt-facets .facets-body > .facet-group { margin-bottom: 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
  .facets-drawer .welt-facets:focus { outline: none; }
}
@media (max-width: 819px) {
  .facets-drawer .welt-facets.is-open {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 50; margin: 0; padding: 0;
    border: 0; border-radius: 0; gap: 0; overflow-y: auto; background: var(--paper);
  }
}
/* Globus-Seite: Filter stehen rechts ueber dem Info-Panel, auf dem Handy ueber dem Globus */
.globe-section { grid-template-areas: "main filters" "main panel"; grid-template-rows: auto 1fr; align-content: start; }
.globe-section .globe-main { grid-area: main; }
.globe-section .globe-filters { grid-area: filters; min-width: 0; }
.globe-section .globe-panel { grid-area: panel; align-self: start; }
@media (max-width: 899px) {
  .globe-section { grid-template-areas: "filters" "main" "panel"; grid-template-rows: auto; }
}
