/* Home page (index.html) only. app.css stays the shared base for the tool
   pages; everything here is scoped to body.home so those pages don't move.

   The page has two faces: a quiet gallery for visitors, and Dev Mode (signed
   in) which adds the pipeline tools, uploads and per-scene editing. Anything
   marked .dev-only is hidden until library.js puts .dev on <body>. */

body.home:not(.dev) .dev-only { display: none !important; }

body.home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 520px at 50% -180px, rgba(255, 122, 26, .13), transparent 70%),
        var(--bg);
}

body.home main.wrap { flex: 1; width: 100%; }

/* ---------------------------------------------------------------- header */

body.home header.top { margin-bottom: 0; background: rgba(22, 18, 14, .72); }
body.home header.top > .inner { padding: 16px 24px; gap: 20px; }

body.home .brand { font-size: 17.5px; }
body.home .brand:hover { color: var(--text); }
body.home .brand .mark { width: 22px; height: 22px; }

.nav-link { color: var(--muted); font-size: 14px; }
.nav-link:hover { color: var(--text); }

/* The gate: one small lock button that opens a password field in place. */
.dev-gate { position: relative; display: flex; align-items: center; gap: 8px; }

.dev-gate .lock {
    padding: 7px;
    background: transparent;
    border-color: transparent;
    color: var(--muted);
}
.dev-gate .lock:hover { color: var(--text); background: var(--panel-2); border-color: var(--border); }

.dev-gate .pop {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    display: flex;
    gap: 8px;
    padding: 10px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.dev-gate .pop input { min-width: 170px; }
.dev-gate .pop[hidden] { display: none; }

/* Dev bar: the pipeline tools, a second row under the header. */
.dev-bar { border-top: 1px solid var(--border); background: rgba(34, 28, 22, .6); }
.dev-bar .inner {
    max-width: 1180px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.dev-chip {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #ffc864;
    background: rgba(255, 200, 100, .1);
    border: 1px solid rgba(255, 200, 100, .3);
    border-radius: 999px;
    padding: 3px 10px;
    margin-right: 8px;
    white-space: nowrap;
}

.dev-bar .tool {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 11px;
    border-radius: 7px;
    color: var(--muted);
    font-size: 13.5px;
    white-space: nowrap;
}
.dev-bar .tool:hover { color: var(--text); background: var(--panel-2); }
.dev-bar .tool svg { flex: none; }

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

.hero { text-align: center; padding: 72px 0 52px; }

.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(30px, 5vw, 46px);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
}

.hero p {
    margin: 0 auto;
    max-width: 600px;
    color: var(--muted);
    font-size: 17px;
}

body.home.dev .hero { padding: 40px 0 28px; }

/* ---------------------------------------------------------------- dev panel */

.dev-panel { margin-bottom: 40px; }
body.home .dropzone { margin-bottom: 16px; padding: 30px 24px; }

.pipeline {
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    counter-reset: step;
}

.pipeline li {
    counter-increment: step;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--muted);
}
.pipeline li::before {
    content: counter(step);
    display: inline-grid;
    place-items: center;
    width: 19px;
    height: 19px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
}
.pipeline a { font-weight: 600; }

/* ---------------------------------------------------------------- gallery */

body.home .grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

body.home .card {
    border-radius: 14px;
    overflow: hidden;
    background: var(--panel);
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
body.home .card:hover {
    border-color: #52463a;
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .4);
}

.card .cover { display: block; color: inherit; }
.card .cover:hover { color: inherit; }

body.home .card .thumb {
    position: relative;
    border-radius: 0;
    border-bottom: 0;
    overflow: hidden;
}

/* A separate layer so the image can zoom without the card moving. */
.card .thumb .img {
    position: absolute;
    inset: 0;
    background: center/cover no-repeat;
    transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}
.card:hover .thumb .img { transform: scale(1.05); }

.card .thumb .play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, .45));
    opacity: 0;
    transition: opacity .2s;
}
.card:hover .thumb .play, .card .cover:focus-visible .play { opacity: 1; }
.card .thumb .play span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .95);
    color: #16120e;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.card .caption { padding: 14px 16px 16px; }
.card .caption .title { font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.card .caption .date { margin-top: 3px; color: var(--muted); font-size: 12.5px; }

/* Dev Mode details under the caption: format, size, notes and actions. */
body.home .card .body { padding: 0 16px 16px; gap: 10px; }

/* ---------------------------------------------------------------- misc */

body.home .empty { padding: 60px 20px 90px; }

body.home footer.site-foot { margin-top: 72px; background: transparent; }

@media (max-width: 560px) {
    body.home header.top > .inner { padding: 12px 16px; gap: 12px; }
    body.home .wrap { padding: 0 16px 48px; }
    .dev-bar .inner { padding: 8px 16px; }
    .hero { padding: 44px 0 32px; }
    .hero p { font-size: 15.5px; }
    body.home .grid { grid-template-columns: 1fr; }
    .dev-gate .pop { right: -8px; }
}

/* Admins and Dev accounts: way back to the admin page (library.js). */
.portal-bar { background: var(--accent); color: var(--on-accent); font-size: 14px; }
.portal-bar .inner { max-width: 1180px; margin: 0 auto; padding: 8px 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.portal-bar span { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.portal-bar .btn { background: var(--on-accent); color: #fff; border: 0; border-radius: 6px; padding: 6px 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.portal-bar .btn:hover { background: #000; color: #fff; }
@media (max-width: 600px) { .portal-bar .inner { padding: 8px 16px; } }
