/* Civic Line components: the tower home, level floors, decision marks, the detail sheet, and theme overrides for older pages.
   Tokens come from theme.css. Class names here are prefixed or unique so they don't collide with app.js page styles. */

/* ---------- Theme overrides for every page ---------- */
body { background: var(--paper); font-size: var(--step-0); line-height: 1.55; }
h1 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: var(--step-2); font-weight: 700; }
.eyebrow { text-transform: none; letter-spacing: 0; font-size: var(--step--1); font-weight: 500; }
.panel, .box, a.card, .tile, .qcard, .tablewrap { border-radius: var(--radius-m); }
.panel, a.card, .qcard { box-shadow: var(--shadow-card); border-color: transparent; }
a.card:hover { border-color: var(--lv, var(--line)); }
button.btn { border-radius: var(--radius-round); min-height: 44px; padding: 0 var(--space-5); }
.chip { min-height: 30px; padding: 2px 12px; }
.brand { gap: var(--space-2); }
.brand svg { width: 24px; height: 24px; color: var(--lv, var(--ink)); transition: color var(--dur-move); }
.brand .zip { border-radius: 6px; }
nav.tabs a { border-radius: var(--radius-round); padding: 6px 12px; }
nav.tabs a[aria-current="page"] { background: var(--lv, var(--ink)); color: var(--surface); }
main#app { position: relative; z-index: 1; }
footer.foot { position: relative; z-index: 1; background: var(--surface); }

/* ---------- Background: faint level drawing + soft glow (tower pages only) ---------- */
@property --glow { syntax: '<color>'; inherits: true; initial-value: transparent; }
body { --glow: color-mix(in srgb, var(--lv, transparent) 9%, transparent); transition: --glow var(--dur-move) var(--ease-out); }
.stage, .glow { position: fixed; z-index: 0; pointer-events: none; opacity: 0; transition: opacity var(--dur-move); }
.glow { inset: 0; background: radial-gradient(70vmax 70vmax at 80% 50%, var(--glow), transparent 70%); }
.stage { width: min(110vh, 80vw); aspect-ratio: 1; right: -8vw; top: 50%; transform: translateY(calc(-50% + var(--drift, 0px))); }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--lv); opacity: .16; transition: opacity var(--dur-move) var(--ease-out); }
.stage svg.out { opacity: 0; }
.stage svg :is(path, circle, polygon) { stroke-width: 2px; stroke-dasharray: 1; stroke-dashoffset: 0; }
.stage svg.drawing :is(path, circle, polygon) { animation: cl-draw 2200ms var(--ease-in-out) both; animation-delay: calc(var(--i) * 90ms); }
@keyframes cl-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
body.towered .stage, body.towered .glow { opacity: 1; }
body.intro-on .stage { opacity: 0; }

/* ---------- The tower (elevator nav) ---------- */
.tower { position: fixed; z-index: 20; left: max(12px, 2vw); top: 50%; transform: translateY(-50%); opacity: 0; pointer-events: none; transition: opacity var(--dur-move); }
body.towered .tower { opacity: 1; pointer-events: auto; }
body.intro-on .tower { opacity: 0; pointer-events: none; }
.tower ol { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); position: relative; }
.tower ol::before { content: ""; position: absolute; left: 23px; top: 24px; bottom: 24px; width: 2px; background: var(--line); }
.tower .car { position: absolute; left: 0; top: 0; width: 48px; height: 48px; border-radius: 50%; background: var(--surface); border: 3px solid var(--lv); box-shadow: var(--shadow-card); transform: translateY(var(--car-y, 0px)); transition: transform var(--dur-move) var(--ease-out), border-color var(--dur-move); }
.tower a { position: relative; display: flex; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--ink-3); font-weight: 500; font-size: var(--step--1); min-height: 48px; }
.tower a .ic { width: 48px; height: 48px; display: grid; place-items: center; flex: none; position: relative; z-index: 1; }
.tower a .ic::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--paper); z-index: -1; }
.tower a svg { width: 28px; height: 28px; }
.tower a svg :is(path, circle, polygon) { stroke-width: 2px; }
.tower a[aria-current="true"] { color: var(--ink); font-weight: 700; }
.tower a[aria-current="true"] .ic { color: var(--lv); }
.tower a[aria-current="true"] .ic::before { background: transparent; }
.tower a span.l { opacity: 0; transform: translateX(-6px); transition: opacity var(--dur-quick), transform var(--dur-quick); background: var(--surface); padding: 2px 8px; border-radius: 6px; box-shadow: var(--shadow-card); white-space: nowrap; color: var(--ink); }
.tower:hover a span.l, .tower:focus-within a span.l { opacity: 1; transform: none; }

/* ---------- Floors ---------- */
body.towered main#app { max-width: none; padding-left: max(92px, 8vw); padding-right: max(16px, 3vw); padding-block: 0 48px; gap: 0; }
.floor { min-height: calc(100vh - 60px); display: flex; align-items: center; padding-block: 32px; }
.floor.short { min-height: 0; }
.fcard { width: min(1120px, 100%); margin-inline: auto; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-radius: var(--radius-l); box-shadow: var(--shadow-card); padding: clamp(20px, 3vw, 40px); display: grid; gap: var(--space-6);
  opacity: .45; transform: translateY(24px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); }
.floor.in .fcard { opacity: 1; transform: none; }
.fhead { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.fhead > svg { width: 52px; height: 52px; color: var(--lv); flex: none; }
.fhead h2 { font-size: var(--step-3); color: var(--lv); }
.fhead h1 { color: var(--lv); }
.fhead p { margin: 2px 0 0; color: var(--ink-2); }
.fhead .boss { margin-left: auto; }
.fcols { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-7); }
.fnote { margin: 0; color: var(--ink-2); }

.boss { display: flex; gap: var(--space-3); align-items: center; text-decoration: none; color: inherit; padding: var(--space-2) var(--space-3); border-radius: var(--radius-m); line-height: 1.3; }
.boss:hover { background: var(--surface-2); }
.boss .face { --size: 56px; }
.boss b { font-size: var(--step-1); display: block; line-height: 1.2; }
.flabel { font-size: var(--step--1); color: var(--ink-3); margin: 0 0 var(--space-2); font-weight: 500; }
.mine { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); }
.mine a { display: flex; gap: var(--space-3); align-items: center; text-decoration: none; color: inherit; line-height: 1.25; }
.mine a:hover b { color: var(--lv); }
.mine .face { --size: 44px; }
.mine small { display: block; color: var(--ink-3); font-size: var(--step--1); }
span.face { display: inline-grid; place-items: center; font-weight: 700; color: #fff; background: var(--ring); font-size: calc(var(--size, 48px) * .36); }

/* ---------- Month chart and decision marks ---------- */
.pulse { display: grid; gap: var(--space-3); align-content: start; }
.pulse .headline { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.pulse .n { font-family: var(--font-display); font-weight: 800; font-size: 3.4rem; line-height: .9; font-variant-numeric: tabular-nums; }
.pulse .cap { color: var(--ink-2); }
.dots { display: grid; grid-template-columns: repeat(var(--days, 30), minmax(0, 1fr)); align-items: end; height: var(--h, 150px); border-bottom: 2px solid var(--line); }
.dots .c { display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; padding-bottom: 4px; height: 100%; overflow: hidden; }
.dots .c.wk { box-shadow: inset 1px 0 0 var(--line); }
.dots-scale { display: flex; justify-content: space-between; }
.mk { --m: var(--sup-unknown); width: 13px; height: 13px; border-radius: 50%; background: var(--m); border: 2px solid var(--m); padding: 0; cursor: pointer; flex: none; display: inline-block; font: inherit;
  transform: scale(.4); transition: transform 380ms var(--ease-out) calc(var(--d, 0) * 18ms + var(--k, 0) * 26ms + 200ms), opacity var(--dur-quick); }
.floor.in .mk, .legend .mk, .drow .mk, .sheet .mk, .mk.now { transform: none; }
.mk.both, .mk.all { --m: var(--sup-both); }
.mk.noobj { --m: var(--sup-both); background: var(--surface); }
.mk.rep { --m: var(--sup-rep); }
.mk.dem { --m: var(--sup-dem); }
.mk.pres { --m: var(--sup-pres); border-radius: 2px; }
.mk.split { --m: var(--sup-split); border-radius: 2px; rotate: 45deg; scale: .85; }
.mk.unknown { --m: var(--sup-unknown); background: transparent; border-style: dashed; }
.floor.in button.mk:hover, .floor.in button.mk:focus-visible, button.mk.now:hover { transform: scale(1.5); transition-delay: 0ms; }
.dim .dots .mk:not(.on) { opacity: .15; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.legend button { font: inherit; font-size: var(--step--1); color: var(--ink-2); background: var(--surface-2); border: 1.5px solid transparent; border-radius: var(--radius-round); padding: 6px 12px 6px 10px; display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; min-height: 36px; }
.legend button[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface); }
.legend b { font-variant-numeric: tabular-nums; }

/* ---------- Decision rows ---------- */
.dlist { display: grid; align-content: start; }
.drow { display: grid; grid-template-columns: 18px 62px minmax(0, 1fr); gap: var(--space-3); align-items: start; text-align: left; font: inherit; color: inherit; background: none; border: 0; border-top: 1px solid var(--line); padding: var(--space-3) var(--space-2); cursor: pointer; transition: background var(--dur-quick); width: 100%; }
.drow:hover { background: var(--surface-2); }
.drow .mk { margin-top: 5px; }
.drow time { color: var(--ink-3); font-size: var(--step--1); padding-top: 2px; }
.drow .t { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.drow small { display: block; color: var(--ink-3); font-size: var(--step--1); }
.drow.lvl { grid-template-columns: 18px 62px minmax(0, 1fr); }
.dmore { justify-self: start; margin-top: var(--space-3); font: inherit; font-weight: 700; color: var(--lv, var(--ink)); background: none; border: 0; padding: var(--space-2) 0; cursor: pointer; }
.dlist .drow.extra { display: none; }
.dlist.all .drow.extra { display: grid; }
.fcard.dim .dlist .drow:not(.on), .fcard.dim .dmore { display: none; }
.quiet { margin: 0; padding: var(--space-3) var(--space-4); border-radius: var(--radius-m); background: var(--surface-2); color: var(--ink-2); }
.fcard .btn { justify-self: start; }
.months { display: grid; gap: var(--space-4); }
.month { border-top: 1px solid var(--line); padding-top: var(--space-4); display: grid; gap: var(--space-3); }
.month > summary { list-style: none; display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; gap: var(--space-4); align-items: center; cursor: pointer; }
.month > summary::-webkit-details-marker { display: none; }
.month > summary h3 { font-size: var(--step-1); }
.month .strip { display: flex; flex-wrap: wrap; gap: 4px; }
.month .strip .mk { width: 10px; height: 10px; }
.month[open] > summary .more-ic { rotate: 180deg; }
.more-ic { transition: rotate var(--dur-quick); }

/* ---------- Detail sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgb(10 16 30 / 35%); opacity: 0; pointer-events: none; transition: opacity var(--dur-move); }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 41; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); box-shadow: -20px 0 60px -20px rgb(0 0 0 / 35%); overflow-y: auto; overscroll-behavior: contain; transform: translateX(104%); transition: transform var(--dur-move) var(--ease-out); padding: calc(var(--space-6) + env(safe-area-inset-top, 0px)) var(--space-6) var(--space-7); display: grid; gap: var(--space-5); align-content: start; border-left: 6px solid var(--lv); }
.sheet.open { transform: none; }
.sheet .close { justify-self: end; margin-bottom: calc(var(--space-5) * -1); width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.sheet h2 { font-size: var(--step-2); }
.sheet .meta { color: var(--ink-3); font-size: var(--step--1); margin: 0; }
.sheet p { margin: 0; }
.sheet h3 { font-size: var(--step-0); font-family: var(--font-body); font-weight: 700; margin-bottom: var(--space-2); }
.support { display: flex; gap: var(--space-3); align-items: center; padding: var(--space-4); border-radius: var(--radius-m); background: var(--surface-2); }
.support .mk { width: 18px; height: 18px; }
.support b { display: block; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.ba div { padding: var(--space-4); border-radius: var(--radius-m); border: 1px solid var(--line); }
.ba span { display: block; font-size: var(--step--1); color: var(--ink-3); margin-bottom: 4px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.steps li { padding-left: var(--space-5); position: relative; }
.steps li::before { content: ""; position: absolute; left: 4px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--lv); }
.votes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.votes li { padding: 6px 12px; border-radius: var(--radius-round); background: var(--surface-2); }
.links { display: flex; flex-wrap: wrap; gap: var(--space-3); }
a.pill-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-5); border-radius: var(--radius-round); border: 1.5px solid var(--ink); text-decoration: none; font-weight: 700; color: var(--ink); }
a.pill-btn.solid { background: var(--lv); border-color: var(--lv); color: var(--surface); }
.sheet .loading { padding: 0; }

/* ---------- Home intro ---------- */
.tintro { min-height: calc(100vh - 60px); display: grid; align-content: center; gap: var(--space-6); padding-block: 48px; width: min(1120px, 100%); margin-inline: auto; }
.tintro h1 { font-size: var(--step-4); max-width: 13ch; }
.tintro p { margin: 0; font-size: var(--step-1); color: var(--ink-2); max-width: 38ch; }
.tintro .updated { font-size: var(--step--1); color: var(--ink-3); }
.skyline { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: end; }
.skyline a { display: grid; justify-items: center; gap: var(--space-2); text-decoration: none; color: var(--ink-2); font-size: var(--step--1); width: 120px; }
.skyline svg { width: 104px; height: 104px; color: var(--c); }
.skyline svg :is(path, circle, polygon) { stroke-width: 2.4px; stroke-dasharray: 1; animation: cl-draw 1200ms var(--ease-in-out) both; animation-delay: calc(var(--s) * 260ms + var(--i) * 40ms); }
.cue { display: inline-flex; gap: var(--space-2); align-items: center; color: var(--ink-3); font-weight: 500; }
.cue svg { width: 20px; height: 20px; animation: cl-bob 1.8s var(--ease-in-out) infinite; }
@keyframes cl-bob { 50% { transform: translateY(5px); } }

/* ---------- Every action ---------- */
.filters { display: grid; gap: var(--space-3); }
.filters .row { gap: var(--space-2); }

@media (max-width: 980px) { .fcols { grid-template-columns: 1fr; gap: var(--space-6); } .fhead .boss { margin-left: 0; } }
@media (max-width: 820px) {
  .tower { left: 0; right: 0; top: auto; bottom: 0; transform: none; background: var(--surface); box-shadow: 0 -8px 24px -12px rgb(0 0 0 / 25%); padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px)); }
  .tower ol { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; }
  .tower ol::before, .tower .car { display: none; }
  .tower a { flex-direction: column; gap: 0; min-height: 56px; justify-content: center; }
  .tower a .ic { width: 34px; height: 34px; }
  .tower a .ic::before { display: none; }
  .tower a span.l { opacity: 1; transform: none; box-shadow: none; background: none; padding: 0; font-size: 0; }
  .tower a span.l::after { content: attr(data-short); font-size: 11px; }
  .tower a[aria-current="true"] .ic { background: color-mix(in srgb, var(--lv) 16%, transparent); border-radius: 12px; }
  .stage { right: 50%; transform: translate(50%, -50%); width: 120vw; }
  body.towered main#app { padding-left: max(12px, env(safe-area-inset-left, 0px)); padding-right: max(12px, env(safe-area-inset-right, 0px)); padding-bottom: 96px; }
  body.towered footer.foot { padding-bottom: 64px; }
  .fcard { padding: var(--space-5); border-radius: var(--radius-m); }
  .dots { --h: 120px; }
  .mk { width: 9px; height: 9px; border-width: 1.5px; }
  .drow .mk, .legend .mk { width: 12px; height: 12px; }
  .skyline a { width: calc(33% - 12px); }
  .month > summary { grid-template-columns: 1fr auto; }
  .month > summary .strip { grid-column: 1 / -1; grid-row: 2; }
  .sheet { top: auto; height: 88vh; border-left: 0; border-top: 6px solid var(--lv); border-radius: var(--radius-l) var(--radius-l) 0 0; transform: translateY(104%); padding: var(--space-5) var(--space-5) calc(var(--space-7) + env(safe-area-inset-bottom, 0px)); }
  .ba { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .fcard, .mk { transition: none; opacity: 1; transform: none; } .cue svg { animation: none; } }

.chip{text-decoration:none}
