/* Glossary page */
.gloss-main { padding-bottom: 80px; }

.gloss-header {
  padding: 70px 0 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.gloss-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.5px;
  margin: 24px 0 18px;
}
.gloss-header h1 em { color: var(--accent); font-style: italic; }
.gloss-header .lede {
  font-size: 17px;
  color: var(--ink-soft);
  line-height: 1.7;
  max-width: 680px;
  margin: 0 0 28px;
}
.gloss-search-wrap { max-width: 480px; }
.gloss-search {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-size: 15px;
  font-family: var(--sans);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--glass) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a7e6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 14px center;
  color: var(--ink);
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.gloss-search:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(217, 119, 87, 0.12); }
.gloss-search::placeholder { color: var(--ink-mute); }

/* Alphabet jumper */
.alpha-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 0 28px;
  position: sticky;
  top: 64px;
  background: var(--bg-0);
  z-index: 10;
  border-bottom: 1px solid var(--line);
  margin: 0 0 28px;
}
.alpha-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  background: var(--glass);
  transition: all .15s;
}
.alpha-nav a:hover {
  background: var(--accent);
  color: var(--btn-primary-fg);
  border-color: var(--accent);
}

/* Letter section divider */
.gloss-letter {
  display: flex;
  align-items: center;
  margin: 36px 0 18px;
  scroll-margin-top: 120px;
}
.gloss-letter span {
  font-family: var(--serif);
  font-size: 38px;
  font-weight: 600;
  color: var(--accent);
  font-style: italic;
  line-height: 1;
  margin-right: 18px;
}
.gloss-letter::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* Glossary items */
.gloss-list {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
}
.gloss-item {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color .2s, transform .15s;
}
.gloss-item:hover {
  border-color: rgba(217, 119, 87, 0.4);
  transform: translateY(-1px);
}
.gloss-item {
  scroll-margin-top: 120px;
}
.gloss-item:target,
.gloss-item.is-target {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  background: rgba(217, 119, 87, 0.10);
  animation: glossFlash 2.2s ease-out;
}
@keyframes glossFlash {
  0%   { background: rgba(217, 119, 87, 0.30); }
  100% { background: rgba(217, 119, 87, 0.10); }
}
.gloss-item dt {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: -0.2px;
}
.gloss-item dd {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink-soft);
}
.gloss-item dd.en {
  font-size: 13px;
  color: var(--accent-deep);
  font-style: italic;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
  text-transform: lowercase;
}

.gloss-empty {
  text-align: center;
  padding: 60px 0;
  color: var(--ink-mute);
  font-size: 16px;
  font-style: italic;
}

/* Topic clusters — thematic mini-indexes above the alphabetical list */
.topic-clusters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 0 0 36px;
}
.topic-cluster {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color .2s;
  overflow: hidden;
}
.topic-cluster:hover { border-color: rgba(217, 119, 87, 0.35); }
.topic-cluster[open] { border-color: var(--accent); }
.topic-cluster summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans);
  user-select: none;
  position: relative;
}
.topic-cluster summary::-webkit-details-marker { display: none; }
.topic-cluster summary::after {
  content: "▾";
  margin-left: auto;
  color: var(--ink-mute);
  font-size: 11px;
  transition: transform .2s;
}
.topic-cluster[open] summary::after { transform: rotate(180deg); }
.topic-cluster .topic-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(217, 119, 87, 0.12);
  color: var(--accent);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 16px;
  flex: 0 0 auto;
}
.topic-cluster[open] .topic-icon {
  background: var(--accent);
  color: var(--btn-primary-fg);
}
.topic-cluster .topic-title {
  font-weight: 600;
  font-size: 14.5px;
  color: var(--ink);
  letter-spacing: -0.1px;
}
.topic-cluster .topic-count {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-left: 2px;
}
.topic-list {
  list-style: none;
  padding: 4px 12px 14px;
  margin: 0;
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
}
.topic-list li { margin: 0; }
.topic-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--ink-soft);
  text-decoration: none;
  line-height: 1.4;
  transition: background .12s, color .12s;
}
.topic-list a:hover {
  background: rgba(217, 119, 87, 0.10);
  color: var(--ink);
}
.topic-list a strong {
  font-weight: 500;
  color: var(--ink);
}
.topic-list .topic-en {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-style: italic;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  text-transform: lowercase;
}

@media (max-width: 700px) {
  .gloss-header { padding: 50px 0 24px; }
  .alpha-nav a { width: 28px; height: 28px; font-size: 14px; }
  .gloss-letter span { font-size: 30px; }
  .gloss-item { padding: 18px 20px; }
  .gloss-item dt { font-size: 19px; }
  .topic-clusters { grid-template-columns: 1fr; }
  .topic-list a { flex-wrap: wrap; }
  .topic-list .topic-en { width: 100%; }
}
