/* Hear the Difference — listening lesson inside Music History (Prompt #331). */

.htd-entry {
  display: flex;
  width: 100%;
  margin-top: 12px;
  padding: 16px 17px;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border: 1px solid rgba(41, 35, 31, .22);
  border-left: 4px solid #b4533a;
  border-radius: 18px;
  background: color-mix(in srgb, #d85f59 9%, var(--paper, #f4efe6));
  color: #29231f;
  text-align: left;
  cursor: pointer;
}

.htd-entry strong {
  font-family: var(--fd);
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.htd-entry > span:last-child {
  color: #5d534a;
  font-size: .78rem;
}

.htd-entry--inline {
  margin: 8px 0 18px;
}

.htd-entry-badge {
  margin-left: 6px;
  padding: 2px 7px;
  border: 1px dashed #7b5611;
  border-radius: 999px;
  color: #7b5611;
  font-style: normal;
  letter-spacing: .06em;
}

.htd {
  --htd-accent: #a4432c;
  padding-bottom: 32px;
  color: #29231f;
}

.htd :is(button, a, summary):focus-visible,
.htd-entry:focus-visible,
.htd h1:focus-visible {
  outline: 3px solid #1f5f8b;
  outline-offset: 2px;
}

.htd-banner {
  display: flex;
  margin: 8px 0 18px;
  padding: 12px 14px;
  flex-direction: column;
  gap: 4px;
  border: 2px dashed #7b5611;
  border-radius: 12px;
  background: rgba(173, 122, 26, .10);
  font-size: .78rem;
  line-height: 1.45;
}

.htd-head {
  padding: 10px 2px 18px;
}

.htd-head h1 {
  margin-top: 8px;
  color: #211c18;
  font-family: var(--fd);
  font-size: clamp(2.2rem, 11vw, 4rem);
  font-weight: 800;
  line-height: .9;
  letter-spacing: -.04em;
  text-transform: uppercase;
}

.htd-head h1:focus {
  outline: none;
}

#p-history.history-paper #histContent .htd-sub {
  margin-top: 10px;
  color: #4d443c !important;
  font-size: 1.02rem !important;
}

.htd-start {
  display: inline-flex;
  min-height: 52px;
  margin-top: 16px;
  padding: 0 22px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--htd-accent);
  color: #fff;
  font-family: var(--fn, inherit);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.htd-moment {
  position: relative;
  margin-top: 14px;
  padding: 18px 16px 16px;
  border: 1px solid rgba(41, 35, 31, .16);
  border-radius: 16px;
  background: rgba(255, 255, 255, .38);
}

.htd-moment--main {
  border-width: 2px;
  border-color: rgba(164, 67, 44, .45);
}

.htd-moment h2 {
  margin: 0 0 8px;
  padding-left: 34px;
  color: #211c18;
  font-family: var(--fd);
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
}

.htd-context h2 {
  padding-left: 0;
}

.htd-num {
  position: absolute;
  top: 15px;
  left: 16px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #29231f;
  color: #f4efe6;
  font-family: var(--fm);
  font-size: .72rem;
}

#p-history.history-paper #histContent .htd-moment p {
  margin: 8px 0;
  font-size: .9rem !important;
  line-height: 1.55 !important;
}

#p-history.history-paper #histContent .htd-muted,
#p-history.history-paper #histContent .htd-caption {
  color: #6b6057 !important;
  font-size: .76rem !important;
}

.htd-syllables {
  display: flex;
  margin: 10px 0 4px;
  padding: 0;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.htd-syllables li {
  padding: 6px 10px;
  border: 1px solid rgba(41, 35, 31, .2);
  border-radius: 8px;
  font-family: var(--fm);
  font-size: .8rem;
}

#p-history.history-paper #histContent .htd-fixture {
  padding: 10px 12px;
  border-left: 4px solid #7b5611;
  background: rgba(173, 122, 26, .10);
  font-size: .78rem !important;
}

.htd-controls {
  display: grid;
  margin-top: 12px;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.htd-controls button {
  min-height: 48px;
  padding: 8px 10px;
  border: 1.5px solid #29231f;
  border-radius: 12px;
  background: transparent;
  color: #29231f;
  font-family: var(--fn, inherit);
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}

.htd-controls .htd-take[aria-pressed='true'] {
  background: #29231f;
  color: #f4efe6;
}

.htd-transport {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
}

.htd-transport button {
  flex: 1;
  min-height: 44px;
  font-weight: 600;
}

.htd-controls button:disabled {
  opacity: .42;
  cursor: default;
}

#p-history.history-paper #histContent .htd-status {
  min-height: 1.4em;
  font-family: var(--fm);
  font-size: .76rem !important;
}

#p-history.history-paper #histContent .htd-error {
  padding: 10px 12px;
  border: 2px solid #9b2c1f;
  border-radius: 10px;
  background: rgba(155, 44, 31, .08);
  color: #7a2014 !important;
  font-weight: 700;
}

.htd-steps {
  display: flex;
  margin: 10px 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.htd-steps li {
  display: inline-flex;
  min-height: 38px;
  padding: 6px 10px;
  align-items: center;
  gap: 4px;
  border: 1.5px solid rgba(41, 35, 31, .22);
  border-radius: 10px;
  font-family: var(--fm);
  font-size: .78rem;
}

.htd-step-mark {
  width: 0;
  overflow: hidden;
  font-size: .6rem;
}

/* Active step: shape, weight, and marker — never colour alone. */
.htd-steps li.is-active {
  border: 3px solid #29231f;
  background: rgba(164, 67, 44, .16);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.htd-steps li.is-active .htd-step-mark {
  width: auto;
}

.htd-path svg {
  display: block;
  width: 100%;
  height: 120px;
  border-radius: 10px;
  background: rgba(41, 35, 31, .04);
}

.htd-path-line {
  stroke: var(--htd-accent);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.htd-path-tonic {
  stroke: #29231f;
  stroke-dasharray: 4 4;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.htd-path-grid {
  stroke: rgba(41, 35, 31, .12);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.htd-path-head {
  stroke: #1f5f8b;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.htd-options {
  display: grid;
  gap: 8px;
}

.htd-options button,
.htd-answer button,
.htd-article-link {
  min-height: 44px;
  padding: 10px 12px;
  border: 1.5px solid rgba(41, 35, 31, .3);
  border-radius: 12px;
  background: transparent;
  color: #29231f;
  font-family: var(--fn, inherit);
  font-size: .86rem;
  text-align: left;
  cursor: pointer;
}

.htd-options button[aria-pressed='true'] {
  border: 3px solid #29231f;
  font-weight: 700;
}

.htd-article-link {
  width: 100%;
  margin-top: 6px;
  font-weight: 700;
}

.htd-sources {
  margin-top: 12px;
  font-size: .78rem;
}

.htd-sources summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
}

.htd-sources ul {
  margin: 4px 0 8px 18px;
}

.htd-sources a {
  color: #1f5f8b;
}

.htd-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (min-width: 720px) {
  .htd-controls {
    grid-template-columns: 1fr 1fr 1.2fr;
  }

  .htd-transport {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .htd-path-head {
    display: none;
  }

  .htd * {
    transition: none !important;
    animation: none !important;
  }
}
