/* Koeru — the light frame: homepage and run summary.
 *
 * `snow` page, white cards, `night` text, `granite` secondary text (AA on
 * snow; `glacier` is never text on a light surface). `signal` only as a fill.
 */

:root { color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body.light { margin: 0; background: var(--k-snow); color: var(--k-night); font-size: 15px; }
a { color: inherit; }

/* --- top bar ------------------------------------------------------------ */

.bar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 28px;
  padding: 0 max(24px, env(safe-area-inset-left, 0px));
  background: #fff; border-bottom: 1px solid var(--k-rule);
}
.bar-nav { display: flex; gap: 22px; font-size: 15px; }
.bar-nav a { text-decoration: none; color: var(--k-night); }
.bar-nav a:hover { color: var(--k-granite); }
.bar-nav a[aria-current] { font-variation-settings: 'wdth' 100, 'wght' 650; box-shadow: inset 0 -2px 0 var(--k-signal); }
.bar-search { position: relative; margin-left: auto; width: min(300px, 32vw); }
.bar-search svg {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px;
  fill: none; stroke: var(--k-granite); stroke-width: 1.8; pointer-events: none;
}
.bar-search input {
  width: 100%; height: 40px; padding: 0 12px 0 36px; font: inherit; font-size: 14px;
  color: var(--k-night); background: var(--k-snow); border: 1px solid var(--k-rule); border-radius: 6px;
}
.bar-search input:focus { outline: none; border-color: var(--k-granite); background: #fff; }
.bar-right { flex: none; }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; }
.brand .mark { width: 28px; height: 28px; display: block; }
.wordmark {
  font-variation-settings: 'wdth' 125, 'wght' 800; font-size: 18px; line-height: 1;
  letter-spacing: -.01em; text-transform: lowercase;
}
.wordmark .tld { font-variation-settings: 'wdth' 125, 'wght' 300; color: var(--k-granite); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  font: inherit; font-size: 14px; font-variation-settings: 'wdth' 100, 'wght' 600;
  border-radius: var(--k-radius); border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--k-night); color: var(--k-snow); }
.btn-signal { background: var(--k-signal); color: var(--k-night); font-variation-settings: 'wdth' 100, 'wght' 650; }
.btn-signal svg { fill: currentColor; stroke: none; }
.btn-signal:hover { filter: brightness(1.04); }
.btn-line { background: #fff; color: var(--k-night); border: 1px solid var(--k-rule); }
.btn-line:hover { border-color: var(--k-granite); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .6; cursor: default; }

.avatar-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: var(--k-rule); color: var(--k-night); text-decoration: none;
  font-variation-settings: 'wdth' 108, 'wght' 650; font-size: 13px;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }


/* --- shared blocks ------------------------------------------------------- */

.card { background: #fff; border: 1px solid var(--k-rule); border-radius: 10px; padding: 16px 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 17px; font-variation-settings: 'wdth' 108, 'wght' 650; }
.muted { margin: 0; font-size: 13px; color: var(--k-granite); }

.foot {
  width: min(1200px, 100% - 32px); margin: 40px auto 0; padding: 28px 0 40px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-top: 1px solid var(--k-rule); color: var(--k-granite); font-size: 14px;
}
.foot .mark { width: 24px; height: 24px; }
.foot .wordmark { font-size: 16px; }
.foot-links { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; font-size: 14px; }
.foot-links a { color: var(--k-granite); text-decoration: none; }
.foot-links a:hover { color: var(--k-night); }
.foot-links .foot-app {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 6px; background: var(--k-night); color: var(--k-snow);
}
.foot-links .foot-app:hover { color: var(--k-snow); filter: brightness(1.15); }
.foot-app svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (max-width: 640px) { .foot-links { margin-left: 0; width: 100%; } }

/* --- lightbox (viewer.js) ---------------------------------------------------- */

.backdrop {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; padding: 16px; background: rgb(19 28 46 / .94);
}
.frame { position: relative; display: flex; flex-direction: column; max-width: 100%; max-height: 100%; gap: 8px; }
.frame img, .frame video { max-width: 100%; max-height: calc(100dvh - 120px); border-radius: var(--k-radius); background: #000; object-fit: contain; }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--k-glacier); font-size: 13px; }
.lb-bar .meta { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.lb-bar .meta strong { font-size: 14px; color: var(--k-snow); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav button { width: 30px; height: 30px; font-size: 20px; line-height: 1; color: var(--k-snow); background: rgb(244 247 249 / .12); border: 0; border-radius: var(--k-radius); cursor: pointer; }
.nav button:disabled { opacity: .3; }
.count { color: var(--k-glacier); font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
.close { position: absolute; top: -6px; right: -6px; width: 32px; height: 32px; font-size: 22px; line-height: 1; color: var(--k-night); background: var(--k-snow); border: 0; border-radius: 50%; cursor: pointer; }

/* The phone's menu: on narrow screens the nav and search fold into a panel
   under the bar, opened by the button at the end of it. */
.bar-menu {
  display: none; place-items: center; width: 40px; height: 40px; flex: none; margin-right: -8px;
  background: none; border: 0; border-radius: 6px; color: var(--k-night); cursor: pointer;
}
.bar-menu svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
.bar-menu[aria-expanded="true"] { background: var(--k-snow); }
.bar-drawer {
  position: sticky; top: 56px; z-index: 29; display: grid; gap: 8px; padding: 12px 16px 16px;
  background: #fff; border-bottom: 1px solid var(--k-rule); box-shadow: 0 12px 24px rgb(19 28 46 / .08);
}
.bar-drawer-search { position: relative; }
.bar-drawer-search svg {
  position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 16px; height: 16px;
  fill: none; stroke: var(--k-granite); stroke-width: 1.8; pointer-events: none;
}
.bar-drawer-search input {
  width: 100%; height: 44px; padding: 0 12px 0 36px; font: inherit; font-size: 16px;
  color: var(--k-night); background: var(--k-snow); border: 1px solid var(--k-rule); border-radius: 6px;
}
.bar-drawer nav { display: grid; }
.bar-drawer nav a {
  display: flex; align-items: center; min-height: 48px; padding: 0 4px; border-bottom: 1px solid var(--k-rule);
  font-size: 17px; text-decoration: none; font-variation-settings: 'wdth' 100, 'wght' 550;
}
.bar-drawer nav a:last-child { border-bottom: 0; }
.bar-drawer nav a[aria-current] { font-variation-settings: 'wdth' 100, 'wght' 700; }

@media (max-width: 760px) {
  .bar { gap: 12px; padding: 0 16px; height: 56px; }
  .bar-nav, .bar-search { display: none; }
  .bar-right { margin-left: auto; }
  .bar-menu { display: grid; }
}
@media (min-width: 761px) {
  .bar-drawer { display: none !important; }
}


/* A chosen picture fills the same circle the initials sat in. */
.avatar { overflow: hidden; }
.avatar.has-img { background: none; padding: 0; }
.avatar.has-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
