/* Vocabulary components matching the N4 destination pages. */
.vocab-word {
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px dotted rgba(40, 92, 84, 0.52);
  border-radius: 0;
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  text-align: inherit;
  cursor: help;
  transition:
    color 180ms ease,
    background-color 180ms ease;
}

.vocab-word:hover {
  color: var(--accent-deep, #285c54);
  background: rgba(217, 235, 229, 0.52);
}


.vocabulary-card {
  --vocabulary-gold: #c59a42;
  --vocabulary-gold-text: #896823;
  --accent-deep: var(--vocabulary-gold-text);
  --water-deep: var(--vocabulary-gold-text);
  --theme-green: var(--vocabulary-gold-text);
  --theme-green-soft: color-mix(in srgb, var(--vocabulary-gold) 16%, var(--card, #fffdf8));
  --theme-hover: color-mix(in srgb, var(--vocabulary-gold) 12%, var(--card, #fffdf8));
  --theme-selected: color-mix(in srgb, var(--vocabulary-gold) 18%, var(--card, #fffdf8));
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0.34rem solid var(--vocabulary-gold);
  border-radius: var(--radius-large);
  background: var(--card);
  box-shadow: var(--shadow);
}

.vocabulary-header {
  display: grid;
  gap: 0.45rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(197, 154, 66, 0.11), transparent 62%),
    var(--card);
}

.vocabulary-kicker {
  margin: 0;
  color: var(--vocabulary-gold-text);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vocabulary-header h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4.5vw, 2.7rem);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.vocabulary-intro {
  max-width: 41rem;
  margin: 0.35rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.vocabulary-table-wrap {
  overflow-x: auto;
}

.vocabulary-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  text-align: left;
}

.vocabulary-table th,
.vocabulary-table td {
  padding: 0.9rem clamp(1rem, 3vw, 1.75rem);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.vocabulary-table thead th {
  color: var(--ink-soft);
  background: var(--paper-light);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.vocabulary-table tbody tr:last-child > * {
  border-bottom: 0;
}

.vocabulary-table tbody tr:hover {
  background: color-mix(in srgb, var(--vocabulary-gold) 12%, var(--card));
}

.vocabulary-table tbody tr.is-just-revealed:hover {
  background: transparent;
}

.vocabulary-table__word {
  width: 26%;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 700;
}

.vocabulary-table__reading {
  width: 26%;
  color: var(--vocabulary-gold-text);
  font-size: 0.92rem;
  font-weight: 700;
}

.vocabulary-table__meaning {
  color: var(--ink-soft);
  font-size: 0.92rem;
}


.vocabulary-dialog {
  width: min(100% - 2rem, 30rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 28px 90px rgba(24, 47, 42, 0.28);
}

.vocabulary-dialog::backdrop {
  background: rgba(23, 39, 35, 0.48);
  backdrop-filter: blur(0.25rem);
}

.vocabulary-dialog__content {
  position: relative;
  padding: 2rem;
}

.vocabulary-dialog__close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper-light);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.vocabulary-dialog__kicker {
  margin: 0 0 0.45rem;
  color: var(--accent-deep, #285c54);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vocabulary-dialog h2 {
  margin: 0;
  padding-right: 2.5rem;
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 600;
}

.vocabulary-dialog__reading {
  margin: 0.3rem 0 0;
  color: var(--accent-deep, #285c54);
  font-weight: 700;
}

.vocabulary-dialog__meaning {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
}


@media screen {
  :root[data-theme="dark"] .vocabulary-card {
    --vocabulary-gold: var(--theme-gold, #e3c077);
    --vocabulary-gold-text: var(--theme-gold, #e3c077);
  }
}

@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme]) .vocabulary-card {
    --vocabulary-gold: var(--theme-gold, #e3c077);
    --vocabulary-gold-text: var(--theme-gold, #e3c077);
  }
}

.vocabulary-section {
  margin-top: 1.5rem;
}

.vocab-word:focus-visible,
.vocabulary-dialog__close:focus-visible,
.vocabulary-table-wrap:focus-visible {
  outline: 3px solid rgba(97, 126, 112, 0.48);
  outline-offset: 0.25rem;
}

.vocabulary-dialog {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
}

@media (max-width: 34rem) {
  .vocabulary-card {
    border-radius: 1.35rem;
  }

  .vocabulary-table th,
  .vocabulary-table td {
    padding: 0.8rem 0.9rem;
  }
}

@media print {
  .vocabulary-dialog {
    display: none !important;
  }

  .vocabulary-card {
    box-shadow: none;
  }

  .vocabulary-table tr {
    break-inside: avoid;
  }
}

.vocabulary-table__word,
.vocabulary-table__reading {
  white-space: nowrap;
}

/* Phones: a full-width vocabulary card, with the meaning under the reading so the list never scrolls sideways. */
@media (max-width: 40rem) {
  /* Run the vocabulary card edge to edge, past the page gutter. */
  .vocabulary-section {
    margin-inline: calc(-1 * var(--page-gutter));
  }

  .page-shell .vocabulary-section .vocabulary-card {
    border-inline: 0;
    border-radius: 0;
  }

  .vocabulary-table {
    min-width: 0;
  }

  .vocabulary-table thead th:nth-child(2)::after {
    content: " & meaning";
  }

  .vocabulary-table thead th:nth-child(3) {
    display: none;
  }

  /* Shrink the word column to its longest word, leaving the rest for the meaning. */
  .vocabulary-table .vocabulary-table__word {
    width: 1%;
  }

  /* Adjacent block cells share one anonymous table cell, stacking them. */
  .vocabulary-table .vocabulary-table__reading,
  .vocabulary-table .vocabulary-table__meaning {
    display: block;
    width: auto;
    border-bottom: 0;
  }

  .vocabulary-table .vocabulary-table__reading {
    padding-bottom: 0.15rem;
    white-space: normal;
  }

  .vocabulary-table .vocabulary-table__meaning {
    padding-top: 0;
  }

  .vocabulary-table tbody tr {
    border-bottom: 1px solid var(--line);
  }

  .vocabulary-table tbody tr:last-child {
    border-bottom: 0;
  }
}
