/* дневник разработчика
   я за внешний вид: timeline слева, карточки справа, пастель
   открытие текста — в js, тут только анимация высоты */

body:has(.diary) #content {
    max-width: min(1180px, 100%);
    border: none;
    box-shadow: none;
    background: transparent;
}

.diary {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 12px 8px 48px;
}

.diary__header {
    text-align: center;
    margin: 8px 0 36px;
}

.diary__header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 3.2vw, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #1a1a1a;
    line-height: 1.2;
}

.diary__header p {
    margin: 10px 0 0;
    font-size: 0.98rem;
    font-weight: 500;
    color: #8e8e93;
}

.diary__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 28px;
    align-items: start;
}

/* ===== timeline ===== */
.diary-timeline {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-width: 0;
}

.diary-days {
    position: sticky;
    top: 96px;
    padding: 22px 20px 20px;
    border-radius: 22px;
    background: #fff5f1;
    border: 1px solid rgba(255, 107, 0, 0.08);
    box-shadow: 0 10px 28px rgba(120, 60, 20, 0.06);
}

.diary-days__icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffe4d4;
    color: #ff5c00;
    margin-bottom: 14px;
}

.diary-days__icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.diary-days__value {
    margin: 0;
    font-size: clamp(2rem, 3vw, 2.45rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #ff5c00;
    font-variant-numeric: tabular-nums;
}

.diary-days__unit {
    margin: 6px 0 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #ff5c00;
    line-height: 1.2;
}

.diary-days__desc {
    margin: 14px 0 0;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.4;
    color: #333333;
}

.diary-item {
    display: grid;
    grid-template-columns: 132px 28px minmax(0, 1fr);
    gap: 0 14px;
    align-items: start;
}

.diary-item__meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 18px;
    text-align: right;
}

.diary-item__date {
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: #2b2b2f;
}

.diary-item__day {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}

.diary-item__year {
    font-size: 0.82rem;
    font-weight: 600;
    color: #8e8e93;
}

.diary-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 8px;
    border: 1.5px solid currentColor;
    background: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}

.diary-tag--important {
    color: #e67a2e;
    background: #fff4ea;
    border-color: #f0a066;
}

.diary-tag--design {
    color: #d45a8a;
    background: #fff0f5;
    border-color: #e89bb8;
}

.diary-tag--feature {
    color: #5b6fd6;
    background: #eef1ff;
    border-color: #9aa8e8;
}

.diary-tag--update {
    color: #8b6bc9;
    background: #f4effc;
    border-color: #b59de0;
}

/* полоса с точкой */
.diary-item__rail {
    position: relative;
    display: flex;
    justify-content: center;
    align-self: stretch;
    min-height: 100%;
}

.diary-item__rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: -22px;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: #e4e6ec;
}

.diary-item:last-child .diary-item__rail::before {
    bottom: 0;
}

.diary-item__dot {
    position: relative;
    z-index: 1;
    margin-top: 26px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #c9cbd4;
    box-shadow: 0 0 0 4px #f4f5f7;
}

.diary-item--featured .diary-item__dot,
.diary-item[data-category="important"] .diary-item__dot {
    border-color: #e67a2e;
}

.diary-item[data-category="design"] .diary-item__dot {
    border-color: #d45a8a;
}

.diary-item[data-category="feature"] .diary-item__dot {
    border-color: #5b6fd6;
}

.diary-item[data-category="update"] .diary-item__dot {
    border-color: #8b6bc9;
}

/* ===== карточки ===== */
.diary-item__card {
    min-width: 0;
}

.diary-card {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 168px 36px;
    gap: 14px;
    align-items: center;
    padding: 18px 16px 18px 20px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
    transition: box-shadow 0.2s ease, transform 0.18s ease;
}

.diary-card--no-media {
    grid-template-columns: minmax(0, 1fr) 36px;
}

.diary-card:hover {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.diary-item--featured .diary-card {
    background: #fff1e6;
    border-color: rgba(230, 122, 46, 0.18);
    box-shadow: 0 10px 28px rgba(230, 122, 46, 0.08);
}

.diary-card.is-open {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: none;
}

.diary-card__main {
    min-width: 0;
}

.diary-card__icon {
    width: 42px;
    height: 28px;
    margin-bottom: 8px;
    color: #e67a2e;
}

.diary-card__icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.diary-card__title {
    margin: 0 0 6px;
    font-size: 1.12rem;
    font-weight: 800;
    line-height: 1.25;
    color: #171717;
}

.diary-item--featured .diary-card__title {
    color: #e06720;
    font-size: 1.35rem;
}

.diary-card__lead {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.45;
    color: #6b6f7a;
}

.diary-card__more {
    display: inline-flex;
    margin-top: 12px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid #e67a2e;
    color: #e67a2e;
    font-size: 0.82rem;
    font-weight: 700;
}

/* превью: только само видео/гиф, без серой заглушки и без текста */
.diary-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    background: #eceff4;
}

.diary-card__media img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.diary-card__chevron {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: #9aa0ae;
    transition: transform 0.25s ease, color 0.2s ease;
}

.diary-card__chevron svg {
    width: 18px;
    height: 18px;
}

.diary-card.is-open .diary-card__chevron {
    transform: rotate(180deg);
    color: #e67a2e;
}

/* панель текста — открывается анимацией */
.diary-card__panel {
    overflow: hidden;
    height: 0;
    opacity: 0;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: height 0.36s cubic-bezier(0.22, 0.9, 0.3, 1), opacity 0.28s ease;
}

.diary-item--featured .diary-card__panel {
    background: #fff7f0;
    border-color: rgba(230, 122, 46, 0.18);
}

.diary-card__panel.is-open {
    opacity: 1;
}

.diary-card__panel-inner {
    padding: 4px 20px 18px;
    font-size: 0.94rem;
    line-height: 1.55;
    color: #3f4450;
}

.diary-card__panel-inner p {
    margin: 0 0 10px;
}

.diary-card__panel-inner p:last-child {
    margin-bottom: 0;
}

.diary-empty {
    text-align: center;
    color: #8e8e93;
    font-weight: 600;
}

@media (max-width: 760px) {
    .diary__layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .diary-days {
        position: static;
        order: -1;
        max-width: 280px;
        margin: 0 auto;
        width: 100%;
    }

    .diary-item {
        grid-template-columns: 88px 22px minmax(0, 1fr);
        gap: 0 8px;
    }

    .diary-item__meta {
        padding-top: 14px;
    }

    .diary-item__day {
        font-size: 0.8rem;
    }

    .diary-tag {
        font-size: 0.58rem;
        padding: 3px 7px;
    }

    .diary-card {
        grid-template-columns: minmax(0, 1fr) 112px 28px;
        gap: 10px;
        padding: 14px 12px;
    }

    .diary-card--no-media {
        grid-template-columns: minmax(0, 1fr) 28px;
    }

    .diary-card__title {
        font-size: 1rem;
    }

    .diary-item--featured .diary-card__title {
        font-size: 1.12rem;
    }

    .diary-card__lead {
        font-size: 0.82rem;
    }
}

@media (max-width: 520px) {
    .diary-item {
        grid-template-columns: 20px minmax(0, 1fr);
        grid-template-areas:
            "rail meta"
            "rail card";
        gap: 0 10px;
    }

    .diary-item__meta {
        grid-area: meta;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-start;
        text-align: left;
        padding-top: 4px;
        gap: 8px;
    }

    .diary-item__date {
        flex-direction: row;
        gap: 6px;
        align-items: baseline;
    }

    .diary-item__rail {
        grid-area: rail;
    }

    .diary-item__dot {
        margin-top: 8px;
    }

    .diary-item__card {
        grid-area: card;
    }

    .diary-card {
        grid-template-columns: minmax(0, 1fr) 28px;
        grid-template-areas:
            "main chevron"
            "media media";
    }

    .diary-card__main { grid-area: main; }
    .diary-card__media { grid-area: media; max-width: 220px; }
    .diary-card__chevron { grid-area: chevron; }
}
