/* ============================================================
   learn-widgets.css  —  the two learn-page learning widgets (Phase 7)
   ------------------------------------------------------------
   Styles for "Cross two skies" and "Spin the wheel". Token colors
   only (from tokens.css). Both widgets are meaningful with JS off:
   the static fallback uses the same shell, so nothing looks empty.

   Motion is opt-in: the reveal fade/lift lives behind
   @media (prefers-reduced-motion: no-preference). Under reduce, the
   result appears instantly with no transform, no fade.
   ============================================================ */

.lw-band {
  margin: var(--s-7) 0;
}

.lw-grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 760px) {
  .lw-grid { grid-template-columns: 1fr 1fr; }
}

.lw-widget {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--panel);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.lw-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0;
}

.lw-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  line-height: 1.15;
  color: var(--moon);
  margin: 0;
}

.lw-note {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
  max-width: 52ch;
}

/* ---- Controls: the two selects, and the spin button ---- */
.lw-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: flex-end;
}

.lw-field {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  flex: 1 1 9rem;
  min-width: 8rem;
}

.lw-field > span {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.lw-select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ivory);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 0.6rem 2rem 0.6rem 0.8rem;
  cursor: pointer;
  /* a token-tinted chevron drawn with the accent, no external asset */
  background-image: linear-gradient(45deg, transparent 50%, var(--brass) 50%),
                    linear-gradient(135deg, var(--brass) 50%, transparent 50%);
  background-position: right 1rem center, right 0.65rem center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.lw-select:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-color: var(--brass);
}

.lw-spin {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--brass);
  border: 1px solid var(--brass-bright);
  border-radius: var(--r-pill);
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  align-self: flex-start;
}
.lw-spin:hover { background: var(--brass-bright); }
.lw-spin:focus-visible {
  outline: 2px solid var(--brass-bright);
  outline-offset: 2px;
}

/* ---- The result card (shared by both widgets) ---- */
.lw-result {
  min-height: 6.5rem; /* reserve space so a reveal does not shift layout */
}

.lw-fallback {
  color: var(--body-text);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0;
}
.lw-fallback a { color: var(--brass-bright); }

/* When JS has mounted, hide the static fallback and show the live card. */
[data-lw-ready] .lw-fallback { display: none; }

.lw-card {
  display: flex;
  gap: var(--s-4);
  align-items: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--ink-2);
  padding: var(--s-4);
}
.lw-card:hover { border-color: var(--brass); background: var(--panel-2); }
.lw-card:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.lw-sigil {
  flex: 0 0 auto;
  display: inline-flex;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--ink);
  align-items: center;
  justify-content: center;
}
.lw-sigil img { width: 56px; height: 56px; display: block; }

.lw-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.lw-cross {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.lw-cross b { color: var(--ivory); font-weight: 500; }
.lw-plus { font-style: normal; color: var(--brass); }

.lw-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  line-height: 1.1;
  color: var(--moon);
}

.lw-essence {
  color: var(--body-text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.lw-cta {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--brass-bright);
}

/* ---- Motion: opt-in only, gentle reveal of a freshly painted card ---- */
@media (prefers-reduced-motion: no-preference) {
  .lw-card {
    animation: lwReveal var(--dur) var(--ease-out) both;
  }
  @keyframes lwReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
}
