/* ==========================================================================
   Chengyu Idioms Hub (/chengyu/) Styles
   ========================================================================== */

.chengyu-hero {
  margin-bottom: 24px;
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(8, 127, 109, 0.05));
  border: 1px solid var(--line);
  padding: 32px 28px;
  border-radius: 18px;
}

.cy-hero-content h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0 12px;
  color: var(--ink);
  line-height: 1.3;
}

.cy-hero-content p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 780px;
  margin-bottom: 20px;
}

.cy-hero-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cy-stat-box {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px 18px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}

.cy-stat-box strong {
  font-size: 20px;
  font-weight: 800;
  color: #b45309;
}

.cy-stat-box span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Toolbar */
.cy-toolbar {
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: 16px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cy-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.cy-search-wrap svg {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  stroke: var(--muted);
  pointer-events: none;
}

.cy-search-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cy-search-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

.cy-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.cy-filter-chip {
  white-space: nowrap;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.cy-filter-chip:hover {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.05);
}

.cy-filter-chip.is-active {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border-color: #b45309;
}

.cy-chip-count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.08);
}

.cy-filter-chip.is-active .cy-chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Grid & Card */
.cy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.cy-card {
  padding: 22px 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.cy-card:hover {
  transform: translateY(-2px);
  border-color: rgba(217, 119, 6, 0.5);
  box-shadow: 0 10px 24px rgba(217, 119, 6, 0.08);
}

.cy-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cy-hanzi {
  font-size: 24px;
  font-weight: 800;
  color: #b45309;
  letter-spacing: 0.08em;
  font-family: var(--font-hanzi, "Noto Serif SC", serif);
}

.cy-header-actions {
  display: flex;
  gap: 6px;
}

.cy-header-actions .icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: all 0.15s ease;
}

.cy-header-actions .icon-btn:hover {
  border-color: #d97706;
  color: #d97706;
  background: rgba(217, 119, 6, 0.08);
}

.cy-phonetics {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.cy-pinyin {
  font-size: 14px;
  color: var(--jade);
  font-weight: 600;
}

.cy-hv {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.cy-meaning {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
  margin: 4px 0 14px;
}

.cy-origin {
  background: rgba(245, 158, 11, 0.06);
  border-left: 3px solid #d97706;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 14px;
}

.cy-origin-title {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.cy-origin-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.cy-example {
  margin-top: auto;
  background: var(--bg);
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.cy-example-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.cy-example-hanzi {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.cy-example-pinyin {
  margin: 0 0 2px;
  font-size: 12px;
  color: var(--muted);
}

.cy-example-vi {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
}

.cy-example-audio-btn {
  font-size: 11px;
  font-weight: 600;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--jade);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.cy-example-audio-btn svg {
  width: 12px;
  height: 12px;
}

.cy-example-audio-btn:hover {
  background: rgba(8, 127, 109, 0.08);
  border-color: var(--jade);
}

.cy-empty-notice {
  text-align: center;
  padding: 36px 20px;
  font-size: 14px;
  color: var(--muted);
  border-radius: 14px;
}

/* Dark Mode */
html[data-theme="dark"] .chengyu-hero {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.15), rgba(8, 127, 109, 0.08));
}

html[data-theme="dark"] .cy-origin {
  background: rgba(245, 158, 11, 0.12);
}

html[data-theme="dark"] .cy-origin-title {
  color: #fde68a;
}

html[data-theme="dark"] .cy-hanzi {
  color: #f59e0b;
}

html[data-theme="dark"] .cy-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

@media (max-width: 640px) {
  .cy-grid {
    grid-template-columns: 1fr;
  }
}
