/* SkywayHero */

:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5f6b78;
  --line: #dfe3e6;
  --primary: #0b6e4f;
  --primary-ink: #ffffff;
  --primary-soft: #e3f1eb;
  --accent: #e08a1e;
  --danger: #b3261e;
  --warn-bg: #fff4dd;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 2px 8px rgba(16, 24, 32, .05);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #1a2027;
    --text: #e7ebef;
    --muted: #9aa6b2;
    --line: #2c343d;
    --primary: #3fb68b;
    --primary-ink: #0c1512;
    --primary-soft: #1d3a30;
    --accent: #f0a23b;
    --danger: #f2827a;
    --warn-bg: #3a2f16;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--primary); text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.9rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
p { margin: 0 0 .75rem; }
code { font-size: .9em; background: var(--primary-soft); padding: .1em .35em; border-radius: 6px; }

/* Layout */

.topbar {
  display: flex; align-items: center; gap: 1.25rem;
  padding: .75rem clamp(1rem, 4vw, 2rem);
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.brand-mark {
  width: 22px; height: 14px; border-radius: 4px; background: var(--primary);
  box-shadow: inset 0 -4px 0 rgba(255, 255, 255, .35);
}
.mainnav { display: flex; gap: .25rem; flex-wrap: wrap; }
.mainnav a { color: var(--muted); text-decoration: none; padding: .35rem .65rem; border-radius: 8px; font-weight: 500; }
.mainnav a:hover { background: var(--primary-soft); color: var(--text); }
.mainnav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }
.who { margin-left: auto; display: flex; align-items: center; gap: .75rem; white-space: nowrap; }
.who .me { color: var(--text); font-weight: 600; text-decoration: none; }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 1rem 1rem 2rem; }

.grid.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; align-items: start; }
.plan-grid { grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); }
@media (max-width: 800px) { .plan-grid { grid-template-columns: 1fr; } }
.row { display: flex; gap: .75rem; flex-wrap: wrap; }
.row > label { flex: 1 1 140px; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.wide { max-width: 760px; }
.center { text-align: center; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.page-head { margin-bottom: 1.25rem; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 60ch; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; font-weight: 700; color: var(--muted); margin-bottom: .25rem; }
.meta { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; }
.empty { color: var(--muted); padding: .5rem 0; }
.error { color: var(--danger); font-weight: 500; }
.count { color: var(--muted); font-size: .9rem; margin-bottom: .5rem; }
.stats { color: var(--muted); text-align: center; margin-top: 2rem; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: .5rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.center .actions { justify-content: center; }

/* Controls */

button, .button {
  font: inherit; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 9px; border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-ink); text-decoration: none;
}
button:hover, .button:hover { filter: brightness(1.07); }
button.small, .button.small { padding: .3rem .65rem; font-size: .875rem; }
button.ghost, .button.ghost { background: transparent; color: var(--primary); }
button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.linklike { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 500; }
.linklike.danger { color: var(--danger); }
.htmx-request button, button.htmx-request { opacity: .7; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 9px; padding: .5rem .65rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 1px; border-color: transparent; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 500; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 500; font-size: .95rem; margin-bottom: .2rem; }

/* Home */

.hero { padding: 2rem 0 1.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); }
.search-big { display: flex; gap: .5rem; max-width: 620px; margin: 1rem 0; }
.search-big input { font-size: 1.1rem; padding: .7rem .9rem; }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters input { flex: 3 1 240px; width: auto; }
.filters select { flex: 1 1 150px; width: auto; }

/* Places */

.places { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .75rem; }
.place {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1rem; display: flex; flex-direction: column; gap: .25rem; box-shadow: var(--shadow);
}
.place-name { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); }
.place-name:hover { color: var(--primary); }
.place .meta { font-size: .9rem; }
.place-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .9rem; margin-top: auto; }
.walk { color: var(--primary); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.stars { color: var(--accent); letter-spacing: 1px; }
.stars .off { color: var(--line); }
.rating { font-weight: 600; }
.score { white-space: nowrap; }
.description { max-width: 65ch; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0 0 1rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.place-page { margin-bottom: 2rem; }

.badge {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap; vertical-align: middle;
}
.badge.closed, .badge.status-cancelled { background: #f6dede; color: var(--danger); }
.badge.warn { background: var(--warn-bg); color: #8a5a00; }
.badge.open, .badge.status-open { background: var(--primary-soft); color: var(--primary); }
.badge.status-decided { background: var(--accent); color: #fff; }

/* Rows (buildings, connections, plans) */

.rows { list-style: none; padding: 0; margin: 0; }
.rows li { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows li > a { font-weight: 600; }
.rows .end { margin-left: auto; display: inline-flex; align-items: center; gap: .5rem; }
.rows.past { opacity: .75; }

/* Map */

.mapwrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem; margin: 1rem 0; overflow: auto; }
svg.map { width: 100%; height: auto; max-height: 520px; display: block; }
svg.map line.sky { stroke: #a9b4bf; stroke-width: 5; stroke-linecap: round; }
svg.map line.sky.stairs { stroke-dasharray: 7 6; }
svg.map line.sky.on { stroke: var(--accent); stroke-width: 7; }
svg.map .bldg circle { fill: var(--surface); stroke: var(--primary); stroke-width: 3; }
svg.map .bldg.on circle { fill: var(--primary); }
svg.map .bldg.focus circle { stroke: var(--accent); stroke-width: 5; }
svg.map .bldg text {
  font-size: 11px; text-anchor: middle; fill: var(--muted); font-weight: 500;
  paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round;
}
svg.map .bldg.on text, svg.map .bldg.focus text { fill: var(--text); font-weight: 700; }
svg.map a:hover circle { fill: var(--primary-soft); }

/* Building */

.hours { border-collapse: collapse; width: 100%; }
.hours th, .hours td { text-align: left; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.hours th { width: 4rem; color: var(--muted); font-weight: 500; }
.hours tr.today th, .hours tr.today td { font-weight: 700; color: var(--text); }

/* Route */

.route-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem 1rem; align-items: end; }
.route-form button { justify-self: start; }
.route-result { margin: 1rem 0; }
.total { font-size: 1.15rem; }
.steps { padding-left: 1.25rem; margin: 0; }
.steps li { padding: .4rem 0; }
.steps li .walk, .steps li .badge { margin-left: .5rem; }

/* Reviews */

.reviews { max-width: 760px; }
.review-form { margin: .75rem 0 .5rem; display: flex; flex-direction: column; gap: .75rem; }
.stars-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: .1rem; }
.stars-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars-input label { font-size: 1.8rem; color: var(--line); cursor: pointer; line-height: 1; }
.stars-input input:checked ~ label,
.stars-input label:hover, .stars-input label:hover ~ label { color: var(--accent); }
.stars-input input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }
.review-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.review-list li { padding: .75rem 0; border-bottom: 1px solid var(--line); }
.review-head { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.review-head time { color: var(--muted); font-size: .85rem; }
.review-list p { margin: .35rem 0 0; }

/* Lunch */

.plan-head { margin-bottom: 1rem; }
.share { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.people { list-style: none; padding: 0; margin: 0 0 .75rem; }
.people li { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .45rem 0; }
.people .who { flex: 1 1 auto; }
.people .start { flex: 1 1 100%; flex-direction: row; align-items: center; font-weight: 400; color: var(--muted); }
.people .start select { flex: 1; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; flex: none;
}
.people li.me .avatar { background: var(--primary); color: var(--primary-ink); }
.invite { display: flex; gap: .5rem; margin-top: .5rem; }
.suggest { list-style: none; padding: 0; margin: 0; }
.suggest li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .35rem 1rem; align-items: center;
  padding: .7rem .5rem; border-bottom: 1px solid var(--line);
}
.suggest li:last-child { border-bottom: 0; }
.suggest li.mine { background: var(--primary-soft); border-radius: 8px; }
.s-main { display: flex; flex-direction: column; min-width: 0; }
.s-main > a { font-weight: 700; }
.s-facts { font-size: .9rem; }
.s-votes { text-align: right; display: flex; flex-direction: column; align-items: flex-end; font-size: .9rem; }
.s-votes .voters { max-width: 12rem; text-align: right; }
.s-act { display: flex; gap: .35rem; justify-content: flex-end; }
@media (max-width: 560px) {
  .suggest li { grid-template-columns: minmax(0, 1fr) auto; }
  .s-act { grid-column: 1 / -1; justify-content: flex-start; }
}
.decided { border: 2px solid var(--accent); }
.decided h2 { font-size: 1.6rem; }
.walks { list-style: none; padding: 0; margin: .75rem 0; }
.walks li { padding: .3rem 0; }
.activity { list-style: none; padding: 0; margin: 0; font-size: .9rem; max-height: 320px; overflow: auto; }
.activity li { padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.activity time { color: var(--muted); margin-right: .4rem; font-variant-numeric: tabular-nums; }
.plan-actions { text-align: right; }
details.card summary { cursor: pointer; font-weight: 600; }
details.card[open] summary { margin-bottom: .75rem; }

/* Toasts */

#toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 50; width: min(92vw, 440px); }
.toast {
  background: var(--text); color: var(--bg); padding: .7rem 1rem; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .2); transition: opacity .4s, transform .4s;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.warn { background: var(--accent); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: .5rem 1rem; }
  .mainnav { order: 3; width: 100%; }
  h1 { font-size: 1.6rem; }
}
