/* Thematic extras — matched to dashboard-shell (brand cards, Space Grotesk). */

.thematic-extras {
  margin-bottom: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.3rem;
}

/* Theme toolbar (title + in-page wave) */
.theme-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.25rem;
  padding: 1.15rem 1.3rem;
  background: var(--card, #fff);
  border: 1px solid var(--line, #eaeef3);
  border-radius: 18px;
  box-shadow: var(--shadow, 0 1px 2px rgba(112,34,131,.04), 0 6px 22px rgba(112,34,131,.07));
}

.theme-eyebrow {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-mid, #8e42a1);
  margin-bottom: .35rem;
}

.theme-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink, #0f172a);
  margin: 0;
  letter-spacing: -.02em;
  line-height: 1.2;
}

.theme-sub {
  margin: .35rem 0 0;
  font-size: .88rem;
  color: var(--muted, #64748b);
  font-weight: 500;
}

.theme-wave {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 180px;
}

.theme-wave-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.theme-wave-controls {
  display: flex;
  align-items: center;
  gap: .45rem;
}

.theme-wave-nav {
  flex-shrink: 0;
  min-height: 40px;
  padding: .35rem .7rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  border: 1px solid var(--line, #eaeef3);
  border-radius: 10px;
  background: #fff;
  color: var(--brand, #702283);
  cursor: pointer;
  box-shadow: var(--shadow, 0 1px 2px rgba(112,34,131,.04));
  transition: background .15s, border-color .15s, color .15s, transform .15s;
  font-family: inherit;
  text-align: left;
}

.theme-wave-nav--next {
  text-align: right;
}

.theme-wave-nav-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 4.2rem;
}

.theme-wave-nav-dir {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.theme-wave-nav-target {
  font-size: .82rem;
  font-weight: 700;
  color: var(--brand, #702283);
  white-space: nowrap;
}

.theme-wave-nav:hover:not(:disabled) {
  border-color: var(--brand-mid, #8e42a1);
  background: rgba(112, 34, 131, .06);
  transform: translateY(-1px);
}

.theme-wave-nav:hover:not(:disabled) .theme-wave-nav-dir {
  color: var(--brand-mid, #8e42a1);
}

.theme-wave-nav:focus-visible {
  outline: 3px solid var(--accent, #009add);
  outline-offset: 2px;
}

.theme-wave-nav:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.theme-wave-nav:disabled .theme-wave-nav-target,
.theme-wave-nav:disabled .theme-wave-nav-dir {
  color: var(--muted, #64748b);
}

.theme-wave-nav .ic {
  width: .8rem;
  height: .8rem;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .theme-wave-controls {
    flex-wrap: wrap;
  }
  .theme-wave-select {
    order: -1;
    flex: 1 1 100%;
  }
  .theme-wave-nav {
    flex: 1 1 calc(50% - .25rem);
    justify-content: center;
  }
}

.theme-wave-select {
  appearance: none;
  flex: 1;
  min-width: 148px;
  padding: .6rem 2.2rem .6rem .9rem;
  font-size: .9rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--ink, #0f172a);
  background:
    #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E")
    no-repeat right .85rem center / 10px;
  border: 1px solid var(--line, #eaeef3);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow, 0 1px 2px rgba(112,34,131,.04));
  transition: border-color .15s, box-shadow .15s;
  min-height: 40px;
}

.theme-wave-select:hover {
  border-color: #b6dbe8;
}

.theme-wave-select:focus {
  outline: none;
  border-color: var(--brand-mid, #8e42a1);
  box-shadow: 0 0 0 3px rgba(142, 66, 161, .15);
}

/* Resources block — reuse .block chrome from shell */
.theme-resources {
  grid-column: 1 / -1;
  margin: 0;
  /* Avoid transform containing-block so PiP fixed positioning works */
  animation: none !important;
  transform: none !important;
}

.wave-resources-aspect.pip-video-active {
  overflow: visible;
}

.theme-resources-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 1.25rem;
  padding: .35rem 1.3rem 1.3rem;
}

.theme-resources-media {
  min-width: 0;
}

.wave-resources-aspect {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 14px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--line, #eaeef3);
}

.wave-resources-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.wave-resources-placeholder {
  background: linear-gradient(160deg, var(--brand-d, #4e165d), var(--brand, #702283) 55%, var(--accent, #009add));
}

.wave-resources-placeholder-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  text-align: center;
  padding: 1.25rem;
  color: rgba(255,255,255,.88);
}

.theme-ph-icon {
  width: 2rem;
  height: 2rem;
  display: flex;
  color: #fff;
  opacity: .92;
}

.theme-ph-icon .ic {
  width: 1.6rem;
  height: 1.6rem;
}

.wave-resources-placeholder-title {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.theme-ph-copy {
  margin: 0;
  font-size: .85rem;
  color: rgba(255,255,255,.72);
  max-width: 22rem;
  line-height: 1.45;
}

.theme-fallback {
  margin: .65rem 0 0;
  font-size: .8rem;
  color: var(--muted, #64748b);
}

.theme-fallback a {
  color: var(--brand-mid, #8e42a1);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.theme-resources-body {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
  padding-top: .15rem;
}

.theme-resource-group {
  padding: 1rem 1.05rem;
  border: 1px solid var(--line, #eaeef3);
  border-radius: 14px;
  background: #fafbfc;
}

.theme-resource-heading {
  margin: 0 0 .35rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted, #64748b);
}

.theme-resource-copy {
  margin: 0 0 .85rem;
  font-size: .9rem;
  color: var(--body, #334155);
  line-height: 1.5;
}

.theme-resource-copy.muted {
  margin-bottom: 0;
  color: var(--muted, #64748b);
}

.theme-resource-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.theme-resource-actions .btn {
  text-decoration: none;
}

.thematic-coming-soon {
  text-align: left;
  padding: 1.4rem 1.5rem;
}

.thematic-coming-soon strong {
  display: block;
  color: var(--ink, #0f172a);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  margin-bottom: .4rem;
}

.thematic-coming-soon p {
  margin: 0;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--muted, #64748b);
}

.thematic-coming-soon b {
  color: var(--brand, #702283);
}

/* PiP — iframe is moved to document.body while active so it is not clipped */
.wave-resources-iframe.pip-active {
  position: fixed !important;
  right: 16px;
  bottom: 16px;
  top: auto !important;
  left: auto !important;
  width: 320px !important;
  height: 180px !important;
  inset: auto 16px 16px auto !important;
  border-radius: 0 0 12px 12px;
  z-index: 9998;
  box-shadow:
    0 25px 50px -12px rgba(112, 34, 131, .45),
    0 0 0 1px rgba(255, 255, 255, .12);
  background: #0f172a;
}

.pip-controls-bar {
  position: fixed;
  right: 16px;
  bottom: 196px; /* 16px + 180px video */
  width: 320px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--brand-d, #4e165d);
  border-radius: 12px 12px 0 0;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .25s, transform .25s, visibility .25s;
  box-shadow: 0 -4px 18px rgba(112, 34, 131, .22);
}

.pip-controls-bar.pip-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.pip-controls-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, .92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 8px;
}

.pip-controls-buttons {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pip-controls-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
}

.pip-controls-btn:hover {
  background: var(--accent, #009add);
  color: #fff;
}

.wave-resources-aspect.pip-video-active::after {
  content: "Playing in mini player";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 48, 95, .82);
  color: rgba(255, 255, 255, .7);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  pointer-events: none;
  border-radius: inherit;
}

@media (max-width: 900px) {
  .theme-resources-grid {
    grid-template-columns: 1fr;
  }
  .theme-toolbar {
    align-items: stretch;
  }
  .theme-wave {
    width: 100%;
  }
  .theme-wave-select {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .wave-resources-iframe.pip-active {
    width: 240px !important;
    height: 135px !important;
    right: 8px;
    bottom: 8px;
    inset: auto 8px 8px auto !important;
  }
  .pip-controls-bar {
    width: 240px;
    right: 8px;
    bottom: 143px; /* 8px + 135px */
  }
}

@media (prefers-reduced-motion: reduce) {
  .pip-controls-bar {
    transition: opacity .1s, visibility .1s;
    transform: none;
  }
}
