/* Favorites.
   - .favorite-button is the admin-only togglable control on detail surfaces.
   - .favorite-indicator is a read-only display, shown on list/gallery surfaces
     when an item is starred. */

.favorite-button[hidden],
.favorite-indicator[hidden],
.admin-sign-in[hidden],
.admin-auth-toast[hidden] {
  display: none !important;
}

.favorite-button {
  --favorite-size: 32px;
  display: inline-grid;
  place-items: center;
  width: var(--favorite-size);
  min-width: var(--favorite-size);
  height: var(--favorite-size);
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 999px;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  line-height: 1;
  vertical-align: -0.125em;
  transition: opacity 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  box-shadow: none;
}

.favorite-button:hover {
  opacity: 1;
  background: color-mix(in srgb, currentColor 8%, transparent);
}

.favorite-button:disabled {
  cursor: wait;
  opacity: 0.35;
}

.favorite-button[data-favorite-read-only="true"]:disabled {
  cursor: default;
  opacity: 1;
}

.favorite-button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.favorite-button svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.favorite-button.is-favorited {
  opacity: 1;
  color: #c89211;
}

.favorite-button.is-favorited svg {
  fill: currentColor;
  stroke: currentColor;
}

@media (prefers-color-scheme: dark) {
  .favorite-button.is-favorited {
    color: #e6b94a;
  }
}

.favorite-button[data-favorite-auto="dharma-detail"] {
  --favorite-size: 24px;
  margin-left: 6px;
  vertical-align: -0.18em;
}

.favorite-button[data-favorite-auto="dharma-detail"] svg {
  width: 17px;
  height: 17px;
}

/* Read-only indicator for list/gallery surfaces.
   Only visible when an item is favorited. */
.favorite-indicator {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #c89211;
  pointer-events: none;
  line-height: 1;
  vertical-align: -0.125em;
}

.favorite-indicator svg {
  display: block;
  width: 14px;
  height: 14px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

@media (prefers-color-scheme: dark) {
  .favorite-indicator { color: #e6b94a; }
}

.talk-card h2 .favorite-indicator,
.talk-card h3 .favorite-indicator {
  margin-left: 6px;
}

.talk-card h2 .favorite-indicator--title-prefix,
.talk-card h3 .favorite-indicator--title-prefix {
  margin-right: 6px;
  margin-left: 0;
  vertical-align: -0.08em;
}

/* Corner indicator used on poem gallery cards. */
.favorite-indicator--corner {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  color: #f7d572;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.favorite-indicator--corner svg {
  width: 16px;
  height: 16px;
}

/* Tiny floating sign-in marker for admin access. */
.admin-sign-in {
  position: fixed;
  right: 10px;
  bottom: 8px;
  z-index: 2147483647;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  color: currentColor;
  opacity: 0.12;
  text-decoration: none;
  font: 13px/14px system-ui, sans-serif;
  text-align: center;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.admin-sign-in:hover,
.admin-sign-in:focus-visible {
  opacity: 0.38;
  transform: scale(1.1);
}

.admin-sign-in::before {
  content: "*";
}

.admin-sign-in[data-admin-auth-action="sign-out"] {
  opacity: 0.22;
}

.admin-sign-in[aria-busy="true"] {
  cursor: wait;
  opacity: 0.34;
}

.admin-auth-toast {
  position: fixed;
  right: 16px;
  bottom: 34px;
  z-index: 2147483646;
  display: grid;
  gap: 4px;
  width: min(320px, calc(100vw - 32px));
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, Canvas 94%, transparent);
  color: CanvasText;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(18px);
}

.admin-auth-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-auth-toast strong {
  font: 600 13px/1.25 system-ui, sans-serif;
}

.admin-auth-toast span {
  color: color-mix(in srgb, CanvasText 72%, transparent);
  font: 12px/1.45 system-ui, sans-serif;
}
