/* ============================================================
   HOME — layout anime (pages/page-home.php)

   Escopo: tudo vive dentro de main.ah. O destaque segue a "Cor destaque"
   das Definições (--color-primary); o ciano é o segundo acento, fixo.
   ============================================================ */

.ah {
    --ah-ink: #0D0A14;
    --ah-surface: #16111F;
    --ah-raise: #211A2E;
    --ah-line: rgba(243, 239, 250, 0.09);
    --ah-text: #F3EFFA;
    --ah-muted: #A49BB8;
    --ah-accent: var(--color-primary, #FF3E7F);
    --ah-accent-rgb: var(--color-primary-rgb, 255, 62, 127);
    --ah-cyan: #3DE2FF;
    --ah-display: 'Dela Gothic One', 'Inter18pt', 'Arial Black', sans-serif;
    --ah-body: 'Zen Kaku Gothic New', 'Inter18pt', system-ui, sans-serif;
    --ah-cut: 28px;
    --ah-dur: 6s;

    position: relative;
    overflow-x: clip;
    background: var(--ah-ink);
    color: var(--ah-text);
    font-family: var(--ah-body);
    padding-block: 0 96px;
    padding-inline: 0;
    color-scheme: dark;
}

.ah *,
.ah *::before,
.ah *::after {
    box-sizing: border-box;
}

.ah a {
    color: inherit;
    text-decoration: none;
}

.ah-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.ah-wrap {
    width: 100%;
    max-width: 1280px;
    margin-inline: auto;
    padding-inline: 20px;
}

.ah-img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: cover;
}

.ah :focus-visible {
    outline: 2px solid var(--ah-cyan);
    outline-offset: 3px;
}

/* ---------- Peças comuns ---------- */

.ah-kicker {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ah-cyan);
}

.ah-meta {
    font-size: 13px;
    color: var(--ah-muted);
    font-variant-numeric: tabular-nums;
}

.ah-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ah-text);
    background: rgba(13, 10, 20, 0.55);
    border: 1px solid rgba(243, 239, 250, 0.22);
    backdrop-filter: blur(6px);
}

.ah-tag--hot {
    background: var(--ah-accent);
    border-color: var(--ah-accent);
    color: #fff;
}

.ah-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 24px 13px 22px;
    font-family: var(--ah-body);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ah-accent);
    border: 0;
    cursor: pointer;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    transition: filter 0.2s ease, transform 0.2s ease;
}

.ah-btn:hover {
    filter: brightness(1.12);
    transform: translateY(-1px);
}

.ah-btn svg {
    width: 16px;
    height: 16px;
}

.ah-btn--ghost {
    background: transparent;
    color: var(--ah-text);
    box-shadow: inset 0 0 0 1px var(--ah-line);
}

.ah-btn--ghost:hover {
    box-shadow: inset 0 0 0 1px var(--ah-accent);
    color: var(--ah-accent);
}

/* ---------- HERO ---------- */

.ah-hero {
    position: relative;
    padding-block: 32px 28px;
    background:
        radial-gradient(60% 70% at 85% 0%, rgba(var(--ah-accent-rgb), 0.22), transparent 70%),
        radial-gradient(40% 60% at 0% 100%, rgba(61, 226, 255, 0.10), transparent 70%);
}

/* Linhas de velocidade de mangá, irradiando atrás do palco */
.ah-speedlines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-conic-gradient(from 0deg at 68% 45%, rgba(243, 239, 250, 0.045) 0deg 0.8deg, transparent 0.8deg 5deg);
    -webkit-mask-image: radial-gradient(closest-side at 68% 45%, transparent 35%, #000 100%);
    mask-image: radial-gradient(closest-side at 68% 45%, transparent 35%, #000 100%);
}

.ah-hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
}

.ah-hero-stage {
    position: relative;
    display: grid;
    min-height: 540px;
    background: var(--ah-surface);
    clip-path: polygon(0 0, calc(100% - var(--ah-cut)) 0, 100% var(--ah-cut), 100% 100%, var(--ah-cut) 100%, 0 calc(100% - var(--ah-cut)));
}

.ah-slide {
    grid-area: 1 / 1;
    position: relative;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0s linear 0.7s;
}

.ah-slide.is-active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease;
}

.ah-slide-media {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.ah-slide-media .ah-img {
    transform: scale(1.08);
    transition: transform 7s ease-out;
}

.ah-slide.is-active .ah-slide-media .ah-img {
    transform: scale(1);
}

/* Degradê para leitura + retícula (screentone) no canto do texto */
.ah-slide-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(rgba(13, 10, 20, 0.55) 1.1px, transparent 1.6px) 0 0 / 7px 7px,
        linear-gradient(15deg, rgba(13, 10, 20, 0.96) 15%, rgba(13, 10, 20, 0.55) 50%, rgba(13, 10, 20, 0) 80%);
    -webkit-mask-image: linear-gradient(15deg, #000 40%, rgba(0, 0, 0, 0.85) 100%);
    mask-image: linear-gradient(15deg, #000 40%, rgba(0, 0, 0, 0.85) 100%);
}

.ah-slide-body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 720px;
    padding: 48px 44px 44px;
}

.ah-slide-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ah-slide-title {
    margin: 0;
    font-family: var(--ah-display);
    font-weight: 400;
    font-size: clamp(28px, 3.6vw, 50px);
    line-height: 1.12;
    letter-spacing: -0.005em;
    color: var(--ah-text);
    text-wrap: balance;
    text-shadow: 0 2px 24px rgba(13, 10, 20, 0.6);
}

.ah-slide-title a:hover {
    color: var(--ah-accent);
}

.ah-slide-excerpt {
    margin: 0;
    max-width: 58ch;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(243, 239, 250, 0.82);
}

.ah-slide-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 20px;
    margin-top: 6px;
}

.ah-vert {
    position: absolute;
    top: 30px;
    right: 34px;
    z-index: 2;
    writing-mode: vertical-rl;
    font-family: var(--ah-display);
    font-size: 46px;
    line-height: 1;
    letter-spacing: 0.08em;
    color: transparent;
    -webkit-text-stroke: 1.2px rgba(243, 239, 250, 0.7);
    pointer-events: none;
}

/* Lista lateral: escolhe o destaque e mostra o tempo do autoplay */
.ah-hero-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ah-hero-pick {
    position: relative;
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    flex: 1;
    width: 100%;
    padding: 12px;
    text-align: left;
    font-family: var(--ah-body);
    color: var(--ah-text);
    background: rgba(22, 17, 31, 0.8);
    border: 1px solid var(--ah-line);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ah-hero-pick:hover {
    background: var(--ah-raise);
}

.ah-hero-pick.is-active {
    background: var(--ah-raise);
    border-color: rgba(var(--ah-accent-rgb), 0.6);
}

.ah-hero-pick-thumb {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
}

.ah-hero-pick-text {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.ah-hero-pick-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
}

.ah-hero-pick-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: transparent;
}

.ah-hero-pick-bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--ah-accent);
}

.ah-hero-pick.is-active .ah-hero-pick-bar span {
    width: 100%;
}

.ah-hero.is-playing .ah-hero-pick.is-active .ah-hero-pick-bar span {
    animation: ah-progress var(--ah-dur) linear forwards;
}

.ah-hero.is-paused .ah-hero-pick.is-active .ah-hero-pick-bar span {
    animation-play-state: paused;
}

@keyframes ah-progress {
    from { width: 0; }
    to { width: 100%; }
}

/* ---------- GÊNEROS ---------- */

.ah-genres {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-block: 8px 12px;
}

.ah-genres-label {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ah-muted);
}

.ah-genres-track {
    display: flex;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    padding-block: 4px;
    scrollbar-width: none;
}

.ah-genres-track::-webkit-scrollbar {
    display: none;
}

.ah-chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 700;
    background: var(--ah-surface);
    border: 1px solid var(--ah-line);
    clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
    transition: background 0.2s ease, color 0.2s ease;
}

.ah-chip span {
    font-size: 12px;
    font-weight: 500;
    color: var(--ah-muted);
    font-variant-numeric: tabular-nums;
}

.ah-chip:hover {
    background: var(--ah-accent);
    color: #fff;
}

.ah-chip:hover span {
    color: rgba(255, 255, 255, 0.8);
}

/* ---------- Cabeçalho de seção ---------- */

.ah-section {
    margin-top: 64px;
}

.ah-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.ah-head-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-family: var(--ah-display);
    font-weight: 400;
    font-size: clamp(26px, 3vw, 36px);
    line-height: 1.1;
    color: var(--ah-text);
}

.ah-head-title--sm {
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    font-size: clamp(22px, 2.4vw, 28px);
}

.ah-head-title a:hover {
    color: var(--ah-accent);
}

.ah-jp {
    font-family: var(--ah-body);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.35em;
    color: var(--ah-accent);
}

.ah-head-count {
    font-family: var(--ah-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--ah-muted);
    font-variant-numeric: tabular-nums;
}

.ah-head-note {
    margin: 0;
    font-size: 14px;
    color: var(--ah-muted);
}

.ah-head-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ah-text);
    transition: color 0.2s ease, gap 0.2s ease;
}

.ah-head-link svg {
    width: 16px;
    height: 16px;
}

.ah-head-link:hover {
    color: var(--ah-accent);
    gap: 12px;
}

/* ---------- EM ALTA (ranking) ---------- */

.ah-rank {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ah-rank-item {
    position: relative;
    padding-left: 46px;
}

.ah-rank-num {
    position: absolute;
    left: -6px;
    top: 38%;
    font-family: var(--ah-display);
    font-size: 150px;
    line-height: 0.8;
    color: var(--ah-ink);
    -webkit-text-stroke: 2px rgba(243, 239, 250, 0.32);
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.ah-rank-item:first-child .ah-rank-num {
    -webkit-text-stroke-color: var(--ah-accent);
}

.ah-rank-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ah-rank-media {
    display: block;
    aspect-ratio: 3 / 4;
    max-width: 100%;
    overflow: hidden;
    background: var(--ah-surface);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.ah-rank-media .ah-img,
.ah-card-media .ah-img,
.ah-latest-media .ah-img,
.ah-feed-thumb .ah-img {
    transition: transform 0.45s ease;
}

.ah-rank-card:hover .ah-img,
.ah-card:hover .ah-img,
.ah-latest-main:hover .ah-img,
.ah-feed-item:hover .ah-img {
    transform: scale(1.05);
}

.ah-rank-card .ah-kicker {
    margin-top: 4px;
}

.ah-rank-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.ah-rank-card:hover .ah-rank-title {
    color: var(--ah-accent);
}

/* ---------- ÚLTIMAS ---------- */

.ah-latest {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 28px;
}

.ah-latest-main {
    position: relative;
    display: flex;
    align-items: flex-end;
    min-height: 460px;
    overflow: hidden;
    background: var(--ah-surface);
}

.ah-latest-media {
    position: absolute;
    inset: 0;
}

.ah-latest-media::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(13, 10, 20, 0.95) 10%, rgba(13, 10, 20, 0.2) 65%, rgba(13, 10, 20, 0) 100%);
}

.ah-latest-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 32px;
}

.ah-latest-title {
    font-family: var(--ah-display);
    font-size: clamp(22px, 2.4vw, 30px);
    line-height: 1.2;
    text-wrap: balance;
}

.ah-latest-main:hover .ah-latest-title {
    color: var(--ah-accent);
}

.ah-feed {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--ah-line);
}

.ah-feed li {
    border-bottom: 1px solid var(--ah-line);
}

.ah-feed-item {
    display: grid;
    grid-template-columns: 74px 64px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    padding-block: 14px;
}

.ah-feed-time {
    position: relative;
    padding-left: 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ah-muted);
    font-variant-numeric: tabular-nums;
}

.ah-feed-time::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    background: var(--ah-cyan);
    transform: rotate(45deg);
}

.ah-feed-thumb {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--ah-surface);
}

.ah-feed-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ah-feed-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.ah-feed-item:hover .ah-feed-title {
    color: var(--ah-accent);
}

/* ---------- TRILHOS POR CATEGORIA ---------- */

.ah-row-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ah-arrow {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: var(--ah-text);
    background: var(--ah-surface);
    border: 1px solid var(--ah-line);
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.ah-arrow svg {
    width: 18px;
    height: 18px;
}

.ah-arrow[data-ah-prev] svg {
    transform: rotate(180deg);
}

.ah-arrow:hover {
    background: var(--ah-raise);
    border-color: var(--ah-accent);
}

.ah-arrow:disabled {
    opacity: 0.35;
    cursor: default;
}

.ah-row-ctrl .ah-head-link {
    margin-left: 10px;
}

.ah-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - 3 * 18px) / 4);
    gap: 18px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.ah-track::-webkit-scrollbar {
    display: none;
}

.ah-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-snap-align: start;
}

.ah-card-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    max-width: 100%;
    overflow: hidden;
    background: var(--ah-surface);
}

.ah-card-media::after {
    content: "";
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 0 var(--ah-accent);
    transition: box-shadow 0.25s ease;
}

.ah-card:hover .ah-card-media::after {
    box-shadow: inset 0 0 0 3px var(--ah-accent);
}

.ah-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
}

.ah-card:hover .ah-card-title {
    color: var(--ah-accent);
}

.ah-more {
    display: flex;
    justify-content: center;
    margin-top: 48px;
}

/* ---------- Responsivo ---------- */

@media (max-width: 1100px) {
    .ah-rank {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: 230px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
        padding-bottom: 4px;
    }
    .ah-rank::-webkit-scrollbar {
        display: none;
    }
    .ah-rank-item {
        scroll-snap-align: start;
    }
    .ah-track {
        grid-auto-columns: calc((100% - 2 * 18px) / 3);
    }
}

@media (max-width: 960px) {
    .ah-hero-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .ah-hero-list {
        flex-direction: row;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scrollbar-width: none;
    }
    .ah-hero-list::-webkit-scrollbar {
        display: none;
    }
    .ah-hero-pick {
        flex: 0 0 280px;
        scroll-snap-align: start;
    }
    .ah-latest {
        grid-template-columns: minmax(0, 1fr);
    }
    .ah-latest-main {
        min-height: 380px;
    }
}

@media (max-width: 640px) {
    .ah {
        --ah-cut: 18px;
    }
    .ah-wrap {
        padding-inline: 16px;
    }
    .ah-hero {
        padding-top: 16px;
    }
    .ah-hero-stage {
        min-height: 500px;
    }
    .ah-slide-body {
        padding: 28px 22px 30px;
        gap: 12px;
    }
    .ah-slide-excerpt {
        font-size: 15px;
    }
    .ah-vert {
        top: 18px;
        right: 18px;
        font-size: 30px;
    }
    .ah-hero-pick {
        flex-basis: 240px;
        grid-template-columns: 56px minmax(0, 1fr);
    }
    .ah-genres {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .ah-section {
        margin-top: 48px;
    }
    .ah-rank {
        grid-auto-columns: 190px;
    }
    .ah-rank-num {
        font-size: 120px;
    }
    .ah-track {
        grid-auto-columns: 72%;
    }
    .ah-arrow {
        display: none;
    }
    .ah-row-ctrl .ah-head-link {
        margin-left: 0;
    }
    .ah-latest-main {
        min-height: 320px;
    }
    .ah-latest-body {
        padding: 22px;
    }
    .ah-feed-item {
        grid-template-columns: 56px minmax(0, 1fr);
        grid-template-areas: "thumb text" "thumb time";
        gap: 4px 14px;
    }
    .ah-feed-thumb {
        grid-area: thumb;
    }
    .ah-feed-text {
        grid-area: text;
    }
    .ah-feed-time {
        grid-area: time;
        font-weight: 500;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ah *,
    .ah *::before,
    .ah *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
    .ah-slide-media .ah-img {
        transform: none;
    }
}
