/* tokens: brand.css */
/* 指標辞典 — open cards (GlossaryB): compact grid, one card opens to a full row. */
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); font-family: var(--font-ui); background: var(--bg); }
.main { min-width: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

main.glossary {
  padding: 40px clamp(16px, 3vw, 44px) 64px;
  display: flex; flex-direction: column; gap: 22px;
}
.gl-head h1 { margin: 0; font-size: 1.75rem; font-weight: 700; }
.gl-lead { margin: 6px 0 0; font-size: 0.875rem; line-height: 1.7; color: var(--muted); }

/* toolbar */
.gl-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gl-search {
  flex: 1 1 320px; max-width: 480px;
  display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; min-height: 46px;
}
.gl-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.15); }
.gl-search-ico { color: var(--faint); font-size: 15px; }
.gl-search input {
  flex: 1; border: 0; outline: none; font: inherit; font-size: 0.875rem;
  color: var(--ink); background: transparent; min-height: 44px;
}
.gl-search input::placeholder { color: #9aa6b5; }
.gl-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.gl-kind {
  font: inherit; font-size: 0.8125rem; font-weight: 700;
  border-radius: 999px; padding: 0 14px; min-height: 40px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: #334155;
}
.gl-kind:hover { border-color: #c9d4e4; }
.gl-kind.is-on { background: #1e293b; border-color: #1e293b; color: #fff; }
.gl-kind-n { margin-left: 6px; font-size: 0.6875rem; opacity: 0.7; }

/* sections */
.gl-group { display: flex; flex-direction: column; gap: 12px; }
.gl-group[hidden] { display: none; }
.gl-group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.gl-group-head h2 { margin: 0; font-size: 1.125rem; font-weight: 700; }
.gl-count { font-size: 0.75rem; font-weight: 700; color: var(--faint); }
.gl-group-desc { flex-basis: 100%; margin: 0; padding-left: 20px; font-size: 0.8125rem; line-height: 1.6; color: var(--muted); }
.gl-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; background: var(--kind-digital); }
.gl-dot.kind-traffic { background: var(--kind-traffic); }
.gl-dot.kind-event { background: var(--kind-event); }
.gl-dot.kind-business { background: var(--kind-business); }
.gl-dot.kind-meta { background: var(--kind-meta); }

.gl-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px; align-items: start; grid-auto-flow: row dense;
}

/* card */
.gl-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.gl-card[hidden] { display: none; }
.gl-card:hover { border-color: #9db8ea; }
.gl-card[open] { grid-column: 1 / -1; border-color: #9db8ea; box-shadow: 0 6px 20px rgba(21, 32, 51, 0.06); }
.gl-card summary {
  list-style: none; cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px; min-height: 150px;
}
.gl-card[open] summary { min-height: 0; }
.gl-card summary::-webkit-details-marker { display: none; }
.gl-card summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 14px; }
.gl-caret {
  width: 8px; height: 8px; margin-right: 4px;
  border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
  transform: rotate(45deg); transition: transform 0.2s ease;
}
.gl-card[open] .gl-caret { transform: rotate(-135deg); }
.gl-card-main { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.gl-card-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gl-sticker { width: 56px; height: 56px; flex: none; object-fit: contain; }


.gl-empty {
  margin: 0; padding: 28px 16px; font-size: 0.875rem; color: var(--muted); text-align: center;
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
}

@media (prefers-reduced-motion: reduce) {
  .gl-open { animation: none; }
  .gl-caret, .gl-card { transition: none; }
}
@media (max-width: 720px) {
  main.glossary { padding: 24px 16px 48px; }
  .gl-list { grid-template-columns: 1fr; }
}
.gl-card:not([open]) .gl-meaning {
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
  height: calc(1.65em * 3);
}
.gl-card summary { min-height: 0; }

/* Phones: search and kinds stay on top; each group opens 4 at a time (canvas SpGlossary) */
.gl-more { display: none; }
@media (max-width: 640px) {
  main.glossary { gap: 16px; }
  .gl-toolbar { position: sticky; top: 57px; z-index: 20; margin: 0 -16px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 8px; }
  .gl-search { flex: none; max-width: none; min-height: 44px; }
  .gl-kinds { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-right: -16px; padding-right: 16px;
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .gl-kinds::-webkit-scrollbar { display: none; }
  .gl-kind { flex: none; min-height: 36px; padding: 0 12px; }
  .gl-group-desc { padding-left: 0; }
  .gl-list { gap: 8px; }
  .gl-card summary { min-height: 0; padding: 12px 14px; gap: 6px; }
  .gl-card:not([open]) .gl-meaning { -webkit-line-clamp: 2; line-clamp: 2; height: calc(1.65em * 2); }
  .gl-sticker { width: 44px; height: 44px; }
  .glossary:not(.is-searching) .gl-group:not(.is-all) .gl-extra { display: none; }
  .glossary:not(.is-searching) .gl-group:not(.is-all) .gl-more { display: flex; }
  .gl-more { align-items: center; justify-content: center; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--accent-ink); font: inherit; font-size: 0.8125rem; font-weight: 700; cursor: pointer; }
}

/* NEW: words added in the last 30 days (metrics/help_added.py) */
.gl-news { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 14px 0 0; padding: 10px 14px; background: #eef4ff; border: 1px solid #c9dbfb; border-radius: 12px; font-size: 0.875rem; }
.gl-news-when { font-size: 0.8125rem; color: var(--muted); }
.gl-news-btn { font: inherit; font-size: 0.8125rem; font-weight: 700; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #2f6fed; background: #fff; color: #1d4ed8; cursor: pointer; }
.gl-news-btn[aria-pressed="true"] { background: #2f6fed; color: #fff; }
.gl-news-btn:focus-visible, .gl-news-link:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }
.gl-news-link { margin-left: auto; font-size: 0.8125rem; font-weight: 700; text-decoration: none; }
.gl-chips { display: inline-flex; align-items: center; gap: 6px; }
.gl-new { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: #2f6fed; color: #fff; font-size: 0.6875rem; font-weight: 800; letter-spacing: 0.02em; }
@media (max-width: 640px) {
  .gl-news-when { flex-basis: 100%; order: 2; }
  .gl-news-btn { order: 3; }
  .gl-news-link { order: 4; }
}
