/* Публичный словарь: хаб, словарь направления, буква, слово, подборка.
   Язык оформления — тот же, что у блога и лендинга: белый фон, синий акцент,
   мягкий градиент в шапке раздела, карточки с тонкой рамкой. Одна разметка у
   серверного рендера и у Vue-страницы, поэтому стили — по классам .dict-*.
   Брейкпоинты — как во всём фронте (frontend-layout.md): 767 / 1023 / 1279. */

.dict {
    --dict-accent: #3B82F6;
    --dict-accent-dark: #2563EB;
    --dict-accent-soft: #EFF6FF;
    --dict-accent-line: #DBEAFE;
    --dict-text: #1A202C;
    --dict-text-secondary: #4A5568;
    --dict-muted: #718096;
    --dict-faint: #A0AEC0;
    --dict-border: #E2E8F0;
    --dict-surface: #F8FAFC;
    --dict-bg: #FFFFFF;
    --dict-mark: #FEF3C7;
    --dict-radius: 16px;
    --dict-radius-sm: 10px;
    --dict-shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.08);
    --dict-font-heading: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
    --dict-font-body: 'Inter', system-ui, sans-serif;
    --dict-side: 24px;

    flex: 1;
    background: var(--dict-bg);
    color: var(--dict-text);
    font-family: var(--dict-font-body);
    line-height: 1.55;

    & a { color: var(--dict-accent); text-decoration: none; }
    & ul { list-style: none; margin: 0; padding: 0; }
    & h1, & h2, & h3 { font-family: var(--dict-font-heading); color: var(--dict-text); }
}

.dict-container {
    width: min(1200px, 100% - 2 * var(--dict-side));
    margin: 0 auto;
}

/* ── Шапка раздела ─────────────────────────────────────────────── */

.dict-hero {
    padding: 32px 0 48px;
    background: linear-gradient(180deg, var(--dict-accent-soft) 0%, var(--dict-bg) 100%);
}

.dict-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 28px;
    font-size: 14px;

    & a { color: var(--dict-accent); }
    & .dict-crumbs__sep { color: var(--dict-faint); }
}

.dict-hero__head {
    display: flex;
    align-items: center;
    gap: 28px;
}

.dict-hero__title {
    margin: 0 0 12px;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.dict-hero__lead {
    max-width: 720px;
    margin: 0;
    font-size: 18px;
    color: var(--dict-text-secondary);
}

/* Плитка с буквой: заменяет картинку, которой нет, и отмечает букву раздела. */
.dict-tile {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #BFDBFE 0%, #60A5FA 100%);
    color: #FFFFFF;
    font-family: var(--dict-font-heading);
    font-size: 22px;
    font-weight: 800;
}

.dict-tile--hero {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    font-size: 44px;
    box-shadow: 0 12px 32px rgba(59, 130, 246, 0.25);
}

/* ── Шапка слова ───────────────────────────────────────────────── */

.dict-word-hero {
    display: grid;
    grid-template-columns: 1fr 280px;
    align-items: center;
    gap: 40px;
}

.dict-word-hero__lemma {
    margin: 14px 0 6px;
    font-size: 56px;
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.dict-word-hero__translation {
    margin: 0 0 8px;
    font-family: var(--dict-font-heading);
    font-size: 28px;
    font-weight: 700;
    color: var(--dict-accent-dark);
}

.dict-word-hero__more {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--dict-text-secondary);

    & em { margin-right: 6px; font-size: 13px; font-style: normal; color: var(--dict-muted); }
}

.dict-word-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

/* Картинка лежит поверх плитки с буквой: нет файла — видна плитка. */
.dict-word-hero__media {
    position: relative;
    width: 280px;
    aspect-ratio: 1;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12);
}

.dict-tile--media {
    width: 100%;
    height: 100%;
    border-radius: 0;
    font-size: 120px;
}

.dict-word-hero__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Кнопки и чипы ─────────────────────────────────────────────── */

.dict-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 22px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--dict-accent);
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF !important;
    transition: background 0.15s, border-color 0.15s;
}

.dict-btn--ghost {
    background: var(--dict-bg);
    border-color: var(--dict-border);
    color: var(--dict-text) !important;
}

.dict-btn--light {
    background: #FFFFFF;
    color: var(--dict-accent-dark) !important;
}

@media (hover: hover) {
    .dict-btn:hover { background: var(--dict-accent-dark); }
    .dict-btn--ghost:hover { background: var(--dict-bg); border-color: var(--dict-accent); }
    .dict-btn--light:hover { background: var(--dict-accent-soft); }
}

.dict-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dict-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--dict-border);
    border-radius: 999px;
    background: var(--dict-bg);
    font-size: 14px;
    color: var(--dict-text-secondary);
}

.dict-chip--accent {
    border-color: var(--dict-accent-line);
    background: var(--dict-accent-soft);
    color: var(--dict-accent-dark);
    font-weight: 600;
}

.dict-chip--link { transition: border-color 0.15s, background 0.15s; }
.dict-chip__lemma { font-weight: 600; color: var(--dict-text); }
.dict-chip__translation { color: var(--dict-muted); }

@media (hover: hover) {
    .dict-chip--link:hover { border-color: var(--dict-accent); background: var(--dict-accent-soft); }
}

/* ── Раскладка: содержимое и карточка-призыв ───────────────────── */

.dict-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    align-items: start;
    gap: 32px;
    padding: 8px 0 80px;
}

.dict-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-width: 0;
}

.dict-aside {
    position: sticky;
    top: 24px;
}

.dict-cta {
    padding: 28px 24px;
    border-radius: var(--dict-radius);
    background: linear-gradient(145deg, #3B82F6 0%, #2563EB 100%);
    color: #FFFFFF;
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.25);

    & .dict-cta__title {
        margin: 0 0 8px;
        font-family: var(--dict-font-heading);
        font-size: 22px;
        font-weight: 800;
        line-height: 1.25;
    }

    & .dict-cta__text {
        margin: 0 0 20px;
        font-size: 15px;
        color: rgba(255, 255, 255, 0.85);
    }
}

/* ── Карточки разделов слова ───────────────────────────────────── */

.dict-card {
    padding: 28px;
    border: 1px solid var(--dict-border);
    border-radius: var(--dict-radius);
    background: var(--dict-bg);

    & .dict-card__title {
        margin: 0 0 18px;
        font-size: 22px;
        font-weight: 700;
    }
}

.dict-examples {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.dict-example {
    padding: 16px 18px;
    border-left: 3px solid var(--dict-accent);
    border-radius: 0 var(--dict-radius-sm) var(--dict-radius-sm) 0;
    background: var(--dict-surface);

    & .dict-example__text { margin: 0; font-size: 17px; font-weight: 500; color: var(--dict-text); }
    & .dict-example__translation { margin: 6px 0 0; font-size: 15px; color: var(--dict-text-secondary); }
    & .dict-example__source { display: block; margin-top: 8px; font-size: 13px; font-style: normal; color: var(--dict-faint); }

    & mark {
        padding: 0 2px;
        margin: 0 -2px;
        border-radius: 4px;
        background: var(--dict-mark);
        color: inherit;
        font-weight: 700;
    }
}

.dict-forms {
    display: grid;
    /* auto-fit: одна таблица склонения растягивается на ширину карточки, а
       таблицы глагола встают в ряд. */
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;

    & h3 {
        margin: 0 0 10px;
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--dict-muted);
    }

    & table {
        width: 100%;
        border-collapse: separate;
        border-spacing: 0;
        border: 1px solid var(--dict-border);
        border-radius: var(--dict-radius-sm);
        overflow: hidden;
        font-size: 15px;
    }

    & th, & td { padding: 9px 12px; text-align: left; }
    & thead th { background: var(--dict-surface); font-size: 12px; font-weight: 600; color: var(--dict-muted); }
    & tbody tr + tr > * { border-top: 1px solid var(--dict-border); }
    & tbody th { font-weight: 500; color: var(--dict-text-secondary); }
    & td { font-weight: 600; color: var(--dict-text); }

    /* Падеж назван и на языке слова, и на языке страницы; видно одно —
       то, что выбрано переключателем. Оба в разметке: поисковик видит оба. */
    &[data-names="native"] .dict-name--page,
    &[data-names="page"] .dict-name--native { display: none; }
}

.dict-forms__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;

    & h3 { margin: 0; }
}

.dict-names {
    display: inline-flex;
    padding: 2px;
    border: 1px solid var(--dict-border);
    border-radius: 999px;
    background: var(--dict-surface);
}

.dict-names__btn {
    padding: 3px 10px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--dict-muted);
    cursor: pointer;

    &[aria-pressed="true"] { background: var(--dict-bg); color: var(--dict-accent-dark); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08); }
}

/* Окончание формы — то, чем она отличается от леммы. */
.dict-ending { color: var(--dict-accent-dark); }

.dict-phrases li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--dict-border);

    &:last-child { border-bottom: 0; padding-bottom: 0; }
    &:first-child { padding-top: 0; }
    & .dict-phrases__text { font-weight: 600; }
    & .dict-phrases__translation { color: var(--dict-text-secondary); }
}

/* ── Списки: алфавит, подборки, слова ──────────────────────────── */

.dict-section .dict-section__title {
    margin: 8px 0 16px;
    font-size: 24px;
    font-weight: 700;
}

.dict-alphabet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 8px;

    & .dict-alphabet__letter {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 48px;
        border: 1px solid var(--dict-border);
        border-radius: 12px;
        background: var(--dict-bg);
        font-family: var(--dict-font-heading);
        font-size: 18px;
        font-weight: 700;
        color: var(--dict-text);
        transition: border-color 0.15s, background 0.15s, color 0.15s;
    }

    & .dict-alphabet__letter--current {
        border-color: var(--dict-accent);
        background: var(--dict-accent);
        color: #FFFFFF;
    }

    & .dict-alphabet__letter--empty {
        color: var(--dict-faint);
        background: var(--dict-surface);
    }
}

@media (hover: hover) {
    .dict-alphabet a.dict-alphabet__letter:not(.dict-alphabet__letter--current):hover {
        border-color: var(--dict-accent);
        color: var(--dict-accent);
    }
}

.dict-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.dict-grid--wide {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.dict-tilecard,
.dict-wordcard {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    padding: 14px 16px;
    border: 1px solid var(--dict-border);
    border-radius: 14px;
    background: var(--dict-bg);
    color: var(--dict-text) !important;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.dict-tilecard {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 20px;

    & .dict-tilecard__title { font-family: var(--dict-font-heading); font-size: 17px; font-weight: 700; }
    & .dict-tilecard__meta { font-size: 13px; color: var(--dict-muted); }
}

/* Карточка подборки: обложка-мозаика из картинок её слов сверху. */
.dict-tilecard--topic {
    gap: 4px;
    padding: 10px 10px 16px;

    & .dict-tilecard__title,
    & .dict-tilecard__meta { padding: 0 8px; }
    & .dict-mosaic { margin-bottom: 8px; }
}

/* Мозаика 2×2; картинок меньше — крупнее каждая. Под картинками — градиент:
   он же виден, если файла нет. */
.dict-mosaic {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 3px;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, #DBEAFE 0%, #93C5FD 100%);

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

.dict-mosaic--1 img { grid-column: 1 / -1; grid-row: 1 / -1; }
.dict-mosaic--2 img { grid-row: 1 / -1; }
.dict-mosaic--3 img:first-child { grid-row: 1 / -1; }

.dict-wordcard {
    & .dict-wordcard__text { display: flex; flex-direction: column; min-width: 0; }
    & .dict-wordcard__lemma { font-weight: 700; font-size: 16px; }
    & .dict-wordcard__translation {
        overflow: hidden;
        font-size: 14px;
        color: var(--dict-muted);
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.dict-wordcard__media {
    position: relative;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;

    & .dict-tile { width: 100%; height: 100%; border-radius: 0; }
    & img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
}

.dict-wordcard--static { color: var(--dict-text-secondary) !important; }

@media (hover: hover) {
    a.dict-tilecard:hover,
    a.dict-wordcard:hover {
        border-color: var(--dict-accent-line);
        box-shadow: var(--dict-shadow-hover);
        transform: translateY(-2px);
    }
}

.dict-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;

    & .dict-pager__state { font-size: 14px; color: var(--dict-muted); }
}

/* ── Брейкпоинты ───────────────────────────────────────────────── */

/* До 1024 — одна колонка: карточка-призыв уходит под содержимое. */
@media (max-width: 1023px) {
    .dict-layout { grid-template-columns: minmax(0, 1fr); }
    .dict-aside { position: static; }
    .dict-word-hero { grid-template-columns: 1fr 200px; gap: 28px; }
    .dict-word-hero__media { width: 200px; }
    .dict-tile--media { font-size: 88px; }
}

@media (max-width: 767px) {
    .dict { --dict-side: 16px; }
    .dict-hero { padding: 20px 0 32px; }
    .dict-crumbs { margin-bottom: 18px; font-size: 13px; }
    .dict-hero__head { gap: 16px; }
    .dict-hero__title { font-size: 30px; }
    .dict-hero__lead { font-size: 16px; }
    .dict-tile--hero { width: 64px; height: 64px; border-radius: 16px; font-size: 30px; }

    /* Картинка — над словом, на всю ширину: на телефоне она и есть первый экран. */
    .dict-word-hero { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    .dict-word-hero__media { order: -1; width: 100%; aspect-ratio: 16 / 9; border-radius: 20px; }
    /* Без картинки плитка с буквой на телефоне — только пустой цветной экран. */
    .dict-word-hero__media--letter { display: none; }
    .dict-word-hero__lemma { font-size: 40px; }
    .dict-word-hero__translation { font-size: 22px; }
    .dict-word-hero__actions .dict-btn { flex: 1 1 100%; justify-content: center; }

    .dict-card { padding: 20px 16px; }
    .dict-card .dict-card__title { font-size: 19px; }
    .dict-example { padding: 14px; }
    .dict-forms { grid-template-columns: minmax(0, 1fr); }
    .dict-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .dict-alphabet { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
    .dict-alphabet .dict-alphabet__letter { height: 42px; font-size: 16px; }
}
