/* The comments under a recipe or a post, and the average under a recipe's byline (CM2).
 *
 * Shared by every theme, like quiz.css, and bound by the same contract (themes/TOKENS.md,
 * rule 3): no `:root` block and no literal colour or font family, so the comments wear
 * whichever theme the site wears, in the tenant's own colours. The section and its title are
 * the theme's own `.block` and `.block h2`.
 *
 * Loaded by publicsite/_head.html only on a page that shows comments (`comments_css`), after
 * the theme's stylesheet. The markup: publicsite/_comments.html, publicsite/recipe/_rating.html,
 * and since CM4 the form (publicsite/_comment_form.html) and its answers
 * (comments/public/*.html).
 */

/* An old `#comment-49` link, and the average's link to the section, land below a sticky
 * header rather than under it. */
.comments,
.comment {
  scroll-margin-top: var(--space-xl);
}

.comment-list,
.comment-replies {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comment {
  padding-block: var(--space-md);
  border-top: 1px solid var(--color-border);
  overflow-wrap: anywhere;
}
.comment-list > .comment:first-child {
  padding-top: 0;
  border-top: 0;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-xs) var(--space-sm);
  margin: 0;
}
.comment-author {
  font-weight: 700;
}
.comment-head time {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* The owner's reply: indented under its comment, with the word "válasz" beside the name. */
.comment-replies {
  margin-top: var(--space-md);
  padding-inline-start: var(--space-md);
  border-inline-start: 2px solid var(--color-border);
}
.comment-reply,
.comment-list > .comment .comment-reply:first-child {
  padding-block: 0;
  border-top: 0;
}
.comment-reply + .comment-reply {
  margin-top: var(--space-md);
}
.comment-badge {
  padding: 0 var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-primary-soft);
  color: var(--color-primary-ink);
  font-size: 0.75rem;
  line-height: 1.6;
}

.comment-body {
  margin-top: var(--space-xs);
}
.comment-body p {
  margin: 0 0 var(--space-xs);
}
.comment-body p:last-child {
  margin-bottom: 0;
}

/* -------------------------------------------------------------------- the stars */

.star {
  color: var(--color-secondary);
}
.star-empty {
  color: var(--color-border);
}
.comment-stars {
  margin: var(--space-xs) 0 0;
  line-height: 1;
  letter-spacing: 0.1em;
}

/* "★ 5,0 (2 értékelés)" under the byline: a link to the section, quiet until pointed at. */
.rating-summary {
  margin: var(--space-xs) 0 0;
}
.rating-summary a {
  color: inherit;
  text-decoration: none;
}
.rating-summary a:hover .rating-count,
.rating-summary a:focus-visible .rating-count {
  text-decoration: underline;
}
.rating-count {
  color: var(--color-muted);
}

/* ------------------------------------------------------------- the form (CM4) */

/* After the list, a full-width hairline above it like the one between comments; alone (no
 * comment yet) it is the section's content. Inside, one readable column — the thank-you line,
 * the form and the note under it alike. */
.comment-new > * {
  max-width: var(--measure);
}
.comment-list + .comment-new {
  margin-top: var(--space-sm);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}
/* A heading of its own size: every theme's `.block h3` is a sub-heading of a recipe's text
 * (1–1.1rem), too small to open the form under a list of comments. */
.comments .comment-new-title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-heading);
  font-size: 1.375rem;
  line-height: 1.2;
}

/* The thank-you line after a sent comment. Said in words, with a border in the brand ink rather
 * than a colour of its own (the portal's `.portal-notice` reasoning). */
.comment-notice {
  border: 1px solid var(--color-primary-ink);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-sm) var(--space-md);
  margin: 0 0 var(--space-md);
}

.comment-form {
  display: grid;
  gap: var(--space-md);
}
.comment-field {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.comment-field > label,
.comment-field legend {
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 600;
  color: var(--color-text);
}
.comment-optional {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--color-muted);
}
.comment-field input[type="text"],
.comment-field textarea {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  font: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
}
.comment-field textarea {
  min-height: 7rem;
  resize: vertical;
}
.comment-field input:focus-visible,
.comment-field textarea:focus-visible {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
  border-color: var(--color-primary-ink);
}

/* An error is said in words, with a border in the text colour — no red of its own, which no
 * tenant palette guarantees to be readable (the portal's `.portal-errors`). */
.comment-errors {
  border: 2px solid currentColor;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text);
}
.comment-errors p {
  margin: 0;
}
.comment-field-error {
  margin: 0;
  font-weight: 600;
  color: var(--color-text);
}

.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-md);
}
.comment-privacy {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}
.comment-privacy a {
  color: inherit;
}

/* The honeypot: in the form, so a bot fills it in, but off screen, out of the tab order and
 * hidden from screen readers — not `display: none`, which the simpler bots skip. */
.comment-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The stars: five radio buttons and "Nincs", drawn as stars. The radio itself is invisible but
 * stays in the tab order and the arrow keys move between the choices; its label is the star.
 * Every rule below has the same weight (`:where()`), so their order decides: the chosen star and
 * the ones before it are filled, the ones after it empty, and a pointer over a star previews the
 * same. Without `:has()` only the chosen star itself is filled. An empty star to choose is drawn
 * in the muted text colour, not the hairline's: on a light background the hairline's grey
 * hardly shows, and a star nobody sees is not one anybody clicks. */
.star-input {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-xs);
}
.star-input input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.star-pick {
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
:where(.star-input) .star-pick {
  color: var(--color-muted);
}
:where(.star-input .star-radio:checked) + .star-pick {
  color: var(--color-secondary);
}
:where(.star-input:has(.star-radio:checked)) .star-pick {
  color: var(--color-secondary);
}
:where(.star-input .star-radio:checked + .star-pick) ~ .star-pick {
  color: var(--color-muted);
}
:where(.star-input:has(.star-pick:hover)) .star-pick {
  color: var(--color-secondary);
}
:where(.star-input .star-pick:hover) ~ .star-pick {
  color: var(--color-muted);
}
.star-none {
  margin-inline-start: var(--space-sm);
  font-size: 0.875rem;
  color: var(--color-muted);
  cursor: pointer;
}
.star-clear:checked + .star-none {
  color: var(--color-text);
  font-weight: 600;
}
.star-input input:focus-visible + label {
  outline: 2px solid var(--color-primary-ink);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ------------------------------------------- the form's own answers (CM4) */

/* One readable column on a surface panel, the portal's frame: not every theme's `<main>` has
 * an inline padding of its own (the magazine theme lets each page frame itself). */
.comment-page {
  box-sizing: border-box;
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
}
.comment-page-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg) var(--space-md);
  overflow-wrap: anywhere;
}
.comment-page-panel > :first-child {
  margin-top: 0;
}
.comment-page-panel > :last-child {
  margin-bottom: 0;
}
/* The panel's heading, the same size on every theme (the portal's 2026-11-10 rule: a theme's
 * display title shouts in a narrow panel). */
.comment-page .page-title {
  margin: 0 0 var(--space-sm);
  font-size: clamp(1.75rem, 1.45rem + 1vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
