/*
  results.css: owned by the opening worker (065/004), design package §6.7 (the result cards).
  One native <dialog class="result"> per beat (results.js). Surface 1 with a hairline at 13%, the
  "Demo" badge and the close icon on top, the beat's time and place in gold, the title, steps 01
  to 03 in mono gold with hairlines between them, then I want this and Close. On narrow screens
  it is a sheet at the foot of the screen, as the mockup draws it (M10). Every rule is scoped to
  .result; logical properties only, so it mirrors in RTL.
*/

.result {
  inline-size: min(35rem, 100% - 2rem);
  max-inline-size: none;
  max-block-size: calc(100vh - 2rem);
  max-block-size: calc(100svh - 2rem);
  padding: 1.75rem clamp(1.25rem, 5vw, 2rem) 2rem;
  overflow: auto;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-device);
  color: var(--ivory);
}
.result[open] {
  display: grid;
  gap: 1.125rem;
}
.result::backdrop {
  background: color-mix(in srgb, var(--night) 74%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .result[open] {
    animation: result-in 0.28s var(--ease-out);
  }
}
@keyframes result-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.result__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block: -0.5rem -0.25rem;
  margin-inline-end: -0.625rem;
}
/* The close icon: a 44px target at every width. */
.result__x {
  display: grid;
  flex: none;
  place-items: center;
  inline-size: 44px;
  block-size: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  transition: color var(--dur-1) var(--ease-out);
}
.result__x:hover {
  color: var(--ivory);
}
.result__x svg {
  inline-size: 20px;
  block-size: 20px;
}
.result .badge {
  white-space: normal;
}

.result__eyebrow {
  margin: 0;
}
.result__title {
  font-size: clamp(1.5rem, 1.25rem + 0.9vw, 1.9375rem);
  letter-spacing: -0.02em;
}
.result__title:lang(ar) {
  letter-spacing: 0;
}

.result__steps {
  margin: 0.25rem 0 0;
}
.result__step {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding-block: 0.875rem;
  border-block-start: 1px solid var(--hairline);
  font-size: 1rem;
  line-height: 1.45;
}
.result__n {
  flex: none;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.result__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-block-start: 0.375rem;
}

/* Narrow: a sheet at the foot of the screen, the buttons full width. */
@media (max-width: 720px) {
  .result {
    inline-size: 100%;
    margin-block: auto 0;
    margin-inline: 0;
    padding-block-end: calc(1.75rem + env(safe-area-inset-bottom, 0px));
    border-block-end: 0;
    border-end-start-radius: 0;
    border-end-end-radius: 0;
  }
  .result__actions .btn {
    flex: 1 1 0;
  }
  @media (prefers-reduced-motion: no-preference) {
    .result[open] {
      animation-name: result-up;
    }
  }
}
@keyframes result-up {
  from {
    transform: translateY(24px);
  }
}
