/*
 * Catalog style "demo22" — rating + comments add-on (loaded instead of _rate.css when
 * index.php?style=demo22 is shown). The rating is a glass panel with a glowing mono read-out and
 * the scale as one segmented switch — your pick lights up safelight red; comments are log panels
 * and the form has dark wells that glow red when focused. Mirrors /demo22/ like demo22.css.
 */

/* cards: a mono read-out line under the title */
.post--card .post__stats { grid-area: stats; }
.post__stats { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 0 8px; font: 400 0.74rem/1.4 var(--mono); color: var(--muted); }
.post__rating { display: inline-flex; align-items: baseline; gap: 2px; }
.post__rating-avg { font: 600 0.95rem/1 var(--mono); color: var(--c, var(--red)); }
.post__rating-max { color: var(--muted); }
.post__comments { color: var(--ink); text-decoration-color: var(--line-2); text-underline-offset: 4px; }
.post__comments:hover { text-decoration-color: var(--c, var(--red)); }

.post__flash { max-width: 780px; margin: 40px 0 0; }
.notice--ok { border-color: rgb(125 255 176 / 0.5); color: var(--mint); box-shadow: 0 0 30px -14px var(--mint); }

/* ── rating ─────────────────────────────────────────────────────────────────────────── */
.rating {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: clamp(20px, 4vw, 48px); align-items: center;
    margin-top: 52px; padding: clamp(18px, 3vw, 30px); border: 1px solid var(--line); border-radius: 18px;
    background: radial-gradient(120% 120% at 0% 0%, rgb(255 75 54 / 0.12), transparent 60%), rgb(20 20 23 / 0.9);
}
.rating__title, .comments__title { margin: 0 0 16px; font: 500 clamp(1.6rem, 2.4vw, 2.1rem)/1.1 var(--sans); letter-spacing: -0.03em; }
.rating__title { grid-column: 1 / -1; }
.rating__score { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 0; }
.rating__avg { font: 600 clamp(3.6rem, 6vw, 5rem)/0.9 var(--mono); letter-spacing: -0.06em; color: var(--red); text-shadow: 0 0 30px rgb(255 75 54 / 0.65); }
.rating__max { font: 500 1rem/1 var(--mono); color: var(--muted); }
.rating__count { width: 100%; margin-top: 8px; font: 500 0.68rem/1.4 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.rating__form { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; min-width: 0; }
.rating__scale {
    display: flex; flex-wrap: wrap; gap: 3px; width: 100%; min-width: 0; margin: 0; padding: 3px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--well);
}
.rating__legend { float: left; width: 100%; margin: 0 0 6px; padding: 4px 6px 2px; font: 500 0.7rem/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rating__opt { position: relative; flex: 1 1 0; min-width: 44px; }
.rating__input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.rating__num {
    display: grid; place-items: center; height: 48px; border-radius: 9px; cursor: pointer; user-select: none;
    font: 600 0.95rem/1 var(--mono); color: var(--muted); transition: background 0.15s, color 0.15s, box-shadow 0.2s;
}
.rating__opt:hover .rating__num { background: var(--panel-2); color: var(--ink); }
.rating__input:checked + .rating__num { background: var(--red); color: var(--on-red); box-shadow: 0 0 24px -4px rgb(255 75 54 / 0.8); }
.rating__input:focus-visible + .rating__num { outline: 2px solid var(--ink); outline-offset: 2px; color: var(--ink); }
.rating__input:checked:focus-visible + .rating__num { color: var(--on-red); }
.rating__submit {
    min-height: 46px; padding: 0 24px; border: 1px solid var(--ink); border-radius: 10px; background: var(--ink); color: var(--bg); text-decoration: none; cursor: pointer;
    font: 600 0.82rem/1 var(--mono);
}
.rating__submit:hover { background: #fff; color: var(--bg); }

/* the visitor's own (final) vote, shown instead of the scale */
.rating__mine { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--well); font: 400 0.85rem/1.6 var(--mono); color: var(--muted); }
.rating__mine-score { display: inline-grid; place-items: center; min-width: 2.2em; height: 2.2em; margin: 0 4px; padding: 0 0.5em; border-radius: 8px; background: var(--red); color: var(--on-red); font-weight: 600; box-shadow: 0 0 20px -4px rgb(255 75 54 / 0.8); }

/* ── comments ──────────────────────────────────────────────────────────────────────── */
.comments { margin-top: 52px; }
.comments__title { display: flex; align-items: baseline; gap: 12px; }
.comments__count { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); font: 500 0.85rem/1.2 var(--mono); letter-spacing: 0; color: var(--red); }
.comments__list { display: grid; gap: 8px; margin: 0 0 24px; padding: 0; list-style: none; }
.comment { padding: 14px 18px; border: 1px solid var(--line); border-left: 3px solid var(--lilac); border-radius: 14px; background: var(--panel); }
.comment:nth-child(3n+2) { border-left-color: var(--cyan); }
.comment:nth-child(3n+3) { border-left-color: var(--amber); }
.comment__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 0 0 6px; }
.comment__author { font: 500 1.05rem/1.2 var(--sans); }
.comment__date { font: 400 0.72rem/1.2 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.comment__body { color: #d6d4dc; overflow-wrap: anywhere; }
.comment__body p { margin: 0 0 8px; }
.comment__body p:last-child { margin-bottom: 0; }
.comments__empty { margin: 0 0 24px; font: 400 0.85rem/1.5 var(--mono); color: var(--muted); }

.comment-form { display: grid; gap: 18px; padding: clamp(18px, 3vw, 26px); border: 1px solid var(--line); border-radius: 18px; background: rgb(20 20 23 / 0.9); }
.comment-form__field { display: grid; gap: 7px; margin: 0; }
.comment-form__label { font: 500 0.68rem/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.comment-form__input, .comment-form__text {
    width: 100%; padding: 11px 13px; border: 1px solid #34343c; border-radius: 10px; background: var(--well); color: var(--ink);
    font: 400 1rem/1.5 var(--sans); color-scheme: dark; transition: border-color 0.15s, box-shadow 0.15s;
}
.comment-form__input { max-width: 380px; }
.comment-form__text { min-height: 120px; resize: vertical; }
.comment-form__input:focus, .comment-form__text:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgb(255 75 54 / 0.28), 0 0 24px -8px var(--red); }
.comment-form__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin: 0; }
.comment-form__submit { min-height: 46px; padding: 0 22px; cursor: pointer; }
.comment-form__note { font: 400 0.74rem/1.5 var(--mono); color: var(--muted); }

@media (max-width: 720px) {
    .rating { grid-template-columns: minmax(0, 1fr); }
    .rating__score { margin-bottom: 18px; }
    .rating__opt { flex: 1 0 calc(20% - 3px); }
}
