:root {
  --bg: #f6f1e7;
  --paper: #fffaf0;
  --ink: #2b2a26;
  --muted: #6d6a60;
  --gum: #5b7a63;
  --gum-deep: #34503d;
  --ochre: #c27a3a;
  --sky: #cfe0e3;
  --line: #e2d9c6;
  --shadow: 0 1px 2px rgba(43, 42, 38, .06), 0 6px 24px rgba(43, 42, 38, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a17;
    --paper: #1f231f;
    --ink: #ece6d8;
    --muted: #a39f92;
    --gum: #8fb39a;
    --gum-deep: #b9d4c0;
    --ochre: #e0a066;
    --sky: #23302f;
    --line: #2f352f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.65 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
a { color: var(--gum-deep); text-underline-offset: 3px; }
a:hover { color: var(--ochre); }
img, svg { max-width: 100%; display: block; }

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* header */
.site-head { padding: 22px 0 0; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand b { font-size: 21px; letter-spacing: .2px; }
.leaf { width: 30px; height: 30px; cursor: pointer; transition: transform .25s ease; user-select: none; }
.leaf:active { transform: rotate(-18deg) scale(.92); }
.leaf.falling { animation: leaf-fall 2.4s ease-in forwards; }
@keyframes leaf-fall {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  30% { transform: translate(30px, 80px) rotate(60deg); }
  60% { transform: translate(-20px, 180px) rotate(-30deg); }
  100% { transform: translate(10px, 320px) rotate(90deg); opacity: 0; }
}
nav a { font: 15px/1 system-ui, -apple-system, "Segoe UI", sans-serif; margin-left: 18px; text-decoration: none; color: var(--muted); }
nav a:hover, nav a[aria-current] { color: var(--ink); }

/* hero */
.hero { position: relative; margin: 18px 0 8px; border-radius: 18px; overflow: hidden; background: var(--sky); box-shadow: var(--shadow); }
.hero svg { width: 100%; height: auto; }
.hero .caption { position: absolute; left: 24px; bottom: 20px; right: 24px; color: #fffaf0; text-shadow: 0 1px 12px rgba(0,0,0,.35); }
.hero h1 { margin: 0; font-size: clamp(28px, 5vw, 46px); line-height: 1.1; }
.hero p { margin: 6px 0 0; font-size: 17px; max-width: 34ch; }
.stars, .fireflies { opacity: 0; transition: opacity 1.2s ease; }
body.night .stars, body.night .fireflies { opacity: 1; }
body.night .day-sky { opacity: 0; }
.day-sky { transition: opacity 1.2s ease; }
.firefly { animation: drift 6s ease-in-out infinite alternate; }
.firefly:nth-child(2n) { animation-duration: 8s; }
.firefly:nth-child(3n) { animation-duration: 5s; animation-delay: -2s; }
@keyframes drift { to { transform: translate(14px, -10px); opacity: .25; } }

/* content */
main { padding-bottom: 40px; }
.intro { font-size: 19px; max-width: 62ch; margin: 28px 0 6px; }
h2 { font-size: 26px; margin: 42px 0 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.trails { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.trail {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: var(--shadow);
}
.trail h3 { margin: 0 0 2px; font-size: 19px; line-height: 1.3; }
.trail .where { font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.trail p { margin: 10px 0; font-size: 16px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; font: 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; }
.chip { padding: 6px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.timtams { letter-spacing: 1px; }
details { margin-top: 8px; }
summary { cursor: pointer; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--gum-deep); }
details p { font-size: 15px; }

.log { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.log li { padding: 0 0 16px 18px; position: relative; }
.log li::before { content: ""; position: absolute; left: -7px; top: 9px; width: 12px; height: 12px; border-radius: 50%; background: var(--gum); border: 2px solid var(--bg); }
.log time { font: 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); display: block; margin-bottom: 2px; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 13px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* footer */
.site-foot { border-top: 1px solid var(--line); padding: 22px 0 40px; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--muted); }
.site-foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; }
.wombat { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.wombat svg { width: 34px; height: 22px; transition: transform .2s; }
.wombat:hover svg { transform: translateX(3px); }

/* toast + effects */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--ink); color: var(--bg);
  padding: 12px 16px; border-radius: 12px; max-width: min(440px, calc(100vw - 32px));
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.dropbear { position: fixed; top: -60px; font-size: 38px; z-index: 40; pointer-events: none; animation: drop 2.8s cubic-bezier(.4, .0, .8, .6) forwards; }
@keyframes drop { to { transform: translateY(115vh) rotate(25deg); } }
.echo { position: fixed; z-index: 45; pointer-events: none; font-style: italic; color: var(--gum-deep); animation: echo 2.6s ease-out forwards; }
@keyframes echo { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.8); } }

/* campfire */
body.campfire { background: #0d1117; color: #e9e2d0; }
body.campfire a { color: #f0b071; }
.sky-canvas { position: fixed; inset: 0; z-index: -1; }
.campfire main { min-height: 80vh; }
.fire { font-size: 54px; text-align: center; animation: flicker 1.4s infinite alternate; }
@keyframes flicker { from { transform: scale(1) rotate(-2deg); filter: brightness(1); } to { transform: scale(1.06) rotate(2deg); filter: brightness(1.25); } }
.story { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .08); border-radius: 14px; padding: 18px 20px; margin: 16px 0; }

/* 404 */
.lost { text-align: center; padding: 60px 0 30px; }
.compass { width: 120px; height: 120px; margin: 0 auto 18px; animation: spin 3s cubic-bezier(.3, 1.6, .6, 1) forwards; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(1060deg); } }

@media (max-width: 560px) {
  body { font-size: 16px; }
  nav a { margin: 0 14px 0 0; }
  .hero .caption { left: 16px; right: 16px; bottom: 14px; }
  .hero p { font-size: 15px; }
  .hero svg { height: 260px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- secrets ---------- */
.hero .caption { pointer-events: none; }
.sun { cursor: pointer; }

/* trail markers: small orange triangles, like the real ones nailed to trees */
.marker { display: inline-flex; vertical-align: middle; width: 14px; height: 14px; padding: 0; margin: 0 2px; border: 0; background: none; cursor: pointer; opacity: .55; transition: opacity .2s, transform .2s; }
.marker svg { width: 100%; height: 100%; }
.marker path, .svg-marker path { fill: #e07b2a; }
.marker:hover, .svg-marker:hover { opacity: 1; transform: scale(1.25); }
.svg-marker { cursor: pointer; opacity: .8; transform-box: fill-box; transform-origin: center; transition: transform .2s; }
.marker.found, .svg-marker.found { opacity: .25; }
.marker-badge { position: fixed; left: 14px; bottom: 14px; z-index: 30; background: var(--paper); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 6px 11px; font: 13px/1 system-ui, -apple-system, "Segoe UI", sans-serif; text-decoration: none; box-shadow: var(--shadow); }

/* honest version */
.trail { display: flex; flex-direction: column; }
.honest-btn { align-self: flex-start; margin-top: 10px; background: none; border: 1px dashed var(--line); color: var(--muted); border-radius: 8px; padding: 4px 8px; font: 12px/1.3 system-ui, -apple-system, "Segoe UI", sans-serif; cursor: pointer; }
.honest-btn:hover { color: var(--ink); border-color: var(--muted); }
.trail.flipped { background: repeating-linear-gradient(var(--paper), var(--paper) 27px, var(--line) 28px); }
.trail.flipped .blurb { font-style: italic; }

/* magpie */
.magpie { position: fixed; z-index: 60; width: 72px; cursor: pointer; transition: transform .9s cubic-bezier(.5, 0, .3, 1); }
.magpie svg { width: 72px; height: 45px; }

/* leech */
.leech { position: fixed; right: 18px; bottom: 70px; z-index: 35; width: 40px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; animation: inch 2.2s ease-in-out infinite; }
.leech svg { width: 40px; height: 14px; }
.leech.salted { animation: none; transform: translateY(40px) rotate(70deg); opacity: 0; transition: transform .8s, opacity .8s; }
@keyframes inch { 0%, 100% { transform: translateX(0) scaleX(1); } 50% { transform: translateX(-10px) scaleX(.75); } }

/* ranger terminal */
.term-open { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; padding: 2px 7px; font: 12px/1.4 ui-monospace, Menlo, Consolas, monospace; cursor: pointer; }
.term-open:hover { color: var(--ink); }
.term { position: fixed; left: 50%; top: 50%; z-index: 70; width: min(560px, calc(100vw - 24px)); transform: translate(-50%, -46%); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; background: #10140f; color: #b8e0a8; border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45); font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; overflow: hidden; }
.term.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }
.term-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #1b2219; color: #8fa886; font-size: 12px; }
.term-x { background: none; border: 0; color: #8fa886; font-size: 18px; line-height: 1; cursor: pointer; }
.term-out { margin: 0; padding: 12px; height: 240px; overflow-y: auto; white-space: pre-wrap; word-break: break-word; font: inherit; }
.term-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #1f281d; }
.term-in { flex: 1; background: none; border: 0; outline: 0; color: #e3f5da; font: inherit; }

/* certificate */
.certificate { text-align: center; padding: 34px 26px; border: 6px double var(--gum); background: var(--paper); border-radius: 6px; }
.certificate h2 { margin: 6px 0; font-size: clamp(24px, 4vw, 34px); }
.cert-name { display: block; font-size: clamp(26px, 5vw, 40px); font-style: italic; color: var(--gum-deep); margin: 10px 0; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.cert-seal { font-size: 46px; }
.cert-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.cert-controls input, .cert-controls button { font: 15px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.cert-controls button { cursor: pointer; }
@media print {
  .site-head, .site-foot, .cert-controls, .marker-badge, .toast, .cert-intro { display: none !important; }
  body { background: #fff; color: #000; }
  .certificate { border-color: #34503d; }
}
