/**
 * IRK Pulse — side pull-tab + slide-in panel.
 * Uses theme tokens (--bg-card, --text, --border …) so it flips automatically
 * between light and dark modes.
 */

/* ============================================================
 * Toggle button — vertical pull-tab on the right edge.
 * ============================================================ */
.irk-pulse-toggle {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    z-index: 900;

    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;

    padding: 14px 8px;
    border: 1px solid var(--accent, var(--color-primary, #4173ff));
    border-right: none;
    border-radius: 12px 0 0 12px;

    background: var(--accent, var(--color-primary, #4173ff));
    color: #fff;
    cursor: pointer;

    font-family: inherit;
    transition: transform 0.18s ease, filter 0.15s;
}

.irk-pulse-toggle:hover {
    transform: translate(-2px, -50%);
    filter: brightness(1.08);
}

.irk-pulse-toggle__icon {
    width: 20px;
    height: 20px;
    color: #fff;
}

.irk-pulse-toggle__label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
}

/* Hide the tab when panel is open — it fades behind the sheet anyway
   and removing it avoids accidental clicks on mobile. */
body.irk-pulse--open .irk-pulse-toggle { opacity: 0; pointer-events: none; }

/* ============================================================
 * Overlay.
 * ============================================================ */
.irk-pulse-overlay {
    position: fixed;
    inset: 0;
    z-index: 950;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.irk-pulse-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
 * Panel.
 * ============================================================ */
.irk-pulse-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 960;

    display: flex;
    flex-direction: column;

    width: min(420px, 92vw);
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    box-shadow: -12px 0 30px rgba(16, 30, 85, 0.14);

    transform: translateX(100%);
    transition: transform 0.25s ease;
}

/* WordPress admin-bar occupies 32px (46px on small screens). Push the panel
   below it so the "Пульс" title isn't hidden behind the admin toolbar. */
body.admin-bar .irk-pulse-panel { top: 32px; }
@media (max-width: 782px) {
    body.admin-bar .irk-pulse-panel { top: 46px; }
}

.irk-pulse-panel.is-open {
    transform: translateX(0);
}

html.dark .irk-pulse-panel {
    box-shadow: -12px 0 30px rgba(0, 0, 0, 0.45);
}

.irk-pulse-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.irk-pulse-panel__title {
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

.irk-pulse-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;

    border: 1px solid var(--border-2);
    border-radius: 6px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.irk-pulse-panel__close:hover {
    background: var(--bg-card-2);
    color: var(--text);
}

.irk-pulse-panel__close svg {
    width: 16px;
    height: 16px;
}

.irk-pulse-panel__body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px 28px;
}

/* ============================================================
 * Tabs.
 * ============================================================ */
/* Pill-style tabs — mirrors theme's `.menu__item-link` in the main header. */
.irk-pulse-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 14px;
}

.irk-pulse-tab {
    padding: 0.5rem 0.875rem;
    background: transparent;
    border: none;
    border-radius: 0.625rem;
    font-family: inherit;
    font-size: 0.84375rem;          /* 13.5px — matches theme .menu__item-link */
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.irk-pulse-tab:hover {
    background: var(--bg-card-2);
    color: var(--text);
}

.irk-pulse-tab.is-active {
    color: var(--tag-text);
    background: var(--tag-bg);
}

.irk-pulse-tab-panel[hidden] { display: none; }

/* ============================================================
 * News — timeline.
 * ============================================================ */
.irk-pulse-timeline {
    list-style: none;
    margin: 0;
    padding: 0 0 0 14px;
    position: relative;
}

/* Vertical line spanning the whole list */
.irk-pulse-timeline::before {
    content: '';
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 4px;
    width: 2px;
    background: var(--border-2);
    border-radius: 2px;
}

.irk-pulse-timeline__item {
    position: relative;
    padding: 4px 0 14px;
}

.irk-pulse-timeline__item:last-child { padding-bottom: 4px; }

.irk-pulse-timeline__dot {
    position: absolute;
    left: -14px;
    top: 16px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent, var(--color-primary, #4173ff));
    box-shadow: 0 0 0 3px var(--bg-card);
    transition: box-shadow 0.15s;
}

/* Halo-accent on the freshest item, like the mockup's `:first-child`. */
.irk-pulse-timeline__item:first-child .irk-pulse-timeline__dot {
    box-shadow: 0 0 0 3px var(--bg-card), 0 0 0 5px var(--accent, var(--color-primary, #4173ff));
}

.irk-pulse-timeline__link {
    display: block;
    padding: 2px 0 2px 8px;
    text-decoration: none;
    color: inherit;
}

.irk-pulse-timeline__time {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dimmer);
    line-height: 1.2;
    margin-bottom: 5px;
}

.irk-pulse-timeline__title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text);
}

.irk-pulse-timeline__link:hover .irk-pulse-timeline__title {
    color: var(--accent, var(--color-primary, #4173ff));
}

/* Load-more button */
.irk-pulse-loadmore {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;

    background: transparent;
    border: 1px dashed var(--border-2);
    border-radius: 10px;

    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s, background-color 0.12s;
}

.irk-pulse-loadmore:hover {
    color: var(--text);
    border-color: var(--accent, var(--color-primary, #4173ff));
    background: var(--bg-card-2);
}

.irk-pulse-loadmore[disabled] {
    opacity: 0.6;
    cursor: default;
}

/* ============================================================
 * Comments list.
 * ============================================================ */
.irk-pulse-comments {
    list-style: none;
    margin: 0;
    padding: 0;
}

.irk-pulse-comment {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.irk-pulse-comment:last-child { border-bottom: none; }

.irk-pulse-comment__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.irk-pulse-comment__avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-card-3);
}

.irk-pulse-comment__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.irk-pulse-comment__name {
    font-weight: 700;
    color: var(--text);
}

.irk-pulse-comment__verif {
    display: inline-flex;
    color: var(--accent, var(--color-primary, #4173ff));
}

.irk-pulse-comment__verif svg { width: 16px; height: 16px; }

.irk-pulse-comment__time {
    margin-left: auto;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
}

.irk-pulse-comment__text {
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text);
}

.irk-pulse-comment__ref {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 10px;

    background: var(--bg-card-2);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dim);
    transition: background-color 0.12s;
}

.irk-pulse-comment__ref:hover {
    background: var(--bg-card-3);
    color: var(--text);
}

.irk-pulse-comment__ref-thumb {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.irk-pulse-comment__ref-title {
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================================
 * Afisha events list.
 * ============================================================ */
.irk-pulse-events {
    list-style: none;
    margin: 0;
    padding: 0;
}

.irk-pulse-event {
    border-bottom: 1px solid var(--border);
}

.irk-pulse-event:last-child { border-bottom: none; }

.irk-pulse-event__link {
    display: grid;
    grid-template-columns: 56px 1fr;
    gap: 12px;
    padding: 12px 0;
    text-decoration: none;
    color: inherit;
}

.irk-pulse-event__thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background-color: var(--bg-card-3);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.irk-pulse-event__thumb--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
}

.irk-pulse-event__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.irk-pulse-event__when {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent, var(--color-primary, #4173ff));
    line-height: 1;
}

.irk-pulse-event__time {
    color: var(--text-dim);
    font-weight: 600;
    margin-left: 2px;
}

.irk-pulse-event__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.irk-pulse-event__link:hover .irk-pulse-event__title {
    color: var(--accent, var(--color-primary, #4173ff));
}

/* ============================================================
 * Week top.
 * ============================================================ */
.irk-pulse-week {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px dashed var(--border-2);
}

.irk-pulse-week__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.irk-pulse-week__title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.irk-pulse-week__head svg { width: 16px; height: 16px; flex-shrink: 0; }

.irk-pulse-week__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: none;
}

.irk-pulse-week__item {
    border-bottom: 1px solid var(--border);
}

.irk-pulse-week__item:last-child { border-bottom: none; }

.irk-pulse-week__link {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 10px;
    padding: 10px 0;
    text-decoration: none;
    color: inherit;
}

.irk-pulse-week__num {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent, var(--color-primary, #4173ff));
    line-height: 1;
}

.irk-pulse-week__body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.irk-pulse-week__item-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

.irk-pulse-week__meta {
    font-size: 12px;
    color: var(--text-dim);
}

.irk-pulse-empty {
    color: var(--text-dim);
    font-size: 13.5px;
    text-align: center;
    padding: 24px 0;
}

/* ============================================================
 * Mobile tweaks.
 * ============================================================ */
@media (max-width: 479px) {
    .irk-pulse-toggle {
        padding: 10px 6px;
        font-size: 11px;
    }

    .irk-pulse-toggle__icon { width: 18px; height: 18px; }
}
