:root {
  font-family: system-ui, sans-serif;
  color: #263c30;
  background: #f7f8f3;
  line-height: 1.45;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
/* Long words (IDs, URLs, user input) wrap instead of widening the page. */
body { margin: 0; overflow-wrap: anywhere; }
a { color: #2c5e42; text-underline-offset: .2em; }
a:hover { color: #1e452f; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  padding-block: max(.5rem, env(safe-area-inset-top)) .5rem;
  border-bottom: 1px solid #d7dfd5;
  background: #fffefa;
  /* Nav labels and the 30-char-max username wrap as whole items, never mid-word. */
  overflow-wrap: normal;
}
header, main, footer { padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right)); }
.brand { text-decoration: none; font-weight: 750; font-size: 1.25rem; letter-spacing: -.04em; }
nav { display: flex; gap: .25rem .75rem; align-items: center; flex-wrap: wrap; }
nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; text-decoration: none; }
nav[aria-label=Konto] { margin-left: auto; justify-content: end; }
/* Same height as the nav links, so wrapped header rows stay even. Flex drops the
   whitespace between label and name; the gap stands in for it. */
.account { display: inline-flex; align-items: center; gap: .3ch; min-height: 44px; font-size: .875rem; color: #53644f; }
main { max-width: 1440px; margin: auto; padding-block: 1.25rem 1.5rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.025em; font-weight: 650; }
h1 { font-size: clamp(1.5rem, 1rem + 1.5vw, 1.8rem); margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; margin: 1.25rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: .35rem 0; }
p { margin: .5rem 0 .75rem; }
small, .meta { color: #53644f; font-size: .85rem; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  background: #2c5e42;
  color: white;
  border: 1px solid #2c5e42;
  border-radius: 5px;
  padding: .5rem .85rem;
  cursor: pointer;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
}
button:hover { background: #1e452f; color: white; }
button:disabled { opacity: .55; cursor: wait; }
.quiet { background: transparent; color: #2c5e42; padding: .4rem .6rem; }
.filters, .columns { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; }
/* Controls line up at the top: the plant search grows into a listbox below its row. */
.filters { margin: 0 0 1rem; align-items: start; }
:is(.filters, .columns) > label { flex: 1; min-width: 140px; }
.filters label { margin-bottom: 0; }
.filters > div { display: flex; align-items: center; gap: .75rem; }
label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .75rem; min-width: 0; }
input, select, textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  color: inherit;
  background: #fffefa;
  border: 1px solid #aebbab;
  border-radius: 4px;
  padding: .5rem .6rem;
  margin-top: .25rem;
}
textarea { min-height: 100px; resize: vertical; }
input[type=checkbox] { width: 1.1rem; min-height: 0; height: 1.1rem; margin-right: .5rem; }
label:has(input[type=checkbox]) { display: flex; align-items: center; min-height: 44px; }
:focus-visible { outline: 3px solid #80a773; outline-offset: 2px; }
.explorer { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
.explorer aside { max-height: 620px; overflow: auto; }
.explorer aside h2 { margin-top: 0; }
plant-map { --map-height: clamp(360px, 60vh, 620px); display: block; position: relative; min-width: 0; min-height: calc(var(--map-height) + 2px); background: #e8eedc; border: 1px solid #d7dfd5; border-radius: 6px; overflow: hidden; }
.map-canvas { height: var(--map-height); }
plant-map[mode=pick] { --map-height: 300px; }
plant-map[mode=view] { --map-height: 280px; }
plant-map + .columns { margin-top: .75rem; }
plant-map .maplibregl-ctrl-group button { width: 44px; height: 44px; }
plant-map .maplibregl-ctrl-attrib-button { min-height: 0; padding: 0; }
/* The vendor CSS removes the underline; links inside text need a cue other than colour. */
plant-map .maplibregl-ctrl-attrib a { text-decoration: underline; }
.map-status { position: absolute; inset: auto 10px 24px; background: rgb(255 254 250 / .93); margin: 0; padding: .2rem .5rem; font-size: .8rem; }
.finding, .entry { background: #fffefa; border: 1px solid #d7dfd5; border-radius: 5px; padding: .75rem; margin-bottom: .5rem; }
.finding p { margin: .25rem 0; color: #53644f; }
.finding h3 a { display: flex; align-items: center; min-height: 44px; padding: .15rem 0; text-decoration: none; }
.finding { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: .75rem; align-items: start; }
.finding:focus-within { border-color: #2c5e42; }
.finding-photo img { display: block; object-fit: cover; border-radius: 4px; }
.photo-placeholder { display: grid; place-items: center; height: 72px; border: 1px dashed #aebbab; border-radius: 4px; background: #e8eedc; color: #53644f; font-size: .75rem; }
.badge { display: inline-block; border-radius: 3px; background: #e8eedc; color: #263c30; padding: .15rem .4rem; font-size: .75rem; font-weight: 650; margin-right: .35rem; }
.empty { margin: 0; padding: 1rem; color: #53644f; border: 1px dashed #aebbab; border-radius: 5px; }
.narrow { max-width: 720px; margin: 0 auto 1.25rem; }
.detail { max-width: 900px; margin: 0 auto; }
.photos { display: flex; gap: .75rem; margin: .75rem 0; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; }
.photos > * { flex: 0 0 min(85%, 420px); margin: 0; min-width: 0; scroll-snap-align: start; }
.photos > :only-child { flex-basis: 100%; }
/* CSS carousel buttons (Chrome/Edge); other browsers keep swipe/scroll only.
   Separate rules on purpose: an unknown pseudo-element invalidates its whole selector list. */
#photos { anchor-name: --photos; }
#photos::scroll-button(*) { position: absolute; position-anchor: --photos; top: calc(anchor(top) + 160px); translate: 0 -50%; width: 44px; height: 44px; border: 1px solid #d7dfd5; border-radius: 50%; background: rgb(255 254 250 / .9); color: #263c30; font-size: 1.6rem; line-height: 1; cursor: pointer; }
#photos::scroll-button(left) { content: "‹" / "Vorheriges Foto"; left: calc(anchor(left) + .25rem); }
#photos::scroll-button(right) { content: "›" / "Nächstes Foto"; right: calc(anchor(right) + .25rem); }
#photos::scroll-button(*):hover { background: #fffefa; color: #1e452f; }
#photos::scroll-button(*):disabled { visibility: hidden; }
#photos::scroll-button(*):focus-visible { outline: 3px solid #80a773; outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) { .photos { scroll-behavior: smooth; } }
.photos figure > a { display: block; background: #e8eedc; border-radius: 5px; cursor: zoom-in; }
.photos img { display: block; width: 100%; height: 320px; object-fit: contain; border-radius: 5px; }
.photos figcaption { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.photo-hidden { padding: .5rem; border: 1px dashed #a68d45; border-radius: 5px; }
.photo-hidden .badge { background: #f2e9c9; color: #64501c; }
.photos .report { margin: 0; }
photo-upload { display: block; padding: .75rem; border: 1px dashed #aebbab; border-radius: 5px; margin: .75rem 0; }
:is(.map-status, .photos, photo-upload p, plant-select p):empty { display: none; }
details { margin: .5rem 0; padding: .25rem .75rem; border: 1px solid #d7dfd5; border-radius: 5px; }
summary { cursor: pointer; font-weight: 600; padding: .65rem 0; min-height: 44px; }
details form { margin-top: .5rem; }
.report { font-size: .8rem; padding: 0; border: 0; }
.prose { white-space: pre-wrap; }
.inline { display: inline-flex; flex-wrap: wrap; gap: .25rem; margin: .25rem .25rem .1rem 0; }
#notice:not(:empty), .notice { padding: .75rem; background: #f2e9c9; border-left: 3px solid #a68d45; margin: 0 0 1rem; }
/* Form results land here while the form may be far down the page; stay above MapLibre's controls (z-index 2). */
#notice:not(:empty) { position: sticky; top: env(safe-area-inset-top, 0); z-index: 3; }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
footer { padding-block: .5rem max(.5rem, env(safe-area-inset-bottom)); border-top: 1px solid #d7dfd5; color: #53644f; font-size: .8rem; }
.install-help { max-width: 720px; padding: 0; margin: 0; border: 0; }
.tabs { gap: 0 .5rem; padding: .25rem 0; border-bottom: 1px solid #d7dfd5; }
.tabs a { padding: .5rem .6rem; border-radius: 4px; }
.tabs [aria-current=page] { background: #e8eedc; font-weight: 650; color: #263c30; }
#admin-results { scroll-margin-top: .5rem; }
#admin-results > form { max-width: 900px; }
.review-photo { display: block; max-width: min(300px, 100%); max-height: 240px; height: auto; margin: .5rem 0; }
plant-select { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .75rem; }
plant-select p { grid-column: 1 / -1; font-size: .8rem; margin: .25rem 0; }
.filters plant-select { flex: 3; min-width: 300px; }
.skip-link { position: absolute; top: -100px; left: 1rem; z-index: 10; padding: .75rem; background: #fffefa; }
.skip-link:focus { top: .5rem; }
@media (max-width: 750px) {
  header { gap: .25rem .75rem; }
  /* Wrapped header rows read as one left-aligned toolbar instead of mixed alignment. */
  nav[aria-label=Konto] { margin-left: 0; justify-content: start; }
  /* Visually hidden: screen readers still announce "Angemeldet als <name>". */
  .account-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tabs { gap: 0 .25rem; }
  .tabs a { padding-inline: .45rem; }
  /* Small filter selects share a row on phones, keeping the map above the fold. */
  .filters > label { min-width: 0; }
  .explorer { grid-template-columns: 1fr; }
  .explorer aside { max-height: none; overflow: visible; }
  plant-map { --map-height: 320px; }
  plant-map[mode=pick] { --map-height: 260px; }
  .filters plant-select { flex-basis: 100%; min-width: 0; }
}
@media (display-mode: standalone) { .install-help { display: none; } }

/* Catalogue tables keep their column headings on narrow screens. */
.plant-catalogue { max-width: 1100px; margin: auto; }
.plant-catalogue .intro { max-width: 720px; }
.table-scroll { overflow-x: auto; }
.plant-catalogue table { width: 100%; min-width: 640px; border-collapse: collapse; background: #fffefa; }
.plant-catalogue caption { text-align: left; padding: .75rem 0; font-weight: 600; }
.plant-catalogue th, .plant-catalogue td { padding: .75rem; text-align: left; vertical-align: top; border-bottom: 1px solid #d7dfd5; }
.plant-catalogue thead { background: #e8eedc; }
.plant-catalogue tbody th { font-weight: 600; }
.plant-catalogue td:last-child a { display: block; padding-block: .25rem; }
.plant-links { font-size: .85rem; margin: -.5rem 0 .5rem; }
.plant-links a { display: inline-flex; align-items: center; min-height: 44px; }
