@font-face {
  font-family: 'Headland One';
  src: url('assets/fonts/HeadlandOne-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Gotu';
  src: url('assets/fonts/Gotu-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

:root {
  --ink: #1d1d1d;
  --paper: #fcfcfc;
  --page: #fafafa;
  --muted: #66635e;
  --line: #e4e2de;
  --soft: #efede9;
  --leaf: #45624a;
  --leaf-2: #819064;
  --warning: #9a6b2f;
  --danger: #7f3838;
  --alert: #8f2f2f;
  --serif: 'Headland One', Georgia, 'Times New Roman', serif;
  --sans: 'Gotu', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { overflow-x: clip; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; }
a { color: inherit; }
img { max-width: 100%; }
button, input, select { font: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem clamp(0.9rem, 4vw, 2.5rem);
  background: var(--ink);
  color: var(--paper);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
}

.brand img { display: block; width: 91px; height: 40px; }

.brand-sub {
  color: #bdbdbd;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  border-left: 1px solid #3a3a3a;
  padding-left: 0.8rem;
}

.search-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid #3a3a3a;
  padding: 0.2rem;
}

.search-switch a {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.72rem;
  color: var(--paper);
  font-size: 0.82rem;
  text-decoration: none;
}

.search-switch a:hover { background: #2a2a2a; }

.search-switch a.is-active {
  background: var(--paper);
  color: var(--ink);
}

.header-note {
  margin: 0;
  color: #bdbdbd;
  font-size: 0.85rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.logout-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid #545454;
  padding: 0.28rem 0.62rem;
  color: var(--paper);
  font-size: 0.82rem;
  text-decoration: none;
}

.logout-link:hover {
  border-color: var(--paper);
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 76rem;
  margin: 0 auto 3rem;
  padding: 0 clamp(0.9rem, 4vw, 2.5rem);
}

.hero {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: clamp(1.6rem, 5vw, 3.1rem) clamp(0.9rem, 4vw, 2.5rem) clamp(1.9rem, 5vw, 3rem);
  background:
    linear-gradient(90deg, rgba(29, 29, 29, 0.98), rgba(29, 29, 29, 0.92)),
    repeating-linear-gradient(90deg, rgba(252, 252, 252, 0.06) 0 1px, transparent 1px 4.5rem);
  color: var(--paper);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
  max-width: 69rem;
  margin: 0 auto;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: #bfc7b2;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.75rem, 5.5vw, 2.65rem);
  line-height: 1.2;
}

.hero-sub {
  max-width: 48rem;
  margin: 0;
  color: #d2d2cf;
  font-size: 0.95rem;
}

.search-form input[type="search"] {
  width: 100%;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--paper);
  border-radius: 0;
  appearance: none;
  background: var(--paper);
  color: var(--ink);
  font-size: 1.02rem;
}

.search-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
  margin-top: 0.7rem;
}

.search-filters select,
.toolbar select {
  min-width: 0;
  padding: 0.72rem 0.8rem;
  border: 1px solid #3a3a3a;
  border-radius: 0;
  background: transparent;
  color: var(--paper);
}

.search-filters select option,
.toolbar select option {
  background: var(--paper);
  color: var(--ink);
}

.search-filters button {
  padding: 0.78rem 2rem;
  border: 1px solid var(--paper);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.search-filters button:hover {
  background: transparent;
  color: var(--paper);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 1.3rem 0 0;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.check-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.4rem;
  padding: 0.42rem 0.65rem;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.86rem;
}

.check-filter input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--leaf);
}

.sort-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.86rem;
}

.toolbar select {
  min-height: 2.4rem;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.summary {
  margin: 1.2rem 0 1rem;
}

.results-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
  gap: 1.1rem;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: var(--ink);
  box-shadow: 0 8px 24px rgba(29, 29, 29, 0.1);
}

.card-media {
  position: relative;
  display: grid;
  min-height: 10rem;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, #eceae6 0%, #f7f6f2 55%, #dfe3d7 100%);
  color: #7b806f;
}

.tree-mark {
  width: 5.6rem;
  height: 5.6rem;
  border: 1px solid rgba(69, 98, 74, 0.3);
  display: grid;
  place-items: center;
  color: var(--leaf);
  font-family: var(--serif);
  font-size: 2rem;
  background: rgba(252, 252, 252, 0.56);
}

.tree-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.media-label {
  position: absolute;
  left: 0.55rem;
  bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 0;
  white-space: nowrap;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.chip {
  position: absolute;
  top: 0.55rem;
  left: 0.55rem;
  background: rgba(29, 29, 29, 0.72);
  color: var(--paper);
}

.badge {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
}

.badge-health-dobry { background: #edf3e8; color: #2f5937; border-color: #cfdec7; }
.badge-health-średni { background: #f6f0df; color: var(--warning); border-color: #e7d8ad; }
.badge-health-zły { background: #f6e7e4; color: var(--danger); border-color: #e4c4bd; }
.badge-health-nieokreślony { background: var(--soft); color: var(--muted); }

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 1rem 1.05rem;
}

.card-title {
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.35;
}

.latin {
  color: var(--muted);
  font-size: 0.84rem;
  font-style: italic;
}

.card-meta {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.card-link {
  align-self: flex-start;
  margin-top: auto;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.35rem 0 0.05rem;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.card-link:hover { border-color: var(--ink); }

.photo-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.photo-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.camera-upload {
  display: none;
}

@media (hover: none) and (pointer: coarse), (max-width: 48rem) {
  .camera-upload {
    display: inline-flex;
  }
}

.upload-label {
  position: relative;
  align-self: flex-start;
  overflow: hidden;
}

.upload-label input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-status {
  min-height: 1.25rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.photo-status.success { color: #2f5937; }
.photo-status.error { color: var(--danger); }

.dashboard-photo-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dashboard-photo-thumb {
  display: grid;
  gap: 0.35rem;
}

.dashboard-photo-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.mini-button {
  min-height: 2rem;
  padding: 0.32rem 0.4rem;
  font-size: 0.72rem;
}

.mini-button:disabled {
  opacity: 0.56;
  cursor: default;
}

.upload-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  background: rgba(29, 29, 29, 0.72);
}

.upload-dialog-backdrop[hidden] {
  display: none;
}

.upload-dialog {
  width: min(46rem, 100%);
  max-height: min(42rem, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  background: #fff;
  padding: clamp(1rem, 3vw, 1.3rem);
}

.upload-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.upload-dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 400;
}

.upload-dialog-head p,
.upload-dialog-note,
.upload-dialog-status {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.upload-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 9rem), 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.upload-preview-card {
  display: grid;
  gap: 0.45rem;
  border: 1px solid var(--line);
  padding: 0.55rem;
  background: #fff;
  cursor: pointer;
}

.upload-preview-card:has(input:checked) {
  border-color: var(--leaf);
  box-shadow: inset 0 0 0 2px var(--leaf);
}

.upload-preview-card input {
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.upload-preview-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--soft);
}

.upload-preview-card span {
  color: var(--leaf);
  font-size: 0.86rem;
}

.upload-preview-card small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.75rem;
}

.upload-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.upload-dialog-status.error {
  color: var(--danger);
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
  gap: 0.7rem;
}

.photo-gallery button {
  display: block;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  padding: 0;
  overflow: hidden;
  background: var(--soft);
  color: inherit;
  cursor: zoom-in;
}

.photo-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 180ms ease;
}

.photo-gallery button:hover img,
.photo-gallery button:focus-visible img {
  transform: scale(1.035);
}

.photo-lightbox {
  width: min(92vw, 72rem);
  max-height: 92dvh;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
}

.photo-lightbox::backdrop {
  background: rgba(14, 14, 14, 0.82);
  backdrop-filter: blur(3px);
}

.photo-lightbox img {
  display: block;
  width: 100%;
  max-height: 92dvh;
  object-fit: contain;
  background: #111;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.38);
}

.photo-lightbox-close {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  z-index: 2;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(29, 29, 29, 0.82);
  color: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.no-results {
  grid-column: 1 / -1;
  padding: 1.8rem;
  border: 1px solid var(--line);
  background: #fff;
}

.no-results h2 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
}

.no-results p { margin: 0; color: var(--muted); }
.no-results.standalone { margin-top: 1.4rem; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  margin: 2rem 0 0.6rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.pagination button {
  min-width: 7rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.pagination button:hover:not(:disabled) { border-color: var(--ink); }
.pagination button:disabled { opacity: 0.45; cursor: default; }

.tree-page { max-width: 72rem; }

.breadcrumb {
  margin: 1.25rem 0 0.8rem;
  font-size: 0.9rem;
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--ink); }

.detail-shell { min-height: 24rem; }

.token-page {
  width: min(42rem, calc(100vw - 1.8rem));
  margin: 2rem auto;
}

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.detail-page-card {
  border-top: 1px solid var(--line);
  padding-top: 1.2rem;
}

.detail-hero {
  display: grid;
  gap: 1rem;
}

.detail-photo {
  position: relative;
  min-height: 17rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, #e7e4dd 0%, #f8f7f4 54%, #dce5d7 100%);
}

.detail-head {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0.55rem 0.2rem;
}

.detail-head h1,
.detail-head h2 {
  margin: 0.1rem 0 0;
  font-size: clamp(1.65rem, 4vw, 2.35rem);
  line-height: 1.25;
}

.tree-number {
  margin: 0.75rem 0 0;
  color: var(--leaf);
  font-family: var(--serif);
  font-size: clamp(1.2rem, 3vw, 1.55rem);
}

.detail-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.button-link:disabled {
  opacity: 0.55;
  cursor: wait;
}

.button-link:hover {
  background: transparent;
  color: var(--ink);
}

.button-link.report-button {
  background: var(--alert);
  border-color: var(--alert);
  color: var(--paper);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
}

.button-link.report-button:hover {
  background: transparent;
  color: var(--alert);
}

.button-link.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.button-link.secondary:hover { border-color: var(--ink); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.7rem;
}

.detail-metric,
.detail-section {
  border: 1px solid var(--line);
  background: #fff;
  padding: 1rem;
}

.detail-metric span,
.detail-section h2,
.detail-section h3 {
  display: block;
  margin: 0 0 0.3rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--sans);
}

.detail-metric strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 400;
}

.detail-section {
  margin-top: 0.7rem;
}

.detail-section p {
  margin: 0;
  white-space: pre-wrap;
}

.source-list {
  display: grid;
  gap: 0.25rem;
  margin: 0;
}

.source-list div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid #efede9;
  padding: 0.35rem 0;
}

.source-list div:first-child { border-top: 0; }
.source-list dt { color: var(--muted); }
.source-list dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

.report-dialog {
  width: min(44rem, calc(100vw - 1.4rem));
  max-height: min(90dvh, 48rem);
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--page);
  color: var(--ink);
}

.report-dialog::backdrop { background: rgba(15, 15, 15, 0.72); }

.report-form {
  display: grid;
  gap: 1rem;
  padding: 1.1rem;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.report-head h2 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.dialog-x {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-size: 1.45rem;
  line-height: 1;
}

.report-tree-box {
  display: grid;
  gap: 0.1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  background: #fff;
}

.report-tree-box strong {
  color: var(--leaf);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
}

.report-tree-box span {
  color: var(--muted);
  font-size: 0.88rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
}

.report-form label {
  display: grid;
  gap: 0.3rem;
}

.report-form label.hp-field {
  position: absolute;
  left: -10000px;
  top: auto;
  display: block;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(50%);
  white-space: nowrap;
}

.report-form label span {
  color: var(--muted);
  font-size: 0.78rem;
}

.report-form input,
.report-form select,
.report-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 0.65rem 0.72rem;
}

.report-form input[readonly] {
  background: var(--soft);
  color: var(--muted);
}

.report-form textarea {
  resize: vertical;
  min-height: 8rem;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-start;
}

.report-status {
  min-height: 1.45rem;
  margin: -0.2rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.report-status.success { color: #2f5937; }
.report-status.warning { color: var(--warning); }
.report-status.error { color: var(--danger); }

.map-link {
  display: inline-block;
  margin-top: 0.65rem;
  text-decoration: underline;
  text-underline-offset: 0.24em;
  text-decoration-color: var(--line);
}

.map-link:hover { text-decoration-color: var(--ink); }

.site-footer {
  margin-top: auto;
  padding: 2rem clamp(0.9rem, 4vw, 2.5rem);
  background: var(--ink);
  color: #bdbdbd;
  font-size: 0.85rem;
}

.site-footer img {
  display: block;
  width: 68px;
  height: 30px;
  margin-bottom: 0.8rem;
}

.site-footer p {
  max-width: 42rem;
  margin: 0;
}

@media (min-width: 42rem) {
  .search-filters { grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 0.7fr) auto; }
  .summary { grid-template-columns: minmax(12rem, 1fr) minmax(18rem, 2fr); align-items: start; }
  .detail-hero { grid-template-columns: minmax(16rem, 0.72fr) minmax(0, 1fr); }
}

@media (max-width: 40rem) {
  .site-header { align-items: flex-start; flex-direction: column; }
  .header-note { display: none; }
  .header-actions { width: 100%; justify-content: flex-start; }
  .search-switch { width: 100%; }
  .search-switch a { flex: 1 1 0; justify-content: center; }
  .sort-label { margin-left: 0; width: 100%; }
  .toolbar select { flex: 1 1 100%; }
  .photo-action-buttons { display: grid; grid-template-columns: 1fr; }
  .pagination { justify-content: space-between; gap: 0.45rem; font-size: 0.82rem; }
  .pagination button { min-width: 0; padding: 0.42rem 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}



