/* "Your area" panel: drops from the top and docks right, at Crushie's width (--sheet-w). See scripts/area.js. */

.ar-sheet {
  position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; width: var(--sheet-w); max-width: 100vw;
  display: grid; grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, color-mix(in oklch, var(--hull) 98%, transparent), color-mix(in oklch, var(--ink) 98%, transparent));
  border-left: 1px solid var(--line-hi);
  box-shadow: -30px 0 80px -30px rgb(0 0 0 / .9);
  transform: translateY(-102%); visibility: hidden;
  transition: transform var(--med) var(--ease), visibility 0s linear var(--med);
}
/* light falls from the top edge, mirroring Crushie's top-right glow */
.ar-sheet::before { content: ""; position: absolute; inset: 0 0 auto; height: 200px; pointer-events: none; background: radial-gradient(80% 100% at 20% 0%, color-mix(in oklch, var(--teal) 22%, transparent), transparent 70%); }
.ar-sheet::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: linear-gradient(90deg, transparent, var(--teal-glow), transparent); opacity: 0; transition: opacity var(--med); }
.ar-sheet.is-open { transform: none; visibility: visible; transition: transform var(--med) var(--ease); }
body.ar-push .page { margin-right: var(--sheet-w); }
body.ar-open .cr-dock { opacity: 0; pointer-events: none; }

/* header */
.ar-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 18px; }
.ar-head__badge { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--teal-glow); background: radial-gradient(circle at 50% 35%, var(--plate-hi), var(--hull) 75%); box-shadow: 0 0 0 1px var(--line-hi); }
.ar-head__badge svg { width: 20px; height: 20px; }
.ar-head__id { flex: 1; display: grid; line-height: 1.25; min-width: 0; }
.ar-head__id b { font-family: var(--f-display); font-size: 1.125rem; font-weight: 800; letter-spacing: .02em; font-variation-settings: "wdth" 115; }
.ar-head__sub { font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .08em; text-transform: uppercase; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* body */
.ar-body { position: relative; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 18px 14px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ar-sheet.is-open .ar-body > * { animation: arIn var(--med) var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms + 90ms); }
@keyframes arIn { from { opacity: 0; transform: translateY(-8px); } }
.ar-label { display: block; margin-bottom: 6px; font-family: var(--f-mono); font-size: .5938rem; letter-spacing: .12em; text-transform: uppercase; color: var(--mist); }

/* combobox */
.ar-place { position: relative; z-index: 3; }
.ar-field { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-hi); background: color-mix(in oklch, var(--ink) 70%, transparent); color: var(--mist); transition: border-color var(--fast), box-shadow var(--fast); }
.ar-field:focus-within { border-color: var(--teal-glow); box-shadow: 0 0 0 4px color-mix(in oklch, var(--teal-glow) 12%, transparent); }
.ar-field svg { width: 16px; height: 16px; flex: none; }
.ar-field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--paper); font: inherit; font-size: .9375rem; }
.ar-field input::placeholder { color: var(--mist); }
.ar-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: 296px; overflow-y: auto; margin: 0; padding: 5px; list-style: none;
  border-radius: 12px; border: 1px solid var(--line-hi); background: color-mix(in oklch, var(--plate) 97%, transparent); backdrop-filter: blur(12px);
  box-shadow: 0 24px 50px -18px rgb(0 0 0 / .9); scrollbar-width: thin;
}
.ar-list[hidden] { display: none; }
.ar-list__opt { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; font-size: .875rem; color: var(--paper); cursor: pointer; }
.ar-list__opt[aria-selected="true"] { background: color-mix(in oklch, var(--teal) 22%, transparent); box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--teal-glow) 50%, transparent); }
.ar-list__k { flex: none; width: 34px; font-family: var(--f-mono); font-size: .5313rem; letter-spacing: .1em; text-transform: uppercase; color: var(--teal-glow); }
.ar-list__note { padding: 10px; font-size: .8125rem; color: var(--fog); }

/* current location */
.ar-locate__btn {
  display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px 0 11px; border-radius: var(--r-pill);
  border: 1px dashed var(--line-hi); font-size: .8125rem; font-weight: 600; color: var(--fog);
  transition: border-color var(--fast), color var(--fast), background var(--fast);
}
.ar-locate__btn svg { width: 16px; height: 16px; color: var(--teal-glow); }
.ar-locate__btn:hover { border-style: solid; border-color: var(--teal-glow); color: var(--paper); background: color-mix(in oklch, var(--teal) 12%, transparent); }
.ar-locate__btn:disabled { cursor: progress; opacity: .8; }
.ar-locate__btn.is-busy svg { animation: arSpin 1.2s linear infinite; }
@keyframes arSpin { to { transform: rotate(360deg); } }
.ar-locate__note { margin: 6px 0 0 4px; font-size: .75rem; line-height: 1.4; color: var(--mist); }
.ar-locate__note:empty { display: none; }
.ar-locate__note.is-ok { color: var(--teal-glow); }
.ar-locate__note.is-warn { color: var(--fog); }

/* radius */
.ar-seg { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
.ar-seg button { justify-content: center; font-variant-numeric: tabular-nums; }

/* map */
.ar-map {
  position: relative; flex: 1 0 300px; min-height: 300px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line-hi); background: var(--ink);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--ink) 60%, transparent), 0 18px 40px -24px rgb(0 0 0 / .9);
}
.ar-map > .ar-map__canvas { position: absolute; inset: 0; } /* beats MapLibre's own .maplibregl-map { position: relative } */
.ar-map__loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; font-family: var(--f-mono); font-size: .625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mist);
  background: repeating-linear-gradient(0deg, transparent 0 23px, color-mix(in oklch, var(--line) 45%, transparent) 23px 24px), repeating-linear-gradient(90deg, transparent 0 23px, color-mix(in oklch, var(--line) 45%, transparent) 23px 24px); }
.ar-map__readout {
  position: absolute; left: 10px; top: 10px; z-index: 2; margin: 0; padding: 4px 8px; border-radius: 6px; pointer-events: none;
  font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .06em; color: var(--fog);
  background: color-mix(in oklch, var(--ink) 78%, transparent); border: 1px solid color-mix(in oklch, var(--line-hi) 70%, transparent); backdrop-filter: blur(6px);
}
.ar-map__here {
  position: absolute; left: 50%; top: 44px; z-index: 3; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  background: var(--teal); color: var(--on-teal); font-size: .8125rem; font-weight: 650; white-space: nowrap;
  box-shadow: 0 10px 24px -8px rgb(0 0 0 / .8), 0 0 0 1px color-mix(in oklch, var(--teal-glow) 60%, transparent);
  animation: arPop var(--med) var(--ease);
}
.ar-map__here[hidden] { display: none; }
.ar-map__here svg { width: 14px; height: 14px; }
.ar-map__here:hover { background: var(--teal-glow); color: var(--ink); }
@keyframes arPop { from { opacity: 0; transform: translate(-50%, -6px); } }

/* MapLibre chrome, re-skinned to the theme */
.ar-map .maplibregl-ctrl-group { background: color-mix(in oklch, var(--plate) 92%, transparent); border: 1px solid var(--line-hi); border-radius: 10px; box-shadow: none; overflow: hidden; }
.ar-map .maplibregl-ctrl-group button { width: 32px; height: 32px; }
.ar-map .maplibregl-ctrl-group button + button { border-top: 1px solid var(--line); }
.ar-map .maplibregl-ctrl-group button:hover { background: color-mix(in oklch, var(--teal) 18%, transparent); }
.ar-map .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1) brightness(.85); }
.ar-map .maplibregl-ctrl.maplibregl-ctrl-attrib, .ar-map .maplibregl-ctrl.maplibregl-ctrl-attrib.maplibregl-compact { background: color-mix(in oklch, var(--ink) 82%, transparent); color: var(--mist); font-size: 10px; border: 1px solid color-mix(in oklch, var(--line-hi) 60%, transparent); }
.ar-map .maplibregl-ctrl-attrib a { color: var(--fog); }
.ar-map .maplibregl-ctrl-attrib.maplibregl-compact { min-height: 22px; }
.ar-map .maplibregl-ctrl-attrib-button { filter: invert(1) brightness(.8); }
.ar-map .maplibregl-canvas:focus-visible { outline: 2px solid var(--teal-glow); outline-offset: -2px; }

/* no-WebGL fallback */
.ar-map__canvas.is-fallback { overflow-y: auto; padding: 14px; }
.ar-map__fb { margin: 0 0 10px; font-size: .8125rem; color: var(--fog); }
.ar-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }

/* venue card */
.ar-card {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 4; max-height: 62%; display: flex; flex-direction: column;
  border-radius: 12px; border: 1px solid var(--line-hi); background: color-mix(in oklch, var(--plate) 96%, transparent); backdrop-filter: blur(12px);
  box-shadow: 0 -10px 40px -16px rgb(0 0 0 / .9); animation: arCard var(--med) var(--ease);
}
.ar-card[hidden] { display: none; }
@keyframes arCard { from { opacity: 0; transform: translateY(10px); } }
.ar-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 12px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.ar-card__name { margin: 0; font-weight: 700; font-size: .9375rem; line-height: 1.25; }
.ar-card__meta, .ar-card__venue { margin: 2px 0 0; font-family: var(--f-mono); font-size: .5938rem; letter-spacing: .06em; text-transform: uppercase; color: var(--mist); }
.ar-card__venue { margin: 10px 0 2px; color: var(--teal-glow); }
.ar-card__note { margin: 8px 14px 0; font-size: .75rem; color: var(--mist); }
.ar-card__x { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--fog); }
.ar-card__x:hover { color: var(--paper); background: color-mix(in oklch, var(--paper) 7%, transparent); }
.ar-card__x svg { width: 15px; height: 15px; }
.ar-card__list { overflow-y: auto; padding: 0 14px 10px; scrollbar-width: thin; }
.ar-card__list ul { margin: 0; padding: 0; list-style: none; }
.ar-card__ev { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px dashed color-mix(in oklch, var(--line-hi) 70%, transparent); }
.ar-card__list ul .ar-card__ev:first-child { border-top: 0; }
.ar-card__ev > div { min-width: 0; }
.ar-card__title { display: block; font-size: .8438rem; font-weight: 600; line-height: 1.3; color: var(--paper); }
.ar-card__title:hover { color: var(--teal-glow); }
.ar-card__when, .ar-card__src { margin: 2px 0 0; font-family: var(--f-mono); font-size: .5938rem; letter-spacing: .04em; color: var(--teal-glow); }
.ar-card__src { color: var(--mist); }
.ar-card__sig { color: var(--sodium); }
.ar-card__go { flex: none; }
.ar-card__go svg { width: 12px; height: 12px; }

.ar-status { margin: 0; font-size: .75rem; line-height: 1.45; color: var(--mist); }
.ar-status b { color: var(--fog); font-weight: 600; }

/* footer */
.ar-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px 14px; border-top: 1px solid var(--line); }
.ar-foot p { margin: 0; font-size: .6875rem; color: var(--mist); text-align: right; }
.ar-reset { flex: none; height: 30px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line-hi); font-family: var(--f-mono); font-size: .5625rem; letter-spacing: .12em; text-transform: uppercase; color: var(--fog); transition: border-color var(--fast), color var(--fast); }
.ar-reset:hover { border-color: var(--teal-glow); color: var(--paper); }

/* below 1200px: a modal over the page */
@media (max-width: 1199px) {
  .ar-sheet { box-shadow: -30px 0 80px -10px rgb(0 0 0 / .9); }
  body.ar-open::after { content: ""; position: fixed; inset: 0; z-index: 85; background: color-mix(in oklch, var(--ink) 55%, transparent); backdrop-filter: blur(2px); }
}
/* phones: a full-width sheet that drops from the top, with the grab handle at its foot */
@media (max-width: 640px) {
  .ar-sheet { bottom: auto; left: 0; width: 100vw; height: 86vh; border-left: 0; border-bottom: 1px solid var(--line-hi); border-radius: 0 0 18px 18px; box-shadow: 0 30px 80px -10px rgb(0 0 0 / .9); }
  .ar-sheet::after { opacity: .6; }
  .ar-foot { position: relative; padding-bottom: 22px; }
  .ar-foot::after { content: ""; position: absolute; bottom: 8px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line-hi); }
  .ar-map { flex-basis: 240px; min-height: 240px; }
}

.ar-map__canvas.is-fallback ~ .ar-map__readout { display: none; }
