/* ==========================================================================
   Manch — application shell (top bar, sidebar) and the Browse surface.
   Palette sampled from the Browse mock: cooler than the auth screen, and a
   redder orange.
   ========================================================================== */

.appshell {
    --page:    #05090c;
    --chrome:  #060a0d;
    --card:    #03060a;
    --raised:  #10171c;
    --field:   #14181c;
    --active:  #2c1211;

    --line:    rgba(255, 255, 255, 0.07);
    --line-2:  rgba(255, 255, 255, 0.13);

    --ink:     #f8f9f9;
    --ink-2:   #b0b1b4;
    --ink-3:   #96989b;
    --ink-4:   #6f7276;

    --accent:  #f4680f;
    --accent-2:#ef4e13;
    --accent-soft: rgba(244, 104, 15, 0.14);

    --bar: 57px;
    --rail-gap: clamp(0.875rem, 1.5vw, 1.375rem);
    --cards: 4;

    --ease: cubic-bezier(0.22, 0.68, 0, 1);

    min-height: 100vh;
    min-height: 100svh;
    background: var(--page);
    color: var(--ink);
    display: flex;
    flex-direction: column;
}

.appshell__body { display: grid; grid-template-columns: 252px minmax(0, 1fr); flex: 1; }
.appshell__main { min-width: 0; padding: 24px clamp(1.5rem, 3vw, 3rem) clamp(1.5rem, 2.5vw, 2.5rem); }

/* --- top bar ------------------------------------------------------------- */

.appshell .topbar {
    position: sticky;
    top: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 2vw, 2rem);
    height: var(--bar);
    padding-inline: clamp(1rem, 2.4vw, 2rem);
    background: rgba(6, 10, 13, 0.92);
    backdrop-filter: blur(14px) saturate(150%);
    border-bottom: 1px solid var(--line);
}

.appshell .topbar__logo {
    display: flex;
    align-items: center;
    flex: none;
    margin-right: 0.75rem;
}
/* 1.5x the original 28px, at the client's ask. */
.appshell .topbar__logo img { height: 42px; width: auto; display: block; }

.appshell .topnav { display: flex; align-items: center; gap: clamp(0.875rem, 1.6vw, 1.375rem); }
.appshell .topnav a {
    position: relative;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-2);
    transition: color 0.18s var(--ease);
}
.appshell .topnav a:hover { color: var(--ink); }

/* A section that is not built yet: present, but plainly not a link. */
.appshell .topnav span {
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-4);
    cursor: default;
}
.appshell .topnav a[aria-current] { color: var(--accent); font-weight: 600; }
.appshell .topnav a[aria-current]::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    animation: nav-underline 0.35s var(--ease);
}
@keyframes nav-underline { from { transform: scaleX(0) } to { transform: scaleX(1) } }

.appshell .topsearch {
    /* Right-hand side, beside the account control — not a centred slab. */
    width: clamp(180px, 22vw, 260px);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    height: 40px;
    padding-inline: 0.9375rem;
    background: var(--field);
    border: 1px solid transparent;
    border-radius: 999px;
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease), width 0.3s var(--ease);
}
.appshell .topsearch:focus-within { border-color: rgba(244, 104, 15, 0.5); background: #171c21; width: clamp(220px, 30vw, 340px); }
.appshell .topsearch svg { width: 17px; height: 17px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; flex: none; }
.appshell .topsearch input {
    flex: 1; min-width: 0;
    background: none; border: 0; outline: none;
    font-size: 0.9375rem; color: var(--ink);
}
.appshell .topsearch input::placeholder { color: var(--ink-4); }

.appshell .topbar__right { display: flex; align-items: center; gap: clamp(0.5rem, 1.4vw, 1rem); flex: none; margin-left: auto; }

.appshell .iconbtn {
    position: relative;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.appshell .iconbtn:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.appshell .iconbtn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.appshell .iconbtn__dot {
    position: absolute;
    top: 9px; right: 10px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--chrome);
}

.appshell .avatarbtn {
    display: flex; align-items: center; gap: 0.375rem;
    padding: 0.25rem 0.5rem 0.25rem 0.25rem;
    border: 0; border-radius: 999px;
    background: transparent;
    color: var(--ink-2);
    cursor: pointer;
    transition: background 0.18s var(--ease);
}
.appshell .avatarbtn:hover { background: rgba(255, 255, 255, 0.06); }
.appshell .avatarbtn img, .appshell .avatarbtn span.face {
    width: 34px; height: 34px;
    border-radius: 50%;
    object-fit: cover;
    display: grid; place-items: center;
    font-size: 0.75rem; font-weight: 700; color: #fff;
}
.appshell .avatarbtn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }

.appshell .burger {
    display: none;
    width: 40px; height: 40px;
    place-items: center;
    border: 1px solid var(--line); border-radius: 10px;
    background: transparent; cursor: pointer;
}
.appshell .burger span { display: block; width: 17px; height: 1.5px; background: var(--ink); position: relative; border-radius: 2px; }
.appshell .burger span::before, .appshell .burger span::after {
    content: ""; position: absolute; left: 0; width: 17px; height: 1.5px; background: var(--ink); border-radius: 2px;
    transition: transform 0.22s var(--ease);
}
.appshell .burger span::before { top: -5px; }
.appshell .burger span::after { top: 5px; }

/* --- sidebar ------------------------------------------------------------- */

.appshell .sidebar {
    position: sticky;
    top: var(--bar);
    align-self: start;
    height: calc(100svh - var(--bar));
    overflow-y: auto;
    padding: 1.5rem 0.875rem;
    background: var(--chrome);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.appshell .sidebar a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9375rem;
    padding: 0.8125rem 1rem;
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--ink-2);
    transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
}
.appshell .sidebar a svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; }
.appshell .sidebar a:hover { background: rgba(255, 255, 255, 0.045); color: var(--ink); }
.appshell .sidebar a:active { transform: scale(0.985); }

.appshell .sidebar a[aria-current] {
    background: var(--active);
    color: var(--accent);
    font-weight: 600;
}
.appshell .sidebar a[aria-current]::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    width: 3px; height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
    transform: translateY(-50%);
    animation: pip 0.3s var(--ease);
}
@keyframes pip { from { height: 0 } to { height: 22px } }

.appshell .sidebar__rule { height: 1px; background: var(--line); margin: 1.25rem 0.5rem; }

/* Entries that exist in the product but not yet in this design: shown, not
   clickable. Give the item an href in the partial to switch it back on. */
.appshell .sidebar__off {
    display: flex;
    align-items: center;
    gap: 0.9375rem;
    padding: 0.8125rem 1rem;
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--ink-4);
    cursor: default;
    user-select: none;
}
.appshell .sidebar__off svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.7; flex: none; opacity: 0.75; }

.appshell .topnav__off {
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-4);
    cursor: default;
    user-select: none;
}

.appshell .avatarbtn[aria-disabled] { cursor: default; }
.appshell .avatarbtn[aria-disabled]:hover { background: transparent; }

.appshell .sidebar__scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(3, 5, 8, 0.6);
    backdrop-filter: blur(2px);
}

/* --- hero ---------------------------------------------------------------- */

.appshell .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-radius: 16px;
    min-height: clamp(260px, 26vw, 380px);
    display: flex;
    align-items: center;
    padding: clamp(2rem, 4vw, 3.5rem);
}

.appshell .hero__img {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center 60%;
    transform: scale(1.02);
    transition: transform 8s linear;
}
.appshell .hero:hover .hero__img { transform: scale(1.06); }

.appshell .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(90deg, rgba(4, 7, 10, 0.95) 0%, rgba(4, 7, 10, 0.82) 38%, rgba(4, 7, 10, 0.35) 68%, rgba(4, 7, 10, 0.55) 100%);
}

.appshell .hero__inner { max-width: 34rem; }

.appshell .hero__eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

.appshell .hero__title {
    margin: 0.875rem 0 1rem;
    font-size: clamp(1.75rem, 1.1rem + 2.4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    line-height: 1.05;
}
.appshell .hero__title .accent { color: var(--accent); display: block; }

.appshell .hero__body { margin: 0 0 2rem; color: var(--ink-2); font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem); max-width: 34ch; }

.appshell .hero__neon {
    position: absolute;
    right: clamp(1rem, 3vw, 2.5rem);
    top: 50%;
    transform: translateY(-50%);
    text-align: right;
    font-size: clamp(0.875rem, 0.6rem + 1vw, 1.375rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: #ffe9d4;
    text-shadow: 0 0 8px rgba(255, 176, 92, 0.9), 0 0 22px rgba(244, 104, 15, 0.75), 0 0 46px rgba(244, 104, 15, 0.45);
    animation: neon 5s ease-in-out infinite;
    pointer-events: none;
}
.appshell .hero__neon::after {
    content: "";
    display: block;
    height: 2px;
    margin-top: 0.5rem;
    margin-left: auto;
    width: 70%;
    border-radius: 2px;
    background: var(--accent);
    box-shadow: 0 0 12px rgba(244, 104, 15, 0.9);
}
@keyframes neon {
    0%, 100% { opacity: 1 }
    46%      { opacity: 0.86 }
    48%      { opacity: 0.55 }
    50%      { opacity: 0.95 }
    52%      { opacity: 0.7 }
    54%      { opacity: 1 }
}

.appshell .btn-accent {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    height: 46px;
    padding: 0 1.25rem;
    border: 0;
    border-radius: 10px;
    background: linear-gradient(95deg, #fb8b22, #ef4e13);
    color: #0b0705;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.18s var(--ease), transform 0.14s var(--ease), box-shadow 0.22s var(--ease);
}
.appshell .btn-accent:hover { filter: brightness(1.06); box-shadow: 0 10px 26px rgba(239, 78, 19, 0.28); }
.appshell .btn-accent:active { transform: translateY(1px); }
.appshell .btn-accent svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2.2; transition: transform 0.22s var(--ease); }
.appshell .btn-accent:hover svg { transform: translateX(3px); }

/* --- filter bar ---------------------------------------------------------- */

.appshell .filterbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: clamp(1.75rem, 3.2vw, 2.75rem) 0 clamp(1.5rem, 2.6vw, 2rem);
    flex-wrap: wrap;
}

.appshell .chips { display: flex; gap: 0.5rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.appshell .chips::-webkit-scrollbar { display: none; }

.appshell .chip {
    display: inline-flex;
    align-items: center;
    height: 38px;
    padding: 0 1.0625rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--raised);
    color: var(--ink-2);
    font-size: 0.875rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.14s var(--ease);
}
/* A warm tint on hover, the same language as the tiles and method buttons.
   A bright neutral outline here read as an error state. */
.appshell .chip:hover {
    color: var(--ink);
    background: #161f26;
    border-color: rgba(244, 104, 15, 0.4);
}
.appshell .chip:active { transform: scale(0.98); }
.appshell .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.appshell .chip[aria-current] {
    background: var(--accent-2);
    border-color: var(--accent-2);
    color: #0b0705;
    font-weight: 700;
}
/* The selected chip should not pick up the idle hover treatment. */
.appshell .chip[aria-current]:hover {
    background: var(--accent-2);
    border-color: var(--accent-2);
    color: #0b0705;
    filter: brightness(1.07);
}

.appshell .filterbar__right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; flex-wrap: wrap; }

.appshell .select-wrap { position: relative; display: inline-flex; }
.appshell .select-wrap::after {
    content: "";
    position: absolute;
    right: 0.75rem; top: 50%;
    width: 7px; height: 7px;
    border-right: 1.5px solid var(--ink-3);
    border-bottom: 1.5px solid var(--ink-3);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
.appshell .select-wrap .select { padding-right: 2.125rem; }

.appshell .chip--clear {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: transparent;
    border-color: rgba(244, 104, 15, 0.4);
    color: var(--accent);
}
.appshell .chip--clear:hover { background: rgba(244, 104, 15, 0.1); border-color: var(--accent); }
.appshell .chip--clear svg { width: 13px; height: 13px; }

.appshell .filternote {
    font-size: 0.8125rem;
    color: var(--ink-3);
    white-space: nowrap;
}

.appshell .sr-only {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.appshell .select {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 38px;
    padding: 0 0.875rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--raised);
    color: var(--ink-2);
    font-size: 0.875rem;
    cursor: pointer;
    appearance: none;
    transition: border-color 0.18s var(--ease), color 0.18s var(--ease);
}
.appshell .select:hover { border-color: var(--line-2); color: var(--ink); }
.appshell .select:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- sections and rails -------------------------------------------------- */

.appshell .section { margin-top: clamp(2.5rem, 4.8vw, 4.25rem); }

/*
 * A plain light-grey hairline between consecutive sections, with equal space
 * above and below it.
 */
.appshell .section + .section { margin-top: clamp(1.75rem, 3.2vw, 2.75rem); }
.appshell .section + .section::before {
    content: "";
    display: block;
    height: 1px;
    margin-bottom: clamp(1.75rem, 3.2vw, 2.75rem);
    background: rgba(255, 255, 255, 0.15);
}

.appshell .section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(1.125rem, 2vw, 1.5rem);
}
.appshell .section__head h2 { font-size: clamp(1.0625rem, 0.9rem + 0.5vw, 1.375rem); font-weight: 700; letter-spacing: -0.02em; }

.appshell .viewall {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--accent);
    transition: gap 0.18s var(--ease);
}
.appshell .viewall svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.appshell .viewall:hover { gap: 0.65rem; }

.appshell .railwrap { position: relative; }

.appshell .rail {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: calc((100% - (var(--cards) - 1) * var(--rail-gap)) / var(--cards));
    gap: var(--rail-gap);
    overflow-x: auto;
    align-items: start;
    scroll-snap-type: x proximity;
    scroll-behavior: smooth;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.appshell .rail::-webkit-scrollbar { display: none; }
.appshell .rail > * { scroll-snap-align: start; }

.appshell .railbtn {
    position: absolute;
    top: 38%;
    z-index: 5;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border: 1px solid var(--line-2);
    border-radius: 50%;
    background: rgba(8, 12, 16, 0.86);
    backdrop-filter: blur(6px);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-50%) scale(0.9);
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), background 0.2s var(--ease);
}
.appshell .railbtn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2.2; }
.appshell .railbtn--prev { left: -12px; }
.appshell .railbtn--next { right: -12px; }
.appshell .railwrap:hover .railbtn { opacity: 1; transform: translateY(-50%) scale(1); }
.appshell .railbtn:hover { background: var(--accent); border-color: var(--accent); color: #0b0705; }
.appshell .railbtn[hidden] { display: none; }

/* --- tiles --------------------------------------------------------------- */

.appshell .tile {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.appshell .tile:hover {
    transform: translateY(-4px);
    border-color: rgba(244, 104, 15, 0.4);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5);
}

.appshell .tile__poster { display: block; position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0a0f14; }
.appshell .tile__poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.appshell .tile:hover .tile__poster img { transform: scale(1.06); }

.appshell .tile__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, rgba(4, 7, 10, 0) 40%, rgba(4, 7, 10, 0.55));
    opacity: 0;
    transition: opacity 0.22s var(--ease);
}
.appshell .tile:hover .tile__play { opacity: 1; }
.appshell .tile__play span {
    width: 44px; height: 44px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(10, 12, 15, 0.7);
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    transform: scale(0.85);
    transition: transform 0.22s var(--ease), background 0.22s var(--ease);
}
.appshell .tile:hover .tile__play span { transform: scale(1); }
.appshell .tile__play span:hover { background: var(--accent); border-color: var(--accent); }
.appshell .tile__play svg { width: 17px; height: 17px; fill: #fff; margin-left: 2px; }

.appshell .tile__badge {
    position: absolute;
    left: 9px; top: 9px;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(6, 9, 12, 0.78);
    backdrop-filter: blur(5px);
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffd9b8;
}
.appshell .tile__time {
    position: absolute;
    right: 9px; bottom: 9px;
    padding: 3px 7px;
    border-radius: 5px;
    background: rgba(6, 9, 12, 0.8);
    font-size: 0.6875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.appshell .tile__body { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.9375rem 1rem 1.125rem; }
.appshell .tile__text { min-width: 0; flex: 1; }
.appshell .tile__title {
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: #f5f6f3;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.appshell .tile__meta {
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: #a8a8ab;
    display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap;
}
.appshell .tile__meta .dot { opacity: 0.5; }

.appshell .tile__more {
    flex: none;
    width: 26px; height: 26px;
    display: grid; place-items: center;
    border: 0; border-radius: 6px;
    background: transparent;
    color: var(--ink-3);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s var(--ease), background 0.2s var(--ease), color 0.2s var(--ease);
}
.appshell .tile:hover .tile__more { opacity: 1; }
.appshell .tile__more:hover { background: rgba(255, 255, 255, 0.07); color: var(--ink); }
.appshell .tile__more svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }

/* genre tiles ------------------------------------------------------------- */

.appshell .genre {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--line);
    transition: transform 0.22s var(--ease), border-color 0.22s var(--ease);
}
.appshell .genre:hover { transform: translateY(-4px); border-color: rgba(244, 104, 15, 0.45); }
.appshell .genre img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease); }
.appshell .genre:hover img { transform: scale(1.07); }
.appshell .genre::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(4, 7, 10, 0.15) 30%, rgba(4, 7, 10, 0.88));
}
.appshell .genre__label {
    position: absolute;
    left: 1.0625rem; right: 1.0625rem; bottom: 1rem;
    z-index: 2;
    display: flex; align-items: center; gap: 0.5rem;
}
.appshell .genre__label svg { width: 18px; height: 18px; stroke: #fff; fill: none; stroke-width: 1.7; flex: none; }
.appshell .genre__name { font-size: 0.9375rem; font-weight: 600; }
.appshell .genre__count { display: block; font-size: 0.75rem; color: #96989b; font-weight: 400; margin-top: 1px; }

/* A filtered result set is a plain grid, on the same four-column rhythm. */
.appshell .resultgrid {
    display: grid;
    grid-template-columns: repeat(var(--cards), minmax(0, 1fr));
    gap: clamp(1.125rem, 1.8vw, 1.75rem) clamp(0.875rem, 1.5vw, 1.375rem);
}

/* --- empty state --------------------------------------------------------- */

.appshell .emptyrail {
    padding: 2.5rem 1.25rem;
    border: 1px dashed var(--line-2);
    border-radius: 12px;
    text-align: center;
    color: var(--ink-3);
    font-size: 0.9375rem;
}

/* --- entrance ------------------------------------------------------------ */

.appshell .rise { opacity: 0; animation: rise 0.6s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) } to { opacity: 1; transform: none } }


/* --- Console's rail ---------------------------------------------------------
   Fills the sidebar slot on Console pages in place of the browsing sidebar.
   It inherits .sidebar, so the sticky column, the scrim and the burger on a
   phone all keep working; only the items inside it differ. */

.appshell .sidebar--console { padding-top: 1.25rem; }

.appshell .sidebar__grp {
    margin: 1.125rem 0 0.25rem 1rem;
    font-size: 0.625rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-4);
}
.appshell .sidebar__grp:first-child { margin-top: 0; }

.appshell .sidebar__consolelink {
    display: block;
    padding: 0.625rem 1rem;
    border-radius: 10px;
    font-size: 0.9375rem;
    color: var(--ink-2);
    transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.appshell .sidebar__consolelink:hover { background: rgba(255, 255, 255, 0.045); color: var(--ink); }

.appshell .sidebar__consolelink[aria-current] {
    background: var(--active);
    color: var(--accent);
    font-weight: 600;
}

/* The way out, held apart from the rail it does not belong to. */
.appshell .sidebar__consolelink--out {
    margin-top: auto;
    padding-top: 0.875rem;
    border-top: 1px solid var(--line);
    border-radius: 0;
    font-size: 0.8125rem;
    color: var(--ink-4);
}
.appshell .sidebar__consolelink--out:hover { background: none; color: var(--accent); }

/* --- shell footer ---------------------------------------------------------
   Type and colour are the shell's own — Switzer, the grey ramp, the orange
   hover. Only the spacing comes from the prototype's footer: 22px between
   columns, 26px down to the notice, 9px under each heading and 3px of
   padding per row. */

.appshell .shellfoot {
    margin-top: clamp(1.25rem, 2vw, 2rem);
    padding: 34px clamp(1.5rem, 3vw, 3rem) 60px;
    border-top: 1px solid var(--line);
    background: var(--chrome);
}
.appshell .shellfoot__inner {
    /* Lines up with the content column above it. */
    max-width: 1240px;
    margin-inline: auto;
}

/* Four columns of links, each under a small upper-case heading. */
.appshell .shellfoot__cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 26px;
}

.appshell .shellfoot__kicker {
    margin: 0 0 9px;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-4);
}

.appshell .shellfoot__list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.appshell .shellfoot__list a, .appshell .shellfoot__list span {
    display: block;
    padding: 3px 0;
    font-size: 0.875rem;
    color: var(--ink-2);
    transition: color 0.18s var(--ease);
}
.appshell .shellfoot__list a:hover { color: var(--accent); }
/* A section that is not built yet: present, but plainly not a link. */
.appshell .shellfoot__list span { color: var(--ink-4); cursor: default; }

.appshell .shellfoot__notice {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.7;
    color: var(--ink-3);
    /* Centred, at the client's ask: it reads as a sign-off under the columns
       rather than as another paragraph of them. */
    text-align: center;
}

/* --- tablet -------------------------------------------------------------- */

@media (max-width: 1024px) {
    .appshell { --cards: 3; }
    .appshell__body { grid-template-columns: minmax(0, 1fr); }

    .appshell .burger { display: grid; }
    .appshell .topnav { display: none; }

    .appshell .sidebar {
        /* Sits below the bar, not under it: the bar is z-index 70. */
        position: fixed;
        top: var(--bar); bottom: 0; left: 0;
        z-index: 68;
        width: 276px;
        height: calc(100svh - var(--bar));
        padding-top: 1rem;
        transform: translateX(-102%);
        transition: transform 0.3s var(--ease);
        border-right: 1px solid var(--line-2);
    }
    .appshell.is-open .sidebar { transform: none; }
    .appshell.is-open .sidebar__scrim { display: block; }
}

/* --- phone --------------------------------------------------------------- */

@media (max-width: 720px) {
    .appshell { --cards: 2; }

    .appshell { --bar: 62px; }
    .appshell .topbar { gap: 0.5rem; }
    .appshell .topbar__logo img { height: 36px; }
    .appshell .topsearch { width: clamp(140px, 34vw, 220px); height: 38px; }
    .appshell .topsearch:focus-within { width: clamp(160px, 40vw, 260px); }

    /* The search takes the row on its own below the bar on the narrowest screens. */
    .appshell .hero { min-height: 230px; padding: 1.5rem 1.375rem; border-radius: 14px; }
    .appshell .hero__neon { display: none; }
    .appshell .hero__body { display: none; }
    .appshell .hero__title { margin-bottom: 1rem; }

    .appshell__main { padding-inline: 1.125rem; }
    .appshell .railbtn { display: none; }
    .appshell .tile__more { opacity: 1; }

    .appshell .shellfoot__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1.25rem; }
}

@media (max-width: 460px) {
    .appshell { --cards: 1.4; }
    .appshell .topsearch { display: none; }
    .appshell .filterbar__right { width: 100%; margin-left: 0; }
    .appshell .select { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .appshell .rise { opacity: 1 !important; animation: none !important; transform: none !important; }
    .appshell .hero__img, .appshell .hero__neon, .appshell .sidebar a[aria-current]::before, .appshell .topnav a[aria-current]::after { animation: none !important; transition: none !important; }
    .appshell .rail { scroll-behavior: auto; }
}

/* --- bare pages -------------------------------------------------------------
   No sidebar: the top bar carries the whole of the navigation, so its links
   stay visible at every width instead of folding into a drawer that is no
   longer there. Placed last so it wins over the tablet and phone rules above. */

.appshell--bare .appshell__body { grid-template-columns: minmax(0, 1fr); }
.appshell--bare .burger { display: none; }
.appshell--bare .topnav { display: flex; }

@media (max-width: 720px) {
    .appshell--bare .topbar { flex-wrap: wrap; height: auto; padding-block: 0.75rem; }
    .appshell--bare .topnav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
        gap: 1.25rem;
    }
    .appshell--bare .topnav::-webkit-scrollbar { display: none; }
    .appshell--bare .topnav a { white-space: nowrap; }
}

/* --- top bar: the paid-tier button and the sign-in link ---------------------
   The design puts one accent button at the end of the bar. Sign in sits beside
   it as plain text so a guest still has a way in. */

.appshell .btn-accent--bar { height: 40px; padding-inline: 1.125rem; font-size: 0.875rem; }
.appshell .btn-accent--bar[aria-disabled] { cursor: default; }
.appshell .btn-accent--bar[aria-disabled]:hover { filter: none; box-shadow: none; transform: none; }

.appshell .topnav__signin {
    /* Sign Out is a <button> so it can POST; without these it wears the
       browser's default grey button chrome. */
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: 0;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink-2);
    transition: color 0.18s var(--ease);
}
.appshell .topnav__signin:hover { color: var(--ink); }

/* --- the story card ----------------------------------------------------------
   One card for every listing surface — Home, Category, Watch later. Poster with
   its label and runtime, title, then a line of credits in the same small
   upper-case voice the section labels use. Lives here rather than in a page
   stylesheet because three pages share it. */

.appshell .scard {
    --thumb-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 13px 13px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg, 8px);
    background: var(--card);
    transition: border-color 0.18s var(--ease), background 0.18s var(--ease),
                transform 0.18s var(--ease);
}
.appshell .scard:hover {
    border-color: var(--line-2);
    background: var(--raised);
    transform: translateY(-2px);
}
.appshell .scard:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.appshell .scard__poster {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: var(--thumb-radius);
    background: var(--raised);
}
.appshell .scard__poster img { width: 100%; height: 100%; object-fit: cover; }

.appshell .scard__tag {
    position: absolute;
    top: 6px;
    left: 6px;
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 0.5rem;
    border: 1px solid rgba(244, 104, 15, 0.55);
    border-radius: 3px;
    background: rgba(244, 104, 15, 0.12);
    backdrop-filter: blur(6px);
    font-size: 0.625rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.appshell .scard__time {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    background: rgba(4, 7, 9, 0.82);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.appshell .scard__title {
    padding-inline: 0.125rem;
    font-size: 0.9375rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--ink);
    /* Two lines, so a long title never pushes a row out of alignment. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.appshell .scard__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35em;
    padding-inline: 0.125rem;
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.5;
    color: var(--ink-4);
}
.appshell .scard__dot { opacity: 0.5; }

/* The section label above a grid: the same voice as the card credits. */
.appshell .kicker {
    margin: 0 0 0.875rem;
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-4);
}

@media (prefers-reduced-motion: reduce) {
    .appshell .scard { transition: none; }
    .appshell .scard:hover { transform: none; }
}

/* --- the notification bell ---------------------------------------------------
   A <details> doing the work of a dropdown. The panel is absolutely positioned
   off the summary, so opening it never reflows the bar.

   Review notices carry a left edge in the accent colour and the rest do not:
   likes and comments outnumber decisions many times over, and without that
   mark a run of them buries the one notice a creator has to act on. */

.appshell .topbell { position: relative; flex: none; }

/* The marker is the browser's own disclosure triangle. */
.appshell .topbell > summary { list-style: none; }
.appshell .topbell > summary::-webkit-details-marker { display: none; }

.appshell .topbell__btn {
    position: relative;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 50%;
    color: var(--text-2);
    cursor: pointer;
    transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.appshell .topbell__btn:hover { background: var(--ink-600); color: var(--text); }
.appshell .topbell[open] .topbell__btn { background: var(--ink-600); color: var(--text); }
.appshell .topbell__btn svg { width: 20px; height: 20px; }

.appshell .topbell__count {
    position: absolute;
    top: 3px; right: 2px;
    min-width: 16px; height: 16px;
    padding: 0 4px;
    display: grid; place-items: center;
    border-radius: 999px;
    background: var(--accent);
    color: #0a0a0a;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1;
}

.appshell .topbell__panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    z-index: 60;
    width: min(360px, calc(100vw - 2rem));
    background: var(--ink-700);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
    overflow: hidden;
}

.appshell .topbell__head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--line-soft);
    font-size: 0.8125rem;
}
.appshell .topbell__clear {
    appearance: none; -webkit-appearance: none;
    background: none; border: 0; padding: 0;
    font-family: inherit; font-size: 0.75rem;
    color: var(--text-3); cursor: pointer;
}
.appshell .topbell__clear:hover { color: var(--text); }

.appshell .topbell__list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }

.appshell .topbell__item {
    display: block;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--line-soft);
    border-left: 2px solid transparent;
    color: var(--text-2);
    transition: background 0.16s var(--ease);
}
.appshell .topbell__item:hover { background: var(--ink-600); }
.appshell .topbell__item.is-new { background: rgba(255, 255, 255, 0.025); }
.appshell .topbell__item--review { border-left-color: var(--accent); }

.appshell .topbell__t {
    display: block;
    font-size: 0.8125rem; font-weight: 600; line-height: 1.4;
    color: var(--text);
}
.appshell .topbell__b {
    display: block;
    margin-top: 0.1875rem;
    font-size: 0.75rem; line-height: 1.5;
    color: var(--text-2);
}
.appshell .topbell__when {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.6875rem;
    color: var(--text-3);
}

.appshell .topbell__empty {
    margin: 0;
    padding: 1.125rem 0.875rem;
    font-size: 0.8125rem; line-height: 1.6;
    color: var(--text-3);
}

.appshell .topbell__all {
    display: block;
    padding: 0.6875rem;
    text-align: center;
    font-size: 0.75rem; font-weight: 600;
    color: var(--text-2);
}
.appshell .topbell__all:hover { color: var(--text); background: var(--ink-600); }

/* On a phone the panel is pinned to the viewport rather than the summary, so
   it cannot hang off the right edge of a narrow bar. */
@media (max-width: 560px) {
    .appshell .topbell__panel {
        position: fixed;
        top: 64px; right: 1rem; left: 1rem;
        width: auto;
    }
}

/* --- top bar on a phone ------------------------------------------------------
   Sign Out and Upload become icons, sized to match the bell, so the three
   controls read as one row of equal targets instead of a word, a pill and a
   circle at three different heights. The labels stay in the markup as the
   accessible name. */

.appshell .topact { display: inline-flex; align-items: center; gap: 0.5rem; }
.appshell .topact__icon { display: none; width: 19px; height: 19px; flex: none; }

@media (max-width: 560px) {
    /* One size for every control in the bar. */
    .appshell .topbar__right { gap: 0.375rem; }

    .appshell .topact__label { display: none; }
    .appshell .topact__icon { display: block; }

    .appshell .topact {
        width: 40px; height: 40px;
        justify-content: center;
        padding: 0;
        gap: 0;
    }

    /* The accent stays — it is still the one action the bar is selling — but
       as a round target the size of its neighbours rather than a wide pill. */
    .appshell .btn-accent--bar.topact {
        border-radius: 50%;
        min-width: 0;
    }

    .appshell .topbar__out { display: flex; }
}

/* --- bare pages: the second row ----------------------------------------------
   No sidebar, so the links live on their own row under the logo. Separated by
   a hairline and set at the same gutter as the bar above, so it reads as part
   of the bar rather than as content that has drifted up into it. */

@media (max-width: 720px) {
    .appshell--bare .topbar { padding-block: 0.5rem; row-gap: 0.5rem; }
    .appshell--bare .topnav {
        padding-top: 0.5rem;
        border-top: 1px solid var(--line-soft);
        gap: 1.125rem;
        font-size: 0.875rem;
    }
}

/* --- the footer on a phone ---------------------------------------------------
   Two columns leave a hole: "Create" holds one link but its grid row is as
   tall as "Watch" beside it, so a block of empty space sits between the first
   pair of sections and the second. One column has no uneven rows to leave a
   hole in, and with ten links in total it is no harder to scan.

   The padding either side of the footer is trimmed too: the page below its
   last section, the main column and the footer's own top padding were
   stacking into a band of empty black before the links began. */

@media (max-width: 720px) {
    .appshell .shellfoot { padding-top: 24px; padding-bottom: 36px; }
    .appshell__main { padding-bottom: 12px; }
}

@media (max-width: 560px) {
    .appshell .shellfoot__cols {
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
    }
}
