/* Tree Huggers: web 1.0 bones, 8-bit skin. */
:root {
  --bg: #f6f1e1;
  --panel: #fffdf5;
  --ink: #1a1a1a;
  --link: #0000ee;
  --visited: #551a8b;
  --leaf: #3fa34d;
  --leaf-dark: #2a7a37;
  --bark: #7a4a24;
  --sky: #60a8e8;
  --warn: #ffffc0;
  --pixel: "Press Start 2P", "Courier New", Courier, monospace;
  --mono: "Courier New", Courier, monospace;
}
html {
  background-color: #2b4a2e;
  background-image:
    linear-gradient(45deg, #27432a 25%, transparent 25%, transparent 75%, #27432a 75%),
    linear-gradient(45deg, #27432a 25%, transparent 25%, transparent 75%, #27432a 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}
body {
  margin: 0;
  padding: 16px 8px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
}
.page {
  max-width: 960px;
  margin: 0 auto;
  background: var(--bg);
  border: 3px solid var(--ink);
  box-shadow: 8px 8px 0 #000;
  padding: 12px 18px 18px;
}
h1, h2, h3, .pixel, .nav, .logo, button, .btn, .counter, th {
  font-family: var(--pixel);
  letter-spacing: 0;
}
h1 { font-size: 18px; line-height: 1.5; margin: 18px 0 12px; }
h2 { font-size: 13px; line-height: 1.6; margin: 24px 0 10px; color: var(--leaf-dark); }
th { font-size: 10px; text-align: left; }
a { color: var(--link); }
a:visited { color: var(--visited); }
hr.thick { border: 0; border-top: 3px solid var(--ink); margin: 10px 0; }
.small { font-size: 12px; }
.muted { color: #666; }
.px { image-rendering: pixelated; image-rendering: crisp-edges; vertical-align: middle; }
code { background: #fff; border: 1px solid #aaa; padding: 1px 4px; font-size: 13px; }

/* header */
.header td { vertical-align: middle; }
.logo { text-decoration: none; color: var(--ink); font-size: 16px; line-height: 1.4; display: inline-flex; align-items: center; gap: 10px; }
.logo span { color: var(--leaf-dark); text-shadow: 3px 3px 0 #bdb; }
.tagline { font-size: 12px; color: #555; margin-top: 4px; }
.nav { font-size: 10px; line-height: 2.2; }
.nav.small { font-family: var(--mono); font-size: 12px; line-height: 1.6; }
form.inline { display: inline; }
button.link { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; box-shadow: none; }
button.link:hover { color: #f00; }

.music-controls { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.music-name { font-family: var(--pixel); font-size: 8px; color: var(--leaf-dark); opacity: 0; transition: opacity .4s; white-space: nowrap; }
.music-name.show { opacity: 1; }
button.music {
  display: inline-block; width: 36px; height: 34px; padding: 2px 0 0; line-height: 0;
  background: var(--panel); border: 2px solid var(--ink); box-shadow: 2px 2px 0 #000;
  margin-bottom: 6px;
}
button.music:hover { background: #fff; }
button.music svg { display: block; margin: auto; }
button.music .slash { display: none; }
button.music:not(.on) .waves { display: none; }
button.music:not(.on) .slash { display: block; }
button.music:not(.on) .cone { fill: #9a9a9a; }

html.loading, html.loading a { cursor: progress; }
html.loading .page { opacity: .85; }

/* flashes */
.flash { border: 3px double var(--ink); background: var(--warn); padding: 8px 12px; margin: 10px 0; }
.flash-ok { background: #d8f5c8; }
.flash-warn { background: #ffd6d6; }
.flash ul { margin: 6px 0 0 18px; }
.notice { border: 2px dashed var(--ink); padding: 6px 10px; background: var(--panel); }
.err { color: #b00000; font-size: 12px; margin-top: 4px; }
.hint { font-size: 12px; color: #555; margin-top: 4px; }

/* tables */
table.data { border-collapse: collapse; background: var(--panel); max-width: 100%; }
table.data td { overflow-wrap: anywhere; }
table.data th, table.data td { border: 2px solid var(--ink); padding: 6px 8px; vertical-align: middle; }
table.data th { background: #e3dcc5; }
.thumb-cell { width: 64px; text-align: center; }
img.thumb { border: 2px solid var(--ink); object-fit: cover; display: inline-block; background: #fff; }
.thumb-placeholder { opacity: .7; }
table.recent td { vertical-align: top; }

/* forms */
table.form th { width: 110px; padding: 10px 10px 10px 0; vertical-align: top; padding-top: 14px; }
table.form td { padding: 8px 0; }
input[type=text], input[type=password], textarea {
  font-family: var(--mono); font-size: 15px; border: 2px solid var(--ink); background: #fff; padding: 6px 8px; box-shadow: inset 2px 2px 0 #ccc;
  max-width: 100%;
}
input[type=file] { font-family: var(--mono); font-size: 13px; }
textarea { width: 100%; box-sizing: border-box; }
button, .btn {
  display: inline-block; font-size: 10px; border: 3px solid var(--ink); background: #e8e0c8; color: var(--ink);
  box-shadow: 3px 3px 0 #000; padding: 9px 12px; cursor: pointer; text-decoration: none; line-height: 1.4;
}
button:hover, .btn:hover { background: #fff; }
button:active, .btn:active { transform: translate(3px, 3px); box-shadow: none; }
button.primary { background: var(--leaf); color: #fff; }
button.primary:hover { background: var(--leaf-dark); }
button.danger { background: #d9534f; color: #fff; }
button:disabled, button.busy { cursor: wait; opacity: .7; transform: translate(3px, 3px); box-shadow: none; }
button.busy { min-width: 11em; text-align: left; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; opacity: 0; }
.loc-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; font-size: 13px; }
.actions { margin-top: 12px; display: flex; gap: 10px; align-items: center; }

/* species picker */
.chip {
  display: inline-block; border: 2px solid var(--ink); background: #dff0d0; padding: 3px 7px; margin: 2px 4px 2px 0;
  font-size: 13px; color: var(--ink); text-decoration: none; box-shadow: 2px 2px 0 #000;
}
.chip:visited { color: var(--ink); }
.chip .x { margin-left: 6px; cursor: pointer; font-weight: bold; color: #900; }
.chip img { width: 16px; height: 16px; vertical-align: -3px; border: 1px solid var(--ink); margin-right: 4px; }
#species-chips:empty { display: none; }
#species-chips { margin-bottom: 6px; }
.results { position: relative; }
.results ul { list-style: none; margin: 0; padding: 0; position: absolute; z-index: 1000; background: #fff; border: 2px solid var(--ink); box-shadow: 4px 4px 0 #000; min-width: 280px; max-width: 100%; }
.results li { padding: 6px 8px; cursor: pointer; border-bottom: 1px dotted #999; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.results li:hover { background: #dff0d0; }
.results li img { width: 28px; height: 28px; border: 1px solid var(--ink); flex: none; }
.results li .sci { color: #666; font-style: italic; }
.nearby { margin-top: 10px; padding: 8px; background: var(--panel); border: 2px dotted var(--ink); }
.nearby .chip { cursor: pointer; background: #fff; }
.nearby .chip:hover { background: #dff0d0; }
.nearby .chip.used { opacity: .4; cursor: default; }
.nearby .n { color: #666; font-size: 11px; }

/* maps */
.map { border: 3px solid var(--ink); background: var(--sky); box-shadow: 6px 6px 0 #000; }
.map-big { height: 520px; }
.map-medium { height: 340px; margin-bottom: 14px; }
.map-small { height: 220px; margin-top: 12px; }
.map-picker { height: 280px; max-width: 560px; }
.map-wrap { margin-top: 12px; }
.map-legend { margin-top: 12px; }
.leaflet-container { font-family: var(--mono); font-size: 12px; }
.leaflet-tile { image-rendering: pixelated; image-rendering: crisp-edges; }
.leaflet-control-zoom a, .leaflet-bar, .leaflet-control-attribution, .leaflet-popup-content-wrapper, .leaflet-popup-tip {
  border-radius: 0 !important;
}
.leaflet-bar { border: 2px solid var(--ink) !important; box-shadow: 3px 3px 0 #000 !important; }
.leaflet-bar a { font-family: var(--pixel); font-size: 12px; color: var(--ink); border-bottom-color: var(--ink) !important; }
.leaflet-control-attribution { font-size: 10px; border: 2px solid var(--ink); border-right: 0; border-bottom: 0; }
.leaflet-popup-content-wrapper { border: 3px solid var(--ink); box-shadow: 4px 4px 0 #000; background: var(--panel); }
.leaflet-popup-content { margin: 10px 12px; line-height: 1.4; }
.leaflet-popup-tip { border: 3px solid var(--ink); border-top: 0; border-left: 0; background: var(--panel); }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink); font-family: var(--pixel); font-size: 12px; }
.popup b { font-family: var(--pixel); font-size: 9px; line-height: 1.6; }
.popup img { display: block; border: 2px solid var(--ink); margin: 6px 0; width: 120px; height: 120px; object-fit: cover; }
.popup .species { font-style: italic; color: #444; }
.leaflet-marker-icon.th-tree { image-rendering: pixelated; filter: drop-shadow(2px 2px 0 rgba(0,0,0,.5)); }

/* show page */
table.show td { padding: 0 0 12px 0; }
.show-photo { width: 55%; padding-right: 18px !important; }
img.photo { max-width: 100%; border: 3px solid var(--ink); box-shadow: 6px 6px 0 #000; display: block; }
.no-photo { border: 3px dashed var(--ink); padding: 40px 10px; text-align: center; background: var(--panel); }
.prose { background: var(--panel); border: 2px solid var(--ink); padding: 10px 14px; max-width: 70ch; }

/* error page */
.error-page { text-align: center; padding: 24px 10px 12px; }
.error-art { margin-bottom: 8px; filter: drop-shadow(4px 4px 0 rgba(0,0,0,.25)); }
.error-art svg { transform: rotate(-12deg); }
.error-page p { max-width: 48ch; margin: 10px auto; }
.error-detail { background: var(--panel); border: 2px dashed var(--ink); padding: 8px; display: inline-block; max-width: 70ch; text-align: left; }
.error-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 18px auto; }

/* footer */
.footer { margin-top: 8px; font-size: 12px; }
.counter { display: inline-block; background: #000; color: #3f3; font-size: 11px; padding: 5px 7px; letter-spacing: 3px; border: 2px solid #777; vertical-align: middle; }
marquee { display: block; background: #000; color: #ff0; padding: 4px; font-family: var(--pixel); font-size: 9px; margin-top: 12px; }

/* ---- mobile ---- */
input[type=text], input[type=password], textarea { font-size: 16px; } /* 16px stops iOS zooming into fields */

@media (max-width: 700px) {
  body { padding: 6px 4px; font-size: 14px; }
  .page { padding: 10px 10px 14px; border-width: 2px; box-shadow: 4px 4px 0 #000; }
  h1 { font-size: 14px; }
  h2 { font-size: 11px; }
  .header td { display: block; text-align: left !important; }
  .nav-cell { margin-top: 8px; }
  .nav { font-size: 9px; line-height: 2.6; }
  .nav.small { font-size: 12px; }
  .logo { font-size: 13px; }
  .map-big { height: 62vh; min-height: 300px; box-shadow: 3px 3px 0 #000; }
  .map-medium { height: 260px; }
  .map-small { height: 200px; }
  .map-picker { height: 260px; max-width: none; }
  .map { box-shadow: 3px 3px 0 #000; }
  table.show td { display: block; width: auto; padding-right: 0 !important; }
  .show-photo { width: auto; }
  img.photo { box-shadow: 4px 4px 0 #000; }
  table.form th { display: block; width: auto; padding: 10px 0 2px; }
  table.form td { display: block; padding: 0 0 6px; }
  table.form input[type=text], table.form input[type=password] { width: 100%; box-sizing: border-box; }
  .loc-row { gap: 8px; }
  .loc-row label { display: flex; align-items: center; gap: 4px; flex: 1; }
  .loc-row input[type=text] { width: 100%; }
  #use-location { width: 100%; }
  .results ul { min-width: 0; width: 100%; box-sizing: border-box; }
  button, .btn { padding: 12px 14px; }
  button.primary { width: 100%; box-sizing: border-box; }
  table.data td, table.data th { padding: 5px 6px; }
  .thumb-cell { width: 54px; }
  .hide-mobile { display: none; }
  table.data { width: 100%; }
  .chip { white-space: normal; }
  .nav-cell .music-controls { position: absolute; top: 10px; right: 10px; margin: 0; }
  .page { position: relative; }
  .footer td { display: block; text-align: left !important; padding: 4px 0; }
  .prose { max-width: none; }
  .popup img { width: 100px; height: 100px; }
}
