/* Lexivox: estilos del sitio, los del diseño de Lexivox (el sitio PHP,
   php.lexivox.com): pizarra (slate) con acento azul, Inter para la interfaz,
   PT Serif para la lectura y Material Symbols para los íconos. Orden:
   fuentes, tokens, base, cabecera, columnas (menú, columna central con
   pestañas, rail), contenido. Tema claro u oscuro (data-theme). */

@font-face {
    font-family: "Inter";
    src: url("/fonts/inter.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Inter";
    src: url("/fonts/inter-italic.woff2") format("woff2");
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "PT Serif";
    src: url("/fonts/ptserif-regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "PT Serif";
    src: url("/fonts/ptserif-bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "PT Serif";
    src: url("/fonts/ptserif-italic.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* Íconos: subconjunto de Material Symbols Outlined (make icons), con
   nombre propio: el administrador declara el suyo con otros íconos. */
@font-face {
    font-family: "Lexivox Symbols";
    src: url("/fonts/symbols.woff2") format("woff2");
    font-weight: 250;
    font-style: normal;
    font-display: block;
}

/* ------------------------------------------------------------------
   Tokens (los del diseño de Lexivox). El tema lo fija main.html en
   <html data-theme>: el guardado o, si no hay, el del sistema.
   ------------------------------------------------------------------ */
:root {
    --bg-app: rgb(241 245 249);
    --bg-surface: rgb(255 255 255);
    --bg-hover: rgb(0 0 0 / 0.04);
    --text-primary: rgb(15 23 42);
    --text-secondary: rgb(71 85 105);
    --text-tertiary: rgb(148 163 184);
    --border-color: rgb(226 232 240);
    --color-accent: rgb(37 99 235);
    --danger: rgb(220 38 38);
    --shadow-level-1: 0 1px 3px rgb(0 0 0 / 0.1);
    --shadow-focus: 0 0 0 3px rgb(37 99 235 / 0.15);
    --logo-text: rgb(15 23 42);
    --logo-shape: rgb(37 99 235);
    --logo-fill: rgb(255 255 255);
    --button-text-color: rgb(255 255 255);
    --button-login-color: rgb(46 63 97);
    --rail-header: #e4ebf2;
    --rail-header-text: #000;
    --color-primary: #0056b3;
    --title-navy: #112a64;
    --name-blue: #24389c;
    --gold: #ca8a04;
    --rail-toggle: rgb(73 100 159 / 0.69);
    --rail-toggle-hover: rgb(91 115 210 / 0.69);
    --scrim: rgb(0 0 0 / 0.35);
    --font-family: "Inter", system-ui, sans-serif;
    --font-family-serif: "PT Serif", Georgia, serif;
    --radius: 0.5rem;
    --gutter: 1rem;
    --max-width: 72rem;

    /* Maquetación: alto de la cabecera (55 px hasta 1020 px de ancho) y
       capas. Los cortes son fijos: 500 (menú), 600 (textos), 700 (columna
       central de 600 px), 1020 (rail y búsqueda), 1280 (menú ancho). */
    --header-height: 55px;
    --z-tabs: 500;
    --z-header: 1000;
    --z-drawer: 1100;
    --z-menu: 1700;
}

@media (min-width: 1020px) {
    :root {
        --header-height: 70px;
    }
}

:root[data-theme="dark"] {
    --bg-app: rgb(2 6 23);
    --bg-surface: rgb(30 41 59);
    --bg-hover: rgb(255 255 255 / 0.05);
    --text-primary: rgb(255 255 255);
    --text-secondary: rgb(148 163 184);
    --text-tertiary: rgb(71 85 105);
    --border-color: rgb(51 65 85);
    --color-accent: rgb(96 165 250);
    --danger: rgb(248 113 113);
    --shadow-level-1: 0 1px 0 rgb(255 255 255 / 0.05);
    --logo-text: rgb(255 255 255);
    --logo-shape: rgb(96 165 250);
    --logo-fill: rgb(30 41 59);
    --rail-header: #2e3f61;
    --rail-header-text: #fff;
    --title-navy: #fff;
    --name-blue: #93a5f5;
    color-scheme: dark;
}

:root[data-theme="light"] {
    color-scheme: light;
}

/* ------------------------------------------------------------------
   Base
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg-app);
    color: var(--text-primary);
    font: 1rem/1.5 var(--font-family);
}

a {
    color: var(--color-accent);
}

:focus-visible {
    outline: none;
    box-shadow: var(--shadow-focus);
    border-radius: 0.25rem;
}

button {
    font: inherit;
    color: inherit;
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Íconos: data-icon="nombre" los dibuja antes del contenido. */
[data-icon]::before {
    content: attr(data-icon);
    font-family: "Lexivox Symbols";
    font-weight: 250;
    font-style: normal;
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    display: inline-block;
    vertical-align: middle;
    font-feature-settings: "liga";
}

/* Insignias: avisos sin leer, «Nuevo», «Pro». */
[data-badge] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    padding: 0.2rem 0.3rem;
    border-radius: 0.35rem;
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1;
    background: #22a55b;
    color: #fff;
}

[data-badge="notification"] {
    background: #2525c4;
}

[data-badge="new"] {
    background: #ffee58;
    color: #000;
}

[data-badge="pro"] {
    background: #9c27b0;
}

/* Botón de solo ícono (cabecera). */
.icon-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0.5rem;
    border: none;
    border-radius: 2rem;
    background: none;
    color: var(--text-secondary);
    text-decoration: none;

    &:hover {
        color: var(--color-accent);
        background: var(--bg-hover);
    }

    & [data-badge] {
        position: absolute;
        top: 0;
        right: 0;
        pointer-events: none;
    }
}

/* ------------------------------------------------------------------
   Cabecera: menú (teléfono), logo, búsqueda y acciones.
   ------------------------------------------------------------------ */
.site-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    display: flex;
    align-items: center;
    gap: 1rem;
    height: var(--header-height);
    padding: 0.5rem;
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-level-1);

    @media (max-width: 319px) {
        gap: 0.25rem;

        & .icon-button {
            padding: 0.25rem;
        }
    }
}

.brand {
    flex-shrink: 0;
    line-height: 0;

    & svg {
        display: block;
        width: 60px;
        height: 20px;

        @media (min-width: 320px) {
            width: 80px;
            height: 28px;
        }

        @media (min-width: 600px) {
            width: 120px;
            height: 40px;
        }
    }
}

.header-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.login {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.9rem 0.5rem 0.6rem;
    border-radius: 2rem;
    background: var(--button-login-color);
    color: #fff;
    font-size: 0.8125rem;
    text-decoration: none;

    &:hover {
        opacity: 0.9;
    }

    & .wide {
        display: none;
    }

    @media (max-width: 599px) {
        gap: 0.2rem;
        font-size: 12px;
    }

    @media (min-width: 600px) {
        & .wide {
            display: inline;
        }

        & .narrow {
            display: none;
        }
    }
}

/* Solo en el teléfono: el botón del menú (bajo 500 px). */
.menu-toggle {
    @media (min-width: 500px) {
        display: none;
    }
}

.fullscreen {
    @media (max-width: 599px) {
        display: none;
    }
}

:root[data-theme="dark"] .theme::before {
    content: "light_mode";
}

:fullscreen .fullscreen::before {
    content: "fullscreen_exit";
}

/* La búsqueda: en la cabecera desde 1020 px; antes, se abre sobre ella. */
.search {
    display: none;
    flex: 1;
    min-width: 0;
    margin: 0;

    & input,
    & select {
        border: none;
        background: transparent;
        color: var(--text-primary);
        outline: none;
        box-shadow: none;
        padding: 0;
    }

    & input {
        flex: 1;
        min-width: 60px;
        height: 100%;
        font-size: 0.9375rem;
    }

    & .icon-button {
        color: var(--text-tertiary);
    }

    & .search-clear::before,
    & .search-filters-toggle::before {
        font-size: 1.1rem;
    }

    & select {
        min-width: 110px;
        max-width: 150px;
        height: 100%;
        padding: 0 16px 0 4px;
        color: var(--text-secondary);
        font-size: 0.875rem;
        text-overflow: ellipsis;
        cursor: pointer;
    }
}

.search-field {
    display: flex;
    align-items: center;
}

@media (min-width: 1020px) {
    .search {
        display: flex;
        align-items: center;
        gap: 8px;
        height: 40px;
        padding: 2px 4px 2px 12px;
        background: var(--bg-app);
        border: 1px solid var(--border-color);
        border-radius: 40px;

        &:focus-within {
            border-color: var(--color-accent);
            background: var(--bg-surface);
            box-shadow: var(--shadow-focus);
        }
    }

    .search-field {
        display: contents;
    }

    .search-close,
    .search-filters-toggle,
    .search-open {
        display: none;
    }

    .search-filters {
        display: flex;
        align-items: center;
        height: 100%;

        & select {
            border-left: 1px solid var(--border-color);
            border-radius: 0;
            padding-left: 8px;
        }
    }
}

@media (max-width: 1019px) {
    :root.search-open .search {
        position: absolute;
        inset: 0 0 auto;
        z-index: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
        min-height: var(--header-height);
        padding: 0.5rem;
        background: var(--bg-surface);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 12px rgb(0 0 0 / 0.08);
        animation: fade-in 0.2s ease-out;
    }

    .search-field {
        height: 40px;
        padding: 2px 4px 2px 0;
        border: 1px solid var(--border-color);
        border-radius: 40px;
    }

    .search-close {
        color: var(--text-secondary) !important;
    }

    .search-filters {
        display: none;
        gap: 6px;

        & select {
            flex: 1;
            max-width: none;
            height: 36px;
            padding: 0 8px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background: var(--bg-app);
        }
    }

    .search.show-filters .search-filters {
        display: flex;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ------------------------------------------------------------------
   Columnas: menú | columna central (600 px) | rail.
   ------------------------------------------------------------------ */
.layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    margin: 0 auto;

    @media (min-width: 500px) {
        gap: 0.5rem;
        padding-top: 8px;
    }

    @media (min-width: 700px) {
        gap: 16px;
    }
}

/* El menú: cajón en el teléfono, íconos desde 500 px, con textos desde
   1280 px. */
.menu {
    position: fixed;
    top: 0;
    left: -250px;
    z-index: var(--z-menu);
    width: 250px;
    height: 100%;
    padding-top: 1rem;
    overflow-y: auto;
    background: var(--bg-surface);
    transition: left 0.3s ease;

    :root.menu-open & {
        left: 0;
    }

    @media (min-width: 500px) {
        position: sticky;
        top: calc(var(--header-height) + 8px);
        left: auto;
        z-index: auto;
        flex-shrink: 0;
        width: 68px;
        height: auto;
        max-height: calc(100vh - var(--header-height) - 8px);
        padding-top: 0;
        background: none;
        transition: none;
    }

    @media (min-width: 1008px) {
        width: 88px;
    }

    @media (min-width: 1280px) {
        width: 275px;
    }

    & ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    & h2 {
        margin: 0.5rem 0;
        padding-left: 0.75rem;
        font-size: 0.75rem;
        font-weight: 700;
        line-height: 1rem;
        text-transform: uppercase;
        color: var(--text-tertiary);
    }

    & a,
    & button {
        position: relative;
        display: flex;
        align-items: center;
        gap: 0.75rem;
        width: 100%;
        min-height: 36px;
        padding: 0 0 0 0.75rem;
        border: none;
        border-radius: 0.375rem;
        background: none;
        color: var(--text-secondary);
        font-size: 0.875rem;
        line-height: 1.25rem;
        text-align: left;
        text-decoration: none;
        transition: color 0.2s, background-color 0.2s;

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }

        &[aria-current] {
            color: var(--color-accent);
            background: var(--bg-hover);
        }

        & > span:first-child {
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
        }

        & [data-badge] {
            margin-left: auto;
            margin-right: 0.75rem;
        }
    }
}

.menu-group {
    margin: 0 0 0.5rem;
    padding: 0.5rem;

    @media (min-width: 500px) {
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 0.5rem;
        box-shadow: var(--shadow-level-1);
    }
}

/* Entre 500 y 1280 px, solo los íconos. */
@media (min-width: 500px) and (max-width: 1279px) {
    .menu {
        & h2 {
            display: none;
        }

        & a,
        & button {
            justify-content: center;
            padding: 0;
        }

        & a > span:first-child,
        & button > span {
            display: none;
        }

        & [data-badge] {
            position: absolute;
            top: 4px;
            right: 4px;
            margin: 0;
            padding: 3px 2px;
            font-size: 0.4rem;
        }
    }
}

/* La columna central. */
.center {
    flex: 1 1 100%;
    min-width: 0;

    @media (min-width: 500px) {
        flex: 1 1 0;
    }

    @media (min-width: 700px) {
        flex: 0 0 600px;
        max-width: 600px;
    }

    & > main {
        padding: 0 0.5rem 1rem;

        @media (min-width: 500px) {
            padding-inline: 0;
        }
    }
}

/* Las pestañas: secciones del sitio sobre la columna central. */
.tabs {
    position: sticky;
    top: var(--header-height);
    z-index: var(--z-tabs);
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-top: none;

    @media (min-width: 500px) {
        border-top: 1px solid var(--border-color);
    }

    & > a,
    & summary {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        padding: 0.6rem 0.5rem;
        color: var(--text-secondary);
        font-size: 0.8rem;
        font-weight: 500;
        line-height: 1rem;
        letter-spacing: 0.025em;
        text-transform: uppercase;
        text-decoration: none;
        cursor: pointer;

        &::before {
            font-weight: 200;
        }

        &:hover {
            color: var(--text-primary);
            background: var(--bg-hover);
        }

        & span {
            @media (max-width: 599px) {
                display: none;
            }
        }
    }

    & > a[aria-current],
    & details[data-active] summary,
    & details[open] summary {
        color: var(--color-accent);
        background: transparent;
    }
}

.tabs-more {
    position: relative;
    flex: 1 1 0;
    display: flex;

    & summary {
        list-style: none;

        &::-webkit-details-marker {
            display: none;
        }
    }
}

.tabs-more-list {
    position: absolute;
    top: calc(100% + 1px);
    right: 0;
    display: flex;
    flex-direction: column;
    width: 220px;
    padding: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0 0 0.75rem 0.75rem;
    box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    animation: fade-in 0.2s ease-out;

    & a {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1.25rem;
        border-radius: 0.375rem;
        color: var(--text-secondary);
        font-size: 0.9rem;
        text-decoration: none;

        &::before {
            font-size: 1.25rem;
        }

        &:hover,
        &[aria-current] {
            background: var(--bg-hover);
            color: var(--text-primary);
        }
    }
}

/* El rail: cajón a la derecha hasta 1020 px; después, tercera columna. */
.rail {
    position: fixed;
    top: var(--header-height);
    right: 0;
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 310px;
    height: calc(100vh - var(--header-height) - 8px);
    padding: 1rem 0.5rem;
    overflow-y: auto;
    background: var(--bg-surface);
    transform: translateX(100%);
    transition: transform 0.25s ease;

    :root.rail-open & {
        transform: none;
    }

    @media (max-width: 330px) {
        width: 260px;
    }

    @media (min-width: 1020px) {
        position: sticky;
        top: calc(var(--header-height) + 8px);
        z-index: auto;
        flex-shrink: 0;
        height: auto;
        max-height: calc(100vh - var(--header-height) - 8px);
        padding: 0;
        background: none;
        transform: none;
        transition: none;
    }
}

.rail-toggle {
    position: fixed;
    top: 30%;
    right: -0.8rem;
    z-index: 50;
    width: 45px;
    height: 60px;
    padding: 0 0.8rem 0 0;
    border: none;
    border-radius: 50% 0 0 50%;
    background: var(--rail-toggle);
    color: #fff;

    &:hover {
        background: var(--rail-toggle-hover);
    }

    @media (min-width: 1020px) {
        display: none;
    }
}

/* Fondo de los cajones abiertos (un toque lo cierra). */
.scrim {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-drawer) - 1);
    background: var(--scrim);

    :root.menu-open & {
        z-index: calc(var(--z-menu) - 1);
    }
}

/* Las tarjetas del rail: título en banda y cuerpo. */
.rail-card {
    flex-shrink: 0;
    padding: 0 0 1.2rem;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-level-1);
    font-size: 0.9rem;

    & > h2 {
        margin: 0 0 0.6rem;
        padding: 0.75rem 1.25rem;
        background: var(--rail-header);
        border-bottom: 1px solid var(--border-color);
        color: var(--rail-header-text);
        font-size: 18px;
        font-weight: 400;
        line-height: 1.4;
    }

    & > :not(h2) {
        margin-inline: 1.2rem;
    }

    & h3 {
        margin-block: 0 0.25rem;
        font-family: var(--font-family-serif);
        font-size: 0.95rem;
    }

    & p {
        margin-block: 0.25rem;
    }
}

.rail-ad {
    padding: 0;

    & img {
        display: block;
        width: 100%;
        height: auto;
    }
}

.pill-body {
    font-family: var(--font-family-serif);
}

.pill-attribution {
    color: var(--text-secondary);
    font-variant: small-caps;
    text-align: right;
}

.rail-ranking:has(ol:empty) {
    display: none;
}

.rail-ranking ol {
    padding-left: 1.25rem;
}

.rail-poll {
    & ul {
        display: grid;
        gap: 0.4rem;
        padding: 0;
        list-style: none;
    }

    & li {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    & button {
        width: 100%;
        padding: 0.4rem 0.6rem;
        border: 1px solid var(--border-color);
        border-radius: var(--radius);
        background: var(--bg-app);
        color: var(--text-primary);
        text-align: left;
    }

    & .poll-result {
        min-width: 3rem;
        text-align: right;
        font-weight: 600;
    }
}

/* Los resultados, solo después de votar (los booleanos de la plantilla son «1» o vacío). */
.rail-poll[data-voted=""] .poll-result {
    display: none;
}

.site-footer {
    padding: 1rem var(--gutter);
    color: var(--text-secondary);
    text-align: center;
}

/* Páginas sin columnas: el ingreso del núcleo y el administrador. */
.page {
    display: flex;
    gap: var(--gutter);
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--gutter);

    & > main {
        flex: 1;
        min-width: 0;
    }
}

/* Menú del administrador (App::admin_layout). */
.admin-menu {
    flex: 0 0 14rem;
    font-size: 0.9rem;

    & h2 {
        margin: 1rem 0 0.25rem;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-secondary);
    }

    & ul {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    & a {
        display: block;
        padding: 0.25rem 0.5rem;
        border-radius: var(--radius);
        color: var(--text-primary);
        text-decoration: none;
    }

    & a:hover {
        background: var(--bg-hover);
    }

    & a[aria-current="page"] {
        background: var(--color-accent);
        color: var(--button-text-color);
    }
}

@media (max-width: 48rem) {
    .page {
        flex-direction: column;
    }

    .admin-menu {
        flex-basis: auto;
    }
}

/* ------------------------------------------------------------------
   Contenido
   ------------------------------------------------------------------ */
/* Controles de formulario. */
input,
select,
textarea {
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
}

.btn-primary {
    display: inline-block;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius);
    background: var(--color-accent);
    color: var(--button-text-color);
    font-weight: 600;
}

.btn-secondary {
    display: block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-align: center;
    text-decoration: none;
}

/* Ingreso del núcleo (/admin/login, /admin/forgot, /admin/reset). */
.wsf-auth {
    display: grid;
    place-items: center;
    padding-block: 2rem;
}

.wsf-auth-card {
    display: grid;
    gap: 1rem;
    width: min(100%, 24rem);
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-level-1);

    & h1 {
        margin: 0;
        font-size: 1.5rem;
    }

    & .card-desc {
        margin: 0.25rem 0 0;
        color: var(--text-secondary);
    }

    & label {
        display: grid;
        gap: 0.25rem;
        font-weight: 500;
    }

    & output {
        color: var(--danger);
    }
}

/* Tarjetas de recursos (portada, listas, búsqueda). */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
    gap: var(--gutter);
    margin: 0;
    padding: 0;
    list-style: none;
}

.card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);

    & img {
        width: calc(100% + 2rem);
        height: auto;
        aspect-ratio: 16 / 9;
        object-fit: cover;
        margin: -1rem -1rem 0;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    & h3 {
        margin: 0;
        font-size: 1.05rem;
        line-height: 1.3;
    }

    & h3 a {
        color: var(--text-primary);
        text-decoration: none;
    }

    & h3 a:hover {
        color: var(--color-accent);
    }
}

.card-meta,
.resource-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.card-summary {
    margin: 0;
    color: var(--text-secondary);
    font-family: var(--font-family-serif);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.chip {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--chip, var(--color-accent)) 15%, transparent);
    color: var(--text-primary);
    border: 1px solid color-mix(in srgb, var(--chip, var(--color-accent)) 50%, transparent);
    text-decoration: none;
}

.type {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* El feed: portada, listas y búsqueda (el diseño de Lexivox). Cada
   recurso: avatar | encabezado, descripción, imagen, datos propios,
   hashtags y la barra de acciones. Toda la tarjeta lleva al recurso. */
.feed {
    @media (max-width: 499px) {
        margin-inline: -0.5rem;
    }
}

.feed-item {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    margin: 0.5rem 0;
    padding: 1rem 1rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    font-size: 11pt;
    transition: border-color 0.2s;

    &:hover {
        border-color: var(--text-tertiary);
    }

    & header {
        display: grid;
        gap: 0.1rem;
    }

    & h2 {
        margin: 0;
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.35;

        & a {
            color: var(--text-primary);
            text-decoration: none;

            /* Toda la tarjeta es el enlace; las acciones quedan encima. */
            &::after {
                content: "";
                position: absolute;
                inset: 0;
                border-radius: inherit;
            }
        }
    }

    & time {
        display: flex;
        align-items: center;
        gap: 0.2rem;
        color: var(--text-secondary);
        font-size: small;

        &::before {
            font-size: 1.25rem;
        }
    }
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--avatar, var(--text-secondary));
    color: #fff;
    font-size: 16px;
    object-fit: cover;

    &::before {
        font-size: 1.5rem;
    }
}

img.avatar {
    border-radius: 0.5rem;
    background: none;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.feed-body {
    display: grid;
    gap: 0.25rem;
    min-width: 0;

    & .meta {
        display: flex;
        align-items: center;
        gap: 0.25rem;
        margin: 0;
        color: var(--text-tertiary);
        font-size: 10pt;

        &::before {
            font-size: 18pt;
        }

        & em {
            margin-left: auto;
            font-style: normal;
        }
    }

    & .description {
        display: -webkit-box;
        margin: 0;
        overflow: hidden;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
    }

    & .image {
        display: block;
        max-width: 100%;
        max-height: 250px;
        margin: 0.5rem auto;
        border-radius: 0.5rem;
    }
}

.details {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 0.3rem 16px;
    align-content: start;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;

    & dt {
        display: flex;
        align-items: center;
        gap: 0.15rem;
        color: var(--text-tertiary);
        font-size: small;
        font-weight: 600;
        white-space: nowrap;

        &::before {
            font-size: 1.25rem;
        }
    }

    & dd {
        margin: 0;
    }

    & .abrogated {
        color: var(--danger);
        font-weight: 600;
    }
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin: 0;
    padding: 0;
    list-style: none;

    &:empty {
        display: none;
    }

    & a {
        position: relative;
        color: var(--color-accent);
        font-size: 0.875rem;
        font-weight: 600;
        text-decoration: none;

        &:hover {
            text-decoration: underline;
        }
    }
}

/* Barra de acciones: me gusta, no me gusta, comentarios | guardar, compartir. */
.actions {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;

    & .stats,
    & .utilities {
        display: flex;
        align-items: center;
        gap: 1rem;

        @media (max-width: 600px) {
            gap: 0;
        }
    }

    & .utilities {
        gap: 0.5rem;
    }

    & button,
    & a {
        display: flex;
        align-items: center;
        gap: 0.375rem;
        padding: 0.5rem;
        border: none;
        border-radius: 0.5rem;
        background: none;
        color: var(--text-secondary);
        font-weight: 300;
        text-decoration: none;
        transition: color 0.2s, background-color 0.2s;

        &:hover {
            background: var(--bg-hover);
        }

        &::before {
            font-size: 1.25rem;
        }

        & span {
            font-size: 0.75rem;

            @media (max-width: 600px) {
                font-size: 10px;
            }
        }
    }

    & [aria-pressed="true"] {
        color: var(--color-accent);
        font-weight: 700;

        &::before {
            font-variation-settings: "FILL" 1;
        }
    }
}

.feed-empty {
    padding: 2rem 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.list-header {
    margin: 0.5rem 0;
    padding: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;

    & h2 {
        margin: 0;
        font-size: 1.25rem;
    }

    & p {
        margin: 0.25rem 0 0;
        color: var(--text-secondary);
    }
}

/* Con el scroll infinito, la paginación solo se ve sin Wasm. */
.pager {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;

    :root[data-lx-ready] &[data-lx-more] {
        visibility: hidden;
        height: 1px;
        margin: 0;
    }
}

/* Un recurso. */
.resource {
    max-width: 46rem;
    margin: 0 auto;

    & h1 {
        font-size: clamp(1.6rem, 4vw, 2.25rem);
        line-height: 1.2;
        margin: 0.5rem 0;
    }
}

.resource-summary {
    font-family: var(--font-family-serif);
    font-size: 1.15rem;
    color: var(--text-secondary);
}

.resource-authors:empty,
.hashtags:empty {
    display: none;
}

.resource-authors span + span::before {
    content: " · ";
}

.resource-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
}

.resource-body {
    font-family: var(--font-family-serif);
    font-size: 1.1rem;
    line-height: 1.7;

    & blockquote {
        margin: 1rem 0;
        padding-left: 1rem;
        border-left: 3px solid var(--border-color);
        color: var(--text-secondary);
    }
}

.resource-data {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.25rem 1rem;

    & dt {
        color: var(--text-secondary);
    }

    & dd {
        margin: 0;
    }
}

.hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0;
    list-style: none;
}

/* Lo social de un recurso. */
.social {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.social-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    & button {
        padding: 0.4rem 0.9rem;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: var(--bg-surface);
        color: var(--text-primary);
    }
}

/* La reacción y el guardado vigentes (los pone el servidor y el Wasm). */
.social-bar[data-reaction="1"] [data-lx-react="1"],
.social-bar[data-reaction="-1"] [data-lx-react="-1"],
.social-bar[data-saved="1"] [data-lx-bookmark] {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--button-text-color);
}

.comment-form {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;

    & textarea {
        width: 100%;
        min-width: 0;
    }

    & output:empty {
        display: none;
    }

    & output {
        color: var(--danger);
    }

    & button {
        justify-self: start;
    }
}

.comments,
.replies {
    margin: 0;
    padding: 0;
    list-style: none;
}

.replies {
    margin-left: clamp(1rem, 4vw, 2.5rem);
    border-left: 2px solid var(--border-color);
    padding-left: 0.75rem;
}

.comment {
    padding: 0.75rem 0;
}

.comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);

    & img {
        border-radius: 50%;
    }

    & strong {
        color: var(--text-primary);
    }
}

.comment-body {
    font-family: var(--font-family-serif);
    overflow-wrap: anywhere;
}

.comment-deleted {
    color: var(--text-secondary);
    font-style: italic;
}

.comment-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;

    & button,
    & summary {
        border: none;
        background: none;
        color: var(--text-secondary);
        cursor: pointer;
        padding: 0.1rem 0.3rem;
    }
}

.comment[data-my-vote="1"] > .comment-actions [data-lx-vote="1"],
.comment[data-my-vote="-1"] > .comment-actions [data-lx-vote="-1"] {
    color: var(--color-accent);
    font-weight: 700;
}

.comment-report form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.comment-reply summary {
    color: var(--color-accent);
    cursor: pointer;
    font-size: 0.85rem;
}

/* Orden de las listas: el vigente, marcado. */
.orders {
    display: flex;
    gap: 0.25rem;
    margin: 0.5rem 0 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;

    & a {
        padding: 0.25rem 0.75rem;
        border-radius: 2rem;
        color: var(--text-secondary);
        font-size: 0.8125rem;
        text-decoration: none;

        &:hover {
            background: var(--bg-hover);
        }
    }
}

.orders[data-order="latest"] [data-order="latest"],
.orders[data-order="popular"] [data-order="popular"],
.orders[data-order="commented"] [data-order="commented"],
.orders[data-order="controversial"] [data-order="controversial"] {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--color-accent);
    font-weight: 600;
}

.follow,
[data-lx-follow] {
    font-size: 0.8rem;
    padding: 0.1rem 0.6rem;
    border: 1px solid var(--color-accent);
    border-radius: 999px;
    background: none;
    color: var(--color-accent);
}

.account-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 1rem;
}

.notifications {
    padding: 0;
    list-style: none;

    & li {
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    & li[data-read=""] {
        font-weight: 600;
    }

    & time {
        color: var(--text-secondary);
        margin-right: 0.5rem;
    }
}

.notification [data-kind="comment_hidden"]::before { content: "Tu comentario quedó oculto por denuncias "; }
.notification [data-kind="comment_restored"]::before { content: "Tu comentario volvió a publicarse "; }
.notification [data-kind="new_resource"]::before { content: "Nueva publicación de lo que sigues "; }

/* Directorio jurídico (el del prototipo): una tarjeta en la columna central
   con la ruta, el título y cada paso (departamentos, ciudades,
   especialidades, profesionales); el perfil con su barra lateral. */
.dj {
    position: relative;
    margin: 0.5rem 0;
    padding: 1.5rem 2rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-level-1);

    @media (max-width: 499px) {
        margin-inline: -0.5rem;
        padding: 1rem;
    }
}

.dj-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 3rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.025em;
    white-space: nowrap;
    overflow: hidden;

    & a {
        display: inline-flex;
        align-items: center;
        gap: 0.15rem;
        min-width: 0;
        max-width: 220px;
        overflow: hidden;
        color: var(--text-secondary);
        text-overflow: ellipsis;
        text-decoration: none;

        &:hover,
        &[aria-current] {
            color: var(--color-accent);
        }

        &::before {
            font-size: 1.4rem;
        }
    }

    & a + a::before {
        content: "chevron_right";
        margin-right: 0.35rem;
        color: var(--text-secondary);
        font-family: "Lexivox Symbols";
        font-size: 16px;
    }
}

.dj-close {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgb(0 0 0 / 0.1);
    color: rgb(0 0 0 / 0.8);
    text-decoration: none;

    :root[data-theme="dark"] & {
        background: rgb(255 255 255 / 0.1);
        color: var(--text-primary);
    }
}

.dj-header {
    margin: 1rem 0 0.25rem;
    text-align: center;

    & h1 {
        margin: 0;
        color: var(--title-navy);
        font-size: 1.875rem;
        font-weight: 800;
        letter-spacing: -0.025em;
    }

    & p {
        margin: 0.25rem 0 0;
        color: var(--text-secondary);
        font-size: 1.125rem;
    }
}

.dj-label {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

.dj-search {
    display: flex;
    align-items: center;
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;

    &:focus-within {
        border-color: var(--color-accent);
        box-shadow: var(--shadow-focus);
    }

    & input {
        flex: 1;
        min-width: 0;
        padding: 0.65rem 1rem;
        border: none;
        background: transparent;
        outline: none;
        box-shadow: none;
    }

    & button {
        padding: 0.5rem 0.75rem;
        border: none;
        background: none;
        color: var(--text-tertiary);
    }
}

/* Departamentos y ciudades. */
.dj-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;

    & a {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0.25rem;
        padding: 1rem 1.5rem;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        border-radius: 1rem;
        box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
        color: var(--text-primary);
        text-decoration: none;
        transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;

        &:hover {
            border-color: color-mix(in srgb, var(--color-primary) 20%, transparent);
            box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
            transform: translateY(-2px);

            & strong {
                color: var(--color-primary);
            }
        }
    }

    & strong {
        font-size: 1.125rem;
    }

    & span {
        color: var(--text-tertiary);
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.1em;
        text-transform: uppercase;
    }
}

/* Especialidades de una ciudad. */
.dj-specialties {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 0 0 1.5rem;
    padding: 0;
    list-style: none;
}

.dj-specialty {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);

    &:hover {
        border-color: var(--color-primary);

        & h2 {
            color: var(--color-primary);
        }
    }

    & header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
    }

    & h2 {
        margin: 0;
        font-family: var(--font-family-serif);
        font-size: 1.5rem;
        letter-spacing: -0.025em;
    }

    & > p {
        display: -webkit-box;
        margin: 0;
        overflow: hidden;
        color: var(--text-secondary);
        font-size: 0.875rem;
        font-weight: 300;
        line-height: 1.625;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    & .dj-button {
        align-self: center;
        padding: 0.75rem 2.5rem;
    }
}

.dj-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    color: var(--text-tertiary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;

    & strong {
        color: var(--color-primary);
        font-size: 1.5rem;
        font-weight: 900;
        line-height: 1;
        margin-bottom: 0.25rem;
    }
}

.dj-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;

    &:empty {
        display: none;
    }

    & li {
        padding: 0.25rem 0.75rem;
        background: var(--bg-app);
        border: 1px solid var(--border-color);
        border-radius: 2rem;
        color: var(--text-secondary);
        font-size: 10px;
        font-weight: 600;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }
}

.dj-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 0.75rem;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;

    &:hover {
        background: color-mix(in srgb, var(--color-primary) 80%, transparent);
    }
}

.dj-empty {
    padding: 1.5rem 0;
    color: var(--text-secondary);
    text-align: center;
}

.dj-empty-line {
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 300;
}

.dj-join {
    margin: 1.5rem 0 0;
    text-align: center;

    & a {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        color: var(--color-accent);
        font-size: 0.875rem;
        font-weight: 600;
        text-decoration: none;

        &::before {
            font-size: 1.25rem;
        }
    }
}

/* Estrellas de una valoración: cinco en contorno y, encima, las rellenas
   hasta --rating (de 0 a 5). */
.stars {
    position: relative;
    display: inline-block;
    font-family: "Lexivox Symbols";
    font-size: 1.25rem;
    line-height: 1;
    vertical-align: middle;
    white-space: nowrap;

    &::before {
        content: "starstarstarstarstar";
        color: var(--text-tertiary);
    }

    &::after {
        content: "starstarstarstarstar";
        position: absolute;
        inset: 0 auto 0 0;
        width: calc(var(--rating, 0) / 5 * 100%);
        overflow: hidden;
        color: var(--gold);
        font-variation-settings: "FILL" 1;
    }
}

/* Profesionales: tarjetas con foto, en dos columnas desde 700 px. */
.dj-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 1rem 0 0.75rem;
    padding: 0;
    list-style: none;

    @media (min-width: 700px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.dj-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    &:hover {
        border-color: var(--color-primary);
        box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    }

    & h2 {
        margin: 0;
        font-family: var(--font-family-serif);
        font-size: 1.125rem;
        font-weight: 500;

        & a {
            color: var(--name-blue);
            text-decoration: none;

            &::after {
                content: "";
                position: absolute;
                inset: 0;
            }
        }
    }
}

.dj-card-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 1;
    flex-direction: column;
    border-radius: 0.75rem;
    background: var(--bg-surface);
}

.dj-card-image {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 11;
    margin-bottom: 0.25rem;
    overflow: hidden;
    border-radius: 0.75rem 0.75rem 0 0;
    background: var(--bg-app);
    color: var(--text-tertiary);

    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    & > span[aria-hidden]::before {
        font-size: 4rem;
    }
}

.dj-badge-location {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 2rem;
    background: rgb(241 245 249);
    color: rgb(15 23 42);
    font-size: 10px;
    font-weight: 600;

    &::before {
        font-size: 0.9rem;
    }
}

.dj-badge-type {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background: rgb(233 193 118 / 0.9);
    color: rgb(15 23 42);
    font-size: 10px;
    font-weight: 600;
}

.dj-card-content {
    display: grid;
    gap: 0.15rem;
    padding: 0 0.75rem;
}

.dj-rating {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin: 0;
    font-size: 0.75rem;

    & strong {
        font-weight: 600;
    }
}

.dj-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 2rem;
    margin: 0;
}

.dj-save {
    position: relative;
    z-index: 1;
    margin-left: auto;
    padding: 0;
    border: none;
    background: none;
    color: var(--text-secondary);

    &::before {
        font-size: 2rem;
    }

    &[data-saved="1"],
    &[data-saved="true"] {
        color: #c9a227;

        &::before {
            content: "bookmark_added";
            font-variation-settings: "FILL" 1;
        }
    }
}

/* «¿Eres abogado?»: la segunda tarjeta de la lista. */
.dj-cards > li:first-child {
    order: 1;
}

.dj-cards > li {
    order: 3;
}

.dj-cards > .dj-card-join {
    order: 2;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-app);
    text-align: center;

    & > span::before {
        color: var(--color-primary);
        font-size: 1.75rem;
    }

    & h2 {
        max-width: 200px;
        font-weight: 700;
    }

    & p {
        max-width: 200px;
        margin: 0;
        font-size: 0.75rem;
        opacity: 0.7;
    }

    & .dj-button {
        padding: 0.5rem 1rem;
        border-radius: 0.5rem;
        font-size: 0.75rem;
        font-weight: 700;
    }
}

.dj-card-areas {
    margin: 0 0 0.25rem;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;

    & span + span::before {
        content: ", ";
    }
}

.dj-card-description {
    margin: 0 0 0.5rem;
    font-size: 11px;
    font-weight: 300;
    line-height: 1.625;
}

.dj-card-footer {
    margin-top: auto;
    padding: 0 0.75rem 0.5rem;

    & .dj-button {
        position: relative;
        z-index: 1;
        width: 100%;
        margin-bottom: 0.25rem;
        border-radius: 0.5rem;
    }
}

/* Personalizaciones compradas en sales (los booleanos: «1» o vacío). */
.dj-card[data-border="1"] {
    padding: 0.18rem;
    border: none;

    &::before {
        content: "";
        position: absolute;
        inset: -100%;
        background: conic-gradient(#ca8a04 0deg, #eab308 60deg, #1d4ed8 120deg, #1e3a8a 180deg, var(--color-primary) 240deg, #1e3a8a 300deg, #ca8a04 360deg);
        animation: spin 15s linear infinite;
    }
}

.dj-card[data-button="1"] .dj-card-footer .dj-button {
    overflow: hidden;
    background: #003f8f;

    &::before {
        content: "";
        position: absolute;
        top: 0;
        left: -150px;
        width: 100px;
        height: 100%;
        background: rgb(255 255 255 / 0.25);
        transform: skewX(35deg);
        animation: shine 5s linear infinite;
        pointer-events: none;
    }
}

.dj-card[data-background="1"] {
    &,
    & .dj-card-inner {
        background: #003f8f;
    }

    & .dj-rating,
    & .dj-card-areas,
    & .dj-card-description {
        color: #fff;
    }

    & h2 a {
        color: #eab308;
    }

    & .dj-card-footer .dj-button {
        background: #eab308;
        color: rgb(15 23 42);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes shine {
    from {
        left: -150px;
    }

    to {
        left: 120%;
    }
}

/* El perfil: barra lateral (foto, contacto) y contenido. */
.dj-profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    margin-top: 1rem;

    @media (min-width: 700px) {
        grid-template-columns: 180px minmax(0, 1fr);

        [data-organization] & {
            grid-template-columns: minmax(0, 1fr) 220px;
        }
    }
}

.dj-side,
.dj-main {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

[data-organization] .dj-side {
    @media (max-width: 699px) {
        order: -1;
    }

    & .dj-photo {
        margin-top: 1.5rem;
        box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    }
}

.dj-photo {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    width: min(100%, 220px);
    justify-self: center;
    padding: 0.5rem;
    border: 2px solid var(--gold);
    border-radius: 0.125rem;
    color: var(--text-tertiary);

    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border: 2px solid var(--border-color);
        border-radius: 0.125rem;
    }

    & > span::before {
        font-size: 4rem;
    }
}

.dj-panel {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;

    & h2 {
        margin: 0;
        padding-bottom: 0.75rem;
        font-size: 0.8rem;
        font-weight: 600;
        text-transform: uppercase;
    }
}

.dj-contact {
    margin: 0;
    padding: 0;
    list-style: none;

    & li {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 0.5rem;
        padding: 0.25rem 0;
        font-size: 0.75rem;
        font-weight: 300;
        overflow-wrap: anywhere;

        &::before {
            grid-row: span 2;
            color: var(--gold);
            font-size: 1rem;
        }

        & span {
            font-weight: 500;
            text-transform: uppercase;
        }

        & a {
            color: inherit;
        }
    }
}

.dj-contact-grid {
    display: grid;
    gap: 0 0.25rem;

    @media (min-width: 700px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.dj-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.5rem 0 0.4rem;
    padding: 0.5rem 1.25rem;
    border-radius: 0.5rem;
    background: #25d366;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
}

.dj-profile-header {
    padding: 0.5rem 0;

    & h1 {
        margin: 0;
        padding-bottom: 0.25rem;
        color: var(--rail-header-text);
        font-family: var(--font-family-serif);
        font-size: 2rem;

        [data-organization] & {
            font-size: 1.5rem;
            letter-spacing: 0;
        }
        font-weight: 700;
        letter-spacing: -0.05em;
        line-height: 1;
    }
}

.dj-profile-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    margin: 0 0 0.5rem;
}

.dj-kind {
    padding: 0.25rem 0.5rem;
    border-radius: 2rem;
    background: var(--border-color);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.dj-profile-top .dj-rating .stars {
    font-size: 0.875rem;
}

.dj-reviews {
    color: var(--text-secondary);
}

.dj-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0.375rem 0;

    & img {
        width: 1.5rem;
        height: 1.5rem;
        border-radius: 0.25rem;
    }

    &:empty {
        display: none;
    }

    & a {
        color: var(--color-accent);
        font-size: 0.8rem;
    }
}

.dj-summary {
    margin: 0 0 0.25rem;
    font-size: 0.8rem;
    line-height: 1.6;

    & p {
        margin: 0 0 0.5rem;
    }
}

.dj-details {
    display: flex;
    gap: 1rem;
}

.dj-details button {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;

    &::before {
        font-size: 1.25rem;
    }

    &:hover {
        color: var(--color-accent);
    }
}

.dj-details[data-saved="1"] [data-lx-profile-save] {
    color: var(--gold);

    &::before {
        font-variation-settings: "FILL" 1;
    }
}

/* Secciones del perfil: título serif con una línea que llega al borde. */
.dj-section {
    padding: 0.5rem 0;

    & > h2 {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin: 0 0 0.5rem;
        font-family: var(--font-family-serif);
        font-size: 1.2rem;
        font-weight: 600;

        &::after {
            content: "";
            flex: 1;
            height: 1px;
            background: color-mix(in srgb, var(--text-tertiary) 30%, transparent);
        }
    }
}

.dj-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0;

    & a {
        padding: 0.25rem 0.5rem;
        border: 1px solid var(--text-tertiary);
        border-radius: 0.375rem;
        color: inherit;
        font-size: 0.75rem;
        font-weight: 300;
        text-decoration: none;

        &:hover {
            border-color: var(--color-accent);
            color: var(--color-accent);
        }
    }
}

.dj-bio {
    font-size: 0.875rem;
}

.dj-milestones:has(ol:empty),
.profile-organizations:has(ul:empty),
.profile-members:not(:has(li, form)) {
    display: none;
}

.dj-timeline {
    display: grid;
    gap: 1rem;
    margin: 0;
    padding: 0 0 0 1rem;
    border-left: 2px solid var(--border-color);
    list-style: none;

    & li {
        position: relative;
        font-size: 0.75rem;

        &::before {
            content: "";
            position: absolute;
            top: 0.3rem;
            left: -1.35rem;
            width: 0.625rem;
            height: 0.625rem;
            border-radius: 50%;
            background: var(--color-primary);
        }
    }

    & h3 {
        margin: 0;
        font-family: var(--font-family-serif);
        font-size: 1rem;
        font-weight: 500;
    }

    & .dj-timeline-kind {
        margin: 0 0 0.5rem;
    }
}

/* Firmas y comunidades de un abogado: nombre y logo, descripción y botón. */
.dj-orgs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;

    @media (min-width: 700px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    & li {
        display: flex;
        flex-direction: column;
        padding: 0.75rem 0.75rem 0.5rem;
        border: 1px solid var(--border-color);
        border-radius: 0.375rem;
        box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);

        &:hover {
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
        }
    }

    & div {
        display: grid;
        grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }

    & strong {
        color: var(--rail-header-text);
        font-family: var(--font-family-serif);
        font-weight: 500;
    }

    & img {
        justify-self: end;
        width: 4rem;
        height: 4rem;
        border-radius: 0.125rem;
        object-fit: contain;
    }

    & p {
        display: -webkit-box;
        margin: 0 0 0.5rem;
        overflow: hidden;
        font-size: 0.8rem;
        font-weight: 300;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
    }

    & .dj-button {
        margin-top: auto;
        margin-bottom: 0.375rem;
        border-radius: 0.5rem;
    }
}

/* Oficinas de un estudio o comunidad. */
.dj-offices {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;

    & li {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 0.75rem;
        font-size: 0.75rem;

        &::before {
            grid-row: span 2;
            color: var(--color-accent);
        }
    }

    & strong {
        font-family: var(--font-family-serif);
        font-size: 0.95rem;
        font-weight: 400;
    }
}

/* Acción de una sección (unirme, reseñar): botón a la derecha del título;
   el formulario se despliega debajo. */
.dj-section:has(> .dj-action) {
    position: relative;

    & > h2 {
        margin-right: 10rem;
    }
}

.dj-action {
    & summary {
        position: absolute;
        top: 0.5rem;
        right: 0;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        padding: 0.4rem 0.8rem;
        border-radius: 0.5rem;
        background: color-mix(in srgb, var(--text-tertiary) 45%, transparent);
        color: var(--text-primary);
        font-size: 0.8rem;
        list-style: none;
        cursor: pointer;

        &::-webkit-details-marker {
            display: none;
        }

        &::before {
            font-size: 1.1rem;
        }
    }
}

/* Equipo, firmas y comunidades. */
.dj-firms {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;

    @media (min-width: 700px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    & a {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0.75rem;
        align-items: center;
        padding: 0.75rem 0.75rem 0.5rem;

        &:has(img) {
            grid-template-columns: auto minmax(0, 1fr);
        }
        border: 1px solid var(--border-color);
        border-radius: 0.375rem;
        box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
        color: inherit;
        text-decoration: none;

        &:hover {
            box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
        }
    }

    & img {
        grid-row: span 2;
        width: 4rem;
        height: 4rem;
        border-radius: 0.125rem;
        object-fit: cover;
    }

    & strong {
        color: var(--rail-header-text);
        font-family: var(--font-family-serif);
        font-weight: 500;
    }

    & span {
        font-size: 0.8rem;
        font-weight: 300;
    }
}

/* Reseñas: formulario y tarjetas. */
.dj-review-form {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);

    & label {
        display: flex;
        align-items: center;
        gap: 1rem;
        font-size: 0.75rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }

    & .dj-button {
        justify-self: end;
    }
}

.dj-reviews-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;

    @media (min-width: 700px) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.dj-review {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);

    & .stars {
        margin-bottom: 0.5rem;
        font-size: 1rem;
    }

    & footer {
        margin-top: auto;
        padding-top: 0.5rem;
        font-size: 0.75rem;

        & time {
            display: block;
            font-weight: 200;
        }
    }
}

.dj-review-text {
    padding-bottom: 1rem;
    font-size: 0.75rem;
    font-style: italic;
    overflow-wrap: anywhere;
}

.dj-review-author {
    color: var(--rail-header-text);
    font-variant: small-caps;
}

.areas-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
    gap: 0.25rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);

    & label {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        font-weight: 400;
    }

    & input {
        width: auto;
    }
}

.area-lawyers {
    margin-bottom: 1.5rem;
}

.area-lawyers:has(ul:empty) {
    display: none;
}

.member-requests:has(ul:empty) {
    display: none;
}

/* Mi cuenta. */
.account {
    max-width: 36rem;
    margin: 0 auto;
}

.account-form {
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);

    & label {
        display: grid;
        gap: 0.25rem;
        font-weight: 500;
    }

    & input,
    & textarea {
        width: 100%;
        min-width: 0;
    }

    & output:empty {
        display: none;
    }

    & output[data-error] {
        color: var(--danger);
    }

    & .hint {
        margin: -0.5rem 0 0;
        font-size: 0.85rem;
        color: var(--text-secondary);
    }
}

.account-avatar {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;

    & label {
        flex: 1;
        min-width: 0;
    }

    & img {
        border-radius: 50%;
        object-fit: cover;
    }
}

.account-meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.placeholder {
    max-width: 40rem;
    margin: 3rem auto;
    font-family: var(--font-family-serif);

    & h1 {
        font-family: var(--font-family);
    }
}

/* Documentos */

.document-type {
    margin-block: 1.5rem;

    & h2 {
        font-size: 1.15rem;
    }
}

.document-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 0.5rem 1.5rem;
    padding: 0;
    list-style: none;
}

.document {
    max-width: 48rem;
    margin-inline: auto;
}

.document-form {
    & fieldset {
        display: grid;
        gap: 1rem;
        min-width: 0;
        margin: 0;
        padding: 0;
        border: 0;
    }

    & legend {
        margin-block-end: 0.75rem;
        font-weight: 600;
        font-size: 1.05rem;
    }

    & select {
        width: 100%;
        min-width: 0;
    }

    & small {
        color: var(--text-secondary);
        font-weight: 400;
    }

    & .required {
        color: var(--danger);
    }
}

.my-documents li {
    display: grid;
    gap: 0.25rem;
}

.document-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;

    & form {
        margin: 0;
    }
}
