/**
 * Common-room banners — the house-article card and the front-page hub card.
 *
 * Deliberately dark in both site themes: like the TV-show promo next door,
 * these read as cinematic plates dropped into the page rather than as panels
 * that follow the surrounding colour scheme.
 *
 * Every moving layer lives inside the card and animates transform or opacity
 * only. Nothing here is fixed to the viewport and nothing uses backdrop-filter,
 * so the card's colour never changes as it scrolls.
 */

.room-promo {
    /* Overridden inline per house; these are the hub's own black-and-purple. */
    --promo-1:      #a119a6;
    --promo-2:      #c93dd4;
    --promo-deep:   #16081f;
    --promo-accent: #d8b4fe;

    position: relative;
    display: flex;
    align-items: center;
    gap: clamp(16px, 3vw, 34px);
    clear: both;
    margin: 8px 0 42px;
    padding: clamp(20px, 3.2vw, 32px);
    min-height: 210px;
    border-radius: 18px;
    overflow: hidden;
    isolation: isolate;
    direction: rtl;
    font-family: 'Estedad', sans-serif;
    background: #0a0810;
    border: 1px solid rgba(199, 125, 255, 0.24);
    box-shadow: 0 14px 38px rgba(20, 6, 30, 0.42);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.room-promo:hover {
    transform: translateY(-3px);
    box-shadow: 0 22px 50px rgba(20, 6, 30, 0.55);
}

/* ---------------------------------------------------------------- layers */

.room-promo__bg,
.room-promo__veil,
.room-promo__motes,
.room-promo__glow {
    position: absolute;
    pointer-events: none;
    z-index: -1;
}

.room-promo__bg,
.room-promo__veil,
.room-promo__glow {
    inset: 0;
}

/* The house cover art is a dim painting; left alone under the veil below it
   goes completely black, so lift it before anything is laid over it. */
.room-promo__bg {
    background: var(--promo-img) center 38% / cover no-repeat;
    filter: brightness(1.8) saturate(1.25) contrast(1.05);
    transform: scale(1.02);
    transition: transform 0.6s ease;
}

.room-promo:hover .room-promo__bg {
    transform: scale(1.07);
}

/* Opaque behind the text, thinning out toward the far edge so the painting is
   still legible there. Angles are absolute, so 0% is the right-hand side. */
.room-promo--house .room-promo__veil {
    background:
        linear-gradient(-90deg,
            rgba(6, 5, 10, 0.92) 0%,
            rgba(6, 5, 10, 0.76) 40%,
            rgba(6, 5, 10, 0.24) 72%,
            rgba(6, 5, 10, 0.04) 100%),
        radial-gradient(ellipse 80% 120% at 4% 50%, var(--promo-deep) 0%, transparent 62%);
}

/* The drifting field. Extended well past the card at both ends so a whole
   tile's worth of travel never exposes an edge; the card's overflow clips it.
   Tile sizes deliberately share no common factor, so the two layers do not
   line up into a visible grid. */
.room-promo__motes {
    inset: -280px 0;
}

.room-promo__motes::before,
.room-promo__motes::after {
    content: '';
    position: absolute;
    inset: 0;
    will-change: transform, opacity;
}

/* ------------------------------------------------------------ animations */

/* Travel is exactly one tile (A) and two tiles (B) so the loop is seamless. */
@keyframes wc-promo-rise-a {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(0, -170px, 0); }
}

@keyframes wc-promo-rise-b {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(0, -254px, 0); }
}

@keyframes wc-promo-twinkle-a {
    0%, 100% { opacity: 0.30; }
    50%      { opacity: 0.85; }
}

@keyframes wc-promo-twinkle-b {
    0%, 100% { opacity: 0.75; }
    50%      { opacity: 0.25; }
}

@keyframes wc-promo-breathe {
    0%, 100% { opacity: 0.45; transform: scale(1); }
    50%      { opacity: 0.90; transform: scale(1.09); }
}

@keyframes wc-promo-sweep {
    0%       { transform: translate3d(-40%, 0, 0); opacity: 0; }
    18%      { opacity: 0.55; }
    100%     { transform: translate3d(120%, 0, 0); opacity: 0; }
}

@keyframes wc-promo-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* ------------------------------------------------------ per-house scenes */

/* Gryffindor — embers off the hearth, and the firelight pulsing under them. */
.room-promo--gryffindor .room-promo__motes::before {
    background:
        radial-gradient(circle at 11% 23%, rgba(255, 176, 74, 0.9) 0 1.5px, transparent 2.2px),
        radial-gradient(circle at 37% 61%, rgba(255, 122, 54, 0.7) 0 1.1px, transparent 1.8px),
        radial-gradient(circle at 58% 9%, rgba(255, 214, 128, 0.8) 0 1.3px, transparent 2px),
        radial-gradient(circle at 79% 44%, rgba(255, 150, 62, 0.65) 0 1.7px, transparent 2.4px),
        radial-gradient(circle at 92% 82%, rgba(255, 196, 92, 0.55) 0 1px, transparent 1.6px);
    background-size: 190px 170px;
    animation: wc-promo-rise-a 9s linear infinite;
}

.room-promo--gryffindor .room-promo__motes::after {
    background:
        radial-gradient(circle at 23% 71%, rgba(255, 214, 128, 0.8) 0 1.8px, transparent 2.6px),
        radial-gradient(circle at 64% 31%, rgba(255, 138, 52, 0.6) 0 1.2px, transparent 2px),
        radial-gradient(circle at 88% 88%, rgba(255, 226, 160, 0.5) 0 1.5px, transparent 2.2px),
        radial-gradient(ellipse 60% 40% at 50% 108%, rgba(255, 138, 52, 0.45) 0%, transparent 70%);
    background-size: 143px 127px, 143px 127px, 143px 127px, 100% 100%;
    animation: wc-promo-rise-b 15s linear infinite, wc-promo-breathe 5.5s ease-in-out infinite;
}

/* Hufflepuff — pollen turning over slowly in a shaft of kitchen sunlight. */
.room-promo--hufflepuff .room-promo__motes::before {
    background:
        radial-gradient(circle at 16% 37%, rgba(255, 226, 150, 0.85) 0 1.7px, transparent 2.5px),
        radial-gradient(circle at 43% 8%, rgba(250, 240, 200, 0.6) 0 1.2px, transparent 2px),
        radial-gradient(circle at 61% 74%, rgba(255, 208, 110, 0.75) 0 1.5px, transparent 2.2px),
        radial-gradient(circle at 86% 29%, rgba(255, 226, 150, 0.55) 0 1px, transparent 1.7px);
    background-size: 190px 170px;
    animation: wc-promo-rise-a 20s linear infinite reverse;
}

.room-promo--hufflepuff .room-promo__motes::after {
    background:
        radial-gradient(circle at 29% 56%, rgba(255, 208, 110, 0.7) 0 1.9px, transparent 2.8px),
        radial-gradient(circle at 72% 17%, rgba(255, 236, 180, 0.5) 0 1.3px, transparent 2px),
        linear-gradient(112deg, transparent 36%, rgba(255, 224, 150, 0.16) 50%, transparent 64%);
    background-size: 143px 127px, 143px 127px, 100% 100%;
    animation: wc-promo-rise-b 32s linear infinite reverse, wc-promo-breathe 9s ease-in-out infinite;
}

/* Ravenclaw — a still sky that breathes, with a streak crossing it now and then. */
.room-promo--ravenclaw .room-promo__motes::before {
    background:
        radial-gradient(circle at 9% 31%, rgba(214, 232, 255, 0.95) 0 1.4px, transparent 2.1px),
        radial-gradient(circle at 34% 68%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.6px),
        radial-gradient(circle at 52% 14%, rgba(178, 205, 255, 0.85) 0 1.2px, transparent 1.9px),
        radial-gradient(circle at 77% 49%, rgba(255, 255, 255, 0.7) 0 1.6px, transparent 2.3px),
        radial-gradient(circle at 94% 87%, rgba(214, 232, 255, 0.6) 0 1px, transparent 1.6px);
    background-size: 190px 170px;
    animation: wc-promo-twinkle-a 4.5s ease-in-out infinite;
}

.room-promo--ravenclaw .room-promo__motes::after {
    background:
        radial-gradient(circle at 21% 82%, rgba(178, 205, 255, 0.9) 0 1.5px, transparent 2.2px),
        radial-gradient(circle at 58% 37%, rgba(255, 255, 255, 0.75) 0 1.1px, transparent 1.8px),
        radial-gradient(circle at 89% 12%, rgba(214, 232, 255, 0.65) 0 1.3px, transparent 2px);
    background-size: 143px 127px;
    animation: wc-promo-twinkle-b 7s ease-in-out infinite;
}

.room-promo--ravenclaw .room-promo__veil::after {
    content: '';
    position: absolute;
    top: 14%;
    right: 0;
    width: 42%;
    height: 2px;
    background: linear-gradient(-90deg, rgba(255, 255, 255, 0.9), rgba(160, 200, 255, 0));
    filter: blur(0.4px);
    animation: wc-promo-sweep 9s ease-in infinite;
    opacity: 0;
}

/* Slytherin — bubbles climbing toward the lake, and caustics on the stone. */
.room-promo--slytherin .room-promo__motes::before {
    background:
        radial-gradient(circle at 14% 57%, rgba(168, 236, 210, 0.5) 0 2.6px, transparent 3.4px),
        radial-gradient(circle at 41% 21%, rgba(206, 245, 230, 0.42) 0 1.6px, transparent 2.3px),
        radial-gradient(circle at 68% 79%, rgba(168, 236, 210, 0.38) 0 2px, transparent 2.8px),
        radial-gradient(circle at 91% 34%, rgba(206, 245, 230, 0.34) 0 1.3px, transparent 2px);
    background-size: 190px 170px;
    animation: wc-promo-rise-a 17s linear infinite;
}

.room-promo--slytherin .room-promo__motes::after {
    background:
        radial-gradient(circle at 27% 39%, rgba(120, 200, 175, 0.45) 0 3.2px, transparent 4.2px),
        radial-gradient(circle at 74% 66%, rgba(168, 236, 210, 0.35) 0 1.8px, transparent 2.6px),
        repeating-linear-gradient(64deg,
            transparent 0 26px,
            rgba(150, 226, 200, 0.07) 26px 30px,
            transparent 30px 58px);
    background-size: 143px 127px, 143px 127px, 100% 100%;
    /* Caustics belong on the water, not behind the copy. */
    -webkit-mask-image: linear-gradient(-90deg, transparent 22%, #000 78%);
            mask-image: linear-gradient(-90deg, transparent 22%, #000 78%);
    animation: wc-promo-rise-b 28s linear infinite, wc-promo-breathe 8s ease-in-out infinite;
}

/* ------------------------------------------------------------- hub scene */

.room-promo--hub {
    border-color: rgba(199, 125, 255, 0.3);
    background:
        radial-gradient(ellipse 90% 130% at 92% 12%, #2a0d3a 0%, transparent 62%),
        radial-gradient(ellipse 70% 110% at 6% 100%, #1b0729 0%, transparent 60%),
        #08060d;
}

.room-promo--hub .room-promo__veil {
    background:
        radial-gradient(ellipse 55% 70% at 88% 8%, rgba(161, 25, 166, 0.42) 0%, transparent 65%),
        radial-gradient(ellipse 45% 60% at 10% 96%, rgba(109, 40, 217, 0.34) 0%, transparent 65%);
}

/* A slow arcane wheel behind everything, wide enough that its corners never
   swing into view while it turns. */
.room-promo--hub .room-promo__glow {
    inset: -60%;
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(199, 125, 255, 0.16) 42deg,
        transparent 96deg,
        transparent 180deg,
        rgba(161, 25, 166, 0.20) 228deg,
        transparent 290deg);
    /* A conic gradient has a hard apex where its stops all meet. Punch the
       middle out so the wedges read as light rather than as a folded sheet. */
    -webkit-mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, transparent 4%, #000 64%);
            mask-image: radial-gradient(ellipse 58% 58% at 50% 50%, transparent 4%, #000 64%);
    animation: wc-promo-spin 42s linear infinite;
    will-change: transform;
}

.room-promo--hub .room-promo__motes::before {
    background:
        radial-gradient(circle at 13% 28%, rgba(216, 180, 254, 0.9) 0 1.5px, transparent 2.2px),
        radial-gradient(circle at 39% 64%, rgba(199, 125, 255, 0.7) 0 1.1px, transparent 1.8px),
        radial-gradient(circle at 57% 11%, rgba(244, 224, 255, 0.8) 0 1.3px, transparent 2px),
        radial-gradient(circle at 81% 47%, rgba(199, 125, 255, 0.6) 0 1.7px, transparent 2.4px),
        radial-gradient(circle at 95% 84%, rgba(216, 180, 254, 0.5) 0 1px, transparent 1.6px);
    background-size: 190px 170px;
    animation: wc-promo-rise-a 14s linear infinite;
}

.room-promo--hub .room-promo__motes::after {
    background:
        radial-gradient(circle at 25% 76%, rgba(244, 224, 255, 0.8) 0 1.8px, transparent 2.6px),
        radial-gradient(circle at 66% 33%, rgba(216, 180, 254, 0.6) 0 1.2px, transparent 1.9px),
        radial-gradient(circle at 90% 91%, rgba(199, 125, 255, 0.5) 0 1.4px, transparent 2.1px);
    background-size: 143px 127px;
    animation: wc-promo-rise-b 24s linear infinite, wc-promo-twinkle-b 6s ease-in-out infinite;
}

/* ------------------------------------------------------------------ crest */

.room-promo__crest {
    flex: 0 0 auto;
    width: clamp(96px, 13vw, 132px);
    display: grid;
    place-items: center;
}

.room-promo__crest img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.6));
    transition: transform 0.4s ease;
}

.room-promo:hover .room-promo__crest img {
    transform: scale(1.06) rotate(-2deg);
}

/* ------------------------------------------------------------------- body */

.room-promo__body {
    flex: 1 1 auto;
    min-width: 0;
}

/* The card is injected into .entry-content, which sets a tall reading
   line-height. Inherited, it pads every small element unevenly and pushes the
   Font Awesome glyphs off the text baseline, so pin the metrics here. */
.room-promo i {
    line-height: 1;
    vertical-align: middle;
}

.room-promo__badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 14px;
    margin-bottom: 12px;
    border-radius: 999px;
    background: rgba(12, 8, 18, 0.62);
    border: 1px solid var(--promo-1);
    color: #f1e7ff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.room-promo--house .room-promo__badge {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

.room-promo__pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--promo-2);
    animation: wc-promo-pulse 2s infinite;
}

@keyframes wc-promo-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(199, 125, 255, 0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(199, 125, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(199, 125, 255, 0); }
}

.room-promo__title {
    margin: 0 0 10px;
    font-family: 'Estedad', sans-serif;
    font-size: clamp(1.4rem, 3.1vw, 2rem);
    font-weight: 900;
    line-height: 1.2;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.7);
}

.room-promo__text {
    margin: 0 0 10px;
    max-width: 46ch;
    font-size: 0.95rem;
    line-height: 1.85;
    color: rgba(240, 236, 250, 0.84);
}

.room-promo__place {
    margin: 0 0 14px;
    font-size: 0.8rem;
    line-height: 1.7;
    color: rgba(240, 236, 250, 0.6);
}

.room-promo__place i {
    margin-left: 5px;
    color: var(--promo-2);
}

/* ------------------------------------------------------------------ stats */

.room-promo__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

.room-promo__stats li {
    min-width: 72px;
    padding: 11px 12px 10px;
    border-radius: 11px;
    text-align: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.room-promo__stats b {
    display: block;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
    color: #fff;
}

.room-promo__stats span {
    display: block;
    margin-top: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    color: rgba(240, 236, 250, 0.62);
}

/* ------------------------------------------------------------- hub crests */

.room-promo__crests {
    display: flex;
    /* Wide enough that the lit crest's ring and glow still clear its neighbours
       once it scales up. */
    gap: 16px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.room-promo__crests li {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    /* Keeps the crest clear of the circular border on every side. */
    padding: 11px;
    box-sizing: border-box;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(199, 125, 255, 0.22);
    opacity: 0.72;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.room-promo:hover .room-promo__crests li {
    opacity: 1;
}

/* Your own house is the one lit up, so the row reads as "and yours is here". */
.room-promo__crests li.is-mine {
    opacity: 1;
    border-color: rgba(216, 180, 254, 0.75);
    box-shadow: 0 0 16px rgba(161, 25, 166, 0.55);
    transform: scale(1.06);
}

.room-promo__crests img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* -------------------------------------------------------------------- cta */

.room-promo__foot {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 18px;
}

.room-promo__cta {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--promo-2) 0%, var(--promo-1) 100%);
    color: #fff !important;
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.5;
    text-decoration: none !important;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
    transition: transform 0.3s ease, box-shadow 0.3s ease, filter 0.3s ease;
}

.room-promo__cta:hover {
    transform: translateY(-2px);
    filter: brightness(1.08);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.room-promo__chevron {
    transition: transform 0.3s ease;
}

.room-promo__cta:hover .room-promo__chevron {
    transform: translateX(-5px);
}

.room-promo__second {
    color: var(--promo-accent) !important;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.6;
    text-decoration: none !important;
    border-bottom: 1px dashed rgba(216, 180, 254, 0.45);
}

.room-promo__second:hover {
    color: #fff !important;
}

.room-promo__note {
    font-size: 0.78rem;
    line-height: 1.7;
    color: rgba(240, 236, 250, 0.6);
}

/* ----------------------------------------------------------------- mobile */

@media (max-width: 782px) {
    .room-promo {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        min-height: 0;
        gap: 14px;
    }

    /* Photo behind a column layout needs an even wash, not a side-to-side one. */
    .room-promo--house .room-promo__veil {
        background:
            linear-gradient(180deg,
                rgba(6, 5, 10, 0.62) 0%,
                rgba(6, 5, 10, 0.88) 55%,
                rgba(6, 5, 10, 0.95) 100%),
            radial-gradient(ellipse 90% 60% at 50% 0%, var(--promo-deep) 0%, transparent 70%);
    }

    .room-promo__crest {
        width: 84px;
        margin: 0 auto;
    }

    .room-promo__text {
        max-width: none;
    }

    .room-promo__stats,
    .room-promo__crests,
    .room-promo__foot {
        justify-content: center;
    }

    .room-promo__stats li {
        flex: 1 1 0;
        min-width: 0;
    }

    .room-promo__cta {
        width: 100%;
        justify-content: center;
    }

    .room-promo__note {
        flex: 1 1 100%;
    }
}

@media (max-width: 400px) {
    .room-promo__badge {
        font-size: 0.7rem;
    }

    .room-promo__crests {
        gap: 12px;
    }

    .room-promo__crests li {
        width: 46px;
        height: 46px;
        padding: 9px;
    }
}

/* ------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
    .room-promo,
    .room-promo *,
    .room-promo *::before,
    .room-promo *::after {
        animation: none !important;
        transition: none !important;
    }

    .room-promo:hover {
        transform: none;
    }
}
