/* ==========================================================================
   زفلتة - صفحة من نحن
   ========================================================================== */

/* ==========================================================================
   قصتنا
   ========================================================================== */
.story-text { color: var(--gray); font-size: 1.08rem; }

.story-boxes { margin: 14px 0 30px; }
.story-box {
    height: 100%;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--white);
    transition: all .4s var(--ease);
}
.story-box:hover,
.story-box.in-focus { border-color: var(--gold); transform: translateY(-5px); box-shadow: var(--shadow); }
.story-box i { color: var(--gold); font-size: 1.8rem; }
.story-box h3 { font-size: 1.15rem; margin: 8px 0 4px; }
.story-box p { color: var(--gray); margin: 0; font-size: .97rem; }

.story-buttons { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- مقطع طبقات الطريق ---------- */
.xs-card {
    --air: 130px;
    position: relative;
    padding: 26px 26px 22px;
    border-radius: 28px;
    background:
        radial-gradient(circle at 15% 0%, rgba(220, 154, 3, .18), transparent 45%),
        linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 28px 28px,
        linear-gradient(160deg, var(--navy-light), var(--navy-dark));
    box-shadow: var(--shadow-lg);
}

.xs-badge {
    position: absolute;
    top: -24px;
    left: -16px;
    z-index: 5;
    padding: 12px 20px;
    border-radius: 18px;
    background: var(--gold);
    color: var(--navy);
    line-height: 1.1;
    text-align: center;
    box-shadow: 0 14px 30px rgba(220, 154, 3, .35);
    animation: float 5s ease-in-out infinite;
}
.xs-badge strong { display: block; font-size: 1.9rem; font-weight: 900; direction: ltr; }
.xs-badge small { font-weight: 700; }

.xs-head { margin-bottom: 8px; }
.xs-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 30px;
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .85);
    font-size: .9rem;
    font-weight: 700;
}
.xs-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    animation: dot-pulse 1.8s ease-out infinite;
}

.xs-body {
    position: relative;
    display: grid;
    grid-template-columns: 190px 1fr;
    column-gap: 30px;
}

/* الطبقات */
.xs-air { position: relative; height: var(--air); }
.xs-stack {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 22px 40px rgba(0, 0, 0, .4);
}
.xs-layer {
    position: relative;
    opacity: 0;
    transform: translateY(-60px);
    transition: filter .5s var(--ease), box-shadow .5s var(--ease);
}
.xs-layer.xs-asphalt {
    height: 64px;
    background: url('../images/textures/asphalt.svg') 0 0 / 90px;
    box-shadow: inset 0 3px 0 rgba(255, 255, 255, .12);
}
.xs-layer.xs-prime {
    height: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, #3d2412 0%, #1a0f07 60%, #2b190c 100%);
}
.xs-layer.xs-prime::after {
    content: "";
    position: absolute;
    inset: 3px 0 auto;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .25), transparent);
    animation: shine 3.5s ease-in-out infinite;
}
.xs-layer.xs-base { height: 84px; background: url('../images/textures/gravel.svg') 0 0 / 120px; }
.xs-layer.xs-soil { height: 96px; background: url('../images/textures/soil.svg') 0 0 / 140px; }

.xs-layer.is-active {
    filter: brightness(1.3) saturate(1.1);
    box-shadow: inset 0 0 0 2px var(--gold), inset 0 0 30px rgba(220, 154, 3, .35);
}

/* بناء الطبقات من تحت لفوق */
.xs-card.is-visible .xs-layer { animation: layer-drop .8s var(--ease) forwards; }
.xs-card.is-visible .xs-layer.xs-soil { animation-delay: .2s; }
.xs-card.is-visible .xs-layer.xs-base { animation-delay: .55s; }
.xs-card.is-visible .xs-layer.xs-prime { animation-delay: .9s; }
.xs-card.is-visible .xs-layer.xs-asphalt { animation-delay: 1.25s; }

/* القائمة جنب الطبقات */
.xs-legend { position: relative; margin: 0; padding: 0; list-style: none; }
.xs-legend-item {
    position: absolute;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    color: var(--white);
    cursor: default;
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
    transition: background .4s var(--ease), border-color .4s var(--ease);
}
.xs-legend-item.xs-asphalt { top: calc(var(--air) + 26px); }
.xs-legend-item.xs-prime { top: calc(var(--air) + 84px); }
.xs-legend-item.xs-base { top: calc(var(--air) + 136px); }
.xs-legend-item.xs-soil { top: calc(var(--air) + 214px); }

.xs-legend-item strong { display: block; font-size: .86rem; line-height: 1.4; }
.xs-legend-item small { display: block; color: rgba(255, 255, 255, .55); font-size: .76rem; }
.xs-num {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid rgba(220, 154, 3, .6);
    color: var(--gold);
    font-size: .8rem;
    font-weight: 900;
    transition: all .4s var(--ease);
}
/* خط التوصيل للطبقة */
.xs-legend-item::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -30px;
    width: 30px;
    border-top: 2px dashed rgba(255, 255, 255, .2);
    transition: border-color .4s var(--ease);
}
.xs-legend-item::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -34px;
    width: 8px;
    height: 8px;
    margin-top: -3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .35);
    transition: background .4s var(--ease), box-shadow .4s var(--ease);
}
.xs-legend-item.is-active { border-color: rgba(220, 154, 3, .7); background: rgba(220, 154, 3, .14); }
.xs-legend-item.is-active .xs-num { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.xs-legend-item.is-active::after { border-top-color: var(--gold); }
.xs-legend-item.is-active::before { background: var(--gold); box-shadow: 0 0 0 4px rgba(220, 154, 3, .25); }

.xs-card.is-visible .xs-legend-item { animation: legend-in .6s var(--ease) forwards; }
.xs-card.is-visible .xs-legend-item.xs-soil { animation-delay: .35s; }
.xs-card.is-visible .xs-legend-item.xs-base { animation-delay: .7s; }
.xs-card.is-visible .xs-legend-item.xs-prime { animation-delay: 1.05s; }
.xs-card.is-visible .xs-legend-item.xs-asphalt { animation-delay: 1.4s; }

/* الهراس */
.xs-roller {
    position: absolute;
    bottom: -3px;
    left: 0;
    z-index: 3;
    width: 170px;
    opacity: 0;
    filter: drop-shadow(0 10px 14px rgba(0, 0, 0, .35));
}
.xs-card.is-visible .xs-roller {
    animation:
        fade-in .6s var(--ease) 1.9s forwards,
        roll 8s ease-in-out 2.2s infinite alternate;
}
.xs-drum,
.xs-wheel { transform-box: fill-box; transform-origin: center; }
.xs-card.is-visible .xs-drum { animation: roll-drum 8s ease-in-out 2.2s infinite alternate; }
.xs-card.is-visible .xs-wheel { animation: roll-wheel 8s ease-in-out 2.2s infinite alternate; }
.xs-beacon { fill: #ff8a00; animation: beacon 1s steps(2) infinite; }

/* بخار الأسفلت */
.xs-steam {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
}
.xs-steam path {
    fill: none;
    stroke: rgba(255, 255, 255, .22);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 26 140;
    stroke-dashoffset: 166;
    animation: steam-rise 3.2s ease-in infinite;
}
.xs-steam path:nth-child(2) { animation-delay: 1.1s; }
.xs-steam path:nth-child(3) { animation-delay: 2.1s; }

/* المواصفات تحت */
.xs-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}
.xs-specs span {
    padding: 7px 14px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 30px;
    background: rgba(255, 255, 255, .05);
    color: rgba(255, 255, 255, .85);
    font-size: .88rem;
    font-weight: 500;
}
.xs-specs i { color: var(--gold); margin-left: 4px; }

@media (max-width: 575.98px) {
    .xs-card { padding: 22px 16px 18px; }
    .xs-badge { left: 8px; top: -26px; padding: 8px 14px; }
    .xs-badge strong { font-size: 1.4rem; }
    .xs-body { grid-template-columns: 1fr; }
    .xs-legend {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        order: 2;
        margin-top: 16px;
    }
    .xs-legend-item { position: static; transform: none; }
    .xs-card.is-visible .xs-legend-item { animation-name: fade-in; }
    .xs-legend-item::before,
    .xs-legend-item::after { display: none; }
    .xs-roller { width: 135px; }
}

/* ==========================================================================
   ما الذي يميز شركتنا (كروت بتتقلب)
   ========================================================================== */
.features-section { background: var(--white); }

.flip-card {
    height: 290px;
    perspective: 1200px;
    cursor: pointer;
    outline: none;
}
.flip-inner {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .85s var(--ease);
}
@media (hover: hover) {
    .flip-card:hover .flip-inner { transform: rotateY(180deg); }
}
.flip-card.flipped .flip-inner,
.flip-card:focus-visible .flip-inner { transform: rotateY(180deg); }

.flip-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 34px;
    border-radius: 24px;
    text-align: center;
    overflow: hidden;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.flip-front {
    border: 1px solid var(--border);
    background: var(--cream);
}
.flip-front::before {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--gold-soft);
}
.flip-front::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: repeating-linear-gradient(90deg, var(--gold) 0 30px, transparent 30px 50px);
}

.flip-num {
    position: absolute;
    top: 18px;
    left: 24px;
    font-size: 3.4rem;
    font-weight: 900;
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(8, 29, 48, .12);
}

.flip-icon {
    position: relative;
    display: grid;
    place-items: center;
    width: 92px;
    height: 92px;
    margin-bottom: 20px;
    border-radius: 50%;
    background: var(--navy);
    color: var(--gold);
    font-size: 2.4rem;
    animation: ring-pulse 2.6s ease-out infinite;
}
.flip-title { font-size: 1.3rem; margin-bottom: 10px; }
.flip-hint { color: var(--gray); font-size: .9rem; font-weight: 500; }
.flip-hint i { display: inline-block; color: var(--gold); animation: spin 3s linear infinite; }

.flip-back {
    background:
        radial-gradient(circle at 0 100%, rgba(220, 154, 3, .25), transparent 50%),
        linear-gradient(160deg, var(--navy-light), var(--navy));
    color: rgba(255, 255, 255, .8);
    transform: rotateY(180deg);
}
.flip-back .flip-title { color: var(--gold); }
.flip-back p { margin: 0; font-size: 1.02rem; }
.flip-back-icon {
    position: absolute;
    bottom: -20px;
    left: -10px;
    color: rgba(255, 255, 255, .05);
    font-size: 8rem;
    line-height: 1;
}

/* ==========================================================================
   لماذا يثق العملاء بنا
   ========================================================================== */
.trust-section {
    position: relative;
    overflow: hidden;
    background: var(--navy);
}
.trust-pattern {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 55%, rgba(220, 154, 3, .14), transparent 40%),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 46px);
}

.trust-layout {
    display: grid;
    grid-template-columns: 1fr 320px 1fr;
    align-items: center;
    gap: 40px;
}
.trust-col { display: grid; gap: 18px; }

.trust-item {
    display: flex;
    gap: 16px;
    padding: 22px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 20px;
    background: rgba(255, 255, 255, .04);
    transition: border-color .4s var(--ease), background .4s var(--ease);
}
.trust-item:hover,
.trust-item.in-focus { border-color: rgba(220, 154, 3, .6); background: rgba(220, 154, 3, .08); }
.trust-item h3 { color: var(--white); font-size: 1.12rem; margin-bottom: 4px; }
.trust-item p { color: rgba(255, 255, 255, .65); margin: 0; font-size: .96rem; }
.trust-icon {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    color: var(--gold);
    font-size: 1.4rem;
    transition: all .4s var(--ease);
}
.trust-item:hover .trust-icon,
.trust-item.in-focus .trust-icon { background: var(--gold); color: var(--navy); transform: rotate(-12deg); }

.trust-center {
    position: relative;
    display: grid;
    place-items: center;
    width: 320px;
    height: 320px;
    margin: 0 auto;
}
.trust-orbit {
    position: absolute;
    border-radius: 50%;
}
.trust-orbit-1 {
    inset: 0;
    border: 2px dashed rgba(220, 154, 3, .45);
    animation: spin 40s linear infinite;
}
.trust-orbit-2 {
    inset: 30px;
    border: 1px solid rgba(255, 255, 255, .12);
    animation: spin 10s linear infinite;
}
.trust-orbit-2 i {
    position: absolute;
    top: -12px;
    left: 50%;
    margin-left: -11px;
    color: var(--gold);
    font-size: 1.3rem;
    filter: drop-shadow(0 0 8px rgba(220, 154, 3, .8));
}
.trust-logo {
    display: grid;
    place-items: center;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--cream);
    box-shadow: 0 0 0 10px rgba(220, 154, 3, .15), 0 0 60px rgba(220, 154, 3, .35);
}
.trust-logo img { width: 150px; mix-blend-mode: multiply; }

@media (max-width: 1199.98px) {
    .trust-layout { grid-template-columns: 1fr 260px 1fr; gap: 24px; }
    .trust-center { width: 260px; height: 260px; }
    .trust-logo { width: 170px; height: 170px; }
    .trust-logo img { width: 125px; }
}
@media (max-width: 991.98px) {
    .trust-layout { grid-template-columns: 1fr; }
    .trust-center { order: -1; width: 240px; height: 240px; margin-bottom: 10px; }
    .trust-logo { width: 160px; height: 160px; }
    .trust-logo img { width: 115px; }
}

/* ==========================================================================
   أنواع المشاريع
   ========================================================================== */
.types-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 240px;
    gap: 20px;
}
.type-card:nth-child(1) { grid-column: span 2; grid-row: span 2; }
.type-card:nth-child(6),
.type-card:nth-child(7) { grid-column: span 2; }

.type-card {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    isolation: isolate;
    background: var(--navy);
}
.type-card img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -2;
    transition: transform .9s var(--ease);
}
.type-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(0deg, rgba(8, 29, 48, .95) 0%, rgba(8, 29, 48, .35) 55%, rgba(8, 29, 48, .1));
    transition: background .5s var(--ease);
}
/* إطار ذهبي بيترسم */
.type-card::after {
    content: "";
    position: absolute;
    inset: 12px;
    border: 2px solid var(--gold);
    border-radius: 14px;
    opacity: 0;
    transform: scale(1.06);
    transition: all .5s var(--ease);
    pointer-events: none;
}

.type-overlay {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    padding: 26px;
    color: var(--white);
}
.type-icon {
    display: inline-grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin-bottom: 12px;
    border-radius: 14px;
    background: var(--gold);
    color: var(--navy);
    font-size: 1.4rem;
    transition: transform .5s var(--ease);
}
.type-title { color: var(--white); font-size: 1.25rem; margin: 0; }
.type-card:nth-child(1) .type-title { font-size: 1.7rem; }
.type-text {
    max-height: 0;
    margin: 0;
    color: rgba(255, 255, 255, .8);
    opacity: 0;
    overflow: hidden;
    transition: max-height .5s var(--ease), opacity .5s var(--ease), margin .5s var(--ease);
}

.type-card:hover img,
.type-card.in-focus img { transform: scale(1.1); }
.type-card:hover::before,
.type-card.in-focus::before { background: linear-gradient(0deg, rgba(8, 29, 48, .97) 0%, rgba(8, 29, 48, .6) 60%, rgba(8, 29, 48, .3)); }
.type-card:hover::after,
.type-card.in-focus::after { opacity: 1; transform: scale(1); }
.type-card:hover .type-icon,
.type-card.in-focus .type-icon { transform: rotate(-10deg) scale(1.08); }
.type-card:hover .type-text,
.type-card.in-focus .type-text { max-height: 80px; margin-top: 8px; opacity: 1; }

@media (hover: none) {
    .type-text { max-height: 80px; margin-top: 8px; opacity: 1; }
}
@media (max-width: 991.98px) {
    .types-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; }
    .type-card:nth-child(1) { grid-row: span 1; }
    .type-card:nth-child(6),
    .type-card:nth-child(7) { grid-column: span 1; }
}
@media (max-width: 575.98px) {
    .types-grid { grid-template-columns: 1fr; }
    .type-card:nth-child(1) { grid-column: span 1; }
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes layer-drop {
    0% { opacity: 0; transform: translateY(-70px); }
    70% { opacity: 1; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
    to { opacity: 1; }
}
@keyframes roll {
    from { left: 0; }
    to { left: calc(100% - 170px); }
}
@keyframes roll-drum {
    to { transform: rotate(430deg); }
}
@keyframes roll-wheel {
    to { transform: rotate(560deg); }
}
@keyframes ring-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 154, 3, .45); }
    80%, 100% { box-shadow: 0 0 0 18px rgba(220, 154, 3, 0); }
}

@keyframes legend-in {
    from { opacity: 0; transform: translateY(-50%) translateX(20px); }
    to { opacity: 1; transform: translateY(-50%) translateX(0); }
}
@keyframes dot-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 154, 3, .6); }
    100% { box-shadow: 0 0 0 8px rgba(220, 154, 3, 0); }
}
@keyframes shine {
    0%, 100% { transform: translateX(-60%); }
    50% { transform: translateX(60%); }
}
@keyframes beacon {
    50% { fill: #ffd27a; }
}
@keyframes steam-rise {
    0% { stroke-dashoffset: 166; opacity: 0; }
    20% { opacity: 1; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}
