/* Chirlyart Galerie – Grundstil.
   Aufbau/Maße angelehnt an picdrop, Farben = Chirlyart (hell + dunkel).
   Schrift: Figtree (frei, optisch nah an picdrops Proxima Nova), selbst gehostet. */
@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-400-normal.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-400-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-500-normal.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-600-normal.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Figtree';
  src: url('/shared/fonts/figtree-latin-700-normal.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

/* ---------- Farbschemata ---------- */
:root, [data-theme='dark'] {
  --gold: #c9a96e;                 /* Akzent (Chirlyart) */
  --gold-ink: #0f0d0a;             /* Text AUF Gold */
  --gold-soft: rgba(201, 169, 110, 0.32);
  --bg: #141311;                   /* Seitenfläche */
  --bg-side: #1b1916;              /* Seitenleiste / Kopf */
  --bg-card: #201d1a;              /* Kacheln, Fenster */
  --bg-tint: #282420;              /* getönte Kästen, Felder */
  --bg-hover: #2f2a25;
  --text: #ece8e1;
  --text-dim: #9b948a;
  --line: rgba(255, 255, 255, 0.11);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 18px rgba(0, 0, 0, 0.35);
  --danger: #f07478;
  --ok: #3dd56d;
  /* Großansicht: farbneutrale Gründe (kein Goldstich hinter Fotos) */
  --lb-bg: #0b0b0b;
  color-scheme: dark;
}
[data-theme='light'] {
  --gold: #7a5f24;                 /* Gold, auf Hell dunkler für echten Kontrast (AA) */
  --gold-ink: #ffffff;
  --gold-soft: rgba(122, 95, 36, 0.4);
  --bg: #f5f4f2;
  --bg-side: #fbfaf9;
  --bg-card: #ffffff;
  --bg-tint: #efedea;
  --bg-hover: #e8e5e1;
  --text: #22201d;
  --text-dim: #5d5852;
  --line: rgba(0, 0, 0, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.08);
  --danger: #d33438;
  --ok: #1e9e4e;
  --lb-bg: #f2f2f2;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Figtree', 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: inherit; font-weight: 700; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; color: inherit; }

/* ---------- Icons (Lucide, Strichstil) ---------- */
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -4px;
}
.ic-sm { width: 16px; height: 16px; vertical-align: -3px; }
.ic-lg { width: 24px; height: 24px; }
.ic-fill { fill: currentColor; stroke: currentColor; stroke-width: 1.5; }

/* ---------- Knöpfe ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-card); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 16px; font-size: 16px; font-weight: 500; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--bg-hover); text-decoration: none; }
.btn.primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(229, 72, 77, 0.1); border-color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.small { padding: 5px 12px; font-size: 14px; }
.btn.big { font-size: 18px; padding: 8px 32px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: none; border: none; border-radius: 8px;
  color: inherit; cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--bg-hover); }

/* ---------- Formulare ---------- */
input[type=text], input[type=password], input[type=date], input[type=search],
input[type=email], textarea, select {
  width: 100%; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; font-size: 15px; font-family: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
label { font-size: 14px; font-weight: 600; display: block; margin: 12px 0 4px; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; }
.check input { width: auto; }

/* ---------- Wortmarke ---------- */
.wordmark { font-weight: 600; letter-spacing: 0.3em; color: var(--gold); text-transform: uppercase; }
.wordmark small { display: block; letter-spacing: 0.42em; font-size: 0.55em; color: var(--text-dim); margin-top: 3px; font-weight: 500; }

/* ---------- Fähnchen ---------- */
.flag-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(12, 12, 12, 0.78); color: #fff;
  border-radius: 6px; padding: 3px 10px;
  font-size: 14px; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  backdrop-filter: blur(2px);
}
.flag-badge .ic { width: 16px; height: 16px; stroke: #fff; }

/* Fähnchen-Menü (Keine · Farben · Fertig abgesetzt) */
.markmenu {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; min-width: 210px;
}
.markmenu button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; font-size: 15px; font-weight: 700; letter-spacing: 0.02em;
  text-transform: uppercase; text-align: left;
}
.markmenu button.none { color: var(--text); text-transform: none; font-weight: 500; }
.markmenu button:hover { background: var(--bg-hover); }
.markmenu button.current { outline: 1.5px solid var(--gold-soft); }
.markmenu .sep { height: 6px; }
.markmenu button.final { background: var(--bg-tint); }

/* Kontext-Menü (⋮) */
.popmenu {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; min-width: 230px;
}
.popmenu button, .popmenu a {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; padding: 9px 12px; border-radius: 8px;
  cursor: pointer; font-size: 15px; text-align: left;
}
.popmenu button:hover, .popmenu a:hover { background: var(--bg-hover); text-decoration: none; }
.popmenu .sep { border-top: 1px solid var(--line); margin: 6px 4px; }
.popmenu .danger { color: var(--danger); }

.pop-backdrop { position: fixed; inset: 0; z-index: 70; }
.pop-anchor { position: absolute; z-index: 71; }

/* ---------- Hinweis unten ---------- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 18px; z-index: 90; font-size: 14px;
  box-shadow: var(--shadow);
}

/* Fähnchen mit sehr dunkler Farbe: heller Rand, damit es auf Dunkel sichtbar bleibt */
.flag-dark { stroke: rgba(255, 255, 255, 0.85) !important; stroke-width: 1.5; }
[data-theme='light'] .flag-dark { stroke: rgba(255, 255, 255, 0.0) !important; }
[data-theme='light'] .flag-dark, [data-theme='light'] svg.flag-dark { stroke: #555 !important; }

/* Marken-Symbole (Instagram & Co.): gefüllt statt Strich */
.ic-brand { fill: currentColor; stroke: none; }

/* ---------- Zeichnen auf dem Bild (Scribbles) ---------- */
.scribble-editor { position: absolute; z-index: 5; touch-action: pinch-zoom; }
.scribble-editor svg.scribble-draw { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.scribble-bar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 14px;
  z-index: 98; max-width: 96vw;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 12px; box-shadow: var(--shadow);
}
.scribble-bar .group { display: inline-flex; gap: 5px; align-items: center; padding: 0 4px; border-right: 1px solid var(--line); }
.scribble-bar .group:last-child { border-right: none; }
.scribble-bar button {
  width: 30px; height: 30px; border-radius: 8px; border: 2px solid transparent;
  cursor: pointer; padding: 0; background: var(--bg-tint);
}
.scribble-bar button.on { border-color: var(--gold); }
.scribble-bar button.txt { background: var(--bg-tint); color: var(--text); font-size: 15px; width: auto; min-width: 34px; height: auto; min-height: 30px; padding: 2px 8px; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; line-height: 1.15; }
.scribble-bar button.txt small { font-size: 8.5px; color: var(--text-dim); display: block; }
.scribble-bar button.txt.save small, .scribble-bar [data-sc-cancel] small { display: none; }
.scribble-bar button.txt.save { background: var(--gold); color: var(--gold-ink); font-weight: 600; }
.scribble-bar button i { display: block; width: 16px; background: currentColor; border-radius: 99px; }
.scribble-hint {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 14px; font-size: 13px; box-shadow: var(--shadow);
  max-width: 90%; text-align: center; transition: opacity 0.4s; pointer-events: none; z-index: 6;
}
.scribble-badge {
  position: absolute; left: 8px; bottom: 8px; background: rgba(15, 14, 12, 0.7); color: #fff;
  border-radius: 6px; padding: 2px 8px; font-size: 12px; display: inline-flex; gap: 4px; align-items: center;
}


/* ---------- Großansicht: eigene Farben je Hintergrund ----------
   Die Großansicht hat ihren eigenen neutralen Grund (schwarz/grau/weiß).
   Alles darin (Leisten, Info-Spalte, Zeichenwerkzeuge, Hinweise) nutzt
   deshalb EIGENE Farbvariablen – unabhängig vom hellen/dunklen Seiten-Schema. */
.lightbox, .lightbox[data-bg='black'], .lightbox[data-bg='grey'] {
  --text: #f0efed;
  --text-dim: rgba(255, 255, 255, 0.72);
  --bg-side: #1d1d1d;
  --bg-card: #262626;
  --bg-tint: #343434;
  --bg-hover: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.22);
  --gold: #d6b87e;
  --gold-ink: #181512;
  color: var(--text);
}
.lightbox[data-bg='white'] {
  --text: #1f1e1c;
  --text-dim: #585550;
  --bg-side: #ffffff;
  --bg-card: #ffffff;
  --bg-tint: #ebebeb;
  --bg-hover: rgba(0, 0, 0, 0.08);
  --line: rgba(0, 0, 0, 0.18);
  --gold: #7a5f24;
  --gold-ink: #ffffff;
  color: var(--text);
}
.lightbox .lb-top, .lightbox .lb-bar, .lightbox .lb-hint { color: var(--text); }
.lightbox .lb-hint { opacity: 1; color: var(--text-dim); }

/* ---------- Regler, Häkchen & Co. im App-Stil (Gold statt Browser-Blau) ---------- */
body, .lightbox { accent-color: var(--gold); }
input[type=range] { accent-color: var(--gold); }
input[type=checkbox], input[type=radio] { accent-color: var(--gold); width: 15px; height: 15px; }


/* Einheitliche Kunden-Fußzeile */
.socialrow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 8px 0 6px; }
.socialrow a { color: var(--text-dim); display: inline-flex; padding: 6px; border-radius: 8px; }
.socialrow a:hover { color: var(--gold); background: var(--bg-hover); text-decoration: none; }
.legalrow { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.legalrow a { color: var(--text-dim); }
.legalrow .dot { opacity: 0.6; }

/* ---------- Versionen (Fassungen): Raster-Abzeichen + Umschalter in der Großansicht ---------- */
.ver-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(15, 14, 12, 0.65); color: #fff; border-radius: 6px; padding: 2px 8px; font-size: 12px; display: inline-flex; gap: 5px; align-items: center; pointer-events: none; z-index: 2; }
.lb-versions { display: flex; gap: 8px; justify-content: center; padding: 6px 10px; flex-wrap: wrap; }
.lb-versions .vpill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px 3px 3px; background: var(--bg-card); color: var(--text); font-size: 12.5px; cursor: pointer; }
.lb-versions .vpill img { width: 26px; height: 26px; object-fit: cover; border-radius: 50%; display: block; }
.lb-versions .vpill.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.lb-versions .vpill:hover { background: var(--bg-hover); }

/* 100%-Zoom "Lupe" (Block 3) */
.loupe { position: absolute; inset: 0; overflow: hidden; background: #000; cursor: grab; z-index: 5; touch-action: none; }
.loupe:active { cursor: grabbing; }
.loupe img {
  position: absolute; left: 0; top: 0;
  /* Vorrang vor den Großansichts-Regeln (die begrenzen Bilder auf die Bühne):
     die Lupe zeigt IMMER die natürliche, volle Bildgröße. */
  max-width: none !important; max-height: none !important;
  width: auto !important; height: auto !important; object-fit: none !important;
  will-change: transform; user-select: none;
}
.loupe-hint { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 2; background: rgba(0,0,0,0.65); color: #fff; font-size: 12.5px; padding: 4px 12px; border-radius: 999px; pointer-events: none; }
.loupe-status { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; display: flex; align-items: center; gap: 10px; max-width: 80%; background: rgba(0,0,0,0.75); color: #fff; font-size: 14px; padding: 10px 16px; border-radius: 10px; text-align: center; }
.loupe-spinner { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: loupe-spin 0.8s linear infinite; }
@keyframes loupe-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loupe-spinner { animation: none; } }
.loupe-close { position: absolute; top: 8px; right: 8px; z-index: 2; width: 34px; height: 34px; border-radius: 50%; border: none; background: rgba(0,0,0,0.65); color: #fff; font-size: 15px; cursor: pointer; }
