/*
 * Catalog style "demo18" — rating + comments add-on (loaded instead of _rate.css when
 * index.php?style=demo18 is shown). Mirrors /demo18/ like demo18.css.
 */
/* rating + comments ──────────────────────────────────────────────────────────────────────────
   cards: two small pills; post: a slide with a giant score and the scale riding in a deep
   pill like the category deck, comments as slides in a grid, the form on a deep slide.
   The fixed category pill covers the bottom of the screen: keep focused fields above it. */
html { scroll-padding-bottom: 96px; }
.post__stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 16px; font: 700 13px/1 var(--font); }
.post__rating { display: inline-flex; align-items: baseline; gap: 2px; padding: 7px 12px; border-radius: 999px; background: var(--deep); color: #fff; }
.post__rating-avg { font-weight: 900; font-size: 15px; }
.post__rating-max { color: var(--on-deep); font-weight: 500; }
.post--even .post__rating { background: var(--yellow); color: var(--ink); }
.post--even .post__rating-max { color: #3d3a2a; }
.post__comments { padding: 7px 12px; border-radius: 999px; box-shadow: inset 0 0 0 2px #cfd6cc; color: var(--soft); text-decoration: none; transition: background 250ms ease, color 250ms ease; }
.post__comments:hover { background: var(--deep); color: #fff; box-shadow: none; }
.post--even .post__comments { box-shadow: inset 0 0 0 2px rgb(255 255 255 / 0.25); color: var(--on-deep); }
.post--even .post__comments:hover { background: #fff; color: var(--ink); }

.post__flash { margin: 40px 0 0; }
.notice--ok { background: var(--deep); color: #f1f3ee; box-shadow: inset 6px 0 0 var(--yellow); }

.rating {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "title title" "score form"; align-items: end; gap: 22px clamp(28px, 5vw, 72px);
    margin-top: 56px; padding: clamp(24px, 3.4vw, 48px); border-radius: 22px; background: var(--paper); box-shadow: 0 24px 50px -30px rgb(15 42 26 / 0.45);
}
.rating__title, .comments__title { margin: 0; font: 900 clamp(34px, 3.8vw, 56px)/0.95 var(--font); letter-spacing: -0.045em; }
.rating__title { grid-area: title; }
.rating__score { grid-area: score; display: grid; grid-template-columns: auto auto; justify-content: start; align-items: end; gap: 0 8px; margin: 0; }
.rating__avg { font: 900 clamp(96px, 10vw, 160px)/0.8 var(--font); letter-spacing: -0.06em; color: var(--deep); }
.rating__max { padding-bottom: 0.2em; font: 700 22px/1 var(--font); color: var(--soft); }
.rating__count { grid-column: 1 / -1; justify-self: start; margin-top: 16px; padding: 8px 14px; border-radius: 999px; background: var(--yellow); color: var(--ink); font: 700 14px/1 var(--font); }
.rating__form { grid-area: form; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 14px 16px; padding-top: 30px; }
.rating__scale {
    position: relative; display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; margin: 0; padding: 4px; border: 0;
    border-radius: 30px; background: var(--deep); box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}
/* out of the fieldset's border box, so the pill keeps its shape */
.rating__legend { position: absolute; left: 8px; bottom: calc(100% + 10px); padding: 0; font: 700 14px/1 var(--font); color: var(--green); white-space: nowrap; }
.rating__opt { position: relative; }
.rating__input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; opacity: 0; }
.rating__num {
    display: grid; place-items: center; width: 46px; height: 46px; border-radius: 999px;
    font: 700 17px/1 var(--font); color: var(--on-deep); cursor: pointer; transition: background 250ms ease, color 250ms ease;
}
.rating__opt:hover .rating__num { background: rgb(255 255 255 / 0.1); color: #fff; }
.rating__opt.is-mine .rating__num { box-shadow: inset 0 0 0 2px var(--yellow); color: #fff; }
.rating__input:checked + .rating__num { background: var(--yellow); color: var(--ink); font-weight: 900; }
.rating__input:focus-visible + .rating__num { position: relative; z-index: 1; outline: 3px solid #fff; outline-offset: 2px; }
.rating__submit { border: 0; cursor: pointer; background: var(--ink); color: #fff; }
.rating__submit:hover { background: var(--green); }

.comments { margin-top: 56px; }
.comments__title { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.comments__count { padding: 8px 16px; border-radius: 999px; background: var(--yellow); color: var(--ink); font: 700 18px/1 var(--font); letter-spacing: 0; }
.comments__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: clamp(12px, 1.6vw, 20px); margin: 0 0 28px; padding: 0; list-style: none; }
.comment { padding: 22px 26px 26px; border-radius: 22px; background: var(--paper); box-shadow: 0 24px 50px -30px rgb(15 42 26 / 0.45); }
.comment:nth-child(even) { background: var(--deep); color: #f1f3ee; }
.comment__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 12px; font: 500 13px/1.3 var(--font); color: var(--soft); }
.comment__author { font: 700 15px/1.3 var(--font); color: var(--green); }
.comment:nth-child(even) .comment__meta { color: #9fb3a5; }
.comment:nth-child(even) .comment__author { color: var(--yellow); }
.comment__body { font: 500 clamp(19px, 1.6vw, 22px)/1.35 var(--font); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.comments__empty { margin: 0 0 28px; color: var(--soft); }
.comment-form {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 18px 22px;
    padding: clamp(22px, 3vw, 40px); border-radius: 22px; background: var(--deep); color: #f1f3ee;
}
.comment-form :focus-visible { outline-color: var(--yellow); }
.comment-form__field { display: grid; align-content: start; gap: 8px; margin: 0; }
.comment-form__label { font: 700 14px/1.2 var(--font); color: var(--yellow); }
.comment-form__input, .comment-form__text { width: 100%; padding: 13px 18px; border: 0; border-radius: 16px; background: var(--paper); color: var(--ink); font: 400 17px/1.5 var(--font); }
.comment-form__input { border-radius: 999px; }
.comment-form__text { min-height: 140px; resize: vertical; }
.comment-form__input:focus, .comment-form__text:focus { outline: 3px solid var(--yellow); outline-offset: 3px; }
.comment-form__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0; }
.comment-form__submit { border: 0; cursor: pointer; }
.comment-form__note { color: var(--on-deep); font-size: 14px; }
@media (max-width: 860px) {
    .rating { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "score" "form"; }
    .rating__form { justify-content: flex-start; }
    .rating__scale { display: grid; grid-template-columns: repeat(5, 52px); }
    .rating__num { width: 52px; height: 52px; }
    .comment-form { grid-template-columns: minmax(0, 1fr); }
}

/* the visitor's own (final) vote, shown instead of the scale */
.rating__mine { margin: 0; line-height: 1.5; }
.rating__mine-score { font-size: 1.6em; font-weight: 700; }
