/* Independent Anime Content Hub catalog. No DLE Filter assets or libraries. */
.ach-catalog {
    --ach-text: var(--ab-text, #edf4ff);
    --ach-heading: var(--ab-heading, #ffffff);
    --ach-muted: var(--ab-text-muted, #acbbd3);
    --ach-surface: var(--ab-panel-solid, #111d36);
    --ach-card: var(--ab-surface-strong, #0d172d);
    --ach-input: var(--ab-input, #080f20);
    --ach-border: var(--ab-border, #30445e);
    --ach-accent: var(--ab-blue-light, #63d8ff);
    --ach-button: #2563eb;
    --ach-focus: var(--ab-focus, #63d8ff);
    --ach-shadow: var(--ab-card-shadow, 0 16px 36px rgb(2 8 24 / 24%));
    width: 100%;
    min-width: 0;
    margin-block: 0 32px;
    color: var(--ach-text);
    line-height: 1.5;
    overflow-wrap: anywhere;
    color-scheme: dark;
}

.lt .ach-catalog,
[data-theme="light"] .ach-catalog,
.ach-catalog[data-theme="light"] {
    --ach-text: #18233a;
    --ach-heading: #0a1530;
    --ach-muted: #51617b;
    --ach-surface: #ffffff;
    --ach-card: #f7fbff;
    --ach-input: #f4f8ff;
    --ach-border: #c8d7e9;
    --ach-accent: #076d94;
    --ach-button: #245fdb;
    --ach-focus: #256dff;
    --ach-shadow: 0 12px 30px rgb(49 79 126 / 10%);
    color-scheme: light;
}

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

.ach-catalog h1,
.ach-catalog h2,
.ach-catalog h3 { color: var(--ach-heading); }

.ach-catalog > h1,
.ach-catalog__heading,
.ach-filter__heading {
    margin: 0 0 18px;
    color: var(--ach-heading);
    font-size: clamp(1.25rem, 2.4vw, 1.8rem);
    font-weight: 700;
    line-height: 1.25;
}

.ach-catalog__intro {
    max-width: 72ch;
    margin: -4px 0 20px;
    color: var(--ach-muted);
}

.ach-filter {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 18px 20px;
    min-width: 0;
    margin: 0 0 22px;
    padding: clamp(18px, 2.2vw, 28px);
    border: 1px solid var(--ach-border);
    border-radius: 20px;
    background: var(--ach-surface);
    color: var(--ach-text);
    box-shadow: var(--ach-shadow);
}

.ach-filter > legend,
.ach-filter__heading { grid-column: 1 / -1; }

.ach-filter > legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    color: var(--ach-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.ach-filter__heading { margin: 0; font-size: 1.15rem; }
.ach-filter__heading h2 { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.4; }
.ach-filter__heading p { margin: 5px 0 0; color: var(--ach-muted); font-size: 0.84rem; font-weight: 400; line-height: 1.5; }

.ach-field {
    display: flex;
    flex-direction: column;
    grid-column: span 2;
    gap: 7px;
    min-width: 0;
    margin: 0;
}

.ach-field--wide,
.ach-field--search { grid-column: 1 / -1; }
fieldset.ach-field { min-inline-size: 0; padding: 0; border: 0; }

.ach-field label,
.ach-field > span,
.ach-field > legend {
    display: block;
    margin: 0;
    padding: 0;
    color: var(--ach-text);
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
}

.ach-field input:not([type="hidden"]),
.ach-field select {
    display: block;
    width: 100%;
    min-width: 0;
    height: 46px;
    min-height: 46px;
    margin: 0;
    padding: 10px 13px;
    border: 1px solid var(--ach-border);
    border-radius: 10px;
    background-color: var(--ach-input);
    color: var(--ach-text);
    font: inherit;
    font-size: 0.94rem;
    line-height: 1.4;
    box-shadow: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ach-field select {
    appearance: auto;
    -webkit-appearance: menulist;
    padding-right: 10px;
    background-image: none !important;
    text-overflow: ellipsis;
    cursor: pointer;
}

.ach-field select option {
    background-color: var(--ach-surface);
    color: var(--ach-text);
}

.ach-field input::placeholder { color: var(--ach-muted); opacity: 0.9; }
.ach-field input:hover,
.ach-field select:hover { border-color: var(--ach-accent); }
.ach-field input:focus,
.ach-field select:focus { border-color: var(--ach-focus); }

.ach-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    min-width: 0;
}

.ach-range label { display: flex; flex-direction: column; gap: 5px; }
.ach-range label > span { color: var(--ach-muted); font-size: 0.78rem; }
.ach-field small,
.ach-filter__hint { color: var(--ach-muted); font-size: 0.8rem; line-height: 1.4; }
.ach-filter__hint { grid-column: 1 / -1; margin: 0; }

.ach-actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    align-items: center;
    gap: 10px 14px;
    margin: 2px 0 0;
}

.ach-actions button,
.ach-actions > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto;
    min-height: 46px;
    height: auto;
    margin: 0;
    padding: 11px 22px;
    border: 1px solid var(--ach-border);
    border-radius: 10px;
    background: transparent;
    color: var(--ach-text);
    font: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.ach-actions button[type="submit"],
.ach-actions .ach-button--primary {
    border-color: var(--ach-button);
    background: var(--ach-button);
    color: #ffffff;
    font-weight: 700;
}

.ach-actions button:hover,
.ach-actions > a:hover { border-color: var(--ach-accent); background: var(--ach-input); }
.ach-actions button[type="submit"]:hover,
.ach-actions .ach-button--primary:hover { border-color: var(--ach-button); background: var(--ach-button); filter: brightness(0.92); color: #fff; }
.ach-actions button:disabled { cursor: wait; opacity: 0.65; }
.ach-actions__hint { color: var(--ach-muted); font-size: 0.82rem; }

.ach-active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.ach-active-filters a,
.ach-active-filters > span,
.ach-active-filters li > span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--ach-border);
    border-radius: 8px;
    background: var(--ach-input);
    color: var(--ach-text);
    font-size: 0.82rem;
    line-height: 1.4;
    text-decoration: none;
}

.ach-active-filters a:hover { border-color: var(--ach-accent); color: var(--ach-accent); }
.ach-active-filters a::after { content: "×"; color: var(--ach-accent); font-size: 1rem; line-height: 1; }

.ach-result-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px 16px;
    margin: 0 0 18px;
    color: var(--ach-muted);
    font-size: 0.94rem;
}

p.ach-result-summary { display: block; }
.ach-result-summary strong,
.ach-result-summary b { color: var(--ach-heading); }
.ach-result-summary h2 { margin: 0; font-size: 1.15rem; line-height: 1.4; }

.ach-catalog-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 22px 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.ach-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    margin: 0;
    border: 1px solid var(--ach-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--ach-card);
    color: var(--ach-text);
    box-shadow: var(--ach-shadow);
    transition: border-color 150ms ease, transform 150ms ease;
}

.ach-card:focus-within,
.ach-card:hover { border-color: var(--ach-accent); }

.ach-card__poster {
    position: relative;
    display: block;
    flex: 0 0 auto;
    aspect-ratio: 2 / 3;
    width: 100%;
    overflow: hidden;
    background: var(--ach-input);
    color: var(--ach-muted);
    text-decoration: none;
}

.ach-card__poster img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    aspect-ratio: 2 / 3;
    margin: 0;
    object-fit: cover;
    object-position: center;
    transition: transform 200ms ease;
}

.ach-card__poster--missing,
.ach-card__placeholder {
    display: grid;
    place-items: center;
    padding: 18px;
    background: linear-gradient(145deg, var(--ach-surface), var(--ach-input));
    color: var(--ach-muted);
    text-align: center;
    font-size: 0.82rem;
}

.ach-card__placeholder { width: 100%; height: 100%; }

.ach-card__badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    max-width: calc(100% - 16px);
    padding: 4px 7px;
    border: 1px solid rgb(255 255 255 / 22%);
    border-radius: 7px;
    background: rgb(4 10 25 / 88%);
    color: #ffffff;
    font-size: 0.76rem;
    font-weight: 500;
    line-height: 1.3;
}

.ach-card__body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
    padding: 14px 13px 16px;
}

.ach-card__title,
.ach-card__title a {
    margin: 0;
    color: var(--ach-accent);
    font-size: 0.94rem;
    font-weight: 700;
    line-height: 1.45;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.ach-card__title {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.ach-card__title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ach-card__meta { display: flex; flex-wrap: wrap; gap: 4px 9px; margin-top: auto; color: var(--ach-muted); font-size: 0.76rem; line-height: 1.5; }
.ach-card__meta > span { min-width: 0; }
.ach-card__description { display: -webkit-box; overflow: hidden; margin: 0; color: var(--ach-text); font-size: 0.82rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; }

.ach-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.ach-pagination a,
.ach-pagination > span,
.ach-pagination li > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    min-height: 42px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--ach-border);
    border-radius: 9px;
    background: var(--ach-surface);
    color: var(--ach-text);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
}

.ach-pagination a:hover { border-color: var(--ach-accent); color: var(--ach-accent); }
.ach-pagination [aria-current="page"] { border-color: var(--ach-button); background: var(--ach-button); color: #fff; }
.ach-pagination [aria-disabled="true"] { color: var(--ach-muted); cursor: default; opacity: 0.7; }
.ach-pagination .ach-pagination__ellipsis,
.ach-pagination > span[aria-hidden="true"] { min-width: 18px; padding-inline: 2px; border-color: transparent; background: transparent; color: var(--ach-muted); }

.ach-notice,
.ach-empty {
    margin: 0 0 22px;
    padding: 18px 20px;
    border: 1px solid var(--ach-border);
    border-radius: 14px;
    background: var(--ach-surface);
    color: var(--ach-text);
}

.ach-notice--error,
.ach-notice[role="alert"] { border-left: 4px solid #ed8e8e; }
.ach-notice ul { margin: 8px 0 0; padding-inline-start: 22px; list-style: disc; }
.ach-notice li { margin-block: 4px; }
.ach-notice a,
.ach-empty a { color: var(--ach-accent); text-decoration: underline; text-underline-offset: 3px; }
.ach-empty { grid-column: 1 / -1; padding: 34px 24px; text-align: center; }
.ach-empty h2,
.ach-empty h3 { margin: 0 0 8px; font-size: 1.2rem; }
.ach-empty p { max-width: 56ch; margin: 0 auto; color: var(--ach-muted); }
.ach-empty .ach-actions { justify-content: center; margin-top: 18px; }

.ach-catalog :is(a, button, input, select, summary):focus-visible {
    outline: 3px solid var(--ach-focus);
    outline-offset: 3px;
}

.ach-card__poster:focus-visible { outline-offset: -4px; }
.ach-filter[aria-busy="true"] button[type="submit"] { cursor: progress; }
.ach-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
    .ach-card:hover { transform: translateY(-3px); }
    .ach-card:hover .ach-card__poster img { transform: scale(1.035); }
}

@media (max-width: 1280px) {
    .ach-catalog-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .ach-catalog-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ach-filter { gap: 16px; }
}

@media (max-width: 800px) {
    .ach-filter { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px; border-radius: 16px; }
    .ach-field { grid-column: span 1; }
    .ach-field--wide,
    .ach-field--search { grid-column: 1 / -1; }
    .ach-catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; }
}

@media (max-width: 560px) {
    .ach-catalog { margin-bottom: 24px; }
    .ach-filter { gap: 14px 12px; padding: 16px; }
    .ach-field--range { grid-column: 1 / -1; }
    .ach-field input:not([type="hidden"]),
    .ach-field select { font-size: 16px; }
    .ach-actions { gap: 10px; }
    .ach-actions button,
    .ach-actions > a { flex: 1 1 120px; padding-inline: 15px; }
    .ach-actions__hint { flex-basis: 100%; }
    .ach-catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 12px; }
    .ach-card { border-radius: 12px; }
    .ach-card__body { gap: 7px; padding: 11px 10px 13px; }
    .ach-card__title,
    .ach-card__title a { font-size: 0.88rem; }
    .ach-card__meta { font-size: 0.73rem; }
    .ach-pagination { gap: 6px; margin-top: 22px; }
    .ach-pagination a,
    .ach-pagination > span,
    .ach-pagination li > span { min-width: 40px; min-height: 44px; padding-inline: 10px; }
}

@media (max-width: 360px) {
    .ach-filter { grid-template-columns: minmax(0, 1fr); }
    .ach-field { grid-column: 1 / -1; }
    .ach-catalog-grid { gap: 14px 10px; }
    .ach-card__body { padding-inline: 8px; }
}

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