/* Docentary — museum ticket timeline theme (parchment / slate / terracotta) */

:root {
  --primary: #2e3a3f;
  --parchment: #f4ebdd;
  --paper: #fbf5ea;
  --accent: #c77a3b;
  --accent-deep: #a25f27;
  --ink: #2e3a3f;
  --ink-soft: #5b676c;
  --ink-faint: #8a9296;
  --line: #d8c9ae;
  --slate: #46586b;
  --ochre: #c29a3c;
  --rust: #a75232;
  --sage: #6e7f5a;
  --danger: #8f3b2a;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--parchment);
  background-image: repeating-linear-gradient(
    0deg, rgba(46, 58, 63, 0.02) 0, rgba(46, 58, 63, 0.02) 1px, transparent 1px, transparent 4px);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.45;
}

button { font: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); overflow: hidden;
}

/* ---------- stack layout ---------- */

#stack {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px calc(96px + env(safe-area-inset-bottom));
}

.view { animation: none; }

.view-head { padding: 6px 2px 14px; }

.view-title {
  margin: 0 0 2px;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--primary);
}

.view-sub {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-style: italic;
}

.section-title {
  margin: 26px 2px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

/* ---------- Wall: admission ticket rail ---------- */

.ticket-rail { margin: 4px 0 18px; }

.rail-stub {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 12px 18px 14px;
}

/* punch-hole notches on the rail stub's top edge */
.rail-stub::before,
.rail-stub::after {
  content: '';
  position: absolute;
  top: -9px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--parchment);
  border: 1.5px solid var(--primary);
}
.rail-stub::before { left: 22px; }
.rail-stub::after { right: 22px; }

.rail-kicker {
  display: block;
  text-align: center;
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-deep);
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
  margin-bottom: 10px;
}

.rail-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.counter { display: flex; align-items: center; gap: 10px; }

.counter-num {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}

.counter-cap {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  line-height: 1.35;
}

.rail-perf {
  align-self: stretch;
  border-left: 2px dashed var(--line);
  margin: 2px 0;
}

.med-ring {
  width: 44px; height: 44px;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--parchment);
}

/* ---------- Wall: wide terracotta action strip ---------- */

.strip-action {
  display: block;
  width: 100%;
  padding: 15px 18px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff7ec;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--accent-deep);
  -webkit-appearance: none;
  appearance: none;
}
.strip-action:active { transform: translateY(1px); box-shadow: none; }

/* ---------- Wall: recent mini stubs ---------- */

.recent-rail { list-style: none; margin: 0; padding: 0; }

.mini-stub {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px 10px 16px;
  margin-bottom: 10px;
}

.mini-perf {
  position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  border-left: 2px dashed var(--line);
}

.mini-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mini-venue {
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mini-exhibit {
  font-size: 0.8rem;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mini-date {
  flex: 0 0 auto;
  font-size: 0.72rem;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

/* ---------- era colors (shared) ---------- */

.era-slate .era-strip, .era-slate .mini-perf { border-color: var(--slate); }
.era-slate .date-medallion { border-color: var(--slate); color: var(--slate); }

.era-ochre .era-strip, .era-ochre .mini-perf { border-color: var(--ochre); }
.era-ochre .date-medallion { border-color: var(--ochre); color: var(--accent-deep); }

.era-rust .era-strip, .era-rust .mini-perf { border-color: var(--rust); }
.era-rust .date-medallion { border-color: var(--rust); color: var(--rust); }

.era-sage .era-strip, .era-sage .mini-perf { border-color: var(--sage); }
.era-sage .date-medallion { border-color: var(--sage); color: var(--sage); }

/* ---------- Trail: perforated ticket stubs ---------- */

.trail {
  list-style: none;
  margin: 0;
  padding: 2px 0 2px 18px;
  position: relative;
}

/* vertical timeline thread */
.trail::before {
  content: '';
  position: absolute;
  left: 8px; top: 10px; bottom: 10px;
  border-left: 2px dashed var(--line);
}

.stub-row {
  position: relative;
  display: flex;
  align-items: stretch;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.era-strip {
  flex: 0 0 6px;
  border-left-width: 0;
}

.stub-row::before {
  /* timeline node dot */
  content: '';
  position: absolute;
  left: -16px; top: 22px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--parchment);
  border: 2px solid var(--accent);
}

.date-medallion {
  flex: 0 0 auto;
  align-self: center;
  margin: 10px 10px 10px 12px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--parchment);
  line-height: 1;
}

.med-day { font-size: 1.05rem; font-weight: 700; }
.med-mon { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px; }

.stub-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 12px 14px 12px 2px;
}

.stub-venue {
  margin: 0 0 2px;
  font-size: 1.02rem;
  color: var(--primary);
  overflow-wrap: anywhere;
}

.stub-date {
  margin: 0 0 4px;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
}

.stub-exhibit {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.stub-note {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.stub-controls {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.stub-btn {
  padding: 8px 14px;
  min-height: 40px;
  border: 1px solid var(--primary);
  border-radius: 8px;
  background: var(--parchment);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.stub-btn:active { background: var(--primary); color: var(--parchment); }

.stub-btn-danger { border-color: var(--danger); color: var(--danger); }
.stub-btn-danger:active { background: var(--danger); color: var(--parchment); }

.stub-notch {
  flex: 0 0 14px;
  border-left: 2px dashed var(--line);
}

/* ---------- Log: gallery-label form ---------- */

.gallery-label {
  background: var(--paper);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  position: relative;
}

.gallery-label::before {
  /* plaque pin */
  content: '';
  position: absolute;
  top: -8px; left: 50%;
  margin-left: -8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--parchment);
  border: 1.5px solid var(--primary);
}

.field { margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

.req { color: var(--accent-deep); }

.field-input {
  display: block;
  width: 100%;
  padding: 12px 12px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf7;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(199, 122, 59, 0.25);
}

textarea.field-note { resize: vertical; min-height: 96px; line-height: 1.5; }

.field-error {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.form-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: #f6e3dc;
  color: var(--danger);
  font-size: 0.85rem;
}

.form-actions { display: flex; flex-direction: column; gap: 10px; }

.form-save { box-shadow: none; }

.btn-ghost,
.btn-danger {
  padding: 12px 16px;
  min-height: 44px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.btn-ghost { border: 1px solid var(--primary); color: var(--primary); }
.btn-danger { border: 1px solid var(--danger); color: var(--danger); }

.btn-ghost:active { background: var(--primary); color: var(--parchment); }
.btn-danger:active { background: var(--danger); color: var(--parchment); }

.form-foot {
  margin: 12px 0 0;
  font-size: 0.74rem;
  color: var(--ink-faint);
  text-align: center;
  font-style: italic;
}

/* ---------- Find: search + venue index ---------- */

.search-rack { margin: 0 0 16px; }

.search-box { border-width: 1.5px; border-color: var(--primary); }

.find-index { list-style: none; margin: 0; padding: 0; }

.find-row { margin-bottom: 10px; }

.find-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 56px;
  text-align: left;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 10px;
  color: var(--ink);
  cursor: pointer;
  gap: 1px;
}
.find-link:active { background: var(--parchment); }

.find-venue { font-weight: 700; color: var(--primary); }

.find-exhibit {
  font-size: 0.84rem;
  color: var(--ink-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.find-date {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ---------- About panel ---------- */

.about-panel {
  margin-top: 30px;
  padding-top: 4px;
  border-top: 1px dashed var(--line);
}

.about-line { margin: 0 0 10px; font-size: 0.88rem; color: var(--ink-soft); }
.about-line strong { color: var(--primary); }

.about-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Empty states ---------- */

.empty {
  margin-top: 18px;
  padding: 22px 18px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  background: rgba(251, 245, 234, 0.6);
}

.empty-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
}

.empty-body {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---------- Bottom tab plaques ---------- */

.tab-plaques {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  max-width: 480px;
  margin: 0 auto;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--parchment);
  border-top: 1.5px solid var(--primary);
  box-shadow: 0 -4px 12px rgba(46, 58, 63, 0.12);
}

.plaque {
  flex: 1 1 0;
  min-height: 52px;
  padding: 8px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--parchment);
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.plaque.is-active {
  background: var(--paper);
  color: var(--primary);
  border-color: var(--accent);
  border-bottom: 3px solid var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 4px 8px rgba(46, 58, 63, 0.22);
}

.plaque:active { color: var(--primary); }

/* ---------- keyboard / small-screen niceties ---------- */

@media (max-width: 340px) {
  .counter-num { font-size: 1.7rem; }
  .med-ring { width: 38px; height: 38px; font-size: 0.9rem; }
}

input[type="date"] { min-height: 46px; }
