/* theCougs.com: Go Cougs map
   Crimson, gray and gray variations from WSU's brand palette (brand.wsu.edu/colors).
   Crimson is never tinted or blended into gray, per the guide. Wheat is a small
   Palouse accent (badges only), well under the guide's 10% accent budget. */

:root {
  --crimson: #A60F2D;
  --crimson-deep: #7A0B21;
  --gray: #4D4D4D;
  --gray-line: #CCCCCC;
  --fog: #EBEBEB;
  --wheat: #E2C48E;
  --ink: #1F1F1F;
  --paper: #FFFFFF;

  --display: "Graduate", "Rockwell", Georgia, serif;
  --body: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --panel-w: 420px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--fog);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--crimson); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
/* Sheet titles get focus only so screen readers start there; no ring needed. */
#sheet-title:focus { outline: none; }

#map { position: fixed; inset: 0; z-index: 1; background: #E6E6E6; }


/* ── Top bar ─────────────────────────────────────────────── */

.top {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0;
  padding: calc(var(--safe-top) + 10px) 16px 28px;
  background: linear-gradient(rgba(235, 235, 235, .96) 60%, rgba(235, 235, 235, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 40px; }
.wordmark { display: flex; align-items: center; gap: 6px; text-decoration: none; min-width: 0; }
.wordmark img { display: block; width: auto; flex-shrink: 1; min-width: 0; }
.wm-mark { height: 44px; flex-shrink: 0; }
.wm-word { height: 28px; }
@media (max-width: 400px) { .wm-mark { height: 38px; } .wm-word { height: 22px; } }
.stats { margin: 2px 0 0; font-size: .95rem; width: fit-content; color: var(--gray); font-weight: 500; }
.stats b { color: var(--ink); font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 18px;
  background: var(--paper); color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: .95rem;
  box-shadow: 0 1px 0 var(--gray-line), 0 2px 8px rgba(31, 31, 31, .08);
}

.me-btn {
  height: 36px; min-width: 36px; padding: 0 14px; border-radius: 18px; border: 0;
  background: var(--crimson); color: #fff; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.me-btn.has-avatar { padding: 0; width: 40px; height: 40px; border-radius: 50%; background: none; }
.me-btn { position: relative; }
.me-btn .avatar { width: 40px; height: 40px; font-size: .95rem; box-shadow: 0 0 0 2px #fff, 0 2px 8px rgba(31, 31, 31, .2); }
.me-badge {
  position: absolute; top: -4px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--wheat); color: var(--ink); border: 2px solid #fff;
  font-size: .75rem; font-weight: 700; line-height: 16px; text-align: center;
}

.install-pill {
  display: inline-flex; align-items: center; margin: 6px 0 0; border-radius: 18px;
  background: var(--paper); box-shadow: 0 1px 0 var(--gray-line), 0 2px 8px rgba(31, 31, 31, .1);
}
.install-pill[hidden] { display: none; }
.install-pill button {
  border: 0; background: none; cursor: pointer; color: var(--crimson);
  display: inline-flex; align-items: center; gap: 6px;
}
#install-open { padding: 7px 4px 7px 12px; font-weight: 700; font-size: .92rem; }
#install-x { padding: 7px 10px 7px 6px; color: var(--gray); }

.steps { list-style: none; counter-reset: step; margin: 6px 0 0; padding: 0; }
.steps li {
  counter-increment: step; position: relative; padding: 12px 0 12px 46px; min-height: 48px;
  border-top: 1px solid var(--fog); font-size: 1.05rem;
}
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 10px;
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--crimson); color: #fff; font-family: var(--display); font-size: 1rem;
}
.steps .ico { display: inline-block; vertical-align: -5px; margin: 0 2px; color: #0A84FF; }
.install-card {
  margin: 18px 0 0; padding: 14px; border-radius: 14px; background: var(--fog); text-align: left;
}
.install-card p { margin: 0 0 10px; }

.demo-note {
  display: inline-block; margin: 6px 0 0; padding: 3px 10px; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: .82rem;
}


/* ── The button ──────────────────────────────────────────── */

.dock {
  position: fixed; z-index: 10; left: 16px; right: 16px;
  bottom: calc(var(--safe-bottom) + 16px);
  max-width: 520px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}
.ticker {
  align-self: center; max-width: 100%;
  border: 0; border-radius: 18px; padding: 7px 14px;
  background: rgba(255, 255, 255, .94); color: var(--ink);
  font-size: .92rem; text-align: left; cursor: pointer;
  box-shadow: 0 2px 10px rgba(31, 31, 31, .12);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ticker b { color: var(--crimson); }

.go {
  min-height: 92px; width: 100%;
  border: 0; border-radius: 20px;
  background: var(--crimson); color: #fff;
  font-family: var(--display); font-size: clamp(2.1rem, 10vw, 2.7rem); line-height: 1;
  letter-spacing: .02em;
  box-shadow: 0 6px 0 var(--crimson-deep), 0 16px 30px rgba(122, 11, 33, .32);
  cursor: pointer;
  transition: transform .08s ease-out, box-shadow .08s ease-out;
}
.go:active { transform: translateY(5px); box-shadow: 0 1px 0 var(--crimson-deep), 0 6px 14px rgba(122, 11, 33, .28); }

body.sheet-open .dock { visibility: hidden; }


/* ── Sheet (bottom sheet on phones, side panel on desktop) ─ */

.sheet {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: min(86dvh, 86vh);
  display: flex; flex-direction: column;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(31, 31, 31, .2);
  animation: sheet-up .24s cubic-bezier(.2, .8, .2, 1);
}
.sheet.compact { max-height: 58dvh; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }

.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--gray-line); margin: 8px auto 0; flex-shrink: 0; }
.sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--fog); color: var(--gray); cursor: pointer;
  display: grid; place-items: center;
}
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 10px 20px calc(var(--safe-bottom) + 22px);
}

@media (min-width: 960px) {
  .sheet {
    left: 16px; right: auto; top: calc(var(--safe-top) + 100px); bottom: 16px;
    width: var(--panel-w); max-width: none; max-height: none; margin: 0;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(31, 31, 31, .18);
    animation-name: panel-in;
  }
  .sheet.compact { max-height: none; }
  .sheet-grip { display: none; }
  .sheet-body { padding: 18px 24px 24px; }
  @keyframes panel-in { from { transform: translateX(-24px); opacity: 0; } }

  .dock { left: 16px; right: auto; width: var(--panel-w); margin: 0; }
  .ticker { align-self: flex-start; }
}


/* ── Sheet content ───────────────────────────────────────── */

.sheet h2 {
  font-family: var(--display); font-weight: 400;
  font-size: 1.55rem; line-height: 1.15;
  margin: 6px 48px 6px 0; color: var(--crimson);
}
.sheet h3 { font-size: 1.05rem; margin: 22px 0 8px; }
.lede { margin: 0 0 14px; color: var(--gray); }
.lede strong { color: var(--ink); }

label { display: block; font-weight: 600; margin: 16px 0 6px; }
label .opt { font-weight: 400; color: var(--gray); }
.hint { margin: 6px 0 0; font-size: .9rem; color: var(--gray); }
.hint.bad { color: var(--crimson); font-weight: 600; }

input[type=text], input[type=email], input[type=number], input[type=date], textarea {
  width: 100%; font: inherit; font-size: 17px; /* 16px+ stops iOS zoom */
  padding: 12px 14px; border: 2px solid var(--gray-line); border-radius: 12px;
  background: #fff; color: var(--ink);
}
input:focus, textarea:focus { border-color: var(--crimson); outline: none; }
input:focus-visible, textarea:focus-visible { box-shadow: 0 0 0 3px var(--fog); }
textarea { resize: none; min-height: 80px; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; font-weight: 600; }

.at-field { position: relative; }
.at-field span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--gray); font-weight: 600; }
.at-field input { padding-left: 32px; }

.count-hint { text-align: right; }

.row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  flex: 1; min-height: 54px; padding: 0 18px; border-radius: 14px; border: 2px solid transparent;
  font-weight: 700; font-size: 1.08rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: var(--crimson); color: #fff; }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-quiet { flex: 0 0 auto; background: transparent; color: var(--ink); border-color: var(--gray-line); }
.btn-small { min-height: 38px; font-size: .95rem; padding: 0 12px; border-radius: 10px; flex: 0 0 auto; }
.link-btn { border: 0; background: none; padding: 0; color: var(--crimson); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.status { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; color: var(--gray); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wheat); flex-shrink: 0; }
.dot.ok { background: #3C8D5A; }
.dot.warn { background: var(--crimson); }
.dot.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }


/* ── Welcome ─────────────────────────────────────────────── */

.welcome-art {
  margin: 4px -20px 16px; aspect-ratio: 1400 / 758;
  background: url("img/palouse.jpg") center / cover no-repeat, var(--wheat);
}
@media (min-width: 960px) { .welcome-art { margin: -18px -24px 18px; border-radius: 18px 18px 0 0; } }
.welcome h2 { font-size: 1.9rem; }
.fine { font-size: .85rem; color: var(--gray); margin: 16px 0 0; }


/* ── Logged ──────────────────────────────────────────────── */

.planted { text-align: center; padding-top: 8px; }
.planted h2 { margin-right: 0; }
.big-number {
  font-family: var(--display); color: var(--crimson);
  font-size: clamp(3.6rem, 18vw, 5.2rem); line-height: 1; margin: 10px 0 4px;
  letter-spacing: -.01em;
}
.planted .lede { max-width: 32ch; margin: 8px auto 0; }


/* ── People + lists ──────────────────────────────────────── */

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: var(--gray); color: #fff;
  font-family: var(--display); font-size: 1rem; line-height: 1;
  object-fit: cover;
}
.avatar.lg { width: 96px; height: 96px; font-size: 2rem; }
.avatar.sm { width: 32px; height: 32px; font-size: .8rem; }

.person { display: flex; align-items: center; gap: 12px; }
.handle { font-weight: 700; color: var(--ink); text-decoration: none; }
.handle:hover { text-decoration: underline; }
.class-of { color: var(--gray); font-size: .92rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 14px 0; border-top: 1px solid var(--fog); }
.list > li:first-child { border-top: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; }
.item-main { min-width: 0; flex: 1; }
.item-place { font-weight: 700; }
.item-story { margin: 2px 0 0; }
.item-meta { margin: 3px 0 0; font-size: .9rem; color: var(--gray); }
.item-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fly { border: 0; background: none; padding: 0; text-align: left; cursor: pointer; width: 100%; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; padding: 1px 8px; border-radius: 6px;
  background: var(--wheat); color: var(--ink); vertical-align: 1px;
}
.badge.no { background: var(--fog); color: var(--gray); }
.badge.era { background: var(--gray); color: #fff; }

.tabs { display: flex; gap: 6px; margin: 4px 0 10px; }
.tab {
  border: 0; background: var(--fog); color: var(--gray);
  padding: 8px 16px; border-radius: 18px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.tab[aria-selected=true] { background: var(--ink); color: #fff; }

.rank { font-family: var(--display); color: var(--gray); width: 2ch; text-align: right; flex-shrink: 0; padding-top: 10px; }
.rank.podium { color: var(--crimson); }
.lb-count { font-family: var(--display); font-size: 1.3rem; color: var(--crimson); padding-top: 6px; }

.profile-head { display: flex; gap: 16px; align-items: center; margin: 6px 48px 4px 0; }
.profile-head h2 { margin: 0; font-size: 1.35rem; overflow-wrap: anywhere; }
@media (max-width: 400px) { .profile-head .avatar.lg { width: 76px; height: 76px; } }
.tally { display: flex; gap: 22px; margin: 16px 0 6px; }
.tally div { font-size: .92rem; color: var(--gray); }
.tally b { display: block; font-family: var(--display); font-weight: 400; font-size: 1.7rem; color: var(--ink); line-height: 1.1; }

.avatar-pick { display: flex; align-items: center; gap: 14px; margin-top: 6px; }

.empty { text-align: center; color: var(--gray); padding: 24px 8px; }
.empty p { margin: 0 0 14px; }


/* ── Map flags ───────────────────────────────────────────── */

.flag-icon { background: none; border: 0; }
.flag-icon svg { display: block; overflow: visible; filter: drop-shadow(0 1px 1px rgba(31, 31, 31, .35)); }
.flag-icon.classmate svg .cloth { fill: var(--gray); }
.flag-icon.pending svg .cloth { fill: #fff; stroke: var(--crimson); stroke-width: 2; stroke-dasharray: 3 2; }
.flag-icon.dim { opacity: .18; }
.flag-icon.drop svg { animation: drop .55s cubic-bezier(.3, 1.6, .5, 1) both; transform-origin: 4px 33px; }
@keyframes drop {
  0% { transform: translateY(-60px) scale(.9); opacity: 0; }
  60% { opacity: 1; }
  100% { transform: none; }
}

.draft-pin svg { filter: drop-shadow(0 4px 6px rgba(31, 31, 31, .35)); }

.cluster {
  display: grid; place-items: center; border-radius: 50%;
  background: var(--crimson); color: #fff;
  border: 3px solid #fff; box-shadow: 0 2px 8px rgba(31, 31, 31, .3);
  font-family: var(--display); font-size: .95rem;
  position: relative;
}
/* a gray dot on clusters that hold Cougs from your era */
.cluster-era {
  position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--gray); border: 2px solid #fff;
}

.leaflet-container { font-family: var(--body); }
.leaflet-container a.handle { color: var(--crimson); }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: 0 6px 24px rgba(31, 31, 31, .2); }
.leaflet-popup-content { margin: 12px 14px; font-size: 1rem; line-height: 1.35; min-width: 200px; }
.pop .person { gap: 10px; margin-bottom: 8px; }
.pop .item-place { display: block; }
.pop .item-story { display: block; }
.pop .era-note { display: block; margin: -2px 0 6px; font-size: .9rem; font-weight: 600; color: var(--gray); }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-bottom.leaflet-right { bottom: calc(var(--safe-bottom) + 150px); }
@media (min-width: 960px) { .leaflet-bottom.leaflet-right { bottom: 0; } }


/* ── Toast ───────────────────────────────────────────────── */

.toast {
  position: fixed; z-index: 50; left: 50%; top: calc(var(--safe-top) + 96px);
  transform: translateX(-50%); max-width: calc(100% - 32px);
  padding: 10px 16px; border-radius: 12px; background: var(--ink); color: #fff;
  font-size: .95rem; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
