/* =========================================================
   The Ape Society gallery. Builds on ../style.css (tokens, header, buttons, footer).
   The other layouts it was chosen from live in lab/gallery-versions/.
   ========================================================= */

:root {
  --t-legendary: #e3b94e;
  --t-epic: #c48fe0;
  --t-rare: #6fa8dc;
  --t-uncommon: #82bb80;
  --t-common: #a29c92;
  --panel: #121110;
  --panel-2: #181614;
  --field: #0f0e0d;
}
.t-legendary { --tc: var(--t-legendary); }
.t-epic { --tc: var(--t-epic); }
.t-rare { --tc: var(--t-rare); }
.t-uncommon { --tc: var(--t-uncommon); }
.t-common { --tc: var(--t-common); }

html.is-locked { overflow: hidden; }

/* ---------- page head ---------- */
.gx { padding-top: 66px; min-height: 70vh; }
.gx-head { padding-top: clamp(26px, 3vw, 40px); padding-bottom: clamp(26px, 3vw, 40px); }
.gx-tabs ul { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px clamp(22px, 3.4vw, 48px); padding-bottom: 14px; border-bottom: 1px solid var(--rule); }
.gx-tabs a { position: relative; display: inline-block; padding: 6px 0; font: 400 clamp(19px, 1.7vw, 23px)/1.2 var(--serif); color: var(--ink-2); }
.gx-tabs a[href]:hover { color: var(--gold-l); }
.gx-tabs a:not([href]) { cursor: default; }
.gx-tabs a[aria-current="page"] { color: var(--ink); }
.gx-tab-line { position: absolute; left: 0; right: 0; bottom: -15px; height: 1px; background: var(--gold); view-transition-name: gx-tab-line; }
.gx-loading, .gx-noscript { text-align: center; color: var(--ink-2); padding: 48px var(--gutter); }
/* the loader: the Society crown with a slow sheen passing over it, above a hairline */
.gx-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 44vh; }
.gx-loader { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.gx-loader-crown {
  width: 58px; aspect-ratio: 122.78 / 107.36;
  -webkit-mask: url("../shared/tailor/TAS_Crown.svg") center / contain no-repeat; mask: url("../shared/tailor/TAS_Crown.svg") center / contain no-repeat;
  background: linear-gradient(105deg, var(--gold) 38%, #f3e3bd 50%, var(--gold) 62%) 0 0 / 300% 100%;
}
.gx-loader-line { position: relative; width: 112px; height: 1px; overflow: hidden; background: var(--rule); }
.gx-loader-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--gold-l), transparent); transform: translateX(-100%); }

/* ---------- moving between Gallery, Family Tree and Rarity Guide ----------
   The three pages crossfade (cross-document view transitions, where supported). The
   header and tabs stay put while the gold underline slides to the new tab. A short
   load shows nothing rather than flashing the loading line, and a slow one fades in. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
.site-header { view-transition-name: site-header; }
.gx-tabs { view-transition-name: gx-tabs; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .26s; }
::view-transition-group(gx-tab-line) { animation-duration: .38s; animation-timing-function: cubic-bezier(.22, .61, .36, 1); }
@media (prefers-reduced-motion: no-preference) {
  .gx-loading { animation: gx-in .4s ease .5s both; }
  .gx-loader-crown { animation: gx-sheen 2.6s cubic-bezier(.45, 0, .55, 1) infinite; }
  .gx-loader-line::after { animation: gx-glide 1.8s cubic-bezier(.45, 0, .55, 1) infinite; }
  .is-late:not([aria-busy]) { animation: gx-in .32s ease both; }
}
@keyframes gx-in { from { opacity: 0; } }
@keyframes gx-sheen { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes gx-glide { to { transform: translateX(250%); } }
.gx-noscript a { color: var(--gold); text-decoration: underline; }
.gx-footer { margin-top: clamp(56px, 7vw, 96px); padding-bottom: 96px; }
.gx-footer .footer-base { margin-top: 32px; }

/* ---------- controls ---------- */
.gx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.gx-search { position: relative; flex: 1 1 260px; min-width: 0; }
.gx-search svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); fill: none; stroke: var(--ink-3); stroke-width: 1.6; pointer-events: none; }
.gx-search input {
  width: 100%; height: 46px; padding: 0 40px 0 42px;
  background: var(--field); color: var(--ink); border: 1px solid var(--rule-2); border-radius: 0;
  font: 400 15px/1 var(--sans); -webkit-appearance: none; appearance: none;
  transition: border-color .25s var(--ease);
}
.gx-search input::placeholder { color: var(--ink-3); }
.gx-search input:focus { outline: none; border-color: var(--gold); }
.gx-search input:focus-visible { outline: 1px solid var(--gold-l); outline-offset: 2px; }
.gx-search input::-webkit-search-cancel-button { display: none; }
.gx-search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; background: none; border: 0; color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer;
}
.gx-search-clear:hover { color: var(--gold-l); }

.gx-sort { display: flex; align-items: center; gap: 8px; }
.gx-sort label { font: 500 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.gx-sort select {
  height: 46px; padding: 0 34px 0 14px; min-width: 150px;
  background: var(--field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%23c9a45c' stroke-width='1.6'/%3E%3C/svg%3E") right 10px center / 16px no-repeat;
  color: var(--ink); border: 1px solid var(--rule-2); border-radius: 0;
  font: 400 14px/1 var(--sans); -webkit-appearance: none; appearance: none; cursor: pointer;
}
.gx-sort select:focus-visible { outline: 1px solid var(--gold-l); outline-offset: 2px; }
.gx-sort option { background: var(--panel); }

.gx-kings, .gx-filters-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px;
  background: transparent; color: var(--ink); border: 1px solid var(--rule-2); border-radius: 0;
  font: 500 12px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
  transition: border-color .25s var(--ease), color .25s var(--ease), background-color .25s var(--ease);
}
.gx-kings:hover, .gx-filters-btn:hover { border-color: var(--gold); color: var(--gold-l); }
.gx-kings img { width: 22px; height: auto; opacity: .9; }
.gx-kings[aria-pressed="true"] { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.gx-kings[aria-pressed="true"] img { filter: brightness(0); opacity: .8; }
.gx-filters-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.gx-filters-btn { display: none; }
.gx-badge, .acc-n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--gold); color: var(--bg); font: 600 11px/1 var(--sans); letter-spacing: 0;
}
.gx-badge[hidden], .acc-n[hidden] { display: none; }

.gx-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-height: 32px; margin: 14px 0 18px; } /* one chip row is always reserved, so picking a filter doesn't push the grid down */
.gx-count { font: 400 14px/1.3 var(--sans); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.gx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gx-chips[hidden] { display: flex; visibility: hidden; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--rule-2); border-radius: 16px;
  font: 400 13px/1 var(--sans); cursor: pointer;
}
.chip:hover { border-color: var(--gold); }
.chip-k { color: var(--ink-3); }
.chip span[aria-hidden] { color: var(--gold); font-size: 15px; }
.chip-clear { background: none; border: 0; padding: 0 4px; color: var(--gold); font: 500 13px/1 var(--sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* rarity marks */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tc, var(--t-common)); }
.rp {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 9px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--tc) 55%, transparent);
  background: color-mix(in srgb, var(--tc) 12%, transparent);
  color: var(--tc); font: 500 12px/1 var(--sans); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.rp-t { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }

/* ---------- facet lists ---------- */
.acc-item { border-bottom: 1px solid var(--rule); }
.acc-item summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 48px; padding: 0 2px; cursor: pointer; list-style: none; /* fixed, so the count badge can't grow it */
  font: 500 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--ink);
}
.acc-item summary::-webkit-details-marker { display: none; }
.acc-item summary::after { content: ""; width: 9px; height: 9px; margin-left: auto; border-right: 1.5px solid var(--gold); border-bottom: 1.5px solid var(--gold); transform: rotate(45deg) translate(-2px, -2px); transition: transform .25s var(--ease); }
.acc-item[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.acc-item summary:hover { color: var(--gold-l); }
.acc-item .fl { padding-bottom: 14px; }

.fl-find input {
  width: 100%; height: 36px; margin-bottom: 8px; padding: 0 10px;
  background: var(--field); color: var(--ink); border: 1px solid var(--rule); border-radius: 0; font: 400 13.5px/1 var(--sans);
}
.fl-find input:focus { outline: none; border-color: var(--gold); }
.fl-gh { margin: 10px 0 2px; font: 500 10.5px/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.fl-group:first-child .fl-gh { margin-top: 2px; }
.fv {
  display: flex; align-items: center; gap: 10px; padding: 6px 4px; cursor: pointer;
  font: 400 14px/1.25 var(--sans); color: var(--ink);
}
.fv[hidden] { display: none; }
.fv:hover { color: var(--gold-l); }
.fv input {
  flex: none; width: 16px; height: 16px; margin: 0; -webkit-appearance: none; appearance: none;
  border: 1px solid var(--rule-2); background: var(--field); cursor: pointer; display: grid; place-items: center;
}
.fv input:checked { background: var(--gold); border-color: var(--gold); }
.fv input:checked::after { content: ""; width: 8px; height: 4px; border-left: 1.6px solid var(--bg); border-bottom: 1.6px solid var(--bg); transform: rotate(-45deg) translate(1px, -1px); }
.fv input:focus-visible { outline: 1px solid var(--gold-l); outline-offset: 2px; }
.fv .crest, .fv .cls-icon { flex: none; }
.fv .cls-icon { width: 20px; height: 18px; object-fit: contain; opacity: .9; }
.tr-icon { flex: none; display: block; width: 24px; height: 24px; }
.tr-icon-none { box-sizing: border-box; border: 1px dashed var(--rule-2); border-radius: 50%; transform: scale(.6); }

/* crests: the family banner, cut out of its backdrop */
.crest { display: block; flex: none; object-fit: contain; object-position: center top; }
/* the popup's crest: animated, no frame */
.crest-plain { border: 0; border-radius: 0; background: none; }
.crest-anim { display: block; flex: none; }
.crest-anim video { display: block; width: 100%; height: auto; background: transparent; }
.cls-icon { display: inline-block; vertical-align: -3px; width: auto; }
.fv-name { flex: 1; min-width: 0; }
.fv-n { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fv.is-zero { opacity: .38; }

/* ---------- results ---------- */
.gx-grid { display: grid; gap: 22px; }
.gx-results img { background: var(--panel); }
.gx-more { display: flex; justify-content: center; padding: 36px 0 0; }
.gx-more[hidden] { display: none; }
.gx-empty { grid-column: 1 / -1; text-align: center; padding: 64px 16px; color: var(--ink-2); }
.gx-empty p { margin-bottom: 18px; font: 400 22px/1.3 var(--serif); color: var(--ink); }
.gx-grid a { display: block; color: inherit; }
.gx-grid a:focus-visible { outline: 1px solid var(--gold-l); outline-offset: 4px; }
.crown { display: inline-block; vertical-align: -1px; height: auto; }

/* captioned card (Salon, Ledger grid, Houses) */
.s-img { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--rule); background: var(--panel); transition: border-color .3s var(--ease); }
.s-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.s-card a:hover .s-img { border-color: var(--gold); }
.s-card a:hover .s-img img { transform: scale(1.035); }
.s-name { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 12px; text-align: center; font: 400 17px/1.25 var(--serif); }
.s-meta { display: block; margin-top: 5px; text-align: center; font: 500 10.5px/1.3 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.is-king .s-img { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 26px rgba(201, 164, 92, .22); }
.is-king .s-name { color: var(--gold-l); }

/* ---------- drawer ---------- */
.gx-drawer {
  margin: 0 auto 0 0; padding: 0; width: min(380px, 100%); height: 100%; max-height: 100%; max-width: 100%;
  background: var(--bg-2); color: var(--ink); border: 0; border-right: 1px solid var(--rule-2);
  flex-direction: column;
}
.gx-drawer[open] { display: flex; }
.gx-drawer::backdrop { background: rgba(0, 0, 0, .66); }
.dr-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.dr-title { font: 400 26px/1 var(--serif); }
.dr-close { background: none; border: 0; color: var(--gold); font: 500 12px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; cursor: pointer; padding: 10px 0 10px 10px; }
.dr-body { flex: 1; overflow-y: auto; padding: 16px 20px; overscroll-behavior: contain; }
.dr-body .gx-kings { width: 100%; justify-content: center; margin-bottom: 8px; }
.dr-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--rule); }

/* ---------- popup (shared) ---------- */
.ap {
  padding: 0; border: 1px solid var(--rule-2); background: var(--bg-2); color: var(--ink);
  max-width: calc(100% - 32px); max-height: calc(100% - 32px);
}
.ap::backdrop { background: rgba(4, 4, 3, .8); }
.ap-in { position: relative; height: 100%; }
.ap-scroll { overflow-y: auto; overscroll-behavior: contain; }
.ap-top { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 10px 10px 0; }
.ap-close, .ap-prev, .ap-next {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: transparent; color: var(--ink); border: 1px solid var(--rule); border-radius: 50%; cursor: pointer;
  transition: border-color .25s, color .25s;
}
.ap-close:hover, .ap-prev:hover:not(:disabled), .ap-next:hover:not(:disabled) { border-color: var(--gold); color: var(--gold-l); }
.ap-close svg, .ap-prev svg, .ap-next svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.ap-prev:disabled, .ap-next:disabled { opacity: .3; cursor: default; }
.ap-nav { display: flex; gap: 6px; }
.ap-fig { position: relative; aspect-ratio: 1; background: var(--panel); overflow: hidden; }
.ap-img { width: 100%; height: 100%; object-fit: cover; }
.ap-head { display: flex; align-items: center; gap: 16px; }
.ap-head .crest { flex: none; }
.ap-name { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font: 400 clamp(28px, 3vw, 38px)/1.1 var(--serif); }
.ap-name .crown { width: 34px; }
.ap-fam { display: flex; align-items: center; gap: 8px; margin-top: 8px; font: 500 11.5px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.ap.is-king .ap-name { color: var(--gold-l); }
.ap.is-king .ap-fam { color: var(--gold); }
.ap.is-king .ap-fig { box-shadow: 0 0 0 1px var(--gold), 0 0 0 5px var(--bg-2), 0 0 0 6px rgba(201, 164, 92, .5), 0 0 48px rgba(201, 164, 92, .22); }
.ap-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 16px; }
.ap-dl svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; }
/* the Ape's OpenSea and Etherscan pages: square buttons beside the download, the marks in the site's colours */
.ap-os { width: var(--h); padding: 0; }
.ap-os svg { width: 22px; height: 22px; fill: currentColor; }
@media (max-width: 600px) {
  /* one row on phones: the download takes the leftover width, the two marks stay square */
  .ap-actions { flex-wrap: nowrap; gap: 8px; }
  .ap-dl { flex: 1 1 auto; min-width: 0; padding: 0 14px; }
  .ap-os { flex: none; }
}
@media (max-width: 420px) { .ap-dl-x { display: none; } }
.ap-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); }
.ap-legend li { display: inline-flex; align-items: center; gap: 7px; font: 500 12px/1 var(--sans); color: var(--ink-2); }
.ap-legend li span:not(.dot) { color: var(--ink-3); font-weight: 400; }

.ap-traits { margin-top: 22px; border-top: 1px solid var(--rule); }
.tr { display: grid; grid-template-columns: 112px 1fr auto; grid-template-areas: "k v p"; align-items: center; column-gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.tr-k { grid-area: k; font: 500 10.5px/1.2 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.tr-v { grid-area: v; display: flex; align-items: center; gap: 9px; font: 400 16px/1.3 var(--sans); color: var(--ink); }
.ap-fam .cls-icon { height: 16px; opacity: .9; }
.tr-v .cls-icon { height: 20px; }
.tr-v .tr-icon, .tr-v .crest { width: 22px; height: 22px; }
.tr-v .crest { height: 26px; }
.tr .rp { grid-area: p; }

@media (prefers-reduced-motion: no-preference) {
  .ap[open] { animation: apIn .35s var(--ease); }
  .ap-img.is-full { animation: fadeIn .4s var(--ease); }
  @keyframes apIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
}

/* ---------- layout: sticky sidebar + grid ---------- */
.s-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: clamp(28px, 3.4vw, 52px); align-items: start; max-width: 1440px; }
.s-side { position: sticky; top: 90px; max-height: calc(100vh - 110px); overflow-y: auto; padding-right: 6px; scrollbar-width: thin; scrollbar-color: var(--rule-2) transparent; }
.s-side-head { padding-bottom: 14px; border-bottom: 1px solid var(--rule); margin-bottom: 14px; }
.s-side-title { font: 400 26px/1 var(--serif); }
.s-side .gx-kings { width: 100%; justify-content: center; margin-bottom: 4px; }
.gx-grid { grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 30px 22px; }

.ap { width: min(1120px, 100%); height: min(760px, calc(100% - 32px)); }
.ap .ap-in { display: flex; flex-direction: column; }
.ap .ap-top { position: absolute; top: 0; right: 0; z-index: 2; }
.ap .ap-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ap .ap-left { padding: 28px; border-right: 1px solid var(--rule); overflow-y: auto; }
.ap .ap-right { padding: 64px 32px 28px; }

/* ---------- Kings in the popup: the throne room, with a royal plaque ---------- */
.kg-stage { position: relative; }
.kg-plaque, .kg-rank { display: none; }
.ap.is-king { background: radial-gradient(90% 70% at 25% 30%, #2a2214, var(--bg-2) 70%); border-color: var(--gold); box-shadow: inset 0 0 0 5px var(--bg-2), inset 0 0 0 6px rgba(201, 164, 92, .45); }
.ap.is-king .ap-left { border-right-color: rgba(201, 164, 92, .35); }
.ap.is-king .ap-fig { box-shadow: 0 0 0 1px var(--gold), 0 0 0 7px rgba(201, 164, 92, .12), 0 0 0 8px rgba(201, 164, 92, .5); }
.ap.is-king .ap-right { position: relative; isolation: isolate; }
.ap.is-king .ap-right::before {
  content: ""; position: absolute; z-index: -1; right: 10px; bottom: 30px; width: 70%; aspect-ratio: 1000 / 1203;
  background: url("../shared/icons/kingape.png") center / contain no-repeat; opacity: .07; pointer-events: none;
}
.ap.is-king .ap-traits, .ap.is-king .tr { border-color: rgba(201, 164, 92, .26); }
.ap.is-king .ap-name { font-size: clamp(32px, 3.4vw, 44px); }
.ap.is-king .ap-name .crown { width: 42px; }
.ap.is-king .ap-fam { display: none; } /* the plaque says it */
.ap.is-king .kg-plaque {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  margin: 18px 0 0; padding: 11px 16px 10px;
  background: linear-gradient(180deg, #d6b46d, #b48d45); color: #1a140a;
  font: 400 15px/1.2 "Classica Pro", var(--serif); letter-spacing: .16em; text-transform: uppercase; text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255, 240, 200, .5), 0 4px 14px rgba(0, 0, 0, .45);
}
.kg-plaque img { filter: brightness(0); opacity: .7; }
.ap.is-king .kg-rank { display: grid; }
.ap.is-king .kg-rank .tr-v { color: var(--gold-l); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .s-layout { display: block; }
  .s-side { display: none; }
  .gx-filters-btn { display: inline-flex; }
  .ap { height: auto; }
  .ap .ap-in { max-height: calc(100vh - 34px); }
  .ap .ap-top { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--rule); background: var(--bg-2); }
  .ap .ap-grid { display: block; flex: 1; min-height: 0; overflow-y: auto; }
  .ap .ap-left { border-right: 0; padding: 20px 22px 0; overflow: visible; }
  .ap .ap-right { padding: 22px 22px 28px; overflow: visible; }
}

@media (max-width: 600px) {
  .gx { padding-top: 60px; }
  /* the four tabs on one line on most phones */
  .gx-tabs ul { column-gap: clamp(12px, 3.6vw, 22px); }
  .gx-tabs a { font-size: clamp(15px, 4.3vw, 19px); }
  .gx-bar > .gx-search { flex-basis: 100%; }
  .gx-sort { flex: 1; }
  .gx-sort select { flex: 1; min-width: 0; }
  .gx-sort label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .gx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
  .s-name { font-size: 15.5px; }
  .s-meta { font-size: 9.5px; letter-spacing: .1em; }

  .ap { max-width: 100%; max-height: 100%; width: 100%; height: 100%; border: 0; }
  .ap .ap-in { max-height: 100vh; max-height: 100dvh; }
  .ap-head { gap: 12px; }
  .ap-head .crest { width: 84px !important; height: auto; }
  .tr { grid-template-columns: 86px 1fr auto; column-gap: 10px; }
  .rp { padding: 4px 7px; gap: 5px; }
  .rp-t { font-size: 9.5px; letter-spacing: .08em; }
  .tr-v { font-size: 15px; }
}

@media (max-width: 900px) {
  .ap.is-king .kg-plaque { font-size: 13px; letter-spacing: .1em; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .s-img img { transition: none; }
}
