/* Cachepoint website, D1 "topo field guide" style (matches the EFB app).
   Paper, ink and ruled lines; square corners; orange only for the main action. */
:root {
  --paper: #f3eee2;
  --paper-2: #e7e0cd;
  --field: #fbf8f1;
  --ink: #1f2a22;
  --muted: #5e6a5f;
  --rule: #cfc6b0;
  --orange: #c8572a;
  --forest: #2e5a3a;
  --sky: #3b6e8f;
  --label: "Barlow Condensed", "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Source Sans 3", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font: 16px/1.45 var(--sans); }
h2, h3 { font-family: var(--serif); margin: 0; }
button { font: inherit; color: inherit; }

.label { font-family: var(--label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-size: 14px; }
.sub { color: var(--muted); margin: 6px 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.error { color: #a83d18; }

/* ---- top bar ---- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  height: 64px; padding: 0 20px;
  background: var(--paper); border-bottom: 2px solid var(--ink);
  position: relative; z-index: 2;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand span { font-family: var(--label); font-weight: 700; font-size: 26px; letter-spacing: 0.06em; text-transform: uppercase; }
.tabs { display: flex; gap: 2px; flex: 1; }
.tab {
  border: 0; background: none; padding: 8px 12px; cursor: pointer;
  font-family: var(--label); font-weight: 600; font-size: 17px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.tab.active { color: var(--ink); box-shadow: inset 0 -3px 0 var(--orange); }

/* ---- buttons ---- */
.btn, .primary {
  border: 2px solid var(--ink); background: transparent; border-radius: 2px; padding: 9px 16px; cursor: pointer;
  font-family: var(--label); font-weight: 700; font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink);
}
.btn:hover { background: var(--paper-2); }
.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.primary:hover { filter: brightness(0.95); }
.primary:disabled { opacity: 0.6; cursor: default; }
.link, .link-btn, .back {
  border: 0; background: none; padding: 4px 0; cursor: pointer;
  font-family: var(--label); font-weight: 700; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--forest);
}

/* ---- map stage ---- */
.stage { position: relative; height: calc(100% - 64px); }
#map { position: absolute; inset: 0; }

/* The explore sheet floats over the map. */
.sheet {
  position: absolute; top: 20px; left: 20px; bottom: 20px; width: 380px;
  overflow-y: auto; background: var(--paper); border: 2px solid var(--ink);
  padding: 20px; z-index: 1;
}
.count { font-family: var(--serif); font-weight: 700; font-size: 64px; line-height: 1; margin-top: 4px; }

.search { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); background: var(--field); padding: 0 12px; margin: 6px 0 18px; }
.search input { flex: 1; border: 0; background: transparent; padding: 11px 0; font: 16px var(--sans); color: var(--ink); outline: none; }

.list-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 2px solid var(--ink); padding-bottom: 6px; }
.list { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  text-align: left; border: 0; border-bottom: 1px solid var(--rule); background: none; padding: 12px 0; cursor: pointer; width: 100%;
}
.row:hover .row-title { color: var(--orange); }
.row-title { font-family: var(--serif); font-weight: 700; font-size: 18px; }
.row-sub { grid-column: 1; color: var(--muted); font-size: 14px; }
.row-side { grid-column: 2; grid-row: 1 / span 2; font-family: var(--label); font-weight: 700; font-size: 16px; letter-spacing: 0.03em; text-align: right; }
.empty { color: var(--muted); padding: 14px 0; }

/* ---- detail ---- */
#detail h2, #view-account h2 { font-size: 30px; line-height: 1.1; margin: 8px 0 6px; }
#detail h3, #view-account h3 { font-family: var(--label); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-size: 14px; margin: 20px 0 6px; }
.hint { background: var(--field); border: 1px solid var(--rule); border-left: 4px solid var(--orange); padding: 10px 12px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin-top: 8px; }
.facts dt { font-family: var(--label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-size: 14px; }
.facts dd { margin: 0; }
.path { padding-left: 20px; margin: 4px 0; }

/* ---- account ---- */
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack input, .stack textarea, .stack select { border: 2px solid var(--ink); background: var(--field); padding: 10px 12px; font: 16px var(--sans); color: var(--ink); border-radius: 0; }
.pair-code { margin: 12px 0; }
.pair-code-value { font: 700 44px var(--label); letter-spacing: 0.14em; }
.pair-code-value.expired { text-decoration: line-through; opacity: 0.5; }
.device-row { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.device-row .row-title { font-size: 16px; }
.device-row .row-sub { grid-column: 1; }
.device-row .link-btn { grid-column: 2; grid-row: 1 / span 2; align-self: center; }

/* ---- map controls ---- */
.maplibregl-ctrl-group { border-radius: 0 !important; border: 2px solid var(--ink); box-shadow: none !important; }
.maplibregl-ctrl-attrib { background: rgba(243, 238, 226, 0.85) !important; }

.sample-banner {
  position: fixed; right: 16px; bottom: 16px; z-index: 3;
  background: var(--ink); color: var(--paper); font-family: var(--label); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 12px; font-size: 13px;
}

/* ---- phones: the sheet becomes a drawer along the bottom ---- */
@media (max-width: 760px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span { font-size: 20px; }
  .brand img { width: 32px; height: 32px; }
  .tab { padding: 8px 6px; font-size: 15px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 52%; border-width: 2px 0 0; padding: 16px; }
  .count { font-size: 44px; }
  .tabs { min-width: 0; }
  .topbar .btn { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
}
html, body { overflow-x: hidden; }


/* ---- home page: map on top, then what Cachepoint is ---- */
body.home { height: auto; overflow-y: auto; }
a.tab { text-decoration: none; display: inline-block; }
a.btn, a.primary { text-decoration: none; display: inline-block; }
.home-map { position: relative; height: 62vh; min-height: 380px; border-bottom: 2px solid var(--ink); }
#home-map { position: absolute; inset: 0; }
.home-map-card {
  position: absolute; left: 20px; bottom: 20px; width: 340px; z-index: 1;
  background: var(--paper); border: 2px solid var(--ink); padding: 18px 20px 20px;
}
.home-body { max-width: 760px; margin: 0 auto; padding: 12px 20px 48px; }
.home-section { padding: 32px 0; border-bottom: 1px solid var(--rule); }
.home-section h2 { font-size: 32px; line-height: 1.15; margin: 8px 0 10px; }
.home-section p { font-size: 18px; line-height: 1.6; margin: 0 0 10px; }
.home-section a { color: var(--forest); }
.home-steps { list-style: none; counter-reset: step; padding: 0; margin: 14px 0 0; }
.home-steps li { counter-increment: step; position: relative; padding: 14px 0 14px 64px; border-top: 2px solid var(--ink); }
.home-steps li:last-child { border-bottom: 2px solid var(--ink); }
.home-steps li::before {
  content: counter(step, decimal-leading-zero); position: absolute; left: 0; top: 12px;
  font: 700 34px/1 var(--label); color: var(--orange); letter-spacing: 0.02em;
}
.home-steps h3 { font-size: 22px; margin: 0 0 4px; }
.home-steps p { margin: 0; }
.home-footer { padding: 24px 0 0; }

@media (max-width: 760px) {
  /* On phones the card sits under the map instead of covering it. */
  .home-map { height: auto; min-height: 0; }
  #home-map { position: relative; height: 46vh; }
  .home-map-card { position: static; width: auto; border-width: 2px 0 0; padding: 16px 20px 20px; }
  .home-map-card .sub { margin-bottom: 12px; }
  .home-section h2 { font-size: 26px; }
  .home-section p { font-size: 17px; }
  .home-steps li { padding-left: 52px; }
  .home-steps li::before { font-size: 28px; }
}
.home-items { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: 1fr 1fr; border-top: 2px solid var(--ink); }
.home-items li { padding: 14px 18px 16px 0; border-bottom: 1px solid var(--rule); }
.home-items h3 { font-size: 20px; margin: 0 0 4px; }
.home-items p { font-size: 16px; margin: 0; }
@media (max-width: 760px) { .home-items { grid-template-columns: 1fr; } }

/* ---- CacheTrails (account panel) ---- */
.trail-card { border: 2px solid var(--ink); background: var(--field); padding: 14px; margin: 12px 0; }
.trail-card h2 { font-size: 24px; margin: 4px 0 10px; }
.trail-stops-head { margin-top: 14px; border-bottom: 2px solid var(--ink); padding-bottom: 4px; }
.trail-add { margin-top: 12px; }
.trail-new { margin-top: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.stack select { border: 2px solid var(--ink); background: var(--field); padding: 9px 10px; font: 15px var(--sans); color: var(--ink); }
.check input { width: auto; padding: 0; border: 0; }
.trail-save { width: 100%; margin-top: 10px; padding: 14px 16px; font-size: 18px; }
.trail-done { display: flex; gap: 10px; align-items: stretch; margin-top: 10px; }
.trail-done .trail-save { flex: 1; margin-top: 0; }
.trail-done .trail-close { display: flex; align-items: center; padding: 0 16px; }
.stamp-edit { padding: 8px 0 14px; border-bottom: 1px solid var(--rule); }
.stamp-img-row { display: flex; align-items: center; gap: 10px; }
.stamp-img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ink); }
.stop-actions { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: flex; gap: 14px; }

/* Drag the panel's right edge to make it wider (desktop only). */
.sheet-grip { position: absolute; top: 20px; bottom: 20px; left: 394px; width: 12px; cursor: ew-resize; z-index: 2; }
.sheet-grip::after { content: ""; position: absolute; top: 50%; left: 2px; width: 4px; height: 44px; margin-top: -22px; background: var(--paper); border-left: 2px solid var(--ink); border-right: 2px solid var(--ink); }
.sheet-grip:hover::after { border-color: var(--ink); }
body.resizing { cursor: ew-resize; user-select: none; }
@media (max-width: 760px) { .sheet-grip { display: none; } }

/* ---- CacheTrail editor page (trail.html) ---- */
a.row { text-decoration: none; color: inherit; }
.editor-sheet { width: 440px; }
.editor-sheet h2 { font-size: 30px; line-height: 1.1; margin: 6px 0 12px; }
.page-row .row-title { font-size: 16px; }
.stop-actions .link-btn:disabled { color: var(--rule); cursor: default; }
.book-preview {
  position: absolute; top: 20px; right: 20px; bottom: 20px; width: 340px; z-index: 1;
  overflow-y: auto; background: var(--paper); border: 2px solid var(--ink); padding: 16px;
}
.pv-wrap { margin: 10px auto 12px; overflow: hidden; padding: 0 6px 6px 0; box-sizing: content-box; }
.pv-sheet { position: relative; width: 300px; height: 420px; box-sizing: border-box; transform-origin: 0 0; }
.pv-sheet.cover { box-shadow: 4px 6px 0 rgba(31, 42, 34, 0.25); }
.pv-coverart { position: absolute; inset: 0; }
.pv-covertext { position: absolute; left: 45px; width: 220px; top: 56px; text-align: center; }
.pv-coverlabel { font: 700 15px var(--label); letter-spacing: 0.3em; text-transform: uppercase; }
.pv-covertitle { font: 700 24px/1.15 var(--serif); margin-top: 6px; }
.pv-coversub { position: absolute; left: 45px; width: 220px; top: 372px; text-align: center; font: 13px var(--label); letter-spacing: 0.08em; text-transform: uppercase; }
.pv-sheet.page { border: 2px solid var(--ink); padding: 16px 18px; box-shadow: 4px 6px 0 rgba(31, 42, 34, 0.18); overflow: hidden; }
.pv-head { font: 700 12px var(--label); letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding-bottom: 5px; margin-bottom: 12px; }
.pv-title { font: 700 21px/1.2 var(--serif); }
.pv-at { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pv-text { font-size: 14px; line-height: 1.45; margin-top: 10px; }
.pv-about { font: 15px/1.5 var(--serif); max-height: 340px; overflow-y: auto; }
.pv-info { font-family: var(--sans); font-size: 14px; margin-top: 8px; white-space: pre-line; max-height: 300px; }
.pv-stamp { position: absolute; left: 50%; bottom: 20px; width: 139px; height: 139px; margin-left: -69px; transform: rotate(-9deg); }
.pv-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pv-pageno { font: 13px var(--label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pv-nav .btn:disabled { opacity: 0.35; cursor: default; }
.pv-colors { display: flex; gap: 8px; margin-top: 8px; }
.pv-swatch { width: 30px; height: 30px; border: 2px solid var(--paper); outline: 2px solid transparent; cursor: pointer; padding: 0; }
.pv-swatch.on { outline-color: var(--ink); }
/* The stamp (same build as the EFB's) */
.st { position: absolute; left: 0; top: 0; box-sizing: border-box; border-radius: 50%; opacity: 0.9; }
.st-inner { position: absolute; border-radius: 50%; }
.st-logo, .st-img { position: absolute; }
.st-img { border-radius: 50%; object-fit: cover; }
.st-ch { position: absolute; display: block; text-align: center; white-space: nowrap; font-family: var(--label); font-weight: 700; letter-spacing: 0; }
@media (max-width: 1100px) {
  .book-preview { position: static; width: auto; border-width: 2px 0 0; max-height: none; }
}
@media (max-width: 760px) {
  .editor-sheet { width: auto; }
}
@media (max-width: 1100px) { .editor-page .maplibregl-ctrl-top-right { right: 0; } }

@media (max-width: 1100px) { .editor-page .sheet-grip { display: none; } }
.trail-save:disabled { background: var(--paper-2); border-color: var(--rule); color: var(--muted); opacity: 1; cursor: default; filter: none; }

/* ---- plain pages without the map (My CacheTrails) ---- */
body.doc-page { height: auto; overflow-y: auto; }
.trails-page { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
.trails-page h1 { font-family: var(--serif); font-size: 40px; line-height: 1.1; margin: 6px 0 14px; }
.trails-page h2 { font-size: 30px; margin: 8px 0 12px; }
