/* Munu's Birds — watercolor-paper aesthetic */

:root {
  --bg: #faf6ee;
  --paper: #ffffff;
  --paper-2: #f3ede0;
  --ink: #2a2520;
  --ink-soft: #665c50;
  --ink-faint: #a69c8d;
  --accent: #4a7b78;
  --accent-hover: #3b6663;
  --accent-complete-bg: #dcefe7;
  --accent-complete-fg: #2a6a56;
  --accent-painting-bg: #f7e7c4;
  --accent-painting-fg: #8a6b1e;
  --rule: #e6dfd0;
  --shadow-sm: 0 1px 2px rgba(42, 37, 32, 0.04), 0 4px 16px rgba(42, 37, 32, 0.06);
  --shadow-lg: 0 1px 2px rgba(42, 37, 32, 0.04), 0 8px 24px rgba(42, 37, 32, 0.10);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.30);
  --radius: 10px;
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* -- Entry / welcome screen -- */
.entry-screen {
  position: fixed;
  inset: 0;
  background-color: var(--bg);
  background-image: url('assets/birds-bg.svg');
  background-repeat: repeat;
  background-size: 600px 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.entry-screen[hidden] { display: none; }
.entry-content {
  max-width: 440px;
  width: 100%;
  text-align: center;
}
.entry-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 40px;
  margin: 0 0 32px;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.entry-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.entry-input {
  width: 100%;
  max-width: 300px;
  padding: 14px 18px;
  font: inherit;
  font-size: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  text-align: center;
}
.entry-input:focus { outline: none; border-color: var(--accent); }
.entry-submit {
  font: inherit;
  font-size: 15px;
  padding: 12px 36px;
  border-radius: 999px;
  border: none;
  background: var(--ink);
  color: var(--bg);
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.entry-submit:hover { background: #000; }
.entry-submit:disabled { opacity: 0.6; cursor: default; }
.entry-error {
  color: #a54b3a;
  font-size: 13px;
  margin: 0;
}
@media (max-width: 500px) {
  .entry-title { font-size: 30px; }
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg);
  background-image: url('assets/birds-bg.svg');
  background-repeat: repeat;
  background-size: 600px 600px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
}

img { display: block; max-width: 100%; }

/* -- Header -- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px 40px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  flex-wrap: wrap;
  gap: 16px;
}
.site-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  margin: 0;
  letter-spacing: 0.01em;
}
.view-tabs { display: flex; gap: 4px; }
.view-tab {
  background: none;
  border: none;
  font: inherit;
  color: var(--ink-soft);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.view-tab:hover { background: var(--paper-2); }
.view-tab.active { background: var(--ink); color: var(--bg); }
.view-tab .count {
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.view-tab.active .count { background: rgba(255, 255, 255, 0.18); color: var(--bg); }

/* -- Layout -- */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 40px;
}

/* -- Filters -- */
.filters {
  font-size: 14px;
  position: sticky;
  top: 110px;
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter-group { margin-bottom: 22px; }
.filter-group h3 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 8px;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.filters label.filter-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  margin: 0;
  line-height: 1.4;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
}
.filter-option input { margin: 0; accent-color: var(--accent); }
.filter-option .count {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.filter-option:hover { color: var(--ink); }
.filter-option.empty,
.filter-option.empty * {
  color: #c9c9c9 !important;
  font-style: normal !important;
  font-weight: normal !important;
  text-decoration: none !important;
}
.filter-option.empty:hover { color: #c9c9c9 !important; }
.filter-option.empty input { opacity: 0.55; }

/* -- Search -- */
.search-bar { margin-bottom: 20px; }
#search {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  transition: border-color 0.15s;
}
#search:focus { outline: none; border-color: var(--accent); }

/* -- Cards -- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.card {
  background: var(--paper);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-img-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--paper-2);
}
.card-img-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center top;
}
.card-body { padding: 12px 14px 14px; }
.card-name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 2px;
  color: var(--ink);
}
.card-sci {
  font-size: 12px;
  font-style: italic;
  color: var(--ink-faint);
  margin: 0 0 8px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-soft);
  gap: 8px;
}
.card-continent { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.status-to-paint { background: var(--paper-2); color: var(--ink-soft); }
.status-painting { background: var(--accent-painting-bg); color: var(--accent-painting-fg); }
.status-complete { background: var(--accent-complete-bg); color: var(--accent-complete-fg); }

.empty {
  text-align: center;
  color: var(--ink-faint);
  padding: 60px 20px;
  font-style: italic;
}

/* -- Modal -- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 37, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--paper);
  border-radius: var(--radius);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-modal);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: none;
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  z-index: 1;
}
.modal-close:hover { background: var(--rule); }
.modal-body { padding: 36px 40px 32px; }

.detail-name {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}
.detail-sci {
  font-style: italic;
  color: var(--ink-soft);
  margin: 0 0 16px;
  font-size: 16px;
}
.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}
.tag {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  font-size: 12px;
}
.detail-description {
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 24px;
}

.bio-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0;
}
.bio-tab {
  background: none;
  border: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink-faint);
  padding: 8px 14px;
  cursor: pointer;
  position: relative;
  top: 1px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.bio-tab:hover { color: var(--ink-soft); }
.bio-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 500;
}

.bio-content { margin-bottom: 24px; }
.bio-text {
  display: none;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink);
}
.bio-text.active { display: block; }
.bio-text p { margin: 0 0 14px; }
.bio-text p:last-child { margin-bottom: 0; }
.detail-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.detail-photo {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--paper-2);
  cursor: zoom-in;
}
.detail-photo img {
  width: 100%; height: 100%;
  object-fit: contain;
  transition: transform 0.2s;
}
.detail-photo:hover img { transform: scale(1.03); }

.credits {
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0 0 24px;
  line-height: 1.7;
}
.credits a {
  color: var(--ink-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.credits a:hover { color: var(--accent); }

.action-row { display: flex; justify-content: center; padding-top: 8px; }
.status-selector {
  display: inline-flex;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.status-btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.status-btn:hover:not(.active) { color: var(--ink); background: rgba(255,255,255,0.5); }
.status-btn.active { cursor: default; }
.status-btn.active[data-status="to-paint"] { background: var(--ink); color: var(--bg); }
.status-btn.active[data-status="painting"] { background: var(--accent-painting-fg); color: #fff; }
.status-btn.active[data-status="complete"] { background: var(--accent); color: #fff; }
.status-btn:active:not(.active) { transform: scale(0.97); }

.status-note {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 12px;
}

/* -- Password modal -- */
.password-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 37, 32, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 20px;
}
.password-backdrop[hidden] { display: none; }
.password-modal {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 28px 28px 22px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-modal);
}
.password-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
  margin: 0 0 6px;
  color: var(--ink);
}
.password-hint {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 16px;
  line-height: 1.5;
}
.password-modal input {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-sizing: border-box;
}
.password-modal input:focus {
  outline: none;
  border-color: var(--accent);
}
.password-error {
  color: #a54b3a;
  font-size: 13px;
  margin: 10px 0 0;
}
.password-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}
.password-btn {
  font: inherit;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.password-cancel {
  background: var(--paper-2);
  color: var(--ink);
}
.password-cancel:hover { background: var(--rule); }
.password-submit {
  background: var(--accent);
  color: #fff;
}
.password-submit:hover { background: var(--accent-hover); }

/* -- Lightbox -- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 15, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* -- Responsive -- */
@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 20px;
  }
  .filters {
    order: 2;
    padding-top: 20px;
    border-top: 1px solid var(--rule);
  }
  .site-header { padding: 20px; }
  .site-title { font-size: 22px; }
  .view-tabs { width: 100%; overflow-x: auto; }
  .modal-body { padding: 24px 20px 20px; }
  .detail-name { font-size: 24px; }
}
