/* Overhead — the aircraft above you as a print. No map, no radar, no table. */

:root {
  --paper: #f6f2e7;
  --paper-2: #efe9da;
  --ink: #26231c;
  --ink-soft: #5d574a;
  --ink-faint: #948c79;
  --rule: #c8bfa8;
  --rule-strong: #8f846b;
  --accent: #8a5a2b;
  --danger: #9c2f24;
  --font-plate: 'IM Fell English', Georgia, 'Times New Roman', serif;
  --font-sc: 'IM Fell English SC', Georgia, serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-plate);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#app { height: 100dvh; position: relative; }

/* ---------- the print ---------- */

main { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3vh 4vw; }

.print {
  margin: 0;
  width: min(100%, 980px);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
}

.print-inner {
  border: 2.5px solid var(--ink);
  outline: 1px solid var(--rule-strong);
  outline-offset: -7px;
  padding: clamp(10px, 2.2vmin, 22px);
  background: var(--paper);
  position: relative;
}

/* corner ticks like an engraved plate frame */
.print-inner::before,
.print-inner::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--rule-strong);
  border-style: solid;
}
.print-inner::before { top: 9px; left: 9px; border-width: 1.5px 0 0 1.5px; }
.print-inner::after { bottom: 9px; right: 9px; border-width: 0 1.5px 1.5px 0; }

.print-img {
  position: relative;
  aspect-ratio: 3 / 2;
  max-height: 62dvh;
  margin: 0 auto;
  width: fit-content;
  max-width: 100%;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.print-img img {
  max-width: 100%;
  max-height: 62dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  filter: sepia(.14) contrast(.96) brightness(1.02) saturate(.82);
}

.ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink-faint);
}
.ph svg { width: 38%; opacity: .45; }
.ph .ph-line { position: absolute; bottom: 12%; font-style: italic; font-size: clamp(11px, 1.6vmin, 15px); color: var(--ink-faint); }

.print-cap { padding: clamp(8px, 1.6vmin, 16px) 4px 0; text-align: center; }

.genus {
  margin: 0;
  font-family: var(--font-sc);
  font-size: clamp(24px, 4.6vmin, 44px);
  line-height: 1.05;
  letter-spacing: .01em;
}
.genus em { font-style: italic; }

.species {
  margin: 2px 0 0;
  font-style: italic;
  font-size: clamp(13px, 2.1vmin, 19px);
  color: var(--ink-soft);
}

.particulars {
  margin: clamp(6px, 1.2vmin, 12px) auto 0;
  max-width: 72ch;
  font-size: clamp(11.5px, 1.75vmin, 15.5px);
  color: var(--ink-soft);
  line-height: 1.5;
}
.particulars b { color: var(--ink); font-weight: normal; }

.credit {
  margin: clamp(5px, 1vmin, 10px) 0 0;
  font-size: clamp(10px, 1.5vmin, 13px);
  color: var(--ink-faint);
  font-style: italic;
}
.credit a { color: inherit; text-decoration: underline dotted; }

.plate-no {
  margin: clamp(6px, 1.4vmin, 14px) 0 0;
  text-align: center;
  font-family: var(--font-sc);
  font-size: clamp(11px, 1.7vmin, 15px);
  color: var(--ink-faint);
  letter-spacing: .08em;
}

.print.emerg .genus { color: var(--danger); }
.print.emerg .print-inner { border-color: var(--danger); }

/* ---------- the filmstrip ---------- */

.strip {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  gap: 8px;
  padding: 10px 16px 12px;
  overflow-x: auto;
  background: linear-gradient(to top, var(--paper) 65%, transparent);
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }

.strip .s {
  flex: 0 0 auto;
  width: 74px;
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 3px 3px 16px;
  position: relative;
  cursor: pointer;
  transition: border-color .15s;
}
.strip .s:hover, .strip .s.on { border-color: var(--rule-strong); }
.strip .s.on::after {
  content: '';
  position: absolute; left: 3px; right: 3px; bottom: 6px;
  border-bottom: 1.5px solid var(--accent);
}
.strip .s img { display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover; filter: sepia(.14) saturate(.82); }
.strip .s .s-sil { display: grid; place-items: center; width: 100%; aspect-ratio: 3/2; color: var(--ink-faint); }
.strip .s .s-sil svg { width: 55%; opacity: .5; }
.strip .s .s-cs {
  position: absolute; bottom: 2px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.strip-empty {
  align-self: center;
  margin: 0 auto;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
}

/* ---------- controls ---------- */

.fab {
  position: fixed;
  top: 14px;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  cursor: pointer;
  z-index: 30;
  transition: color .15s, border-color .15s;
}
.fab:hover { color: var(--ink); border-color: var(--ink); }
.fab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.fab svg { width: 21px; height: 21px; }

#btnCfg { right: 14px; }
#btnNext { right: 64px; }

/* ---------- error banner ---------- */

.errban {
  position: fixed;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 7px 16px;
  border: 1px solid var(--danger);
  border-radius: 4px;
  background: var(--paper);
  color: var(--danger);
  font-size: 12.5px;
  max-width: min(92vw, 560px);
  text-align: center;
}

/* ---------- dialog ---------- */

.cfg {
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  padding: 20px 22px 16px;
  width: min(94vw, 440px);
  box-shadow: 0 16px 50px rgba(40,35,20,.25);
}
.cfg::backdrop { background: rgba(40, 36, 25, .45); }

.cfg h2 {
  margin: 0 0 14px;
  font-family: var(--font-sc);
  font-size: 21px;
  font-weight: normal;
}

.cfg label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cfg input, .cfg select {
  font: 500 14px var(--font-mono);
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 9px 10px;
  width: 100%;
}
.cfg input:focus-visible, .cfg select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cfg input:disabled { opacity: .45; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; align-items: end; }

.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule-strong); border-radius: 5px; overflow: hidden; margin-bottom: 14px; }
.seg-btn {
  font: 500 11.5px var(--font-mono);
  padding: 9px 6px;
  background: var(--paper);
  border: 0;
  color: var(--ink-soft);
  cursor: pointer;
}
.seg-btn.on { background: var(--ink); color: var(--paper); }

.chk {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 2px 0 14px;
  font-family: var(--font-plate);
  font-size: 13.5px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
}
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }

.actions { display: flex; justify-content: space-between; gap: 10px; }

.btn {
  font: 500 12.5px var(--font-mono);
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 5px;
  padding: 10px 15px;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink); }
.btn.primary { border-color: var(--ink); }

.note { margin: 12px 0 0; font-size: 11.5px; color: var(--ink-soft); min-height: 1em; font-family: var(--font-mono); }

/* ---------- responsive ---------- */

@media (max-width: 700px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100dvh; }
  main { padding: 5vh 5vw 110px; }
  .print-img img { max-height: 48dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none !important; }
}

.fade-in { animation: fadein .8s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
