/* Farbwelt des alten Auftritts, modernisiert:
   #990000 -> --wine, #CCCC99 -> --sand, #FFFFCC -> --cream */
:root {
  --wine: #8a1a1a;
  --wine-dark: #5c0f0f;
  --sand: #c9c69a;
  --cream: #faf7ef;
  --ink: #1c1a17;
  --muted: #6b6459;
  --line: #e4dfd2;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.6 "Iowan Old Style", "Palatino Linotype", Georgia, serif;
}

.wrap { width: min(1100px, 92vw); margin: 0 auto; }

/* Textlinks: weinrot statt Browser-Blau, Unterstrich erst bei Hover/Fokus.
   Lange Listen bleiben dadurch ruhig, die Zugehoerigkeit ist trotzdem klar. */
a {
  color: var(--wine);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  text-decoration-skip-ink: auto;
}
a:hover { color: var(--wine-dark); text-decoration: underline; }
a:focus-visible {
  outline: 2px solid var(--wine);
  outline-offset: 2px;
  border-radius: 2px;
}
a:visited { color: var(--wine-dark); }
/* `a:visited` ist spezifischer als eine Klasse. Ohne diese Zeilen faerbt es
   besuchte Links auf dunklen Flaechen dunkel auf dunkel (Buttons, Menue,
   Wortmarke) — schwarze Schrift auf rotem Grund am 07.11. gesehen. */
.button:visited { color: #fff; }
.button-quiet:visited { color: var(--wine-dark); }
.brand:visited { color: #fff; }
.main-nav a:visited { color: var(--cream); }
/* Im Fliesstext bleibt der Unterstrich, sonst gehen Links zwischen Text unter. */
.prose a, .page-body a, .article-body a { text-decoration: underline; }
.prose a:hover, .page-body a:hover, .article-body a:hover { text-decoration-thickness: 2px; }

.site-header { background: var(--wine-dark); border-bottom: 3px solid var(--sand); }
.header-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 2rem; padding: 1rem 0; }
.brand { color: #fff; text-decoration: none; font-size: 1.45rem; letter-spacing: .12em; text-transform: uppercase; }
.brand span { display: block; font-size: .62rem; letter-spacing: .3em; color: var(--sand); }
.main-nav a { color: var(--cream); text-decoration: none; margin-left: 1.6rem; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }
.main-nav a:hover { color: var(--sand); }

main { padding: 2.5rem 0 4rem; }
h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); color: var(--wine-dark); margin: 0 0 .4rem; }
h2 { color: var(--wine); margin-top: 2.4rem; }

.hero { padding: 3rem 0 2rem; border-bottom: 1px solid var(--line); }
.hero p { color: var(--muted); max-width: 46ch; }

.button {
  display: inline-block; margin-top: 1rem; padding: .7rem 1.4rem;
  background: var(--wine); color: #fff; text-decoration: none;
  border-radius: 2px; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase;
}
.button:hover { background: var(--wine-dark); }
.button-quiet { background: transparent; color: var(--wine-dark); border: 1px solid var(--wine); }
.button-quiet:hover { background: var(--sand); color: var(--wine-dark); }

.wine-grid { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.wine-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--sand); padding: 1rem 1.1rem; }
.wine-card a { text-decoration: none; color: inherit; }
.wine-name { display: block; font-weight: 600; color: var(--wine-dark); }
.wine-meta { display: block; font-size: .85rem; color: var(--muted); }

.entity-grid { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.entity-card { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--sand); padding: 1rem 1.1rem; }
.entity-card a { text-decoration: none; color: inherit; }

.region-list { list-style: none; padding: 0; display: grid; gap: .5rem; }
.region-list li { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--sand); padding: .7rem 1rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.region-list a { color: var(--wine-dark); font-weight: 600; text-decoration: none; }

.filter-form { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0; }
.filter-form input, .filter-form select { padding: .5rem .6rem; border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; }
.filter-form button { padding: .5rem 1rem; border: 0; background: var(--wine); color: #fff; font: inherit; cursor: pointer; }
.filter-form button:hover { background: var(--wine-dark); }

/* Bilder bleiben in ihrer natürlichen Größe: kleine Scans werden nicht auf
   Kachelbreite hochskaliert, große nur auf den verfügbaren Raum verkleinert. */
.thumb { display: block; width: auto; max-width: 100%; max-height: 140px; height: auto; object-fit: contain; margin-bottom: .7rem; background: var(--cream); }
.detail-photo { display: block; width: auto; max-width: 100%; max-height: 420px; height: auto; margin: 1rem 0; border: 1px solid var(--line); background: #fff; }
.detail-media { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1rem; }
.detail-etiket { display: block; width: auto; max-width: 200px; max-height: 300px; height: auto; object-fit: contain; margin: 1rem 0; border: 1px solid var(--line); background: #fff; }
.media-frame { display: block; margin-bottom: .7rem; }
.media-frame > .thumb,
.media-frame > .detail-photo,
.media-frame > .detail-etiket { margin-bottom: 0; }

/* Ruhiger Platzhalter, wenn kein Bild gesetzt ist oder die Datei nicht lädt. */
.media-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 120px; margin-bottom: .7rem; padding: 1rem;
  background: var(--cream); border: 1px solid var(--line); color: var(--wine-dark);
  text-align: center;
}
.media-placeholder.detail-photo,
.media-placeholder.detail-etiket { max-width: 320px; min-height: 200px; }
.media-initial { font-size: 2.2rem; line-height: 1; color: var(--wine); }
.media-caption { margin-top: .5rem; font-size: .9rem; color: var(--muted); font-style: normal; }

/* Regionskarte: quadratischer Kartenausschnitt mit Bildnachweis darunter. */
.region-map { margin: 1.4rem 0; }
.region-map img { display: block; width: min(512px, 100%); height: auto; border: 1px solid var(--line); background: #fff; }
.region-map figcaption { margin-top: .4rem; font-size: .8rem; color: var(--muted); }
.region-map figcaption a { color: var(--muted); }
.media-note { display: block; margin: -.3rem 0 .7rem; font-size: .9rem; color: var(--muted); font-style: normal; }
.winery-about { max-width: 68ch; }
.winery-wines { margin: .4rem 0 1.2rem; }
.winery-wines a { color: var(--wine); }
.same-region { margin-top: 2.4rem; }

.detail .prose { max-width: 68ch; }
.muted { color: var(--muted); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1.2rem; margin: 1rem 0; }
dl.facts dt { color: var(--muted); font-size: .9rem; }
dl.facts dd { margin: 0; }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 2rem; }
.pager a { color: var(--wine); }

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: .85rem; }

/* Hauptmenü klebt beim Scrollen oben (auf Wunsch: primäres Menü immer erreichbar),
   der Pfeil unten rechts springt zurück an den Seitenanfang. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  transition: box-shadow .15s ease;
}
.site-header.is-stuck { box-shadow: 0 6px 18px rgba(28, 26, 23, .22); }

/* Mobil: eine Zeile mit Hamburger; das Menue klappt als Panel unter der
   Leiste auf. Ohne JavaScript bleibt die Navigation sichtbar (progressive
   enhancement), der Button wird dann gar nicht erst angezeigt. */
.nav-toggle { display: none; }

@media (max-width: 699px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .5rem 0;
  }
  .brand { font-size: 1.05rem; }
  .brand span { display: none; }

  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 4px;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }
  .js .nav-toggle:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
  .nav-toggle-bars { display: flex; flex-direction: column; gap: 4px; }
  .nav-toggle-bars span { display: block; width: 20px; height: 2px; background: currentColor; }

  .main-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    order: 3;
  }
  .main-nav a {
    margin: 0;
    padding: .7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    font-size: .8rem;
  }

  .js .main-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    padding: .35rem 1rem .8rem;
    background: var(--wine-dark);
    border-top: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 10px 24px rgba(28, 26, 23, .3);
  }
  .js .main-nav.is-open { display: flex; }
  .js .main-nav a { padding: .85rem .25rem; font-size: .85rem; }
}

.to-top {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 901;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--wine-dark);
  border-radius: 50%;
  background: var(--wine);
  color: #fff;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(28, 26, 23, .28);
}
.to-top.is-visible { display: block; }
.to-top:hover { background: var(--wine-dark); }
.to-top:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  .site-header, .to-top { transition: none; }
}

/* Winzer-Portal: Formulare und Listen ruhig und auf schmalen Geräten einspaltig. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.messages { margin-top: 1rem; }
.message {
  margin: 0 0 .5rem; padding: .75rem 1rem;
  border: 1px solid var(--line); border-left: 4px solid var(--wine);
  background: #fff; color: var(--ink);
}
.message-success { border-left-color: #3d6b36; }
.message-error { border-left-color: #a11; }
.message-warning { border-left-color: #9a6a00; }

.portal { max-width: 780px; }
.portal-wide { max-width: 1000px; }
.portal-narrow { max-width: 460px; }
.portal-card {
  margin: 1.2rem 0; padding: 1rem 1.2rem;
  border: 1px solid var(--line); border-left: 4px solid var(--sand);
  background: #fff;
}
.portal-card h2 { margin-top: 0; }
.portal-columns { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.portal-selection { list-style: none; padding: 0; display: grid; gap: .6rem; }
.portal-selection li {
  padding: .8rem 1rem; border: 1px solid var(--line);
  border-left: 4px solid var(--sand); background: #fff;
}
.portal-list { list-style: none; padding: 0; margin: 0; }
.portal-list li {
  padding: .55rem 0; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.portal-list li:last-child { border-bottom: 0; }
.portal-form { margin: 1.2rem 0; }
.portal-form p { margin: 0 0 1rem; }
.portal-form label { display: block; margin-bottom: .25rem; color: var(--wine-dark); font-weight: 600; }
.portal-form input[type="text"],
.portal-form input[type="email"],
.portal-form input[type="url"],
.portal-form input[type="number"],
.portal-form input[type="password"],
.portal-form input[type="file"],
.portal-form select,
.portal-form textarea {
  width: 100%; padding: .55rem .6rem; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit;
}
.portal-form textarea { resize: vertical; }
.portal-form .helptext { display: block; margin-top: .2rem; font-size: .85rem; color: var(--muted); }
.portal-form ul.errorlist { margin: .25rem 0; padding-left: 1.1rem; color: #a11; }
.portal-form button {
  padding: .65rem 1.3rem; border: 0; background: var(--wine); color: #fff;
  font: inherit; letter-spacing: .08em; text-transform: uppercase; cursor: pointer;
}
.portal-form button:hover { background: var(--wine-dark); }
.portal-fieldset {
  margin: 1.2rem 0; padding: 1rem 1.2rem;
  border: 1px solid var(--line); background: #fff;
}
.portal-fieldset legend {
  padding: 0 .4rem; color: var(--wine-dark);
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.portal-image-preview { margin: .4rem 0 1rem; }
.portal-image-preview img {
  display: block; width: auto; max-width: 100%; max-height: 280px;
  height: auto; border: 1px solid var(--line); background: #fff;
}
.portal-image-preview figcaption { margin-top: .3rem; font-size: .85rem; }
.checkbox-row { display: flex; align-items: center; gap: .45rem; }
.checkbox-row label { margin: 0; }
.portal-table { width: 100%; border-collapse: collapse; margin: 1.2rem 0; }
.portal-table th, .portal-table td {
  padding: .55rem .5rem; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: middle;
}
.portal-table th { color: var(--wine-dark); font-size: .85rem; text-transform: uppercase; }
.wine-thumb {
  display: block; width: 56px; height: 56px; object-fit: cover;
  border: 1px solid var(--line); background: #fff;
}
.status {
  display: inline-block; padding: .1rem .45rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600;
}
.status-online { background: #e7f1e3; color: #3d6b36; }
.status-draft { background: #f5eddb; color: #7a5b00; }
.portal-actions { white-space: nowrap; }
.portal-actions a + a { margin-left: .7rem; }
.link-danger { color: #a11; }
.button-danger { background: #a11; }
.button-danger:hover { background: #7d0d0d; }

@media (max-width: 699px) {
  .portal { max-width: none; }
  .portal-card { padding: .9rem 1rem; }
}
