/*
 * Community recipes on the static site.
 *
 * The quick-look panel styles live in recipes/partials/recipe_preview.html,
 * which the Yours tab never renders — so the dialog CSS it needs is repeated
 * here for the client-rendered community preview. Kept in step by hand when
 * the partial changes.
 *
 * Loaded only by `manage.py export_static_site` output.
 */

#recipe-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

#recipe-preview-overlay[hidden] { display: none; }

.rp-grain-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ui-muted, #9a958c);
  cursor: pointer;
  white-space: nowrap;
}

.rp-grain-toggle input { accent-color: var(--ui-accent, #ff6a1a); }

.rp-grain-toggle--cta {
  display: flex;
  width: fit-content;
  margin-bottom: 0.75rem;
  font-size: 0.72rem;
}

.rp-scrim {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.82);
  backdrop-filter: blur(6px);
}

.rp-dialog {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
  width: min(100%, 1000px);
  height: min(88vh, 860px);
  max-height: 88vh;
  border-radius: 22px;
  overflow: hidden;
  background: #141417;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.rp-media {
  position: relative;
  min-height: 0;
  background: #0b0b0d center / cover no-repeat;
}

.rp-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 11, 13, 0.15) 0%, rgba(11, 11, 13, 0.05) 40%, rgba(11, 11, 13, 0.85) 100%);
}

.rp-media__caption {
  position: absolute;
  left: 1.6rem;
  right: 1.6rem;
  bottom: 1.6rem;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.rp-media__name {
  font-family: var(--font-recipe, "Instrument Serif", Georgia, serif);
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: 0.005em;
  color: var(--ui-accent, #ff6a1a);
  overflow-wrap: anywhere;
}

.rp-media__label {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(245, 242, 234, 0.65);
}

.rp-panel {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: 1.75rem 1.9rem 1.9rem;
}

.rp-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  border-radius: 12px;
  background: none;
  color: var(--ui-muted, #9a958c);
  font-size: 0.9rem;
  cursor: pointer;
}

.rp-close:hover { color: var(--ui-text, #f5f2ea); border-color: rgba(245, 242, 234, 0.3); }

.rp-title {
  padding-right: 3rem;
  font-family: var(--font-recipe, "Instrument Serif", Georgia, serif);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: 0.005em;
  text-transform: none;
  color: var(--ui-text, #f5f2ea);
  overflow-wrap: anywhere;
}

.rp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}

.rp-tag {
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: #1d1d21;
  color: var(--ui-text, #f5f2ea);
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rp-stats {
  display: flex;
  gap: 2.2rem;
  margin: 1.35rem 0 1.5rem;
  padding-bottom: 1.35rem;
  border-bottom: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
}

.rp-stats dt {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ui-muted, #9a958c);
}

.rp-stats dd {
  margin-top: 0.3rem;
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--ui-text, #f5f2ea);
  overflow-wrap: anywhere;
}

.rp-settings__head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 0.5rem;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ui-muted, #9a958c);
}

.rp-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-top: 1px solid rgba(245, 242, 234, 0.05);
  font-size: var(--text-sm);
}

.rp-row > span {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ui-muted, #9a958c);
}

.rp-row > b {
  font-weight: 700;
  color: var(--ui-text, #f5f2ea);
  text-align: right;
}

.rp-row__accent { color: var(--ui-accent, #ff6a1a) !important; }

.rp-cta {
  position: sticky;
  bottom: 0;
  z-index: 1;
  margin-top: 1.5rem;
  padding: 1.15rem 1.2rem 1.2rem;
  border-radius: 16px;
  background: #1a1a1e;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
}

.rp-cta__label {
  margin-bottom: 0.75rem;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ui-muted, #9a958c);
}

.rp-cta__btn {
  display: block;
  width: 100%;
  padding: 0.95rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--ui-accent, #ff6a1a);
  color: #14110b;
  font-size: var(--text-md);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.rp-cta__btn:hover { background: #ff8a4d; }

.rp-cta__hint {
  margin-top: 0.7rem;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--ui-muted, #9a958c);
}

@media (max-width: 860px) {
  #recipe-preview-overlay { padding: 0; }

  .rp-dialog {
    grid-template-columns: 1fr;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    border: none;
    overflow-y: auto;
  }

  .rp-media { min-height: 0; height: 38vh; }

  .rp-panel { overflow: visible; padding: 1.4rem 1.2rem 2rem; }
}

/* ── community upload extras ─────────────────────────────── */

.community-nickname-label {
  display: block;
  margin-top: var(--space-1);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ui-text);
}

.community-nickname-label span {
  font-weight: 400;
  color: var(--ui-muted);
}

#quick-import-name,
#quick-import-author {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  border-radius: 12px;
  background: #1d1d21;
  color: var(--ui-text, #f5f2ea);
  font-size: 0.9rem;
}

#quick-import-name:focus,
#quick-import-author:focus {
  outline: none;
  border-color: var(--ui-accent, #ff6a1a);
}

.community-load-more {
  display: block;
  margin: var(--space-2) auto 0;
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  border-radius: 999px;
  background: none;
  color: var(--ui-text, #f5f2ea);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.community-load-more:hover { border-color: var(--ui-accent, #ff6a1a); }

.community-load-more[hidden] { display: none; }

/* ── rename on the community preview ───────────────────────── */

.rp-edit {
  margin-top: 0.9rem;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  border-radius: 14px;
  background: #1a1a1e;
  display: grid;
  gap: 0.6rem;
}

.rp-edit__field {
  display: grid;
  gap: 0.3rem;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ui-muted, #9a958c);
}

.rp-edit__field input {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--ui-line, rgba(245, 242, 234, 0.1));
  border-radius: 10px;
  background: #101013;
  color: var(--ui-text, #f5f2ea);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: normal;
}

.rp-edit__field input:focus {
  outline: none;
  border-color: var(--ui-accent, #ff6a1a);
}

.rp-edit__row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.rp-edit__save {
  padding: 0.5rem 1.1rem;
  border: none;
  border-radius: 999px;
  background: var(--ui-text, #f5f2ea);
  color: #14110b;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.rp-edit__save:disabled { opacity: 0.5; cursor: default; }

.rp-edit__status {
  font-size: 0.75rem;
  color: var(--ui-muted, #9a958c);
}

/* Shared cards reuse .recipe-card wholesale; the plate has no link target. */
.recipe-card--community .recipe-card__link { cursor: pointer; }
