/* MisahaTech - بلوك "تاريخ الشركة (خط زمني)" (الموقع + المحرر) */
.mt-tl {
    --tl-accent: var(--clr-primary, #00dda2);
    --tl-accent-rgb: var(--clr-primary-rgb, 0, 221, 162);
    --tl-accent-dk: var(--clr-primary-dk, #007a62);
    --tl-bg: var(--clr-white, #fff);
    --tl-soft: var(--clr-light, #f5f7fa);
    --tl-border: var(--clr-border, #e4e8ee);
    --tl-text: var(--clr-text, #2d2d2d);
    --tl-title: var(--clr-dark, #22263a);
    --tl-muted: var(--clr-muted, #666);
    margin: 2em 0 !important;
    padding: 22px 22px 18px;
    border: 1px solid var(--tl-border);
    border-radius: 16px;
    background: var(--tl-bg);
    direction: rtl;
    color: var(--tl-text);
    line-height: 1.8
}

/* ---------- الرأس ---------- */
.mt-tl__head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px
}

.mt-tl__logo {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    border: 1px solid var(--tl-border);
    background: var(--tl-soft);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 1.6rem
}

.mt-tl__logo img,
.article-body .mt-tl__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
    margin: 0 !important;
    border-radius: 0
}

.mt-tl__company {
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.4;
    color: var(--tl-title)
}

.mt-tl__sub {
    font-size: .85rem;
    color: var(--tl-muted)
}

/* ---------- الشريط الزمني ---------- */
.mt-tl__track {
    position: relative;
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    padding: 4px 2px 10px;
    margin: 0 -4px
}

.mt-tl__node {
    position: relative;
    flex: 1 0 128px;
    min-width: 128px;
    scroll-snap-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 30px 8px 8px;
    border: 0;
    border-radius: 12px;
    background: none;
    font: inherit;
    color: inherit;
    text-align: center;
    cursor: pointer;
    transition: background .2s
}

/* الخط الأفقي بين النقاط */
.mt-tl__node::before {
    content: "";
    position: absolute;
    top: 15px;
    right: 0;
    left: 0;
    height: 3px;
    background: var(--tl-border)
}

.mt-tl__node:first-child::before { right: 50% }
.mt-tl__node:last-child::before { left: 50% }
.mt-tl__node:only-child::before { display: none }

.mt-tl__node.is-past::before,
.mt-tl__node.is-active::before {
    background: var(--tl-accent)
}

.mt-tl__node.is-active::before {
    background: linear-gradient(to left, var(--tl-accent) 50%, var(--tl-border) 50%)
}

.mt-tl__node:first-child.is-active::before {
    background: var(--tl-border)
}

.mt-tl__dot {
    position: absolute;
    top: 8px;
    left: 50%;
    width: 17px;
    height: 17px;
    transform: translateX(-50%);
    border-radius: 50%;
    background: var(--tl-bg);
    border: 3px solid var(--tl-border);
    transition: transform .2s, border-color .2s, background .2s, box-shadow .2s;
    z-index: 1
}

.mt-tl__node.is-past .mt-tl__dot {
    border-color: var(--tl-accent)
}

.mt-tl__node.is-active .mt-tl__dot {
    border-color: var(--tl-accent);
    background: var(--tl-accent);
    transform: translateX(-50%) scale(1.25);
    box-shadow: 0 0 0 5px rgba(var(--tl-accent-rgb), .2)
}

.mt-tl__year {
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1.3;
    color: var(--tl-title);
    unicode-bidi: plaintext
}

.mt-tl__node.is-active .mt-tl__year {
    color: var(--tl-accent-dk)
}

.mt-tl__ntitle {
    font-size: .8rem;
    line-height: 1.5;
    color: var(--tl-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden
}

.mt-tl__has {
    font-size: .7rem;
    opacity: .7
}

.mt-tl__node:hover {
    background: var(--tl-soft)
}

.mt-tl__node:focus-visible {
    outline: 2px solid var(--tl-accent);
    outline-offset: 2px
}

/* ---------- تفاصيل الحدث ---------- */
.mt-tl__panel {
    position: relative;
    margin-top: 12px;
    padding: 18px 20px 14px;
    border-radius: 14px;
    background: var(--tl-soft);
    border: 1px solid var(--tl-border)
}

.mt-tl__panel + .mt-tl__panel { margin-top: 12px }

.mt-tl.is-js .mt-tl__panel { display: none }
.mt-tl.is-js .mt-tl__panel.is-active { display: block; animation: mtTlIn .25s ease }

@keyframes mtTlIn {
    from { opacity: 0; transform: translateY(6px) }
    to { opacity: 1; transform: none }
}

@media (prefers-reduced-motion: reduce) {
    .mt-tl.is-js .mt-tl__panel.is-active { animation: none }
}

.mt-tl__phead {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px
}

.mt-tl__pyear {
    padding: 2px 12px;
    border-radius: 20px;
    background: var(--tl-accent);
    color: #06261d;
    font-weight: 900;
    font-size: .9rem;
    unicode-bidi: plaintext
}

.mt-tl__ptitle {
    font-size: 1.1rem;
    font-weight: 900;
    line-height: 1.5;
    color: var(--tl-title)
}

.mt-tl__text {
    font-size: .95rem;
    white-space: pre-line
}

/* الصور */
.mt-tl__gallery {
    display: grid;
    gap: 10px;
    margin-top: 14px
}

.mt-tl__gallery--1 { grid-template-columns: 1fr }
.mt-tl__gallery--2 { grid-template-columns: repeat(2, 1fr) }
.mt-tl__gallery--3 { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)) }

.mt-tl__fig,
.article-body .mt-tl__fig {
    margin: 0 !important;
    position: relative
}

.mt-tl__fig a {
    display: block;
    border: 0 !important;
    padding: 0 !important;
    background: none !important
}

.mt-tl__fig img,
.article-body .mt-tl__fig img {
    display: block;
    width: 100%;
    aspect-ratio: 16/10;
    object-fit: cover;
    margin: 0 !important;
    border-radius: 10px;
    background: var(--tl-bg)
}

.mt-tl__gallery--1 .mt-tl__fig img {
    aspect-ratio: auto;
    max-height: 420px;
    object-fit: contain
}

.mt-tl__fig figcaption {
    margin-top: 5px;
    font-size: .8rem;
    color: var(--tl-muted);
    text-align: center
}

/* السابق / التالي */
.mt-tl__nav {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 14px;
    padding-top: 10px;
    border-top: 1px dashed var(--tl-border)
}

.mt-tl.is-js .mt-tl__nav { display: flex }

.mt-tl__nav button {
    border: 1px solid var(--tl-border);
    background: var(--tl-bg);
    color: var(--tl-title);
    font: inherit;
    font-size: .85rem;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer
}

.mt-tl__nav button:hover:not([disabled]) {
    border-color: var(--tl-accent);
    color: var(--tl-accent-dk)
}

.mt-tl__nav button[disabled] { opacity: .35; cursor: default }

.mt-tl__count {
    font-size: .8rem;
    color: var(--tl-muted);
    direction: ltr
}

/* ---------- الهاتف ---------- */
@media (max-width: 600px) {
    .mt-tl { padding: 16px 14px 14px }
    .mt-tl__node { flex-basis: 108px; min-width: 108px }
    .mt-tl__year { font-size: 1.05rem }
    .mt-tl__panel { padding: 14px }
    .mt-tl__gallery--2 { grid-template-columns: 1fr 1fr }
    .mt-tl__gallery--3 { grid-template-columns: 1fr 1fr }
}

/* ---------- الوضع الداكن ---------- */
[data-theme=dark] .mt-tl {
    --tl-bg: var(--dm-bg2, #1c2030);
    --tl-soft: var(--dm-bg3, #262b3d);
    --tl-border: var(--dm-border, #2e3447);
    --tl-text: #c8cad6;
    --tl-title: #e2e4ed;
    --tl-muted: #8b90a8;
    --tl-accent-dk: var(--tl-accent)
}

/* ---------- المحرر فقط ---------- */
.mt-tl-editor .mt-tl__logo--pick { cursor: pointer; padding: 0; font: inherit; font-size: 1.6rem }
.mt-tl-editor .mt-tl__who { flex: 1; min-width: 0 }
.mt-tl-editor .mt-tl__node { user-select: none }
.mt-tl-editor .mt-tl__bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
    border-top: 1px dashed var(--tl-border);
    border-bottom: 1px dashed var(--tl-border)
}
.mt-tl-editor .mt-tl__sp { flex: 1 }
.mt-tl-editor .mt-tl__edit-row { max-width: 260px; margin-bottom: 6px }
.mt-tl-editor .mt-tl__ptitle { margin-bottom: 6px }
.mt-tl-editor .mt-tl__text { min-height: 3em; margin-bottom: 10px }
.mt-tl-editor .mt-tl__gallery { margin-bottom: 10px }
.mt-tl-editor .mt-tl__cap-in {
    width: 100%;
    margin-top: 4px;
    border: 1px solid var(--tl-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px
}
.mt-tl-editor .mt-tl__img-rm {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(255, 255, 255, .9) !important;
    border-radius: 50%
}
