/*
 * Irton Manor — Reviews ("Modern Heritage")
 * ------------------------------------------------------------------
 * Theme-side restyle of the reservations plugin's [irton_reviews] shortcode
 * output. This file deliberately does NOT fork the plugin's PHP: it targets the
 * plugin's REAL review classes (.irton-reviews-shortcode, .irton-property-review-card,
 * .irton-ai-summary-card, .irton-property-reviews-head …) and repaints them to the
 * approved mockups (property-mockup.html + homepage-mockup.html).
 *
 * Loaded AFTER the plugin's own property.css (handle {slug}-property-front) so it
 * wins on source order without needing !important. Everything is scoped under
 * .irton-reviews-shortcode so it cannot leak into other components.
 *
 * Companion JS: assets/js/reviews-modal.js turns the plugin's inline "Show more"
 * control into an Airbnb-style "Show all N reviews" modal (all cards render up
 * front via per_page="-1"; the modal reuses them).
 */

/* ---- Wrapper ------------------------------------------------------------ */
.irton-reviews-shortcode {
    margin-top: 16px;
    color: var(--im-ink);
    font-family: var(--im-sans);
}

/* ---- Summary / rating header ------------------------------------------- */
.irton-reviews-shortcode .irton-property-reviews-head {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 0 0 22px;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--im-stone);
    flex-wrap: wrap;
}
.irton-reviews-shortcode .irton-property-reviews-head__crest {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.irton-reviews-shortcode .irton-property-reviews-head__leaf {
    display: inline-flex;
    width: 26px;
    height: 34px;
    color: var(--im-brass);
}
.irton-reviews-shortcode .irton-property-reviews-head__leaf svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}
/* Mirror the RIGHT laurel. Target the <svg> (not the span) to match the plugin's
   own rule — otherwise the span-flip here and the plugin's svg-flip stack and
   cancel out, leaving both laurels facing the same way. */
.irton-reviews-shortcode .irton-property-reviews-head__leaf--right svg {
    transform: scaleX(-1);
}
.irton-reviews-shortcode .irton-property-reviews-head__score {
    font-family: var(--im-serif);
    font-weight: 500;
    font-size: 2rem;
    line-height: 1;
    color: var(--im-green);
}
.irton-reviews-shortcode .irton-property-reviews-head__title {
    font-family: var(--im-serif);
    font-weight: 500;
    font-size: 1.5rem;
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin: 0 0 4px;
    color: var(--im-ink);
}
.irton-reviews-shortcode .irton-property-reviews-head__text {
    margin: 0 0 4px;
    color: #43483d;
    font-size: 0.95rem;
    line-height: 1.55;
}
.irton-reviews-shortcode .irton-property-reviews-head__count {
    display: block;
    font-size: 0.8125rem;
    color: var(--im-muted);
    letter-spacing: 0.01em;
}

.irton-reviews-shortcode .irton-reviews-empty {
    margin: 0;
    padding: 18px 0;
    color: var(--im-muted);
    font-style: italic;
}

/* ---- Grid --------------------------------------------------------------- */
.irton-reviews-shortcode .irton-property-reviews-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.irton-reviews-shortcode .irton-property-reviews-grid [data-review-item][hidden] {
    display: none;
}

/* ---- Review card -------------------------------------------------------- */
.irton-reviews-shortcode .irton-property-review-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--im-stone);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 12px 30px rgba(28, 50, 22, 0.05);
    box-sizing: border-box;
    max-width: 100%;
    margin: 0;
}

/* Stars — brass, mockup letter-spacing */
.irton-reviews-shortcode .irton-property-review-card__stars {
    display: flex;
    align-items: center;
    gap: 3px;
    margin: 0 0 10px;
    color: var(--im-brass);
    line-height: 1;
}
.irton-reviews-shortcode .irton-property-review-card__star {
    display: inline-flex;
    width: 15px;
    height: 15px;
    color: var(--im-stone); /* inactive */
}
.irton-reviews-shortcode .irton-property-review-card__star.is-active {
    color: var(--im-brass);
}
.irton-reviews-shortcode .irton-property-review-card__star svg {
    width: 100%;
    height: 100%;
    display: block;
}
.irton-reviews-shortcode .irton-property-review-card__badge--new {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #eef3ea;
    color: var(--im-green);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Guest line */
.irton-reviews-shortcode .irton-property-review-card__meta {
    order: 3; /* place guest name below the quote, per mockup .who */
    margin-top: 12px;
}
.irton-reviews-shortcode .irton-property-review-card__guest {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 8px;
    font-size: 0.8125rem;
    color: var(--im-ink);
    font-weight: 500;
}
.irton-reviews-shortcode .irton-property-review-card__guest-name {
    font-weight: 500;
}
.irton-reviews-shortcode .irton-property-review-card__verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    background: #eef3ea;               /* sage tint */
    color: var(--im-green);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.irton-reviews-shortcode .irton-property-review-card__verified::before {
    content: "\2713"; /* ✓ */
    font-size: 0.75rem;
    line-height: 1;
}
.irton-reviews-shortcode .irton-property-review-card__property {
    color: var(--im-muted);
    font-weight: 400;
}
.irton-reviews-shortcode .irton-property-review-card__property::before {
    content: "\00B7"; /* · */
    margin-right: 6px;
    color: var(--im-muted);
}

/* Quote body — serif, mockup .q */
.irton-reviews-shortcode .irton-property-review-card__content {
    order: 2;
}
.irton-reviews-shortcode .irton-property-review-card__excerpt,
.irton-reviews-shortcode .irton-property-review-card__full {
    font-family: var(--im-serif);
    font-size: 1rem;
    line-height: 1.4;
    color: var(--im-ink);
    margin: 0;
}
.irton-reviews-shortcode .irton-property-review-card__full > *:first-child { margin-top: 0; }
.irton-reviews-shortcode .irton-property-review-card__full > *:last-child { margin-bottom: 0; }
.irton-reviews-shortcode .irton-property-review-card__toggle {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--im-green);
    font-family: var(--im-sans);
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.irton-reviews-shortcode .irton-property-review-card__toggle:hover {
    color: var(--im-green-deep);
}

/* Source + date row — mockup .revmeta */
.irton-reviews-shortcode .irton-property-review-card__base {
    order: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
    margin-block-start: 12px;
    border-top: 1px solid var(--im-stone);
}
.irton-reviews-shortcode .irton-property-review-card__origin {
    display: inline-flex;
    align-items: center;
}
.irton-reviews-shortcode .irton-property-review-card__origin.is-empty { display: none; }
.irton-reviews-shortcode .irton-property-review-card__origin a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}
/* Logo variant: the plugin renders an <img> when a source icon exists. */
.irton-reviews-shortcode .irton-property-review-card__origin img {
    height: 18px !important;   /* override the inline height:Npx from the plugin so brand logos sit on the pill row consistently */
    width: auto !important;
    display: block;
    opacity: 0.9;
}
/* Text variant: no icon, just a label -> render as the mockup source pill. */
.irton-reviews-shortcode .irton-property-review-card__origin > span,
.irton-reviews-shortcode .irton-property-review-card__origin > a > span {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 5px;
    background: #eef3ea;        /* .src-manor default (Irton green) */
    color: var(--im-green);
    font-size: 0.65625rem;      /* ~10.5px */
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.4;
    white-space: nowrap;
}
.irton-reviews-shortcode .irton-property-review-card__date {
    flex: 0 0 auto;
    font-size: 0.71875rem;      /* ~11.5px */
    color: var(--im-muted);
    white-space: nowrap;
}

/* ---- AI summary card ---------------------------------------------------- */
.irton-reviews-shortcode .irton-ai-summary-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--im-parchment);
    border: 1px solid var(--im-stone);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 12px 30px rgba(28, 50, 22, 0.05);
    box-sizing: border-box;
    max-width: 100%;
    position: relative;
}
.irton-reviews-shortcode .irton-ai-summary-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: 16px 0 0 16px;
    background: var(--im-brass);
}
.irton-reviews-shortcode .irton-ai-summary-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
}
.irton-reviews-shortcode .irton-ai-summary-card__stars {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    color: var(--im-brass);
    line-height: 1;
}
.irton-reviews-shortcode .irton-ai-summary-card__star {
    display: inline-flex;
    width: 15px;
    height: 15px;
    color: var(--im-stone);
}
.irton-reviews-shortcode .irton-ai-summary-card__star.is-active { color: var(--im-brass); }
.irton-reviews-shortcode .irton-ai-summary-card__star svg { width: 100%; height: 100%; display: block; }
.irton-reviews-shortcode .irton-ai-summary-card__score {
    font-family: var(--im-serif);
    font-weight: 500;
    font-size: 1.375rem;
    line-height: 1;
    color: var(--im-green);
}
.irton-reviews-shortcode .irton-ai-summary-card__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}
.irton-reviews-shortcode .irton-ai-summary-card__list li {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-family: var(--im-serif);
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--im-ink);
}
.irton-reviews-shortcode .irton-ai-summary-card__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 999px;
    background: #eef3ea;
    color: var(--im-green);
    font-size: 0.6875rem;
    font-family: var(--im-sans);
}
.irton-reviews-shortcode .irton-ai-summary-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--im-stone);
}
.irton-reviews-shortcode .irton-ai-summary-card__badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--im-brass);
}
.irton-reviews-shortcode .irton-ai-summary-card__badge-icon { font-size: 0.8125rem; line-height: 1; }
.irton-reviews-shortcode .irton-ai-summary-card__meta {
    font-size: 0.71875rem;
    color: var(--im-muted);
}

/* ---- Plugin inline actions (replaced by the modal trigger) -------------- */
/* The modal JS repurposes/hides this; also hide by default in case JS fails
 * we leave it visible (progressive enhancement) — so DO NOT hard-hide here.
 * reviews-modal.js sets the trigger's text + behaviour; the JS-added trigger
 * carries .irton-reviews-modal__open styling below. */
.irton-reviews-shortcode .irton-property-reviews__actions {
    margin-top: 20px;
}
.irton-reviews-shortcode .irton-property-reviews__more,
.irton-reviews-modal__open {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 12px 22px;
    border-radius: 999px;
    border: 1px solid var(--im-stone);
    background: transparent;
    color: var(--im-green);
    font-family: var(--im-sans);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.irton-reviews-shortcode .irton-property-reviews__more:hover,
.irton-reviews-modal__open:hover {
    background: var(--im-parchment);
    border-color: var(--im-brass);
    color: var(--im-green-deep);
}

/* ---- Modal (built by reviews-modal.js) ---------------------------------- */
.irton-reviews-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    flex-direction: column;
    background: rgba(28, 50, 22, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.irton-reviews-modal[hidden] { display: none; }
.irton-reviews-modal.is-open { opacity: 1; }
.irton-reviews-modal__dialog {
    position: relative;
    background: var(--im-warm-white);
    width: min(920px, 100%);
    max-height: 100%;
    margin: auto;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(28, 50, 22, 0.28);
}
.irton-reviews-modal__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--im-stone);
    background: var(--im-warm-white);
}
.irton-reviews-modal__title {
    font-family: var(--im-serif);
    font-weight: 500;
    font-size: 1.375rem;
    line-height: 1.15;
    margin: 0;
    color: var(--im-ink);
}
.irton-reviews-modal__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 1px solid var(--im-stone);
    background: #fff;
    color: var(--im-green);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}
.irton-reviews-modal__close:hover {
    background: var(--im-parchment);
    border-color: var(--im-brass);
}
.irton-reviews-modal__body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px;
}
/* All cards visible inside the modal, single readable column. */
.irton-reviews-modal .irton-property-reviews-grid {
    grid-template-columns: 1fr;
    gap: 16px;
}
.irton-reviews-modal .irton-property-reviews-grid [data-review-item][hidden] {
    display: flex; /* reveal every card inside the modal */
}
.irton-reviews-modal .irton-ai-summary-card[hidden] { display: flex; }

/* Prevent background scroll while the modal is open. */
body.irton-reviews-modal-open { overflow: hidden; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 940px) {
    .irton-reviews-shortcode .irton-property-reviews-grid { grid-template-columns: 1fr; }
    .irton-reviews-shortcode .irton-property-reviews-head__title { font-size: 1.375rem; }
}
@media (max-width: 620px) {
    .irton-reviews-modal__dialog { border-radius: 0; width: 100%; height: 100%; }
    .irton-reviews-modal__head { padding: 16px; }
    .irton-reviews-modal__body { padding: 16px; }
}
