/* Openings encyclopedia (/openings/), generated by scripts/openings/build.ts.
   Boards, mini boards and move lists are styled in styles.css, which the home page shares */

.op {
  padding-top: 2rem;
}

/* Breadcrumbs */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  font-size: 0.9rem;
  color: var(--color-2);
  margin-bottom: 2rem;
}

.crumbs a {
  color: var(--color-2);
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--green-highlight);
}

.crumbs [aria-current] {
  color: var(--color);
}

.crumb-sep {
  opacity: 0.6;
}

/* Board + info */
.op-top {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.op-board {
  flex: 0 0 auto;
  width: min(420px, 100%);
}

.op-info {
  flex: 1 1 auto;
  min-width: 0;
}

.op-family {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.op-family a {
  color: var(--color-2);
  text-decoration: none;
}

.op-family a:hover {
  color: var(--green-highlight);
}

.op-title {
  font-size: 2.75rem;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.op-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.op-eco,
.op-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  color: var(--color-2);
}

.op-tag {
  border-color: var(--green-highlight);
  color: var(--green-highlight);
}

.op-summary,
.op-placeholder {
  color: var(--color-2);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.op-placeholder {
  font-style: italic;
}

.op-cta.button-primary {
  display: inline-block;
  text-decoration: none;
  font-size: 1.1rem;
  padding: 0.35rem 1.25rem;
}

/* Variation / family cards */
.op-section {
  margin-top: 3.5rem;
}

.op-h2 {
  font-family: 'Marcellus', serif;
  font-weight: 400;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.op-count {
  font-family: 'Red Hat Display', sans-serif;
  font-size: 1rem;
  color: var(--color-2);
}

.var-grid,
.op-results {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.var-card {
  display: flex;
  align-items: stretch;
  gap: 0.9rem;
  height: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  text-decoration: none;
  color: var(--color);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.var-card:hover {
  background-color: var(--background-hover);
  border-color: var(--green-highlight);
}

.var-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.var-name {
  font-weight: 600;
}

.var-moves {
  font-size: 0.85rem;
  color: var(--color-2);
  overflow-wrap: anywhere;
}

.var-sub {
  font-size: 0.85rem;
  color: var(--color-2);
  margin-top: auto;
  padding-top: 0.25rem;
}

/* Search (index page) */
.op-search {
  margin-bottom: 1rem;
}

.op-search input {
  width: 100%;
  max-width: 560px;
  font: inherit;
  font-size: 1.1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--background);
  color: var(--color);
}

.op-search input:focus {
  outline: 2px solid var(--outline-color);
  outline-offset: 1px;
}

/* Style tag filters (index): toggles, combined with the search text */
.op-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.op-tag-chip {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--color-2);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.op-tag-chip:hover {
  color: var(--color);
  border-color: var(--color-hover);
}

.op-tag-chip[aria-pressed="true"] {
  color: var(--color);
  border-color: var(--green-highlight);
  background: rgba(99, 165, 0, 0.15);
}

.op-tag-chip:focus-visible {
  outline: 2px solid var(--outline-color);
  outline-offset: 2px;
}

.op-tag-count {
  font-size: 0.8em;
  opacity: 0.65;
  margin-left: 0.15rem;
}

.op-results {
  margin-top: 1.5rem;
}

/* The grid display above would otherwise beat the browser's own [hidden] rule */
.op-results[hidden],
#op-groups[hidden] {
  display: none;
}

.op-more {
  grid-column: 1 / -1;
  color: var(--color-2);
  padding: 0.5rem 0;
}

@media (max-width: 768px) {
  .op {
    padding: 1.5rem 1rem 3rem;
  }

  .op-top {
    flex-direction: column;
    gap: 1.5rem;
  }

  .op-board {
    width: 100%;
  }

  .op-title {
    font-size: 2rem;
  }

  .op .headline {
    font-size: 2.5rem;
  }
}

/* Game stats and White / draw / Black bars */
.op-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.op-games {
  font-weight: 600;
  white-space: nowrap;
}

.op-stats .bar {
  flex: 1 1 auto;
  max-width: 320px;
  height: 1.4rem;
}

.op-stats-none,
.cont-none {
  color: var(--color-2);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.bar {
  display: flex;
  height: 1.1rem;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

.bar > span {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
}

.bar-w { background: #F2F0E5; color: #100F0F; }
.bar-d { background: #878580; color: #FFFCF0; }
.bar-b { background: #282726; color: #CECDC3; }
.bar-none { border-style: dashed; background: transparent; }

.op-exploring {
  font-size: 0.95rem;
  color: var(--color-2);
  background: var(--background-hover);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  margin-bottom: 1rem;
}

.op-exploring a {
  color: var(--color);
  font-weight: 600;
}

.op.is-loading #op-board,
.op.is-loading #op-cont,
.op.is-loading #op-stats {
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

/* Continuations */
.cont-list {
  list-style: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.cont-list li + li {
  border-top: 1px solid var(--border-color);
}

.cont {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 3.5rem 4.5rem minmax(120px, 240px);
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--color);
  transition: background-color 0.15s ease;
}

.cont:hover {
  background-color: var(--background-hover);
}

.cont-move {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cont-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cont-share,
.cont-games {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--color-2);
  font-size: 0.9rem;
}

/* Index: first-move cards and the A–Z list */
.fm-move {
  font-weight: 700;
  font-size: 1.1rem;
}

.op-first-moves {
  margin-top: 2rem;
}

/* The result bar runs edge to edge along the bottom of a first-move card */
.fm-card {
  flex-wrap: wrap;
  align-content: space-between; /* keeps the bar on the bottom edge in a taller grid row */
  row-gap: 0.6rem;
  overflow: hidden;
}

.fm-card > .bar {
  flex: 0 0 calc(100% + 1.5rem);
  margin: 0.15rem -0.75rem -0.75rem;
  height: 1.25rem;
  border: none;
  border-top: 1px solid var(--border-color);
  border-radius: 0;
}

.fm-card > .mini + .var-text {
  flex: 1 1 0;
}

.az {
  list-style: none;
  columns: 4 220px;
  column-gap: 2rem;
}

.az li {
  break-inside: avoid;
  padding: 0.2rem 0;
}

.az a {
  color: var(--color);
  text-decoration: none;
}

.az a:hover {
  color: var(--green-highlight);
}

.az-count {
  font-size: 0.8rem;
  color: var(--color-2);
}

@media (max-width: 768px) {
  .cont {
    grid-template-columns: 4.5rem minmax(0, 1fr) 3rem;
    gap: 0.25rem 0.75rem;
  }

  .cont-games {
    display: none;
  }

  .cont .bar {
    grid-column: 1 / -1;
  }
}

/* Published description */
.op-text {
  max-width: 72ch;
  color: var(--color);
  line-height: 1.75;
}

.op-text p + p {
  margin-top: 1rem;
}
