/* kwikapps.net
   The idea: the front door of a Kwik building. The page is the lobby directory, one line per
   floor, and beside it the frame itself going up, one floor for each app. Point at an app and
   its floor lights up and the hoist goes to it.
   Daylight concrete ground, black type, Kwik red only on the logo and the floor you are pointing
   at. One typeface (Archivo), squeezed narrow for the big type like stencilled site lettering. */

@font-face {
  font-family: 'Archivo Variable';
  font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../vendor/fonts/archivo-latin-ext-wdth-normal.woff2) format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Archivo Variable';
  font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url(../vendor/fonts/archivo-latin-wdth-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ground: #e9eae7;      /* poured concrete, daylight */
  --ground-2: #dcdeda;
  --sheet: #ffffff;
  --ink: #000000;
  --ink-2: #4a5056;
  --ink-3: #8a9096;
  --line: #c9cbc6;
  --kwik: #ff0000;        /* the logo red */
  --kwik-ink: #d4000a;    /* the same red, dark enough for text */
  --ok: #0a7a45;
  --wait: #b77b00;
  --font: 'Archivo Variable', 'Archivo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--ground); }
body { margin: 0; color: var(--ink); font: 400 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, p, ol { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- layout: directory on the left, the frame on the right ---------- */
.page {
  display: grid;
  grid-template-columns: minmax(380px, 600px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: 'top stage' 'board stage';
  min-height: 100dvh;
}
.top { grid-area: top; position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 26px clamp(20px, 3.4vw, 48px) 0; }
.logo img { display: block; height: 30px; width: auto; }
.board { grid-area: board; padding: clamp(28px, 6vh, 64px) clamp(20px, 3.4vw, 48px) 40px; }
.stage {
  grid-area: stage; position: sticky; top: 0; height: 100dvh; overflow: hidden;
  background: linear-gradient(180deg, #f6f7f5 0%, #eceeeb 52%, #dddfdb 100%);
  border-left: 1px solid var(--line);
}
.stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; touch-action: pan-y; }

@media (max-width: 920px) {
  .page { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; grid-template-areas: 'top' 'stage' 'board'; }
  .top { padding-top: 18px; }
  .logo img { height: 26px; }
  .stage { position: relative; height: min(86vw, 440px); border-left: 0; background: none; margin-top: 6px; }
  .board { padding-top: 4px; }
}

/* ---------- intro ---------- */
.intro h1 {
  font-size: clamp(64px, 8.2vw, 118px); line-height: 0.86; font-weight: 820; font-stretch: 62%;
  letter-spacing: -0.012em; margin-left: -0.04em;
}
.intro p { margin-top: 16px; font-size: 18px; line-height: 1.45; color: var(--ink-2); max-width: 40ch; }
@media (max-width: 920px) { .intro h1 { font-size: clamp(56px, 16vw, 84px); } .intro p { font-size: 16.5px; margin-top: 10px; } }

/* ---------- search + groups ---------- */
.finder { margin-top: 30px; display: grid; gap: 12px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 14px; width: 20px; height: 20px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input {
  width: 100%; height: 50px; padding: 0 44px 0 44px; border: 2px solid var(--ink); border-radius: 8px; background: var(--sheet);
  font-size: 17px; -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus-visible { outline: 3px solid var(--kwik); outline-offset: 2px; }
.search kbd { position: absolute; right: 12px; font: 600 13px var(--font); color: var(--ink-2); border: 1.5px solid var(--line); border-radius: 5px; padding: 1px 7px; }
@media (hover: none) { .search kbd { display: none; } }
.groups { display: flex; flex-wrap: wrap; gap: 6px; }
.groups button {
  height: 36px; padding: 0 13px; border-radius: 18px; border: 1.5px solid var(--line); background: transparent; cursor: pointer;
  font-weight: 580; font-stretch: 90%; font-size: 15px; display: inline-flex; align-items: center; gap: 6px;
}
.groups button:hover { border-color: var(--ink); }
.groups button[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: #fff; }
.groups b { font-weight: 650; font-variant-numeric: tabular-nums; opacity: 0.7; }

/* ---------- recently opened ---------- */
.recent { margin-top: 22px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.recent a { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 6px; background: var(--sheet); border-radius: 17px; text-decoration: none; color: var(--ink); font-weight: 580; font-stretch: 92%; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); }
.recent a:hover { box-shadow: 0 0 0 2px var(--ink); }
.recent a i { width: 24px; height: 24px; border-radius: 50%; background: var(--ground); display: grid; place-items: center; }
.recent a svg { width: 15px; height: 15px; }

/* ---------- the directory ---------- */
.floors { list-style: none; padding: 0; margin-top: 26px; border-top: 2px solid var(--ink); }
.floor { position: relative; display: grid; grid-template-columns: 62px 44px minmax(0, 1fr) auto; align-items: center; column-gap: 14px; border-bottom: 1px solid var(--line); }
.floor-link { position: absolute; inset: 0; z-index: 1; border-radius: 2px; }
.floor-link:focus-visible { outline-offset: -3px; }
.floor-no {
  font-size: 40px; line-height: 1; font-weight: 760; font-stretch: 62%; font-variant-numeric: tabular-nums; color: var(--ink-3);
  padding: 18px 0; letter-spacing: -0.01em; transition: color 0.15s;
}
.floor-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--sheet); display: grid; place-items: center; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); transition: background 0.15s, color 0.15s; }
.floor-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.floor-text { min-width: 0; padding: 14px 0; }
.floor-text h2 { font-size: 19px; line-height: 1.2; font-weight: 700; font-stretch: 88%; }
.floor-text h2 .state { margin-left: 8px; vertical-align: 2px; }
.floor-text p { font-size: 14.5px; line-height: 1.4; color: var(--ink-2); margin-top: 2px; }
.floor-text .addr { font-size: 13px; color: var(--ink-3); margin-top: 3px; font-variant-numeric: tabular-nums; }
.state { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 560; font-stretch: 100%; color: var(--ink-3); white-space: nowrap; }
.state i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: none; }
.state.up { color: var(--ok); } .state.up i { background: var(--ok); }
.state.down { color: var(--wait); } .state.down i { background: var(--wait); }
.floor-actions { position: relative; z-index: 2; display: flex; gap: 2px; }
.tool { width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.tool:hover { background: var(--ground-2); color: var(--ink); }
.tool svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.floor.on .floor-no { color: var(--kwik-ink); }
.floor.on .floor-icon { background: var(--kwik); color: #fff; }
.floor.on { background: linear-gradient(90deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0)); }

@media (max-width: 560px) {
  .floor { grid-template-columns: 40px 40px minmax(0, 1fr) auto; column-gap: 11px; }
  .floor-no { font-size: 30px; }
  .floor-icon { width: 40px; height: 40px; }
  .floor-text h2 { font-size: 17.5px; }
  .floor-text .addr, .state span { display: none; }
  .floor-actions .tool[data-act='copy'] { display: none; }
}
@media (max-width: 560px) {
  .groups { flex-wrap: nowrap; overflow-x: auto; margin: 0 -20px; padding: 0 20px 4px; scrollbar-width: none; }
  .groups::-webkit-scrollbar { display: none; }
  .groups button { flex: none; }
}
.none { padding: 26px 0; color: var(--ink-2); }
.none b { color: var(--ink); }

.foot { margin-top: 34px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 4px; }

/* the name tag that floats beside the lit floor */
.floor-tag {
  position: absolute; left: 0; top: 0; z-index: 2; pointer-events: none; white-space: nowrap;
  background: var(--ink); color: #fff; font-weight: 640; font-stretch: 88%; font-size: 15px; padding: 5px 11px 5px 9px; border-radius: 4px;
  display: flex; gap: 8px; align-items: center;
}
.floor-tag b { color: #ff5a52; font-stretch: 70%; font-size: 17px; font-weight: 760; }
@media (max-width: 920px) { .floor-tag { font-size: 13px; } }

/* ---------- buttons, dialog, toast ---------- */
.btn { height: 44px; padding: 0 16px; border: 2px solid var(--ink); background: var(--sheet); border-radius: 8px; font-weight: 640; font-stretch: 92%; cursor: pointer; }
.btn:hover { background: var(--ground); }
.install { height: 36px; padding: 0 13px; border: 1.5px solid var(--ink); background: transparent; border-radius: 18px; font-weight: 600; font-size: 14px; cursor: pointer; }

dialog { border: 0; border-radius: 14px; padding: 22px 24px 24px; width: min(440px, calc(100vw - 24px)); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5); color: var(--ink); }
dialog::backdrop { background: rgba(0, 0, 0, 0.5); }
.qr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.qr-head h2 { font-size: 28px; line-height: 1.05; font-weight: 780; font-stretch: 70%; }
.x { width: 38px; height: 38px; flex: none; border: 0; background: none; border-radius: 50%; font-size: 26px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.x:hover { background: var(--ground); color: var(--ink); }
.qr-about { color: var(--ink-2); margin-top: 6px; }
.qr-code { margin: 18px auto 8px; width: min(300px, 100%); aspect-ratio: 1; }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-url { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.qr-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }

#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 50;
  background: var(--ink); color: #fff; font-weight: 600; padding: 11px 18px; border-radius: 9px; pointer-events: none; transition: opacity 0.2s, transform 0.2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- printing a site poster ---------- */
#poster { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  body.printing .page, body.printing dialog, body.printing #toast { display: none !important; }
  body.printing #poster { display: block; }
  html, body { background: #fff; }
  #poster { color: #000; font-family: var(--font); }
  #poster .p-brand { display: flex; align-items: center; gap: 4mm; font-size: 20pt; font-weight: 760; font-stretch: 80%; }
  #poster .p-mark { width: 16mm; height: 16mm; }
  #poster h1 { font-size: 46pt; line-height: 0.95; font-weight: 820; font-stretch: 64%; margin: 14mm 0 4mm; }
  #poster p { font-size: 15pt; line-height: 1.35; max-width: 150mm; }
  #poster .p-qr { width: 120mm; height: 120mm; margin: 12mm 0 6mm; }
  #poster .p-qr svg { width: 100%; height: 100%; }
  #poster .p-url { font-size: 20pt; font-weight: 700; }
  #poster .p-how { margin-top: 3mm; font-size: 13pt; color: #333; }
}

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