/* =====================================================================
   Home page v2 — templates/app/newhome_content.html (+ static/js/home-v2.js)
   Replaces newhome-main.css (504KB theme) + newhome.css + GSAP.
   Rules of thumb kept everywhere below:
   - only transform animates (runs on the compositor, not the main thread);
     no animated filters / shadows / backdrop-filter / custom properties
   - big decorations (rings, discs, shadows) are static; only small items move
   - the stacked cards are plain position:sticky (native scroll, no pinning)
   All classes are prefixed nh- so nothing collides with main.css.
   ===================================================================== */

/* ---------- header over the dark hero (same look as the old home) ---------- */
body > nav {
    position: absolute;
    top: 0;
    color: #fff;
    background: transparent;
    border-color: rgb(255 255 255 / 19%);
}
@media (min-width: 768px) {
    body #menuModal {
        position: absolute;
        top: 0;
        z-index: 9999;
        padding: 0 12px;
        color: #fff;
        background: transparent;
        border-bottom: 1px solid rgb(255 255 255 / 19%);
        -webkit-backdrop-filter: blur(19px);
        backdrop-filter: blur(19px);
    }
}
body .h-cat-menu { color: #fff; }
body .h-cat-menu svg { fill: #fff; }
body div.sign-menu svg, body a.sign-menu svg { fill: #fff !important; }
body .sabt-asli { background: transparent; color: #fff !important; border-color: rgb(255 255 255 / 23%); }
body .sign-menu.logined { background: transparent !important; border-color: rgb(255 255 255 / 20%); color: #fff !important; }
body .menu-icon svg path { fill: #fff !important; }
body .downmenu { display: none !important; }

.nh-sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* =====================================================================
   Orbit (hero + every card)
   .nh-orbit is the dashed ring (static); .nh-orbit__disc is the static disc;
   each .nh-orbit__item is placed on the ring by --a and, when JS runs, gets its
   own WAAPI animation around the same circle (keeps it upright).
   ===================================================================== */
.nh-orbit {
    --ring: 900px;       /* ring diameter */
    --disc: 700px;       /* inner disc diameter */
    --bw: 10px;          /* ring border width */
    --item-w: 160px;
    --item-h: 146px;
    --r: calc(var(--ring) / 2 - var(--bw) / 2);
    position: absolute;
    width: var(--ring);
    height: var(--ring);
    border: var(--bw) dashed #fff;
    border-radius: 50%;
    touch-action: pan-y;             /* vertical swipe still scrolls the page */
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.nh-orbit:active { cursor: grabbing; }
.nh-orbit__disc {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--disc);
    height: var(--disc);
    margin: calc(var(--disc) / -2) 0 0 calc(var(--disc) / -2);
    border-radius: 50%;
    background: linear-gradient(180deg, hsl(218 42% 10% / 59%), hsl(218 90% 19% / 27%));
    box-shadow: 0 0 50px rgb(0 0 0 / 25%);
    pointer-events: none;
}
.nh-orbit__item {
    position: absolute;
    left: 50%;
    top: 50%;
    width: var(--item-w);
    height: var(--item-h);
    margin: calc(var(--item-h) / -2) 0 0 calc(var(--item-w) / -2);
    transform: rotate(var(--a, 0deg)) translateY(calc(var(--r) * -1)) rotate(calc(var(--a, 0deg) * -1)) rotate(var(--tilt, 0deg));
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    border: 2px solid #38517a;
    /* frosted glass like the old home. backdrop blur is the one costly effect kept on a
       moving element: only a few small items, and they are paused whenever off-screen
       or under another card, so it only costs while actually visible */
    background: linear-gradient(45deg, rgb(255 255 255 / 3%), rgb(21 98 223 / 12%), rgb(255 255 255 / 7%));
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    pointer-events: none;
}
.nh-orbit__item img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 10px;
    object-fit: contain;
    -webkit-user-drag: none;
}

/* =====================================================================
   Hero
   ===================================================================== */
.nh-hero {
    position: relative;               /* no z-index: the search overlay must stay above the page */
    display: flex;
    flex-direction: column;
    min-height: 80vh;
    min-height: 80svh;
    padding: 100px 0 30px;
    color: #fff;
}
.nh-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    isolation: isolate;               /* Safari: keep moving items inside the rounded clip */
    overflow: hidden;
    border-radius: 0 0 55px 55px;
    background: linear-gradient(270deg, #09367f, #102d5c, #0a172d);
}
/* size follows the viewport so the lowest item never reaches the category row
   (items reach 2/3 of the ring below the hero top) nor the text column */
.nh-orbit--hero {
    --ring: min(860px, 60vw, calc(117vh - 330px));
    --disc: calc(var(--ring) * .78);
    top: calc(var(--ring) / -3);
    inset-inline-end: calc(var(--ring) / -3);   /* rtl: left side, ltr: right side */
}
@supports (height: 1svh) {
    .nh-orbit--hero { --ring: min(860px, 60vw, calc(117svh - 330px)); }
}
.nh-orbit--hero .nh-orbit__disc {    /* turns with the items (data-nh-spin), so the gradient rotates */
    background: linear-gradient(180deg, #0a172b, #0d439b);
}
.nh-orbit--hero .nh-orbit__item {
    z-index: 1;
    border: 1px solid rgb(255 255 255 / 28%);
    background: rgb(255 255 255 / 5%);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(15px);
}

.nh-hero__inner {
    position: relative;               /* no z-index: see .search-container below */
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0 5%;
    pointer-events: none;             /* let the orbit behind receive drags */
}
.nh-hero__content {
    width: 50%;
    max-width: 660px;
    pointer-events: auto;
}

.nh-title {
    margin: 0;
    color: #fff;
    font-size: clamp(28px, 3.1vw, 50px);
    font-weight: 800;
    line-height: 1.55;
    letter-spacing: -.3px;
}
.nh-title__line { display: block; }
.nh-title__line + .nh-title__line { color: rgb(255 255 255 / 88%); }
.nh-title__accent {
    background: linear-gradient(90deg, #8ec2ff, #fff 75%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* search bar (includes/search_bar.html) — not sticky inside the hero */
.nh-search { margin-top: 28px; }
.nh-hero .search-container {
    position: relative;
    top: auto;
    z-index: 20;                      /* above the page-level blur overlay (z 5) and .nh-cats */
    margin: 0;
    padding: 0;
    background: none;
}
.nh-hero .search-bar {
    max-width: none;
    margin: 0;
    box-shadow: 0 12px 32px rgb(0 0 0 / 25%);
}
/* results: a separate card under the bar; hidden while empty (js.js shows the box on
   focus even with nothing in it, which on the dark hero looked like a broken white box) */
.nh-hero .results-container {
    top: calc(100% + 8px);
    max-height: min(420px, 60vh);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgb(0 0 0 / 28%);
    color: var(--black, #222);
    text-align: start;
}
.nh-hero .results-container.nh-empty { display: none !important; }

.nh-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 30px;
    margin-top: 28px;
}
.nh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-decoration: none;
}
/* the original button design: a transparent -> #0052d8 gradient turning around it.
   Rotating a square layer (transform, compositor) looks the same as the old animated
   --gradient-angle, which re-styled the page on every frame */
.nh-btn--primary {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    min-width: 240px;
    padding: 3px;
    border-radius: 50px;
    color: #fff;
}
.nh-btn--primary::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    z-index: -1;
    width: 100%;
    height: 0;
    padding-bottom: 100%;             /* square as wide as the button */
    margin-top: -50%;
    background: linear-gradient(180deg, rgb(0 0 0 / 0%), #0052d8);
    animation: nh-spin 7s linear infinite;
}
.nh-btn--primary span {
    display: block;
    width: 100%;
    padding: 10px 20px;
    border-radius: 50px;
    background: #134594;
    font-size: 18px;
    text-align: center;
    transition: background-color .25s;
}
.nh-btn--primary:hover { color: #fff; }
.nh-btn--primary:hover span { background: #1a55b5; }
.nh-btn--ghost {
    padding: 2px;
    border-bottom: 1px solid currentColor;
    color: rgb(255 255 255 / 80%);
    font-size: 17px;
    font-weight: 400;
}
.nh-btn--ghost:hover { color: #fff; }
@keyframes nh-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* categories row: icon is a transparent PNG used as a mask -> painted white */
.nh-cats {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 12px;
    width: calc(100% - 10%);
    max-width: 1280px;
    margin: 36px auto 0;
}
.nh-cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-width: 0;
    padding: 16px 6px 14px;
    border: 1px solid rgb(255 255 255 / 12%);
    border-radius: 18px;
    background: rgb(255 255 255 / 6%);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    transition: background-color .25s, border-color .25s, transform .25s;
}
.nh-cat:hover {
    color: #fff;
    background: rgb(255 255 255 / 14%);
    border-color: rgb(255 255 255 / 32%);
    transform: translateY(-3px);
}
.nh-cat__icon {
    flex: none;
    width: 38px;
    height: 38px;
    object-fit: contain;
    filter: brightness(0) invert(1);  /* any dark icon on a transparent background -> white */
}
.nh-cat__name {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =====================================================================
   Famous businesses marquee
   ===================================================================== */
.nh-brands {
    --card-w: clamp(260px, 34vw, 520px);
    --card-h: calc(var(--card-w) * .74);
    --gap: clamp(14px, 2vw, 30px);
    padding: 64px 0 40px;
    overflow: hidden;
}
.nh-marquee { direction: ltr; }
.nh-marquee__row {
    padding: calc(var(--gap) / 2) 0;
    overflow: hidden;
    touch-action: pan-y;              /* sideways swipe drags the row, vertical scrolls the page */
    cursor: grab;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.nh-marquee__row.is-dragging { cursor: grabbing; }
.nh-marquee__shift {                 /* added by JS: scroll boost / drag offset layer */
    width: max-content;
    will-change: transform;
}
.nh-marquee__track {
    display: flex;
    width: max-content;
}
.nh-brand {
    position: relative;
    display: block;
    flex: none;
    width: var(--card-w);
    height: var(--card-h);
    margin-right: var(--gap);         /* margin (not gap) so both halves of the loop are equal */
    overflow: hidden;
    border-radius: 25px;
    background: #e3e9f4;
    direction: rtl;
    -webkit-user-drag: none;
}
.nh-brand img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-user-drag: none;
}
.nh-brand__name {
    position: absolute;
    right: 14px;
    bottom: 14px;
    padding: 7px 18px;
    border-radius: 14px;
    background: rgb(255 255 255 / 88%);
    color: #0b1b36;
    font-size: 16px;
    font-weight: 700;
}
.nh-brand--caption {
    display: flex;
    align-items: flex-end;
    padding: clamp(22px, 3vw, 40px);
    background: linear-gradient(196deg, #09367f, #102d5c, #0a172d);
    direction: ltr;
}
.nh-brand--caption p {
    margin: 0;
    color: #fff;
    font-size: clamp(22px, 2.6vw, 42px);
    font-weight: 700;
    line-height: 1.25;
}

/* =====================================================================
   Stacked category cards — pure CSS sticky: every card sticks at the same
   top and the next one scrolls over it. No JS, no pinning, no scaling.
   ===================================================================== */
.nh-stack {
    --top: 24px;
    /* spacing via gap, not card margins: a sticky box keeps its margin inside the
       container, so margins would push the covered cards up at the end of the pile */
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: calc(100% - 64px);
    max-width: 1400px;
    margin: 40px auto 80px;
}
.nh-card {
    flex: none;
    position: -webkit-sticky;
    position: sticky;
    top: var(--top);
    /* all cards share one compact height, capped by the small viewport
       (svh does not change when the address bar hides/shows) */
    display: flex;
    height: min(480px, calc(100vh - var(--top) - 24px));
    height: min(480px, calc(100svh - var(--top) - 24px));
    overflow: hidden;
    isolation: isolate;               /* Safari: clip the moving orbit items to the radius */
    border-radius: 40px;
    background: var(--bg, #1562df);
    color: #fff;
}

/* the "meydan" on the card's left: an island a touch deeper than the card colour with a
   light rim, inside a long-dash lane; the icons drive along the lane (8 of them). */
.nh-orbit--card {
    --ring: 350px;
    --disc: calc(var(--ring) * .56);
    --bw: 3px;
    --item-w: 58px;
    --item-h: 58px;
    --lane: rgb(255 255 255 / 50%);
    top: 50%;
    margin-top: calc(var(--ring) / -2);
    inset-inline-end: 64px;           /* rtl: left side */
    border-color: transparent;        /* the lane line is the turning .nh-meydan__lane */
}
.nh-orbit--card .nh-orbit__disc {      /* the island */
    background:
        radial-gradient(circle at 35% 30%, rgb(255 255 255 / 12%), rgb(255 255 255 / 0%) 65%),
        linear-gradient(rgb(0 10 60 / 16%), rgb(0 10 60 / 16%)),
        var(--bg);
    border: 3px solid rgb(255 255 255 / 55%);
    box-shadow: 0 0 0 10px rgb(255 255 255 / 6%), 0 12px 30px rgb(0 10 50 / 18%);
}
.nh-meydan__lane {                     /* long dashes on the lane; turns with the icons */
    position: absolute;
    inset: calc(var(--bw) * -1);
    border-radius: 50%;
    background: repeating-conic-gradient(var(--lane) 0 5deg, transparent 5deg 12deg);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
    pointer-events: none;
}
.nh-orbit--card .nh-orbit__item {
    z-index: 3;
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: 16px;
    background: rgb(255 255 255 / 20%);
}
.nh-orbit--card .nh-orbit__item img { padding: 12px; }

.nh-card__go {
    position: absolute;
    top: 24px;
    inset-inline-start: 24px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgb(0 0 0 / 35%);
    color: #fff;
    transition: transform .3s;
}
.nh-card__go:hover { color: #fff; transform: scale(1.06); }
.nh-card__go svg { width: 22px; height: 22px; }

.nh-card__body {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: none;
    width: calc(100% - var(--ring-space, 540px));
    padding: 34px 40px 36px;
    pointer-events: none;             /* orbit behind stays draggable; links re-enable below */
}
.nh-card__title {
    margin: 0;
    padding-inline-start: 84px;
    padding-top: 10px;
    color: #fff;
    font-size: clamp(24px, 2.4vw, 38px);
    font-weight: 900;
    line-height: 1.4;
}
/* tags: soft glass pills (design 3) */
.nh-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    pointer-events: auto;
}
.nh-tags a {
    padding: 6px 18px;
    border: 1px solid rgb(255 255 255 / 38%);
    border-radius: 999px;
    background: rgb(255 255 255 / 8%);
    color: #fff;
    font-size: 14px;
    line-height: 1.6;
    transition: background-color .2s, border-color .2s;
}
.nh-tags a:hover {
    color: #fff;
    background: rgb(255 255 255 / 20%);
    border-color: rgb(255 255 255 / 70%);
}
.nh-stats {
    display: flex;
    gap: 12%;
    margin-top: 22px;
}
.nh-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.nh-stat__num {
    direction: ltr;
    font-size: clamp(30px, 2.8vw, 44px);
    font-weight: 900;
    line-height: 1.15;
}
.nh-stat__label { font-size: 14px; opacity: .9; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1399.9px) {
    .nh-cats { gap: 10px; }
    .nh-cat { font-size: 12px; }
}

@media (max-width: 1023.9px) {
    .nh-hero {
        --ring: 600px;
        --item-h: 146px;
        padding-top: calc(30px + var(--ring) / 2 + var(--item-h) / 2 + 24px);
        min-height: 0;
    }
    .nh-orbit--hero {
        --ring: 600px;
        --disc: 470px;
        top: calc(30px - var(--ring) / 2);
        inset-inline-end: auto;
        left: 50%;
        margin-left: calc(var(--ring) / -2);
    }
    .nh-hero__inner { padding: 0 20px; justify-content: center; }
    .nh-hero__content { width: 100%; max-width: 640px; text-align: center; }
    .nh-actions { justify-content: center; }
    .nh-cats {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-top: 30px;
        padding: 2px 20px 6px;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scroll-padding-inline: 20px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .nh-cats::-webkit-scrollbar { display: none; }
    .nh-cat { flex: 0 0 96px; scroll-snap-align: start; }

}

@media (max-width: 599.9px) {
    .nh-hero { --ring: 520px; --item-h: 108px; }
    .nh-hero__bg { border-radius: 0 0 40px 40px; }
    .nh-orbit--hero {
        --ring: 520px;
        --disc: 400px;
        --bw: 7px;
        --item-w: 118px;
        --item-h: 108px;
    }
    .nh-orbit__item img { padding: 8px; }
    .nh-title { font-size: min(28px, 6.3vw); }
    .nh-title__line { white-space: nowrap; }   /* always exactly two lines */
    .nh-btn--primary { min-width: 0; }
    .nh-btn--primary span { font-size: 15px; padding: 10px 22px; }
    .nh-btn--ghost { font-size: 15px; }
    .nh-cat {flex-basis: 95px;}
}

/* ---------- category cards, responsive ---------- */
@media (min-width: 1024px) and (max-width: 1279.9px) {
    .nh-card { --ring-space: 400px; }
    .nh-orbit--card {--ring: 300px;--item-w: 52px;--item-h: 52px;inset-inline-end: 44px;}
}
@media (max-width: 1023.9px) {
    .nh-stack { width: calc(100% - 32px); }
    /* meydan on top (full circle), text below; still one height for every card */
    .nh-card {
        flex-direction: column;
        height: min(640px, calc(100vh - var(--top) - 16px));
        height: min(640px, calc(100svh - var(--top) - 16px));
        border-radius: 32px;
    }
    .nh-orbit--card {
        --ring: 220px;
        --item-w: 44px;
        --item-h: 44px;
        top: 34px;
        margin-top: 0;
        inset-inline-end: auto;
        left: 50%;
        margin-left: calc(var(--ring) / -2);
    }
    .nh-orbit--card .nh-orbit__disc { box-shadow: 0 0 0 7px rgb(255 255 255 / 6%); }
    .nh-orbit--card .nh-orbit__item { border-radius: 12px; }
    .nh-orbit--card .nh-orbit__item img { padding: 9px; }
    .nh-card__go { top: 16px; inset-inline-start: 16px; width: 50px; height: 50px; }
    .nh-card__go svg { width: 18px; height: 18px; }
    .nh-card__body {
        flex: 1;
        width: 100%;
        min-height: 0;
        justify-content: flex-end;
        padding: 0 20px 24px;
    }
    .nh-card__title { padding: 0; margin-bottom: 14px; font-size: 24px; }
    .nh-tags { gap: 7px; }
    .nh-tags a { padding: 5px 13px; font-size: 13px; }
}
@media (max-width: 599.9px) {
    .nh-stack { --top: 12px; gap: 16px; width: calc(100% - 24px); margin-top: 24px; }
    .nh-card {
        height: min(700px, calc(100vh - var(--top) - 16px));
        height: min(700px, calc(100svh - var(--top) - 16px));
    }
    .nh-orbit--card { --ring: 210px; --item-w: 42px; --item-h: 42px; }
    .nh-card__title { font-size: 22px; }
    .nh-tags { gap: 6px; }
    .nh-tags a { padding: 5px 12px; }
    .nh-stats { justify-content: space-around; gap: 0; margin-top: 16px; }
    .nh-stat__num { font-size: 28px; }
    .nh-stat__label { font-size: 13px; }
}
/* short phones: smaller meydan and pills so the longest card still fits */
@media (max-width: 1023.9px) and (max-height: 720px) {
    .nh-orbit--card { --ring: 180px; --item-w: 38px; --item-h: 38px; top: 26px; }
    .nh-orbit--card .nh-orbit__item img { padding: 8px; }
    .nh-orbit--card .nh-orbit__item img { padding: 9px; }
    .nh-card__title { font-size: 21px; margin-bottom: 10px; }
    .nh-tags { gap: 6px; }
    .nh-tags a { padding: 4px 11px; font-size: 12px; }
    .nh-stat__num { font-size: 24px; }
}

/* =====================================================================
   Motion control
   ===================================================================== */
.nh-hero.is-paused .nh-btn--primary::before { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
    .nh-btn--primary::before { animation: none; }
    .nh-cat, .nh-card__go { transition: none; }
}
