/* Literature History Map スタイル */

.lh-outer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.2rem;
}

.breadcrumb {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}
.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}

.lh-intro {
  font-size: 0.88rem;
  color: var(--color-text-light);
  margin-bottom: 1.2rem;
  line-height: 1.7;
}

/* details セクション（掲載誌・流派フィルタ） */
.lh-filter-details {
  margin: 0.4rem 0 0.6rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-alt);
}
.lh-filter-details summary {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  padding: 0.2rem 0;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
}
.lh-filter-details summary::-webkit-details-marker {
  display: none;
}
.lh-filter-details summary::before {
  content: "▶";
  font-size: 0.7rem;
  color: var(--color-text-muted);
  transition: transform 0.15s;
  flex-shrink: 0;
}
.lh-filter-details[open] summary::before {
  transform: rotate(90deg);
}
.lh-filter-details[open] summary {
  margin-bottom: 0.4rem;
}
.lh-filter-details .lh-chips {
  margin-top: 0.3rem;
}
.lh-clear-btn {
  margin-left: auto;
  padding: 0.15rem 0.6rem;
  font-size: 0.74rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-white);
  color: var(--color-text-muted);
  cursor: pointer;
}
.lh-clear-btn:hover {
  background: var(--color-bg);
  color: var(--color-text-light);
}
.lh-chip-group {
  display: inline-block;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  font-weight: 600;
  padding: 0.2rem 0.5rem 0.2rem 0.7rem;
  margin: 0 0.2rem 0 0.4rem;
  border-left: 2px solid var(--color-border);
}
.lh-chip-group:first-child {
  margin-left: 0;
  border-left: none;
  padding-left: 0;
}

/* filter bar */
.lh-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: center;
  margin: 0.4rem 0 0.6rem;
  padding: 0.6rem 0.4rem;
  border-radius: 4px;
  background: var(--color-bg-alt);
}
.lh-filter-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lh-filter-label {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}
.lh-search-input {
  width: 16rem;
  max-width: 100%;
  padding: 0.35rem 0.6rem;
  font-family: var(--font-primary);
  font-size: 0.86rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-white);
}
.lh-search-input:focus {
  outline: 2px solid var(--color-primary-light);
  outline-offset: -1px;
  border-color: var(--color-primary);
}
.lh-search-clear {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.3rem;
  line-height: 1;
}
.lh-chips {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}
.lh-chip {
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  font-family: var(--font-primary);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-white);
  color: var(--color-text-light);
  cursor: pointer;
  transition: all 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.lh-chip:hover {
  background: var(--color-bg);
  color: var(--color-primary);
}
.lh-chip.active {
  background: var(--color-primary);
  color: var(--color-white);
  border-color: var(--color-primary);
}
.lh-result-count {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

/* school legend swatch */
.lh-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.lh-school-chip.active,
.lh-magazine-chips .lh-chip.active {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* lane background (alternate row striping) */
.lh-lane-bg {
  fill: transparent;
}
.lh-lane-bg.odd {
  fill: rgba(0, 0, 0, 0.025);
}

/* map-note */
.map-note {
  font-size: 0.78rem;
  color: var(--color-text-light);
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-border);
  padding: 0.5rem 0.8rem;
  margin: 0.4rem 0;
  line-height: 1.6;
}
.map-note-source {
  background: var(--color-bg);
  border-left-color: var(--color-primary-light);
}

/* chart : 4 セルグリッド (corner / axis / sidebar / bars) */
.lh-chart-wrap {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-white);
  overflow: auto;
  max-height: 48vh;
  margin: 0.6rem 0 1rem;
  cursor: grab;
  display: grid;
  grid-template-columns: 134px max-content; /* 作家名94 + 件数40 */
  grid-template-rows: 32px max-content;
}
.lh-chart-wrap.is-panning {
  cursor: grabbing;
  user-select: none;
}

/* セル：左上 corner（sticky top + left） */
.lh-corner {
  grid-column: 1; grid-row: 1;
  position: sticky;
  top: 0;
  left: 0;
  z-index: 10;
  background: var(--color-bg-alt);
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  font-family: var(--font-primary);
  font-size: 0.68rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
}
.lh-corner-label-name {
  flex: 1;
  text-align: right;
  padding-right: 6px;
  border-right: 1px solid var(--color-border);
}
.lh-corner-label-count {
  width: 40px;
  text-align: right;
  padding-right: 6px;
}

/* セル：上行 axis（sticky top） */
.lh-axis-cell {
  grid-column: 2; grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}
.lh-axis-cell svg {
  display: block;
}

/* セル：左列 sidebar（sticky left） */
.lh-sidebar {
  grid-column: 1; grid-row: 2;
  position: sticky;
  left: 0;
  z-index: 5;
  background: var(--color-bg-alt);
  border-right: 1px solid var(--color-border);
  display: flex;
}
.lh-name-col {
  width: 94px;
  overflow-x: auto;
  scrollbar-width: thin;
  flex-shrink: 0;
}
.lh-name-list {
  display: flex;
  flex-direction: column;
  width: max-content;
  min-width: 100%;
}
.lh-name-row {
  height: 22px;
  line-height: 22px;
  padding: 0 6px 0 4px;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  color: var(--color-text);
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.lh-name-row.odd {
  background: rgba(0, 0, 0, 0.025);
}
.lh-name-row:hover {
  background: rgba(108, 36, 31, 0.08);
  color: var(--color-primary);
}
.lh-name-row.selected {
  background: var(--color-primary);
  color: var(--color-white);
}
.lh-count-col {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.lh-count-row {
  height: 22px;
  line-height: 22px;
  padding-right: 6px;
  font-family: var(--font-primary);
  font-size: 0.66rem;
  color: var(--color-text-muted);
  text-align: right;
  cursor: pointer;
  transition: background-color 0.12s, color 0.12s;
}
.lh-count-row.odd {
  background: rgba(0, 0, 0, 0.025);
}
.lh-count-row:hover {
  background: rgba(108, 36, 31, 0.08);
  color: var(--color-primary);
}
.lh-count-row.selected {
  background: var(--color-primary);
  color: var(--color-white);
}

/* セル：右下 bars */
.lh-bars-cell {
  grid-column: 2; grid-row: 2;
}
.lh-bars-cell svg {
  display: block;
}

/* スマホ調整 */
@media (max-width: 640px) {
  .lh-chart-wrap {
    grid-template-columns: 110px max-content; /* 作家名74 + 件数36 */
  }
  .lh-name-col {
    width: 74px;
  }
  .lh-count-col {
    width: 36px;
  }
  .lh-name-row {
    font-size: 0.74rem;
  }
}
.lh-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  color: var(--color-text-muted);
  font-size: 0.88rem;
  pointer-events: none;
  transition: opacity 0.15s;
}
.lh-loading.hidden {
  opacity: 0;
}

/* SVG chart */
.lh-grid line {
  stroke: var(--color-border);
  stroke-width: 0.5;
  opacity: 0.4;
}
.lh-grid-major line {
  opacity: 0.7;
}
.lh-axis-top text {
  font-family: var(--font-primary);
  fill: var(--color-text-light);
}
.lh-tick-yearly { font-size: 0.6rem; opacity: 0.5; }
.lh-tick-minor  { font-size: 0.7rem; opacity: 0.7; }
.lh-tick-major  { font-size: 0.78rem; font-weight: 600; }

.lh-bar {
  cursor: pointer;
  stroke: rgba(0, 0, 0, 0.15);
  stroke-width: 0.5;
  transition: filter 0.12s;
}
.lh-bar:hover {
  filter: brightness(1.18);
}
.lh-bar.selected {
  stroke: var(--color-accent);
  stroke-width: 2;
}
.lh-works.has-search .lh-bar:not(.match) {
  opacity: 0.18;
}
.lh-works.has-search .lh-bar.match {
  filter: brightness(1.1);
}
.lh-bar-label {
  font-family: var(--font-primary);
  font-size: 0.7rem;
  fill: var(--color-white);
  font-weight: 500;
  cursor: pointer;
}
.lh-bar-label:hover {
  text-decoration: underline;
}
.lh-bar-label.outside {
  fill: var(--color-text);
  font-weight: 400;
}
.lh-works.has-search .lh-bar-label.outside {
  fill: var(--color-text-light);
}

/* tooltip */
.lh-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: var(--color-text);
  color: var(--color-white);
  padding: 0.4rem 0.6rem;
  border-radius: 3px;
  font-size: 0.78rem;
  line-height: 1.5;
  max-width: 22rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.lh-tooltip-name {
  font-weight: 600;
  margin-bottom: 0.1rem;
}
.lh-tooltip-creator {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.74rem;
  margin-bottom: 0.2rem;
}
.lh-tooltip-period {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.85);
}

/* detail panel */
.lh-detail-panel {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-white);
  padding: 0.9rem 1rem;
  margin: 0.6rem 0 1.2rem;
  font-size: 0.86rem;
}
.lh-detail-empty {
  color: var(--color-text-muted);
  font-size: 0.84rem;
  font-style: italic;
}
.lh-detail-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text-muted);
  font-size: 0.74rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  cursor: pointer;
}
.lh-detail-close:hover {
  background: var(--color-bg);
  color: var(--color-text-light);
}
.lh-detail-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.lh-detail-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
}
.lh-detail-creator {
  font-size: 0.86rem;
  color: var(--color-text-light);
}
.lh-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  font-size: 0.78rem;
  color: var(--color-text-light);
  line-height: 1.7;
  margin-bottom: 0.5rem;
}
.lh-detail-meta strong {
  color: var(--color-text);
  margin-right: 0.3em;
  font-weight: 600;
}
.lh-detail-school {
  display: inline-block;
  padding: 0.05em 0.6em;
  border-radius: 999px;
  color: var(--color-white);
  font-size: 0.72rem;
  font-weight: 500;
  margin-right: 0.2em;
}
.lh-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  margin: 0.6rem 0 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--color-border);
}
.lh-detail-actions a {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.82rem;
}
.lh-detail-actions a:hover {
  text-decoration: underline;
}
.lh-detail-affiliate {
  color: var(--color-accent) !important;
}
.lh-detail-pr-note {
  font-size: 0.72rem;
  color: var(--color-text-muted);
  margin-top: 0.4rem;
  font-style: italic;
}
.lh-detail-bio {
  font-size: 0.85rem;
  line-height: 1.75;
  color: var(--color-text);
  margin: 0.4rem 0;
  padding: 0.5rem 0.8rem;
  background: var(--color-bg-alt);
  border-left: 3px solid var(--color-primary-light);
  border-radius: 2px;
}
.lh-detail-author-works {
  max-height: 280px;
  overflow-y: auto;
}
.lh-detail-section {
  margin-top: 0.6rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--color-border);
}
.lh-detail-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.3rem;
}
.lh-detail-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.6;
}
.lh-detail-list-item {
  display: inline-flex;
  gap: 0.3em;
}
.lh-detail-list-meta {
  color: var(--color-text-muted);
  font-size: 0.74rem;
}

/* guide */
.lh-guide {
  font-size: 0.86rem;
  line-height: 1.8;
  color: var(--color-text-light);
  margin-top: 1.4rem;
}
.lh-guide h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.4rem;
  margin-bottom: 0.4rem;
  color: var(--color-text);
}
.lh-guide ul {
  margin-left: 1.2rem;
  padding-left: 0;
}
.lh-guide li {
  margin-bottom: 0.3rem;
}
