/* Home — Apple-inspired Persian magazine layout */
.home {
    display: grid;
    gap: var(--space-2xl);
    padding-bottom: var(--space-md);
}

/* Visually hidden page title (SEO / a11y) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hero */
.home-hero-wrap { margin: 0; }
.home-hero {
    background: var(--surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    --hero-title-min-h: 102px;
    --hero-excerpt-min-h: 74px;
    --hero-copy-min-h: 340px;
}
.home-hero.is-syncing-heights .home-hero__slide {
    visibility: visible !important;
    opacity: 0 !important;
    pointer-events: none !important;
    z-index: 0 !important;
}
.home-hero__viewport {
    position: relative;
    min-height: 280px;
    height: min(56vw, 420px);
    background: #091e42;
}
@media (min-width: 768px) {
    .home-hero__viewport {
        height: 480px;
        min-height: 480px;
    }
}
@media (min-width: 1024px) {
    .home-hero__viewport {
        height: 560px;
        min-height: 560px;
    }
}
.home-hero__track {
    position: absolute;
    inset: 0;
}
.home-hero__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity .55s var(--ease-out), visibility .55s;
    z-index: 0;
}
.home-hero__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}
.home-hero__slide-link {
    display: block;
    height: 100%;
    color: #fff !important;
    text-decoration: none !important;
}
.home-hero__bg {
    position: absolute;
    inset: 0;
}

.home-hero__media {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #091e42;
}

.home-hero__media-backdrop {
    position: absolute;
    inset: -14%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(24px) saturate(1.12);
    opacity: 0.5;
    transform: scale(1.06);
    pointer-events: none;
}

.home-hero__media-img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}

.home-hero__slide.is-active .home-hero__media-img {
    animation: homeHeroKenBurns 6.5s linear forwards;
}

@keyframes homeHeroKenBurns {
    from { transform: scale(1); }
    to { transform: scale(1.04); }
}

.home-hero__bg-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #091e42 0%, #0f3d56 45%, #1e3a8a 100%);
}
.home-hero__scrim {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(to top, rgba(0, 0, 0, .68) 0%, rgba(0, 0, 0, .28) 42%, rgba(0, 0, 0, .08) 100%),
        linear-gradient(to inline-start, rgba(0, 0, 0, .48) 0%, rgba(0, 0, 0, .18) 38%, transparent 72%);
    pointer-events: none;
}
.home-hero__content {
    position: absolute;
    inset-inline-start: 0;
    inset-inline-end: auto;
    bottom: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    text-align: start;
    padding: var(--space-lg);
    padding-bottom: calc(var(--space-2xl) + 56px);
    z-index: 2;
    width: min(480px, calc(100% - var(--space-lg)));
    max-width: 100%;
    min-width: 0;
    pointer-events: none;
}
.home-hero__content > * {
    pointer-events: auto;
}
.home-hero__copy {
    width: 100%;
    min-width: 0;
    min-height: var(--hero-copy-min-h, 370px);
    display: grid;
    gap: 0;
    align-content: end;
}
.home-hero__badge-slot {
    min-height: 30px;
    display: flex;
    align-items: flex-end;
    margin-bottom: var(--space-sm);
}
@media (min-width: 768px) {
    .home-hero__badge-slot {
        margin-bottom: var(--space-md);
    }
}
.home-hero__badge {
    display: inline-block;
    padding: 6px 14px;
    margin-bottom: 0;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 18px;
    letter-spacing: 0;
    color: #fff;
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .22);
    backdrop-filter: blur(14px);
}
@media (min-width: 768px) {
    .home-hero__content {
        padding: var(--space-2xl);
        padding-bottom: calc(var(--space-2xl) + 64px);
    }
}
.home-hero__title {
    margin: 0 0 var(--space-sm);
    font-size: clamp(1.125rem, 0.95rem + 0.95vw, 1.5rem);
    font-weight: 700;
    line-height: 1.48;
    letter-spacing: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: var(--hero-title-min-h, 102px);
    color: #fff;
    text-wrap: balance;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -webkit-text-stroke: 0.35px rgba(0, 0, 0, .55);
    paint-order: stroke fill;
    text-shadow:
        0 0 1px rgba(0, 0, 0, .95),
        0 0 2px rgba(0, 0, 0, .85),
        0 1px 2px rgba(0, 0, 0, .75),
        0 2px 10px rgba(0, 0, 0, .55),
        0 4px 24px rgba(0, 0, 0, .42);
}
.home-hero__excerpt {
    margin: 0 0 var(--space-md);
    font-size: clamp(0.8125rem, 0.78rem + 0.2vw, 0.9375rem);
    font-weight: 400;
    line-height: 1.65;
    color: rgba(255, 255, 255, .94);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: var(--hero-excerpt-min-h, 74px);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-wrap: pretty;
    -webkit-text-stroke: 0.25px rgba(0, 0, 0, .45);
    paint-order: stroke fill;
    text-shadow:
        0 0 1px rgba(0, 0, 0, .9),
        0 1px 2px rgba(0, 0, 0, .65),
        0 2px 12px rgba(0, 0, 0, .45);
}
.home-hero__excerpt.is-empty {
    visibility: hidden;
}
@media (min-width: 768px) {
    .home-hero {
        --hero-title-min-h: 132px;
        --hero-excerpt-min-h: 97px;
        --hero-copy-min-h: 390px;
    }
    .home-hero__title {
        font-size: clamp(1.375rem, 1.05rem + 0.9vw, 1.875rem);
        line-height: 1.4;
        margin-bottom: var(--space-md);
        -webkit-line-clamp: 5;
    }
    .home-hero__excerpt {
        font-weight: 500;
        line-height: 1.75;
        -webkit-line-clamp: 3;
    }
}
@media (min-width: 1024px) {
    .home-hero__title {
        font-size: clamp(1.5rem, 1.1rem + 0.65vw, 2rem);
        line-height: 1.38;
    }
}
.home-hero__date-slot {
    min-height: 22px;
    display: flex;
    align-items: center;
}
.home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.home-hero__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    height: 52px;
    padding: 0 var(--space-lg);
    border-radius: 16px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    background: #fff;
    color: var(--text-primary) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
    transition: transform .25s ease, box-shadow .25s ease;
}
.home-hero__cta-icon {
    display: inline-flex;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform .25s ease;
}
.home-hero__slide-link:hover .home-hero__cta-icon {
    transform: translateX(-3px);
}
.home-hero__slide-link:hover .home-hero__cta {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .22);
}
.home-hero__date {
    display: block;
    font-size: 13px;
    font-weight: 500;
    line-height: 22px;
    color: rgba(255, 255, 255, .72);
}

/* Slider chrome — overlaid on hero image */
.home-hero__chrome {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    z-index: 4;
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    pointer-events: none;
    background: linear-gradient(to top, rgba(0, 0, 0, .45) 0%, transparent 100%);
}
.home-hero__progress {
    height: 3px;
    background: rgba(255, 255, 255, .28);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: var(--space-md);
    pointer-events: none;
}
.home-hero__progress-bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--primary);
    border-radius: inherit;
    transition: width .1s linear;
    transform-origin: inline-start;
}
.home-hero__progress-bar.is-animating {
    animation: homeHeroProgress 6.5s linear forwards;
}
@keyframes homeHeroProgress {
    from { width: 0; }
    to { width: 100%; }
}
.home-hero__controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    pointer-events: auto;
}
.home-hero__arrows {
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
}
.home-hero__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(14px);
    color: var(--text-primary);
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
    transition: background .2s ease, transform .25s ease;
    font-family: inherit;
}
.home-hero__btn:hover {
    transform: scale(1.06);
}
.home-hero__btn:focus-visible {
    outline: 3px solid rgba(10, 132, 255, .28);
    outline-offset: 2px;
}
.home-hero__counter {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, .92);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    backdrop-filter: blur(14px);
}
.home-hero__counter-sep { opacity: .45; margin-inline: 4px; }

/* Thumbnail strip */
.home-hero__thumbs {
    display: flex;
    flex-direction: row;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg) var(--space-lg);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-top: 1px solid var(--border);
    background: var(--surface);
    direction: rtl;
    height: calc(86px + var(--space-md) + var(--space-lg));
    min-height: calc(86px + var(--space-md) + var(--space-lg));
}
.home-hero__thumbs::-webkit-scrollbar {
    display: none;
}
.home-hero__thumb {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: min(232px, 50vw);
    min-height: 86px;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: transparent;
    cursor: pointer;
    text-align: start;
    font-family: inherit;
    transition: background .2s ease, border-color .2s ease, box-shadow .25s ease;
    scroll-snap-align: start;
}
.home-hero__thumb:hover {
    background: var(--surface-secondary);
}
.home-hero__thumb.is-active {
    background: var(--accent-soft);
    border-color: rgba(10, 132, 255, .22);
    box-shadow: 0 4px 16px rgba(10, 132, 255, .12);
}
.home-hero__thumb-img {
    position: relative;
    flex-shrink: 0;
    width: 58px;
    height: 58px;
    border-radius: 13px;
    overflow: hidden;
    background: var(--surface-secondary);
}

.home-hero__thumb-backdrop {
    position: absolute;
    inset: -18%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(14px) saturate(1.1);
    opacity: 0.48;
    transform: scale(1.08);
    pointer-events: none;
}

.home-hero__thumb-photo,
.home-hero__thumb-img img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
}
.home-hero__thumb-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #64d2ff, #7c4dff);
}
.home-hero__thumb-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 22px;
    min-height: 44px;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Main layout — single column on tablet/mobile */
.home-layout {
    display: grid;
    gap: var(--space-xl);
    align-items: start;
}
@media (min-width: 1024px) {
    .home-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: var(--space-xl);
    }
    .home-main { min-width: 0; }
    .home-aside { min-width: 0; }
}

.home-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: box-shadow .25s ease;
}
.home-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    padding: var(--space-lg) var(--space-lg) var(--space-md);
}
.home-panel__title-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.home-panel__accent {
    width: 4px;
    height: 24px;
    border-radius: 999px;
    background: var(--primary);
    flex-shrink: 0;
}
.home-panel__accent--teal { background: var(--teal); }
.home-panel__accent--violet { background: var(--accent-purple); }
.home-panel__title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 38px;
    color: var(--text-primary);
}
.home-panel__more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary) !important;
    text-decoration: none !important;
    transition: gap .2s var(--ease-out), color .2s ease;
}
.home-panel__more:hover {
    gap: 8px;
    color: var(--primary-hover) !important;
}
.home-panel__body {
    padding: 0 var(--space-lg) var(--space-lg);
}

/* Articles */
.home-articles__lead { margin-bottom: var(--space-md); }
.home-articles--grid {
    display: grid;
    gap: var(--space-md);
}
@media (min-width: 640px) {
    .home-articles--grid { grid-template-columns: repeat(2, 1fr); }
}

/* Sidebar tutorials */
.home-aside {
    display: grid;
    gap: var(--space-lg);
}
.home-panel--compact .home-panel__head {
    padding-block: var(--space-md) var(--space-sm);
}
.home-panel--compact .home-panel__title {
    font-size: 18px;
    line-height: 30px;
}
.home-tuts {
    list-style: none;
    margin: 0;
    padding: 0 var(--space-md) var(--space-md);
    display: grid;
    gap: 2px;
}
.home-tuts__link {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    grid-template-areas: "num media text arrow";
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-sm);
    border-radius: 14px;
    color: inherit !important;
    text-decoration: none !important;
    transition: background .2s ease, transform .25s ease;
}
.home-tuts__link:hover {
    background: var(--surface-secondary);
}
.home-tuts__num {
    width: 24px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.home-tuts__media {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-secondary);
    flex-shrink: 0;
}
.home-tuts__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.home-tuts__media-fallback {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #64d2ff, #7c4dff);
}
.home-tuts__text { min-width: 0; }
.home-tuts__title {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 28px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.home-tuts__meta {
    display: block;
    font-size: 13px;
    font-weight: 500;
    line-height: 22px;
    color: var(--text-tertiary);
    margin-top: 2px;
}
.home-tuts__arrow {
    color: var(--text-tertiary);
    font-size: 14px;
    opacity: 0;
    transform: translateX(4px);
    transition: opacity .2s ease, transform .25s var(--ease-out);
}
.home-tuts__link:hover .home-tuts__arrow {
    opacity: 1;
    transform: translateX(0);
}
.home-panel__more-icon {
    display: inline-flex;
    flex-shrink: 0;
    transition: transform .2s var(--ease-out);
}
.home-panel__more:hover .home-panel__more-icon {
    transform: translateX(-3px);
}

/* Apps */
.home-apps {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: 0 var(--space-md) var(--space-md);
}
.home-app {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    color: inherit !important;
    text-decoration: none !important;
    box-shadow: var(--shadow-soft);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.home-app:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(124, 77, 255, .2);
}
.home-app__icon {
    --home-app-hue: 142;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin-bottom: var(--space-sm);
    border-radius: 14px;
    background: linear-gradient(145deg,
        hsl(var(--home-app-hue) 55% 52%) 0%,
        hsl(calc(var(--home-app-hue) + 25) 50% 42%) 100%);
    color: #fff;
    box-shadow: 0 0.5px 1px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .07);
    border: 1px solid rgba(0, 0, 0, .1);
    overflow: hidden;
}
.home-app__icon--img {
    background: #fff;
    padding: 0;
}
.home-app__icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.home-app__icon-letter {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    user-select: none;
}
.home-app__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 28px;
}
.home-app__tag {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 500;
    line-height: 22px;
    color: var(--text-tertiary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.home-empty {
    padding: var(--space-3xl) var(--space-lg);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 15px;
}

/* Skeleton shimmer (optional loading state) */
.home-skeleton {
    border-radius: var(--radius-lg);
    background: linear-gradient(90deg, var(--surface-secondary) 25%, #e8ecf1 50%, var(--surface-secondary) 75%);
    background-size: 200% 100%;
    animation: homeShimmer 1.4s infinite;
}
@keyframes homeShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

body.is-home main {
    padding-top: var(--space-md);
    overflow-x: clip;
}
body.is-home .home {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}
@media (max-width: 767px) {
    body.is-home main.wrap {
        width: 100%;
        max-width: 100%;
        padding-inline: var(--space-md);
    }

    .home-hero-wrap,
    .home-layout,
    .home-main,
    .home-aside,
    .home-panel,
    .home-panel__body {
        min-width: 0;
        max-width: 100%;
    }

    .home {
        gap: var(--space-xl);
    }
    .home-hero {
        --hero-title-min-h: 132px;
        --hero-excerpt-min-h: 56px;
        --hero-copy-min-h: 250px;
    }
    .home-hero__viewport {
        height: min(108vw, 520px);
        min-height: 440px;
    }
    .home-hero__title {
        font-size: clamp(0.9375rem, 0.84rem + 1vw, 1.1875rem);
        line-height: 1.5;
        -webkit-line-clamp: 6;
        margin-bottom: var(--space-xs);
    }
    .home-hero__content {
        inset-inline: 0;
        width: 100%;
        max-width: 100%;
        padding: var(--space-md);
        padding-bottom: calc(var(--space-xl) + 48px);
    }
    .home-hero__copy {
        gap: var(--space-xs);
    }
    .home-hero__excerpt {
        font-size: 0.8125rem;
        line-height: 1.58;
        -webkit-line-clamp: 2;
        margin-bottom: var(--space-sm);
    }
    .home-hero__cta {
        height: 46px;
        padding: 0 var(--space-md);
        font-size: 14px;
    }
    .home-hero__chrome {
        padding-inline: var(--space-md);
    }
    .home-panel__title {
        font-size: 20px;
        line-height: 32px;
    }
    .home-panel__head,
    .home-panel__body {
        padding-inline: var(--space-md);
    }
    .home-apps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-sm);
        padding-inline: var(--space-sm);
    }
    .home-app {
        padding: var(--space-md) var(--space-sm);
    }
    .home-articles--grid {
        grid-template-columns: 1fr;
    }

    .home-hero__thumbs {
        padding-inline: var(--space-md);
    }

    .home-hero__thumb {
        width: min(220px, 78vw);
    }

    .home-tuts__title {
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 767px) {
    .home-layout { gap: var(--space-lg); }
    .home-aside { gap: var(--space-lg); }
}

@media (prefers-reduced-motion: reduce) {
    .home-hero__slide,
    .home-hero__media-img,
    .post-card__link,
    .home-hero__progress-bar.is-animating,
    .home-app {
        transition: none;
        animation: none;
    }
    .home-hero__slide.is-active .home-hero__media-img {
        transform: none;
    }
}
