/* /poker-terms: the glossary sheet. Needs app.css, nav.css and site.css first.
   A sticky bar holds the search and the letters; on wide screens a rail on the
   left holds the order switch and the topics, and each term is a row: the word
   on the left, the meaning on the right. Phones stack it. */

.vh { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.gl-page { --gl-bar: 122px; }
@media (min-width: 1100px) { .gl-page { --gl-bar: 78px; } }
.gl-page main { padding-top: clamp(28px, 5vw, 60px); }
/* site.css holds main's children to 40rem; the sheet needs the full width */
main > .wrap.gl > .gl-bar, main > .wrap.gl > .gl-grid { max-width: none !important; }
.gl-head { max-width: 40rem; }
.gl-head h1 { margin-bottom: 14px; }
.gl-lead { color: var(--ink-2); font-size: 19px; line-height: 1.5; margin: 0 0 26px; }

/* ── the bar: search and letters, stuck to the top ─────────────── */
.gl-bar {
  position: sticky; top: 0; z-index: 5;
  margin: 0 calc(-1 * clamp(20px, 4vw, 40px));
  padding: 12px clamp(20px, 4vw, 40px) 10px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color var(--fast) var(--ease);
}
.gl-bar.stuck { border-bottom-color: var(--line-2); }
.gl-search { position: relative; max-width: 34rem; }
.gl-glass { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.gl-input {
  width: 100%; min-height: 52px; padding: 0 84px 0 46px; border: 0; border-radius: var(--r-pill);
  background: var(--surface-2); box-shadow: var(--ring); color: var(--ink);
  font: 500 17px/1 var(--font-text); -webkit-appearance: none; appearance: none;
}
.gl-input::placeholder { color: var(--ink-3); }
.gl-input:focus-visible { outline: none; box-shadow: var(--ring), 0 0 0 2px var(--ink); }
.gl-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.gl-count { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); font: 600 13px/1 var(--font-text); color: var(--ink-3); font-variant-numeric: tabular-nums; pointer-events: none; }

.gl-letters { display: flex; gap: 2px; margin: 10px 0 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gl-letters::-webkit-scrollbar { display: none; }
@media (max-width: 899px) {
  /* a fade at the right edge says the row goes on */
  .gl-letters { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 44px), transparent); padding-right: 36px; }
}
.gl-letters a, .gl-letters span {
  flex: none; display: grid; place-items: center; min-width: 34px; height: 36px; border-radius: var(--r-xs);
  font: 700 15px/1 var(--font-display); text-decoration: none; color: var(--ink);
}
.gl-letters span { color: var(--ink-4); }
.gl-letters a:hover { background: var(--surface-2); }
.gl-letters a[aria-current="true"] { background: var(--ink); color: var(--ink-inv); }

/* ── rail and list ─────────────────────────────────────────────── */
.gl-grid { display: grid; gap: 18px; margin-top: 18px; }
.gl-rail { display: grid; gap: 14px; min-width: 0; }
.gl-views { display: inline-grid; grid-auto-flow: column; padding: 4px; gap: 4px; border-radius: var(--r-pill); background: var(--surface-2); box-shadow: var(--ring); justify-self: start; }
.gl-views a { display: grid; place-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); font: 600 15px/1 var(--font-display); color: var(--ink-2); text-decoration: none; }
.gl-views a[aria-current="page"] { background: var(--ink); color: var(--ink-inv); }
.gl-topics { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * clamp(20px, 4vw, 40px)); padding: 2px clamp(20px, 4vw, 40px); }
.gl-topics::-webkit-scrollbar { display: none; }
.gl-topics a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--ring); font: 600 14px/1.2 var(--font-text); color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.gl-topics a:hover { color: var(--ink); background: var(--surface-2); }

.gl-list { min-width: 0; }
.gl-sec { scroll-margin-top: calc(var(--gl-bar, 124px) + 6px); }
.gl-sec > h2 { margin: 34px 0 4px; font: 700 40px/1 var(--font-display); letter-spacing: -.04em; }
.gl-sec:first-child > h2 { margin-top: 6px; }
#topic-seats > h2, [id^="topic-"] > h2 { font-size: clamp(26px, 3.4vw, 32px); letter-spacing: -.03em; }

/* ── one term ──────────────────────────────────────────────────── */
.term { position: relative; display: grid; gap: 6px 28px; padding: 18px 0 20px; border-top: 1px solid var(--line-2); scroll-margin-top: calc(var(--gl-bar, 124px) + 10px); }
.term-name h3 { margin: 0; font: 700 21px/1.2 var(--font-display); letter-spacing: -.02em; }
.term-name h3 a { text-decoration: none; }
.term-name h3 a:hover { text-decoration: underline; }
.aka { margin: 4px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-3); }
.tag { margin: 6px 0 0; font: 600 12px/1.2 var(--font-text); color: var(--ink-3); }
.term-body { min-width: 0; }
.def { margin: 0; font-size: 17px; line-height: 1.55; }
.ex { margin: 10px 0 0; font-size: 15.5px; line-height: 1.5; color: var(--ink-2); }
.rel { margin: 10px 0 0; font-size: 15px; line-height: 1.9; color: var(--ink-3); }
.rel a { color: var(--ink-2); }
.rel a:hover { color: var(--ink); }

.copy {
  position: absolute; top: 14px; right: 0; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: transparent;
  color: var(--ink-3); font: 600 13px/1 var(--font-text); cursor: pointer; touch-action: manipulation;
}
.copy::before {
  content: ""; width: 16px; height: 16px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M8.5 11.5a3 3 0 0 0 4.24 0l2.83-2.83a3 3 0 0 0-4.24-4.24l-.7.7M11.5 8.5a3 3 0 0 0-4.24 0l-2.83 2.83a3 3 0 0 0 4.24 4.24l.7-.7' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M8.5 11.5a3 3 0 0 0 4.24 0l2.83-2.83a3 3 0 0 0-4.24-4.24l-.7.7M11.5 8.5a3 3 0 0 0-4.24 0l-2.83 2.83a3 3 0 0 0 4.24 4.24l.7-.7' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.copy:hover { background: var(--surface-2); color: var(--ink); }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.copy span { display: none; }
.copy.done { color: var(--good, var(--ink)); }
.copy.done span { display: inline; }
@media (hover: hover) {
  .copy { opacity: 0; transition: opacity var(--fast) var(--ease); }
  .term:hover .copy, .copy:focus-visible, .copy.done { opacity: 1; }
  .copy span { display: inline; }
}
.term-name { padding-right: 44px; }

/* the term an address points at */
.term:target { background: var(--surface-2); border-radius: var(--r-xs); border-top-color: transparent; box-shadow: 0 0 0 12px var(--surface-2); }
.term:target + .term { border-top-color: transparent; }
@media (prefers-reduced-motion: no-preference) {
  .term:target { animation: gl-flash 1.6s var(--ease) both; }
  @keyframes gl-flash { from { background: var(--surface-4); box-shadow: 0 0 0 12px var(--surface-4); } to { background: var(--surface-2); box-shadow: 0 0 0 12px var(--surface-2); } }
}

/* example cards: the app's faces, small */
.gl-eg { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 12px 0 2px; }
.gl-cards { display: grid; gap: 5px; }
.gl-cap { font: 600 11.5px/1 var(--font-text); color: var(--ink-3); letter-spacing: .02em; }
.gl-row { display: flex; gap: 4px; }
.gl .pc { --w: 34px; box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 1.5px rgba(0, 0, 0, .05), 0 3px 8px -2px rgba(0, 0, 0, .12); }

.gl-empty { padding: 30px 0 10px; border-top: 1px solid var(--line-2); }
.gl-empty p { margin: 0 0 8px; color: var(--ink-2); }
.gl-empty b { color: var(--ink); font-weight: 600; }
[hidden] { display: none !important; }

.gl-end { max-width: 40rem; margin-top: 64px; padding-top: 8px; border-top: 1px solid var(--line-2); }
.gl-end h2 { margin-top: 30px; }
.gl-tools { margin-top: 24px; font-size: 16px; color: var(--ink-2); }

/* ── wide screens: rail on the left, the word beside its meaning ─ */
@media (min-width: 900px) {
  .gl-grid { grid-template-columns: 190px minmax(0, 1fr); gap: 48px; }
  .gl-rail { position: sticky; top: calc(var(--gl-bar, 80px) + 18px); align-self: start; max-height: calc(100vh - var(--gl-bar, 80px) - 36px); overflow: auto; }
  .gl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; }
  .gl-search { flex: 0 1 320px; min-width: 260px; }
  .gl-topics { flex-direction: column; gap: 2px; margin: 0; padding: 0; overflow: visible; }
  .gl-topics a { background: transparent; box-shadow: none; padding: 7px 12px; min-height: 0; line-height: 1.3; white-space: normal; border-radius: var(--r-xs); }
  .term { grid-template-columns: 13rem minmax(0, 1fr); }
  .gl-letters { flex-wrap: wrap; overflow: visible; margin: 0; gap: 0; }
  .gl-letters a, .gl-letters span { min-width: 26px; height: 34px; }
}
@media (max-width: 420px) {
  .gl-lead { font-size: 17px; }
  .gl-sec > h2 { font-size: 34px; }
  .term-name h3 { font-size: 20px; }
  .gl-letters a, .gl-letters span { min-width: 38px; height: 40px; font-size: 16px; }
}

/* searching: one flat list, best match first */
.gl-list.searching { display: flex; flex-direction: column; }
.gl-list.searching .gl-sec { display: contents; }
.gl-list.searching .gl-sec > h2 { display: none; }
.gl-list.searching .gl-empty { order: 9; }
.gl-list.searching .term:first-of-type, .gl-list.searching .term { border-top: 1px solid var(--line-2); }
