/* 29Court Hub: layout only. Every color, radius, space, font, and motion
   value resolves to a --29d-* token from the design system CDN files.
   The one literal below (16px search text) is the iOS no-zoom-on-focus
   threshold, a platform constant, not a design value. */

* { box-sizing: border-box; }
html, body { height: 100%; }
body { background: var(--29d-bg); color: var(--29d-text-1); margin: 0; }

/* ---------- top chrome ---------- */
.hub-top {
  position: sticky; top: 0; z-index: 35;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--29d-s-3);
  padding: var(--29d-s-2) var(--29d-page-pad);
  background: color-mix(in srgb, var(--29d-bg) 88%, transparent);
  backdrop-filter: blur(var(--29d-s-3)); -webkit-backdrop-filter: blur(var(--29d-s-3));
  border-bottom: 1px solid var(--29d-border);
}
.hub-brand {
  display: inline-flex; align-items: center; gap: var(--29d-s-2);
  background: none; border: 0; padding: var(--29d-s-1);
  border-radius: var(--29d-r-2); cursor: pointer; color: var(--29d-text-1);
  font-family: var(--29d-font-ui); font-feature-settings: var(--29d-font-features);
}
.hub-brand:active { transform: scale(.98); }
.hub-brand:focus-visible { outline: none; box-shadow: var(--29d-focus-halo); }
.hub-mark {
  border-radius: var(--29d-r-2); border: 1px solid var(--29d-border);
  background: var(--29d-bg); display: block;
}
.hub-brand-text { font-family: var(--29d-font-display); font-weight: var(--29d-weight-xbold); font-size: var(--29d-text-lg); }
.hub-brand-sub {
  font-family: var(--29d-font-mono); font-size: var(--29d-text-xs);
  color: var(--29d-text-2); text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--29d-border); border-radius: var(--29d-r-1);
  padding: var(--29d-s-0) var(--29d-s-1);
}
.hub-top-actions { display: flex; gap: var(--29d-s-2); }

/* ---------- home ---------- */
.hub-home {
  max-width: 1120px; margin: 0 auto;
  padding: var(--29d-s-6) var(--29d-page-pad) var(--29d-s-16);
}
.hub-hero { margin-bottom: var(--29d-s-6); }
.hub-h1 {
  font-family: var(--29d-font-display); font-weight: var(--29d-weight-xbold);
  font-size: var(--29d-text-3xl); line-height: var(--29d-lh-3xl);
  margin: 0 0 var(--29d-s-2);
}
.hub-sub { color: var(--29d-text-2); font-size: var(--29d-text-md); line-height: var(--29d-lh-md); margin: 0; max-width: 34em; }

.hub-search { margin-bottom: var(--29d-s-8); }
.hub-search .ds-input { width: 100%; font-size: max(var(--29d-text-md), 16px); }

.hub-section { margin-bottom: var(--29d-s-8); }
.hub-eyebrow {
  font-family: var(--29d-font-mono); font-size: var(--29d-text-xs);
  text-transform: uppercase; letter-spacing: .08em; color: var(--29d-text-3);
  margin-bottom: var(--29d-s-3);
}

.hub-rail {
  display: flex; gap: var(--29d-s-3); overflow-x: auto;
  padding-bottom: var(--29d-s-1); scrollbar-width: none;
}
.hub-rail::-webkit-scrollbar { display: none; }
.hub-chip {
  display: inline-flex; align-items: center; gap: var(--29d-s-2);
  flex: 0 0 auto; min-height: var(--29d-control-h);
  padding: var(--29d-s-2) var(--29d-s-3);
  background: var(--29d-surface); border: 1px solid var(--29d-border);
  border-radius: var(--29d-r-3); color: var(--29d-text-1);
  font-family: var(--29d-font-ui); font-feature-settings: var(--29d-font-features);
  font-size: var(--29d-text-sm); font-weight: var(--29d-weight-medium);
  cursor: pointer; transition: background var(--29d-t-fast) var(--29d-ease), transform var(--29d-t-fast) var(--29d-ease);
}
.hub-chip:hover { background: var(--29d-wash); }
.hub-chip:active { transform: scale(.98); }
.hub-chip:focus-visible { outline: none; box-shadow: var(--29d-focus-halo); }

.hub-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--29d-s-3); }
@media (min-width: 720px) { .hub-grid { grid-template-columns: repeat(3, 1fr); gap: var(--29d-s-4); } }
@media (min-width: 1080px) { .hub-grid { grid-template-columns: repeat(4, 1fr); } }

.hub-tile {
  display: flex; flex-direction: column; gap: var(--29d-s-2);
  width: 100%; text-align: left; cursor: pointer;
  background: var(--29d-surface); border: 1px solid var(--29d-border);
  border-radius: var(--29d-r-3); padding: var(--29d-s-4);
  color: var(--29d-text-1);
  font-family: var(--29d-font-ui); font-feature-settings: var(--29d-font-features);
  transition: background var(--29d-t-fast) var(--29d-ease), transform var(--29d-t-fast) var(--29d-ease), border-color var(--29d-t-fast) var(--29d-ease);
}
.hub-tile:hover { background: var(--29d-wash); border-color: var(--29d-border-strong); }
.hub-tile:active { transform: scale(.98); }
.hub-tile:focus-visible { outline: none; box-shadow: var(--29d-focus-halo); }
.hub-tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--29d-s-2); }
.hub-mono {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--29d-s-12); height: var(--29d-s-12); flex: 0 0 auto;
  background: var(--29d-wash-2); border-radius: var(--29d-r-2);
  font-family: var(--29d-font-display); font-weight: var(--29d-weight-xbold);
  font-size: var(--29d-text-lg); color: var(--29d-text-1);
}
.hub-tile-name { font-size: var(--29d-text-md); font-weight: var(--29d-weight-semibold); line-height: var(--29d-lh-sm); }
.hub-tile-sub { font-size: var(--29d-text-sm); color: var(--29d-text-2); line-height: var(--29d-lh-sm); }
.hub-tile-meta { margin-top: auto; display: flex; gap: var(--29d-s-2); flex-wrap: wrap; }

.hub-empty { color: var(--29d-text-2); font-size: var(--29d-text-md); padding: var(--29d-s-6) 0; }
.hub-foot { margin-top: var(--29d-s-12); color: var(--29d-text-3); font-size: var(--29d-text-sm); }
.hub-foot p { margin: 0 0 var(--29d-s-1); }
.hub-foot-note { color: var(--29d-text-3); }

/* monogram mark inside chips */
.hub-chip .hub-mono { width: var(--29d-s-6); height: var(--29d-s-6); font-size: var(--29d-text-sm); }

body.hub-viewing .hub-top { display: none; }

/* ---------- viewer ---------- */
.hub-viewer {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  background: var(--29d-bg);
}
.hub-viewer[hidden] { display: none; }
.hub-viewbar {
  display: flex; align-items: center; gap: var(--29d-s-2);
  padding: var(--29d-s-2) var(--29d-s-3);
  padding-top: calc(var(--29d-s-2) + env(safe-area-inset-top));
  border-bottom: 1px solid var(--29d-border);
  background: color-mix(in srgb, var(--29d-bg) 92%, transparent);
}
.hub-viewtitle { flex: 1; min-width: 0; text-align: center; }
.hub-viewname { font-weight: var(--29d-weight-semibold); font-size: var(--29d-text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-viewurl { font-family: var(--29d-font-mono); font-size: var(--29d-text-xs); color: var(--29d-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-viewactions { display: flex; gap: var(--29d-s-2); }
@media (max-width: 560px) { .hub-viewurl { display: none; } }
.hub-ico { width: var(--29d-s-4); height: var(--29d-s-4); vertical-align: -3px; }
.hub-frame-wrap { position: relative; flex: 1; min-height: 0; }
#hub-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--29d-bg); }
.hub-veil {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--29d-s-3); background: var(--29d-bg);
}
.hub-veil[hidden] { display: none; }
.hub-veil-mark { border-radius: var(--29d-r-3); }
.hub-veil-text { color: var(--29d-text-2); font-size: var(--29d-text-sm); }
.hub-hint {
  position: absolute; left: var(--29d-s-3); right: var(--29d-s-3); bottom: var(--29d-s-3); z-index: 3;
  display: flex; align-items: center; justify-content: space-between; gap: var(--29d-s-3);
  background: var(--29d-surface); border: 1px solid var(--29d-border);
  border-radius: var(--29d-r-3); padding: var(--29d-s-3);
  box-shadow: var(--29d-shadow-pop); font-size: var(--29d-text-sm); color: var(--29d-text-2);
}
.hub-hint[hidden] { display: none; }

/* ---------- bottom nav ---------- */
.hub-navicon { width: var(--29d-s-6); height: var(--29d-s-6); display: block; }
.hub-bottomnav { padding-bottom: env(safe-area-inset-bottom); }
@media (max-width: 860px) {
  .hub-home { padding-bottom: calc(var(--29d-s-16) + var(--29d-s-12) + env(safe-area-inset-bottom)); }
  .hub-frame-wrap { margin-bottom: calc(var(--29d-s-16) + env(safe-area-inset-bottom)); }
}
@media (min-width: 861px) {
  .hub-bottomnav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hub-tile, .hub-chip, .hub-brand { transition: none; }
}
