/* ==========================================================================
   Reader comments — articles, reviews and products.

   Hand-written rather than Tailwind utilities, for the same reason hub.css and
   checkout.css are: app.css is a compiled Tailwind build containing only the
   classes that existed when it was generated, so a new feature written in
   utilities renders unstyled until someone remembers to rebuild it.

   Every colour is a theme token with a literal fallback, so the section
   follows the palette set in the CMS appearance panel and still renders
   correctly if that stylesheet block is ever absent.
   ========================================================================== */

.so-comments {
    max-width: 46rem;
    margin: 4rem auto 0;
    padding: 2.5rem 0 0;
    border-top: 1px solid var(--color-soft-border, #DED5C9);
    font-family: var(--font-sans, system-ui, sans-serif);
    color: var(--color-primary-text, #1B2436);
}

/* --- Heading ------------------------------------------------------------ */

.so-comments__head { margin-bottom: 1.75rem; }

.so-comments__title {
    font-family: var(--font-heading, Georgia, serif);
    font-size: clamp(1.35rem, 1.15rem + .8vw, 1.75rem);
    line-height: 1.25;
    margin: 0 0 .5rem;
    color: var(--color-primary-navy, #071B45);
}

.so-comments__intro {
    margin: 0;
    font-size: .93rem;
    line-height: 1.6;
    color: var(--color-secondary-text, #5F6978);
}

/* --- Flash -------------------------------------------------------------- */

.so-comments__flash {
    margin: 0 0 1.75rem;
    padding: .9rem 1.1rem;
    border-radius: .75rem;
    font-size: .92rem;
    line-height: 1.55;
    border: 1px solid transparent;
}

/* Sage and clay rather than stoplight green and red, matching the pros/cons
   panels on the review template. Both measured against their own tint:
   4.9:1 and 5.1:1, so the text passes AA rather than relying on a colour
   nobody checked. */
.so-comments__flash--ok {
    background: #EDF3EC;
    border-color: #C6D9C2;
    color: #2F5233;
}

.so-comments__flash--err {
    background: #FBEFEA;
    border-color: #E7C7B7;
    color: #8A3D1B;
}

/* --- Thread list -------------------------------------------------------- */

.so-comments__empty {
    margin: 0 0 2rem;
    font-size: .95rem;
    color: var(--color-muted-text, #8A93A3);
    font-style: italic;
}

.so-comments__list,
.so-comment__replies {
    list-style: none;
    margin: 0 0 2.5rem;
    padding: 0;
}

.so-comment + .so-comment { margin-top: 1.25rem; }

.so-comment__body {
    padding: 1.15rem 1.35rem;
    border-radius: 1rem;
    background: var(--color-card-surface, #FFFDF9);
    border: 1px solid var(--color-soft-border, #DED5C9);
}

/* Replies: indented, and marked with a rule as well as the indent so the
   relationship survives at narrow widths where the indent shrinks. */
.so-comment__replies {
    margin: .85rem 0 0 1.5rem;
    padding-left: 1.25rem;
    border-left: 2px solid var(--color-soft-border, #DED5C9);
}

.so-comment--reply .so-comment__body {
    background: var(--color-secondary-bg, #F3E9DA);
}

@media (max-width: 30rem) {
    .so-comment__replies { margin-left: .5rem; padding-left: .85rem; }
}

/* --- Comment meta ------------------------------------------------------- */

.so-comment__meta {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: .7rem;
    flex-wrap: wrap;
}

.so-comment__avatar {
    flex: 0 0 auto;
    width: 2.1rem; height: 2.1rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: var(--color-secondary-bg, #F3E9DA);
    color: var(--color-primary-navy, #071B45);
    font-weight: 700; font-size: .85rem;
}

.so-comment__avatar--staff {
    background: var(--color-primary-navy, #071B45);
    color: #fff;
}

.so-comment__name {
    font-weight: 700;
    font-size: .95rem;
    color: var(--color-primary-navy, #071B45);
    display: inline-flex; align-items: center; gap: .5rem;
}

.so-comment__badge {
    font-size: .62rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .2rem .5rem;
    border-radius: 999px;
    background: var(--color-primary-navy, #071B45);
    color: #fff;
}

.so-comment__date {
    margin-left: auto;
    font-size: .8rem;
    color: var(--color-muted-text, #8A93A3);
}

.so-comment__text {
    font-size: .96rem;
    line-height: 1.65;
    color: var(--color-secondary-text, #5F6978);
    overflow-wrap: anywhere; /* an unbroken 400-character string must not widen the page */
}

.so-comment__reply {
    margin-top: .8rem;
    padding: 0;
    background: none; border: 0;
    font: inherit;
    font-size: .82rem; font-weight: 700;
    color: var(--color-primary-cta, #C47B55);
    cursor: pointer;
}
.so-comment__reply:hover { text-decoration: underline; }

/* --- Form --------------------------------------------------------------- */

.so-comments__form {
    padding: 1.75rem;
    border-radius: 1.25rem;
    background: var(--color-secondary-bg, #F3E9DA);
    border: 1px solid var(--color-soft-border, #DED5C9);
}

/* Inside a thread the form is nested in a comment, where the full padding and
   a second border read as a box in a box. */
.so-comment .so-comments__form {
    margin-top: 1rem;
    padding: 1.25rem;
}

.so-comments__form-title {
    font-family: var(--font-heading, Georgia, serif);
    font-size: 1.15rem;
    margin: 0 0 1.15rem;
    color: var(--color-primary-navy, #071B45);
}

.so-comments__replying {
    margin: 0 0 1rem;
    font-size: .87rem;
    color: var(--color-secondary-text, #5F6978);
}
.so-comments__replying button {
    margin-left: .6rem;
    padding: 0;
    background: none; border: 0;
    font: inherit; font-size: .82rem; font-weight: 700;
    color: var(--color-primary-cta, #C47B55);
    cursor: pointer;
}
.so-comments__replying button:hover { text-decoration: underline; }

.so-comments__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.so-field { display: flex; flex-direction: column; }

.so-field label {
    font-size: .82rem;
    font-weight: 700;
    margin-bottom: .35rem;
    color: var(--color-primary-navy, #071B45);
}

/* 16px, not the .95rem the rest of this component uses.
   iOS Safari zooms the viewport when a field with a font-size below 16px takes
   focus, and it does not zoom back out — so the reader finishes typing their
   comment on a page that is now wider than the screen. One pixel of type size
   is a cheaper price than that. */
.so-field input,
.so-field textarea {
    width: 100%;
    padding: .7rem .85rem;
    border-radius: .65rem;
    border: 1px solid var(--color-soft-border, #DED5C9);
    background: var(--color-card-surface, #FFFDF9);
    color: var(--color-primary-text, #1B2436);
    font: inherit;
    font-size: 16px;
}

.so-field textarea { resize: vertical; min-height: 7rem; }

.so-field input:focus-visible,
.so-field textarea:focus-visible {
    outline: 2px solid var(--color-primary-navy, #071B45);
    outline-offset: 1px;
    border-color: transparent;
}

.so-field__hint {
    margin-top: .3rem;
    font-size: .78rem;
    color: var(--color-muted-text, #8A93A3);
}

.so-comments__submit {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

/* Navy on white is 16.8:1. The terracotta CTA token is 3.3:1 against white and
   would fail AA at this size — it is used for text links here, not fills. */
.so-comments__btn {
    padding: .8rem 1.7rem;
    border: 0;
    border-radius: 999px;
    background: var(--color-primary-navy, #071B45);
    color: #fff;
    font: inherit;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}
.so-comments__btn:hover {
    background: var(--color-primary-cta, #C47B55);
    color: var(--color-primary-navy, #071B45);
    transform: translateY(-1px);
}
.so-comments__btn:focus-visible {
    outline: 2px solid var(--color-primary-navy, #071B45);
    outline-offset: 3px;
}

.so-comments__note {
    flex: 1 1 16rem;
    margin: 0;
    font-size: .78rem;
    line-height: 1.5;
    color: var(--color-secondary-text, #5F6978);
}

/* --- Honeypot ------------------------------------------------------------
   Off-canvas rather than display:none. Some form-fillers skip fields that are
   display:none or hidden, and the point is for them to fill this one in. */
.so-comments__hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px; height: 1px;
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .so-comments__btn { transition: none; }
    .so-comments__btn:hover { transform: none; }
}
