/* ═══════════════════════════════════════════════════════════════
   HOMEPAGE (index.php)
   Builds on css/character.css (the cd-* tokens, panels, buttons and card frames);
   everything here is hm-* scoped. Static on load by design: no loader, no intro
   animation, only hover / focus feedback.
   ═══════════════════════════════════════════════════════════════ */

.hm-body {
    --green: #65d26e;
    --red: #e8413c;
    background-image:
        radial-gradient(circle at 18% 8%, rgba(101, 210, 110, 0.07) 0%, transparent 42%),
        radial-gradient(circle at 85% 18%, rgba(232, 65, 60, 0.07) 0%, transparent 45%),
        radial-gradient(circle at 50% 70%, rgba(74, 144, 217, 0.05) 0%, transparent 55%),
        radial-gradient(circle, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: auto, auto, auto, 18px 18px;
}
.hm { display: grid; gap: 22px; align-content: start; }
.hm > * { min-width: 0; }
.hm > #top-banner:empty { display: none; }   /* the ad slot takes no grid row (and no gap) until an ad is put in it */

/* ── Hero ──────────────────────────────────────────────────────── */
.hm-hero {
    position: relative;
    display: grid;
    gap: 6px 28px;
    align-items: center;
    margin-top: 8px;
    padding: 22px 18px 24px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background:
        radial-gradient(ellipse at 100% 0%, rgba(232, 65, 60, 0.14), transparent 55%),
        radial-gradient(ellipse at 0% 100%, rgba(101, 210, 110, 0.1), transparent 55%),
        linear-gradient(160deg, rgba(26, 45, 77, 0.92), rgba(10, 22, 40, 0.92));
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}
.hm-hero::before {                         /* manga speed lines, still */
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-conic-gradient(from 0deg at 75% 110%, transparent 0deg, rgba(255, 255, 255, 0.025) 0.6deg, transparent 1.2deg, transparent 4deg);
}
.hm-hero > * { position: relative; }
.hm-hero-text { min-width: 0; }

.hm-badge {
    display: inline-block;
    margin: 0 0 14px;
    padding: 5px 14px;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--red), #c0302c);
    box-shadow: 0 4px 18px rgba(232, 65, 60, 0.3);
    color: #fff;
    font: 700 0.7rem/1.3 var(--font-body);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
.cd-jp .hm-badge { letter-spacing: 1px; }
.hm-title {
    margin: 0 0 12px;
    font: 400 clamp(2.3rem, 7.4vw, 4.4rem)/0.98 var(--font-display);
    letter-spacing: 1px;
    text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.45);
}
.cd-jp .hm-title { letter-spacing: 0; font-size: clamp(2rem, 6.4vw, 3.8rem); line-height: 1.08; }
/* The site logo is the title. The PNG is 1280x720 with the artwork inside (139,157)-(1054,553); the box shows just
   that part, so the logo lines up with the text around it. The .hm-title font styles the alt text if it fails to load. */
.hm-logo {
    position: relative;
    width: min(100%, 500px);
    aspect-ratio: 915 / 396;
    margin: 0 0 16px;
    overflow: hidden;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
}
.hm-logo img {
    position: absolute;
    left: -15.191%;      /* 139 / 915 */
    top: -39.646%;       /* 157 / 396 */
    width: 139.891%;     /* 1280 / 915 */
    max-width: none;
    height: auto;
}
.hm-lead { max-width: 54ch; margin: 0 0 18px; color: var(--text-2); font-size: 1rem; }
.hm-cta, .hm-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.hm-cta .cd-btn svg, .hm-btns .cd-btn svg { flex: none; }
.hm-btn-gold { border-color: rgba(255, 213, 83, 0.6); color: var(--gold) !important; }
.hm-btn-gold:hover { background: var(--gold); border-color: var(--gold); color: var(--navy) !important; }

.hm-hero-art {
    position: relative;
    display: block;
    width: 100%;
    max-width: 380px;
    margin: 6px auto 0;
    aspect-ratio: 841 / 602;
    text-decoration: none;
}
.hm-hero-art::before {                     /* glow in the card's attribute colour */
    content: '';
    position: absolute;
    inset: 4% 8%;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--hero) 70%, transparent) 0%, color-mix(in srgb, var(--hero2) 22%, transparent) 45%, transparent 70%);
    filter: blur(6px);
}
.hm-hero-art img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.55));
    transition: transform 0.35s ease;
}
.hm-hero-art:hover img { transform: scale(1.03); }
.hm-hero-cap {
    position: absolute;
    right: 0;
    bottom: 2%;
    max-width: 92%;
    padding: 5px 12px;
    border: 1px solid color-mix(in srgb, var(--hero2) 55%, transparent);
    border-radius: 999px;
    background: rgba(10, 22, 40, 0.8);
    backdrop-filter: blur(6px);
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.hm-hero-cap small { margin-right: 6px; color: var(--hero2); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
.hm-hero-art:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 12px; }

@media (min-width: 640px) {
    .hm-hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); padding: 30px 26px 30px 30px; }
    .hm-hero-art { max-width: none; margin: 0; }
    .hm-title { font-size: clamp(2.1rem, 5.1vw, 4.4rem); }
    .cd-jp .hm-title { font-size: clamp(1.9rem, 4.5vw, 3.8rem); }
}
@media (min-width: 992px) { .hm-hero { padding: 36px 36px 36px 40px; } }

/* ── Counts ────────────────────────────────────────────────────── */
.hm-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: -6px 0 0;
    padding: 0;
    list-style: none;
}
.hm-stats li {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background: var(--panel-bg);
    text-align: center;
}
.hm-stats b { font: 400 clamp(1.3rem, 3.6vw, 1.75rem)/1.15 var(--font-display); color: #fff; font-variant-numeric: tabular-nums; }
.hm-stats li:last-child b { color: var(--gold); font-size: clamp(1.05rem, 2.6vw, 1.3rem); align-self: center; }
.hm-stats span { color: var(--text-3); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; }
.cd-jp .hm-stats span { letter-spacing: 0; }
@media (min-width: 760px) { .hm-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ── End-of-service note ───────────────────────────────────────── */
.hm-eos {
    padding: 14px 18px;
    border: 1px solid rgba(232, 65, 60, 0.25);
    border-left: 4px solid var(--red);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: linear-gradient(90deg, rgba(232, 65, 60, 0.1), rgba(15, 25, 50, 0.6) 60%);
}
.hm-eos p { margin: 0; color: var(--text-2); font-size: 0.92rem; }
.hm-eos strong { color: var(--text); }

/* ── Sections + explore tiles ──────────────────────────────────── */
.hm-h2 { display: inline-block; margin-bottom: 18px; }
.hm-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.hm-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--c) 10%, transparent), transparent 55%),
        var(--panel-bg);
    text-decoration: none;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.hm-tile:hover, .hm-tile:focus-visible {
    border-color: color-mix(in srgb, var(--c) 65%, transparent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent) inset;
    transform: translateY(-2px);
}
.hm-tile:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hm-tile.is-new { border-color: rgba(255, 213, 83, 0.45); }
.hm-tile-ic {
    display: grid;
    flex: none;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--c) 16%, rgba(255, 255, 255, 0.03));
    color: var(--c);
}
.hm-tile-txt { display: grid; flex: 1; gap: 2px; min-width: 0; }
.hm-tile-h { font: 400 1.12rem/1.2 var(--font-display); color: var(--text); letter-spacing: 0.3px; }
.cd-jp .hm-tile-h { letter-spacing: 0; }
.hm-tile-p { color: var(--text-3); font-size: 0.82rem; line-height: 1.35; }
.hm-tile-go { flex: none; color: var(--text-3); font-size: 1.1rem; transition: transform 0.2s, color 0.2s; }
.hm-tile:hover .hm-tile-go { color: var(--c); transform: translateX(3px); }
.hm-new {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--navy);
    font: 800 0.62rem/1.5 var(--font-body);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ── Team Builder spotlight ────────────────────────────────────── */
.hm-tb { display: grid; gap: 18px; align-items: center; }
.hm-tb::before { background: linear-gradient(90deg, var(--gold), var(--acc2) 60%, transparent); }
.hm-tb-fan { position: relative; width: 100%; max-width: 300px; height: 210px; margin: 0 auto; }
.hm-tb-fan .tb-lcard {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 128px;
    filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
}
.hm-tb-fan .hm-fan-0 { z-index: 3; transform: translateX(-50%); }
.hm-tb-fan .hm-fan-1 { z-index: 2; transform: translateX(-108%) rotate(-10deg) translateY(14px); }
.hm-tb-fan .hm-fan-2 { z-index: 1; transform: translateX(8%) rotate(10deg) translateY(14px); }
.hm-tb:hover .hm-fan-1 { transform: translateX(-118%) rotate(-14deg) translateY(16px); }
.hm-tb:hover .hm-fan-2 { transform: translateX(18%) rotate(14deg) translateY(16px); }
.hm-tb-body { display: grid; gap: 12px; justify-items: start; }
.hm-tb-body .cd-h2 { margin-bottom: 6px; }
.hm-tb-lead { margin: 0; color: var(--text-2); }
.hm-tb-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.hm-tb-list li { position: relative; padding-left: 22px; color: var(--text); font-size: 0.92rem; }
.hm-tb-list li::before { content: '✦'; position: absolute; left: 0; top: 0; color: var(--gold); }
@media (min-width: 760px) {
    .hm-tb { grid-template-columns: 300px minmax(0, 1fr); gap: 28px; }
}

/* ── Summon Simulator spotlight: the Team Builder's layout mirrored (text left, art right), with a recruit in
      mid-reveal as the art: a rainbow burst, a UR face up between two face-down cards ─────────────────────── */
.hm-sim::before { background: linear-gradient(90deg, #ff5d6c, #ffd553 28%, #57dd5c 52%, #5b95ed 76%, transparent); }
.hm-sim-art { position: relative; width: 100%; max-width: 300px; height: 210px; margin: 0 auto; }
.hm-sim-burst {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 112%;
    aspect-ratio: 1.42;
    transform: translate(-50%, -50%);
    background: conic-gradient(from 20deg, #ff5d6c, #ffd553, #79ff80, #5bc8ff, #b959e6, #ff5d6c);
    clip-path: polygon(100% 50%, 89.7% 54.5%, 94.8% 60.2%, 84.9% 62.2%, 95% 71.7%, 81.3% 69.7%, 89.1% 81.2%, 78.3% 78.3%, 81.2% 89.1%, 69.7% 81.3%, 70% 91.4%, 62.2% 84.9%, 61.1% 98.7%, 54.5% 89.7%, 50% 100%, 45.9% 86.8%, 38.9% 98.7%, 37.8% 84.9%, 30% 91.4%, 28.7% 83.9%, 18.8% 89.1%, 23.8% 76.2%, 10.9% 81.2%, 18.7% 69.7%, 5% 71.7%, 12.2% 63.2%, 5.2% 60.2%, 13.2% 54.1%, 0% 50%, 13.2% 45.9%, 1.3% 38.9%, 12.2% 36.8%, 5% 28.3%, 18.7% 30.3%, 14% 21.3%, 23.8% 23.8%, 18.8% 10.9%, 28.7% 16.1%, 28.3% 5%, 37.8% 15.1%, 38.9% 1.3%, 45.9% 13.2%, 50% 4%, 54.5% 10.3%, 61.1% 1.3%, 62.2% 15.1%, 71.7% 5%, 69.7% 18.7%, 81.2% 10.9%, 78.3% 21.7%, 86% 21.3%, 81.3% 30.3%, 95% 28.3%, 84.9% 37.8%, 98.7% 38.9%, 89.7% 45.5%);
    opacity: 0.9;
}
.hm-sim-back {
    position: absolute;
    top: 30px;
    left: 50%;
    z-index: 1;
    width: 104px;
    aspect-ratio: 194 / 244;
    border: 3px solid #05080f;
    border-radius: 9px;
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.22) 1.4px, transparent 2px) 0 0 / 9px 9px,
        linear-gradient(140deg, #2b4a86, #162a52);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.45);
    transition: transform 0.3s ease;
}
.hm-sim-back::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.85); font: 400 2rem/1 var(--font-display); -webkit-text-stroke: 0.12em #05080f; paint-order: stroke fill; }
.hm-sim-b1 { transform: translateX(-132%) rotate(-12deg); }
.hm-sim-b2 { transform: translateX(32%) rotate(12deg); }
.hm-sim:hover .hm-sim-b1 { transform: translateX(-142%) rotate(-16deg); }
.hm-sim:hover .hm-sim-b2 { transform: translateX(42%) rotate(16deg); }
.hm-sim-art .tb-lcard { position: absolute; top: 4px; left: 50%; z-index: 2; width: 128px; transform: translateX(-50%) rotate(-3deg); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.5)); }
.hm-sim-word {
    position: absolute;
    left: 50%;
    bottom: 0;
    z-index: 3;
    transform: translateX(-50%) rotate(-5deg);
    color: #fff;
    font: 400 1.3rem/1 var(--font-display);
    letter-spacing: 0.5px;
    white-space: nowrap;
    -webkit-text-stroke: 0.18em #05080f;
    paint-order: stroke fill;
    text-shadow: 0.07em 0.08em 0 #05080f;
}
@media (min-width: 760px) {
    .hm-tb.hm-sim { grid-template-columns: minmax(0, 1fr) 300px; }
    .hm-sim .hm-sim-art { order: 1; }
}

/* ── Newest characters / memories ──────────────────────────────── */
.hm-cards, .hm-mems { display: grid; gap: 14px 10px; margin: 0; padding: 0; list-style: none; }
.hm-cards { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.hm-mems { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.hm-cards a, .hm-mems a { display: grid; gap: 3px; align-content: start; height: 100%; text-decoration: none; transition: transform 0.2s; }
.hm-cards a:hover, .hm-mems a:hover { transform: translateY(-3px); }
.hm-cards a:focus-visible, .hm-mems a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 8px; }
.hm-cards .tb-lcard { margin-bottom: 3px; }
.hm-mems .md-thumb { margin-bottom: 3px; }
.hm-card-t { color: var(--text-3); font-size: 0.7rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-card-n {
    display: -webkit-box;
    overflow: hidden;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.hm-mems .hm-card-n { font-size: 0.74rem; text-align: center; }
.hm-date { color: var(--gold); font-size: 0.68rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.hm-mems .hm-date { text-align: center; }

/* ── Downloads + community ─────────────────────────────────────── */
.hm-duo { display: grid; gap: 22px; }
@media (min-width: 760px) { .hm-duo { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.hm-duo .cd-h2 { margin-bottom: 14px; }
.hm-note { margin: 0 0 14px; color: var(--text-2); font-size: 0.9rem; }
.hm-x:hover { background: #000; border-color: #fff; color: #fff !important; }
.hm-discord:hover { background: #5865f2; border-color: #8891f7; color: #fff !important; }
.hm-patreon:hover { background: #f96854; border-color: #ff9a8b; color: #fff !important; }
.hm-built { margin: 14px 0 0; color: var(--text-3); font-size: 0.82rem; }
.hm-built a { color: var(--gold); font-weight: 600; text-decoration: none; }
.hm-built a:hover { text-decoration: underline; }

/* ── Sister sites ──────────────────────────────────────────────── */
.hm-sites {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.hm-sites a { display: block; overflow: hidden; border: 1px solid var(--panel-border); border-radius: var(--radius); transition: transform 0.2s, border-color 0.2s; }
.hm-sites a:hover { transform: translateY(-2px); border-color: var(--acc2); }
.hm-sites a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.hm-sites img { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
    .hm-hero-art img, .hm-tile, .hm-tile-go, .hm-tb-fan .tb-lcard, .hm-cards a, .hm-mems a, .hm-sites a { transition: none; }
    .hm-hero-art:hover img, .hm-tile:hover, .hm-cards a:hover, .hm-mems a:hover, .hm-sites a:hover { transform: none; }
    .hm-tb:hover .hm-fan-1 { transform: translateX(-108%) rotate(-10deg) translateY(14px); }
    .hm-tb:hover .hm-fan-2 { transform: translateX(8%) rotate(10deg) translateY(14px); }
    .hm-sim-back { transition: none; }
    .hm-sim:hover .hm-sim-b1 { transform: translateX(-132%) rotate(-12deg); }
    .hm-sim:hover .hm-sim-b2 { transform: translateX(32%) rotate(12deg); }
}
