/* -------------------------------------------------------------------------
 * Codex front-end styles
 *
 * Deliberately light-touch: the plugin can be installed on any theme, so the
 * defaults inherit the site's own typography and colours. The Collected Worlds
 * theme layers its own, richer styles on top.
 * ---------------------------------------------------------------------- */

/* Dynamic child-entry lists */

.codex-children {
    margin: 2.5rem 0;
}

.codex-children__heading {
    margin: 0 0 1rem;
    font-size: 1.35rem;
    line-height: 1.25;
}

.codex-children__grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    gap: 1rem !important;
}

.codex-card {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 8px;
}

.codex-card__title {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    line-height: 1.3;
}

.codex-card__title a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.codex-card__excerpt {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    opacity: 0.8;
}

/* Wikilinks that have no matching entry */

.codex-link--missing {
    opacity: 0.7;
    border-bottom: 1px dotted currentColor;
    cursor: help;
}

/* Tree navigation (used by the codex/nav block) */

.codex-nav__series {
    display: block;
    margin: 0 0 1rem;
    font-size: 1.05rem;
    line-height: 1.3;
    text-decoration: none;
}

.codex-nav__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.codex-nav__list .codex-nav__list {
    margin-left: 0.85rem;
    padding-left: 0.55rem;
    border-left: 1px solid rgba(127, 127, 127, 0.35);
}

.codex-nav__item {
    position: relative;
    margin: 0.1rem 0;
}

.codex-nav__item > a {
    display: block;
    padding: 0.3rem 0.4rem;
    border-radius: 4px;
    line-height: 1.35;
    text-decoration: none;
}

.codex-nav__item > a:hover {
    background: rgba(127, 127, 127, 0.12);
}

.codex-nav__item.is-current > a {
    font-weight: 600;
}

/* Search form */

.codex-search {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 1.1rem;
}

.codex-search__input {
    flex: 1 1 auto;
    min-width: 0;
}

/* Backlinks */

.codex-backlinks {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(127, 127, 127, 0.35);
}

.codex-backlinks__title {
    margin: 0 0 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.75;
}

.codex-backlinks ul {
    margin: 0;
    padding-left: 1.1rem;
}

/* Breadcrumbs */

.codex-breadcrumbs {
    margin: 0 0 1.6rem;
    font-size: 0.78rem;
    line-height: 1.5;
    letter-spacing: 0.03em;
}

.codex-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.codex-breadcrumbs__item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.codex-breadcrumbs__item + .codex-breadcrumbs__item::before {
    content: "/";
    opacity: 0.4;
}

.codex-breadcrumbs a {
    color: inherit;
    text-decoration: none;
    opacity: 0.75;
}

.codex-breadcrumbs a:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.codex-breadcrumbs .is-current {
    opacity: 0.55;
}

/* Series landing page: section cards */

.codex-browse {
    margin: 2rem 0 2.5rem;
}

.codex-browse__grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
    gap: 1rem !important;
}

.codex-section-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 1.15rem 1.25rem;
    border: 1px solid rgba(127, 127, 127, 0.35);
    border-radius: 10px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.codex-section-card:hover,
.codex-section-card:focus-within {
    border-color: var(--codex-accent, currentColor);
    transform: translateY(-2px);
}

.codex-section-card__title {
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.3;
}

.codex-section-card__title a {
    color: inherit;
    text-decoration: none;
}

.codex-section-card__title a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.codex-section-card__description {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.55;
    opacity: 0.8;
}

.codex-section-card__count {
    margin: 0.25rem 0 0;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.55;
}

/* Curated content that follows the section index on a series page */

.codex-series__extra {
    margin-top: 2.75rem;
}
