/* App shell: sidebar on desktop, top bar + bottom navigation on mobile. */

.shell { min-height: 100vh; min-height: 100dvh; }
.side { display: none; }
.top {
  position: sticky; top: 0; z-index: 30; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) var(--gutter) 0;
  display: flex; align-items: center; gap: 4px;
  background: color-mix(in srgb, var(--ink) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.top .spacer { flex: 1; }
.main { padding: 20px var(--gutter) calc(var(--nav-h) + var(--safe-b) + 28px); max-width: 1240px; margin: 0 auto; min-height: 60vh; }
.main:focus { outline: none; }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--coal) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.navlink {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--mute); font-size: 11px; font-weight: 500; letter-spacing: .01em; min-width: 0; transition: color .15s;
}
.navlink svg { width: 22px; height: 22px; }
.navlink[aria-current="page"] { color: var(--on-burg); }
.navlink[aria-current="page"]::before {
  content: ""; position: absolute; inset: 6px 8px; background: var(--burg); border-radius: 12px; z-index: -1;
}
.navlink .badge { position: absolute; top: 8px; left: calc(50% + 6px); }

.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--lime); color: var(--on-lime);
  font-size: 11px; font-weight: 700; line-height: 17px; text-align: center;
}

.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--bone); }
.brand__mark { width: 28px; height: 28px; flex: none; }
.brand__word { font-family: var(--font-display); font-style: italic; font-weight: 700; font-size: 22px; letter-spacing: -0.01em; line-height: 1; }
.brand__word i { font-style: normal; color: var(--gold-text); }

.iconbtn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--bone); position: relative;
  transition: background .15s;
}
.iconbtn:hover { background: var(--char); }
.iconbtn svg { width: 22px; height: 22px; }
.iconbtn .badge { position: absolute; top: 2px; right: 0; }

@media (min-width: 900px) {
  :root { --gutter: 36px; }
  .shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .top { display: none; }
  .bottom { display: none; }
  .main { padding-top: 34px; padding-bottom: 80px; width: 100%; }
  .side {
    display: flex; flex-direction: column; gap: 26px; position: sticky; top: 0; height: 100vh; height: 100dvh; padding: 26px 18px 22px;
    background: var(--coal); border-right: 1px solid var(--line);
  }
  .side .brand__word { font-size: 26px; }
  .side .brand__mark { width: 34px; height: 34px; }
  .side nav { display: flex; flex-direction: column; gap: 2px; }
  .side .navlink {
    flex-direction: row; justify-content: flex-start; gap: 12px; height: 44px; padding: 0 14px; border-radius: 10px; font-size: 14.5px;
  }
  .side .navlink::before { inset: 0; }
  .side .navlink:hover:not([aria-current="page"]) { background: var(--char); color: var(--bone); }
  .side .navlink .badge { position: static; margin-left: auto; }
  .side__foot { margin-top: auto; display: grid; gap: 10px; }
  .side__search { width: 100%; justify-content: flex-start; }
}

/* Page head */
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagehead p { margin-top: 6px; color: var(--mute); max-width: 60ch; }
.pagehead__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.section { margin-top: 38px; }
.section:first-child { margin-top: 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section__head a, .section__head button.link { color: var(--gold-text); font-size: 14px; font-weight: 500; }
.section__head a:hover, .section__head button.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.section__note { color: var(--mute); font-size: 13.5px; margin: -8px 0 14px; max-width: 70ch; }

.footnote { margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--mute); font-size: 12.5px; max-width: 80ch; }
.footnote a { color: var(--gold-text); text-decoration: underline; text-underline-offset: 2px; }

/* Rails (horizontal posters) and grids */
.rail {
  display: grid; grid-auto-flow: column; grid-auto-columns: 128px; gap: 14px; overflow-x: auto; scroll-snap-type: x proximity;
  margin: 0 calc(var(--gutter) * -1); padding: 4px var(--gutter) 10px; scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
.rail--wide { grid-auto-columns: 148px; }
@media (min-width: 900px) { .rail { grid-auto-columns: 156px; gap: 18px; } .rail--wide { grid-auto-columns: 176px; } }

.grid {
  display: grid; gap: 22px 14px; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}
@media (min-width: 600px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 18px; } }
.grid--compact { grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 16px 10px; }
@media (min-width: 600px) { .grid--compact { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); } }

.stack { display: grid; gap: 10px; }
.stack--lg { gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.cols { display: grid; gap: 28px; }
@media (min-width: 900px) { .cols--2 { grid-template-columns: 1fr 1fr; } .cols--aside { grid-template-columns: minmax(0, 1fr) 340px; } }

/* Scrollable control rows */
.scrollx { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter); }
.scrollx::-webkit-scrollbar { display: none; }
.scrollx > * { flex: none; }
