/* ── Reset & base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'EB Garmond';
  font-size: 16px;
  line-height: 1.6;
  color: #1a1a1a;
  background: #f7f5f0;
  background-image: url("../the_garden/art/desk.jpg");
  background-attachment: scroll; 

  background-position: center bottom;
  height: fit-content; 
  min-height: 100vh;
  padding-bottom: 100px;
}

/* ── Layout ───────────────────────────────── */
header {
  background: transparent;
  background-image: url("../the_garden/art/paper.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: -1;
  max-width: 400px;
  font-family: 'EB Garmond';
  color: black;
  padding: 1.5rem 2rem;
  
}

header p {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}

main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 2rem 3rem;
  
  position: relative;
  z-index: 0;
}

main::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("../the_garden/art/paper.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
}

.divider {
  margin: 5px;
  min-height: 20px;
  background-image: url("../the_garden/art/divider.png");
  background-size: cover;
  background-repeat: repeat-x;
}

.thin-divider {
  margin: 5px;
  min-height: 5px;
  background-image: url("../the_garden/art/thin-divider.png");
  background-size: cover;
  background-repeat: repeat-x;
}

/* ── Search ───────────────────────────────── */

#unsaved-banner {
  background: #fff3cd;
  color: #7a5000;
  border-bottom: 1px solid #f0d080;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

#unsaved-banner button {
  background: #7a5000;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
}

#unsaved-banner button:hover {
  background: #5a3a00;
}

.button-89 {
  --b: 1px;   /* border thickness */
  --s: .2em; /* size of the corner */
  --color: black;
  
  padding: calc(.5em + var(--s)) calc(.9em + var(--s));
  color: var(--color);
  --_p: var(--s);
  background:
    conic-gradient(from 90deg at var(--b) var(--b),#0000 90deg,var(--color) 0)
    var(--_p) var(--_p)/calc(100% - var(--b) - 2*var(--_p)) calc(100% - var(--b) - 2*var(--_p));
  transition: .3s linear, color 0s, background-color 0s;
  outline: var(--b) solid #0000;
  outline-offset: .6em;
  font-size: 12px;
  font-family: 'EB Garmond';

  border: 0;

  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.button-89:hover,
.button-89:focus-visible{
  --_p: 0;
  outline-color: var(--color);
  outline-offset: .05em;
}

.button-89:active {
  background: var(--color);
  color: #fff;
}

#login-password {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: 'EB Garmond';
  font-size: 1rem;
  border: none;
  border-bottom: 1px solid black;
  background: transparent;
  outline: none;
  transition: border-color 0.2s;
  }
  
#login-password:focus { border-bottom: 1px solid #2d5a27; }

#search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border-bottom: 1px solid black;
  background: transparent;
  outline: none;
  transition: border-color 0.2s;
}

#search-input:focus { border-bottom: 1px solid #2d5a27; }

#type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.75rem;
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 4px 14px;
  font-family: 'EB Garmond';
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: black solid 1px;
  transition: background 0.15s;
}

.filter-btn:hover {
  text-shadow: #ffcc00 1px 0 10px;
}

.filter-btn[data-type="plant"]   { color: #2d5a27; }
.filter-btn[data-type="insect"]  { color: #7a5000;  }
.filter-btn[data-type="bird"]    { color: #1a4a7a;  }
.filter-btn[data-type="mammal"]  { color: #4a1a7a;  }
.filter-btn[data-type="fungus"]  { color: #7a3010;  }
.filter-btn[data-type="other"]   { color: #444;  }

.filter-btn[data-type="plant"].active   { border-bottom: #2d5a27 solid 1px; color: #2d5a27; }
.filter-btn[data-type="insect"].active  { border-bottom: #7a5000 solid 1px; color: #7a5000; }
.filter-btn[data-type="bird"].active    { border-bottom: #1a4a7a solid 1px; color: #1a4a7a; }
.filter-btn[data-type="mammal"].active  { border-bottom: #4a1a7a solid 1px; color: #4a1a7a; }
.filter-btn[data-type="fungus"].active  { border-bottom: #7a3010 solid 1px; color: #7a3010; }
.filter-btn[data-type="other"].active   { border-bottom: #444 solid 1px;    color: #444; }

.filter-btn.active {
  color: black;
  font-style: italic;
}

#search-results {
  background: transparent;
  list-style: none;
  margin-top: 0.5rem;
  overflow: hidden;
}

#search-results:empty { display: none; }

#search-results li {
  background: transparent;
  border-bottom: #484848 solid 1px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.1s;
}

#search-results li:hover {border-bottom: 1px solid black; text-shadow: #ffcc00 1px 0 10px;}
#search-results li:last-child { border-bottom: 1px solid black; }


.searchable-select {
  position: relative;
  width: 100%;
}

.searchable-select-selected {
  padding: 0.4rem 2rem 0.4rem 0.4rem;
  border-bottom: 1px solid black;
  cursor: pointer;
  font-family: 'EB Garamond';
  font-size: 0.95rem;
  color: #1a1a1a;
  background: transparent;
  user-select: none;
}

.searchable-select-selected::after {
  content: '∨';
  position: absolute;
  right: 0.4rem;
  font-size: 0.7rem;
  color: #555;
}

.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background-image: url("../the_garden/art/dark-news.png");
  background-size: cover;
  border: none;
  padding: 0.25rem 0;
}

.searchable-select-dropdown.open {
  display: block;
}

.searchable-select-search {
  width: 100%;
  padding: 0.4rem 0.8rem;
  border: none;
  border-bottom: 1px solid #b8a98a;
  background: transparent;
  font-family: 'EB Garamond';
  font-size: 0.9rem;
  outline: none;
}

.searchable-select-options {
  max-height: 180px;
  overflow-y: auto;
}

.searchable-select-option {
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  font-family: 'EB Garamond';
  font-size: 0.95rem;
  color: #1a1a1a;
  transition: background 0.1s;
}

.searchable-select-option:hover {
  text-shadow: #ffcc00 1px 0 10px;
}

.searchable-select-option.selected {
  font-style: italic;
  color: #2d5a27;
}

.searchable-select-option.hidden-option {
  display: none;
}


/* ── Type badges ──────────────────────────── */
.badge {
  font-family: 'EB Garmond';
  font-style: italic;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;

}

.badge-group { 
  background: transparent; 
  color: #555; 
  font-style: italic;
  border: 1px solid #aaa;
  border-radius: 2px;
}

.badge-plant    { background: transparent; color: #2d5a27; }
.badge-insect   { background: transparent; color: #7a5000; }
.badge-bird     { background: transparent; color: #1a4a7a; }
.badge-mammal   { background: transparent; color: #4a1a7a; }
.badge-fungus   { background: transparent; color: #7a3010; }
.badge-other    { background: transparent; color: #444; }

/* ── Entry detail panel ───────────────────── */
#entry-panel { 
  margin-top: 1.5rem; 
  background: transparent;
  }
  
#entry-panel::after {
  content: '';
  display: table;
  clear: both;
}

#entry-header {
  background: transparent;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

#entry-image {
  float: right;
  max-width: 200px;
  margin: 0 0 0.5rem 1.5rem;
  border-radius: 4px;
}

#entry-name    { font-family: 'EB Garamond'; font-size: 1.6rem; margin: 0.4rem 0 0.2rem; }
#entry-scientific { color: #343231; font-style: italic; }

#entry-description {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  color: #333;
}

.char-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.char-name {
  font-weight: 600;
  color: #555;
  min-width: 120px;
  text-transform: capitalize;
}

.char-value {
  color: #333;
}

/* ── Relationships ────────────────────────── */
#entry-relationships h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #555;
  margin: 1.25rem 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.8rem;
}

.rel-card {
  background: transparent;
  border-bottom: #484848 1px solid;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background 0.15s;
}

.rel-card:hover {
  background: transparent;
  border-bottom: black 1px solid;
}

.rel-label {
  font-size: 0.75rem;
  font-style: italic;
  color: black;
  min-width: 110px;
}

.rel-name { font-weight: 500; }

.note-edit-btn {
  background: transparent;
  border-bottom: 1px solid #ccc;
  border-radius: 4px;
  color: #888;
  cursor: pointer;
  font-size: 0.75rem;
  padding: 2px 6px;
  transition: background 0.15s, border-bottom 0.15s;
}

.note-edit-btn:hover {
  background: transparent;
  border-bottom: black 1px solid;
  color: #2d5a27;
}

/* ── Add form ─────────────────────────────── */
#add-section {
  background: transparent;
  padding: 1.5rem;
  margin-top: 1.5rem;
}

#add-section h2 { margin-bottom: 1rem; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin: 1rem 0 0.3rem;
}

input[type="text"],
input[type="search"],
textarea {
  background: transparent;
  width: 100%;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: none;
  border-bottom: black 1px solid;
  transition: border-bottom 0.2s;
}

input:focus, textarea:focus {  outline: none; border: none; border-bottom: #2d5a27 1px solid; }

select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  border-bottom: 1px solid black;
  padding: 0.4rem 2rem 0.4rem 0.4rem;
  font-family: 'EB Garamond';
  font-size: 0.95rem;
  color: #1a1a1a;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23333' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.4rem center;
  width: 100%;
}

select:focus {
  outline: none;
  border-bottom: 1px solid #2d5a27;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-selected {
  padding: 0.4rem 2rem 0.4rem 0.4rem;
  border-bottom: 1px solid black;
  cursor: pointer;
  font-family: 'EB Garamond';
  font-size: 0.95rem;
  color: #1a1a1a;
  background: transparent;
  user-select: none;
}

.custom-select-selected::after {
  content: '∨';
  position: absolute;
  right: 0.4rem;
  font-size: 0.7rem;
  color: #555;
}

.custom-select-options {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background-image: url("../the_garden/art/paper.png");
  background-size: 100% 100%;
  border: 1px solid #b8a98a;
  padding: 0.25rem 0;
}

.custom-select-options.open {
  display: block;
}

.custom-select-option {
  padding: 0.4rem 0.2rem;
  margin: 20px;
  cursor: pointer;
  font-family: 'EB Garamond';
  font-size: 0.95rem;
  color: #1a1a1a;
  border: none;
  border-bottom: #808080 1px solid;
  transition: border-bottom 0.1s;
}

.custom-select-option:hover {
  border-bottom: black 1px solid;
}

.custom-select-option.selected {
  font-style: italic;
  color: #2d5a27;
}

/* ── Floating add button ──────────────────── */

#add-btn {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  width: 200px;
  z-index: 10;
}

#add-btn .art {
  width: 100%;
  height: auto;
}

/* ── Utility ──────────────────────────────── */
.hidden { display: none !important; }