/* Wander-specific styles */

/* Peek tiles */
.peek-grid {
  display: grid;
  /* Desktop: 3 columns (2 rows of 3 tiles) */
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin: 2rem auto;
  padding-bottom: 0.5rem;
  padding-inline: 0.75rem;
  max-width: 980px;
  align-items: start; /* Prevent tiles from stretching to match tallest tile */
}

/* Narrow gutters wrapper used only for Sneak peek + Quirky fun fact */
.narrow-gutters {
  /* cancel out page horizontal padding (1.5rem) so this block can use more width */
  width: calc(100% + 3rem);
  margin-left: -1.5rem;
  margin-right: -1.5rem;
  padding-left: 4rem;
  padding-right: 4rem;
}

@media (max-width: 900px) {
  .narrow-gutters {
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Narrower side gutters only for the quirky fun-fact panel */
.panel[aria-labelledby="funfact-title"] .panel__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

.peek {
  position: relative;
  cursor: pointer;
  /* Let tile height adjust to content, but set a min-height */
  min-height: 120px;
  box-sizing: border-box;
  /* Remove fixed width to allow responsive sizing */
}

.peek__front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 1.5rem;
  background: var(--color-light, #f5f5f5);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 4px;
  list-style: none;
  transition: all 0.2s ease;
}

.peek__front:hover {
  background: var(--color-lighter, #fff);
  border-color: var(--color-dark, #333);
}

.peek__word {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  text-align: center;
}

.peek__hint {
  font-size: 0.75rem;
  color: var(--color-muted, #999);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.peek__back {
  display: none;
  padding: 1.5rem;
  background: var(--color-light, #f5f5f5);
  border: 1px solid var(--color-border, #ddd);
  border-radius: 4px;
  /* let the back size itself based on content when shown */
  height: auto;
  box-sizing: border-box;
  overflow: visible;
}

.peek__back-word {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border, #ddd);
}

/* Only show one side at a time so the tile height stays fixed */
.peek[open] .peek__front {
  display: none;
}
.peek[open] .peek__back {
  display: block;
}

/* When a tile is opened, allow it to grow to fit its content */
.peek[open] {
  height: auto;
}

.meaning-row {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border, #ddd);
}

.meaning-row:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.meaning-lang {
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-dark, #333);
  margin-bottom: 0.5rem;
}

.meaning-row p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.meaning-row strong {
  color: var(--color-dark, #333);
}

/* Peek controls */
.peek-controls {
  margin: 2rem 0;
}

.peek-controls__row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.peek-controls--center {
  text-align: center;
}

.peek-controls--center .peek-controls__row {
  justify-content: center;
}

/* Button styles */
.pill {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--color-dark, #333);
  color: white;
  border: none;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill:hover:not(:disabled) {
  background: var(--color-darker, #1a1a1a);
  transform: translateY(-2px);
}

.pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status message */
.muted {
  color: var(--color-muted, #999);
  font-size: 0.85rem;
}

/* Peek footer */
.peek-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border, #ddd);
}

/* Pairs table */
.pairs-table {
  display: flex;
  flex-direction: column;
  max-width: 950px; /* constrain width and center on the page */
  margin: 2rem auto;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 4px;
  overflow: hidden;
}

.pairs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--color-border, #ddd);
}

.pairs-row:last-child {
  border-bottom: none;
}

.pairs-head {
  background: var(--color-light, #f5f5f5);
  font-weight: 600;
}

.pairs-cell {
  padding: 0.35rem 0.5rem;
  border-right: 1px solid var(--color-border, #ddd);
  line-height: 1;
}

.pairs-cell:last-child {
  border-right: none;
}

.pairs-word {
  font-weight: 500;
  font-style: italic;
}

/* Pairs note */
.pairs-note {
  background: var(--color-light, #f5f5f5);
  padding: 1.5rem;
  border-radius: 4px;
  margin-top: 2rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.pairs-aside__label {
  margin: 0 0 1rem 0;
  font-weight: 600;
}

.pairs-aside__text {
  margin: 0;
  font-style: italic;
  color: var(--color-dark, #333);
}

/* Responsive */
/* Tablet: 2 columns (3 rows of 2 tiles) */
@media (max-width: 768px) {
  .peek-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .pairs-row {
    grid-template-columns: 1fr;
  }

  .pairs-cell {
    border-right: none;
    border-bottom: 1px solid var(--color-border, #ddd);
    padding: 0.75rem;
  }

  .pairs-cell:last-child {
    border-bottom: none;
  }
}

/* Mobile: 1 column (6 rows of 1 tile) */
@media (max-width: 520px) {
  .peek-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .peek {
    min-height: 100px;
  }

  .peek__front {
    padding: 1rem;
  }

  .peek__back {
    padding: 1rem;
  }
}
