/* =========================================================================
   Salesive Themes — Library + theme detail
   Aesthetic: refined light "editorial marketplace" — paper white, Salesive blue.
   ========================================================================= */

:root {
    --bg: #f5f7fa;
    --bg-soft: #ffffff;
    --ink: #0f1726;
    --ink-dim: #586173;
    --ink-faint: #9aa3b2;
    --line: rgba(15, 23, 38, 0.09);
    --line-strong: rgba(15, 23, 38, 0.16);
    --card: #ffffff;

    --blue: #0d65d9;
    --blue-deep: #0a4eaa;
    --blue-tint: #e6f1ff;
    --blue-wash: #f0f6ff;

    --shadow-soft: 0 1px 2px rgba(15, 23, 38, 0.04),
        0 10px 30px -18px rgba(15, 23, 38, 0.22);
    --shadow-blue: 0 18px 44px -22px rgba(13, 101, 217, 0.45);

    --font-display: "Fraunces", "Times New Roman", serif;
    --font-ui: "Hanken Grotesk", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;

    --maxw: 1320px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}
body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Atmosphere: soft blue glow + faint grain ---------------------------- */
.atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.atmosphere::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(
            820px 480px at 82% -10%,
            rgba(13, 101, 217, 0.12),
            transparent 60%
        ),
        radial-gradient(
            680px 520px at 4% 4%,
            rgba(13, 101, 217, 0.06),
            transparent 55%
        );
}
.atmosphere::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap {
    position: relative;
    z-index: 1;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 clamp(1.25rem, 4vw, 3rem);
}

/* --- Top bar ------------------------------------------------------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: linear-gradient(
        180deg,
        rgba(245, 247, 250, 0.92),
        rgba(245, 247, 250, 0.6)
    );
    border-bottom: 1px solid var(--line);
}
.topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    height: 68px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--ink);
}
.brand__logo {
    height: 44px;
    width: auto;
    display: block;
}
@media (max-width: 480px) {
    .brand__logo { height: 36px; }
}
.topnav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}
.topnav a {
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.25s var(--ease);
}
.topnav a:hover {
    color: var(--blue);
}
.status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-dim);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.4rem 0.75rem;
    background: var(--bg-soft);
}
.status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--blue);
    animation: pulse 2.4s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(13, 101, 217, 0.45); }
    70% { box-shadow: 0 0 0 7px rgba(13, 101, 217, 0); }
    100% { box-shadow: 0 0 0 0 rgba(13, 101, 217, 0); }
}
@media (max-width: 760px) {
    .topnav a:not(.status) { display: none; }
}

/* --- Hero ---------------------------------------------------------------- */
.hero {
    padding: clamp(3.25rem, 8vw, 6rem) 0 clamp(1.5rem, 4vw, 3rem);
    position: relative;
}
.hero__eyebrow {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.34em;
    color: var(--blue);
    display: flex;
    align-items: center;
    gap: 0.9rem;
}
.hero__eyebrow::before {
    content: "";
    width: 42px;
    height: 1px;
    background: var(--blue);
}
.hero__title {
    font-family: var(--font-display);
    font-optical-sizing: auto;
    font-weight: 350;
    font-size: clamp(2.7rem, 8vw, 6.2rem);
    line-height: 0.97;
    letter-spacing: -0.035em;
    margin: 1.5rem 0 0;
    max-width: 17ch;
}
.hero__title em {
    font-style: italic;
    font-weight: 500;
    color: var(--blue);
}
.hero__title .thin {
    color: var(--ink-dim);
}
.hero__sub {
    margin-top: 1.6rem;
    max-width: 54ch;
    font-size: clamp(1rem, 1.4vw, 1.18rem);
    color: var(--ink-dim);
    line-height: 1.6;
}
.hero__sub code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    color: var(--blue-deep);
    background: var(--blue-wash);
    border: 1px solid var(--blue-tint);
    padding: 0.12em 0.5em;
    border-radius: 6px;
}
.hero__glyph {
    position: absolute;
    top: clamp(1rem, 5vw, 2.5rem);
    right: -0.5rem;
    font-family: var(--font-display);
    font-size: clamp(7rem, 22vw, 17rem);
    line-height: 1;
    color: var(--blue);
    opacity: 0.08;
    pointer-events: none;
    user-select: none;
}

/* --- Controls ------------------------------------------------------------ */
.controls {
    margin-top: clamp(2.25rem, 5vw, 3.25rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--line);
}
.search {
    position: relative;
    flex: 1 1 280px;
    max-width: 420px;
}
.search input {
    width: 100%;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 0.95rem;
    padding: 0.85rem 1rem 0.85rem 2.7rem;
    box-shadow: var(--shadow-soft);
    transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.search input::placeholder {
    color: var(--ink-faint);
}
.search input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px var(--blue-tint);
}
.search svg {
    position: absolute;
    left: 0.95rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--ink-faint);
}
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.chip {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: lowercase;
    color: var(--ink-dim);
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.5rem 0.95rem;
    cursor: pointer;
    transition: all 0.25s var(--ease);
}
.chip:hover {
    color: var(--blue);
    border-color: var(--blue-tint);
}
.chip[aria-pressed="true"] {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
    font-weight: 500;
}

/* --- Notice banner ------------------------------------------------------- */
.notice {
    margin-top: 1.5rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--ink-dim);
    background: var(--blue-wash);
    border: 1px solid var(--blue-tint);
    border-left: 3px solid var(--blue);
    border-radius: 10px;
    padding: 0.8rem 1rem;
}
.notice.show {
    display: flex;
}
.notice b {
    color: var(--ink);
    font-weight: 600;
}

/* --- Gallery grid -------------------------------------------------------- */
.gallery-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: clamp(2.25rem, 5vw, 3.25rem) 0 1.5rem;
    gap: 1rem;
}
.gallery-head h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.02em;
}
.gallery-head .count {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink-faint);
    letter-spacing: 0.05em;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 0;
    margin-bottom: 5rem;
}

/* --- Theme card ---------------------------------------------------------- */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card);
    /* Hairline grid: adjacent cards' outlines overlap into a single 1px line,
       with no gaps and no colored fill on incomplete last rows. */
    outline: 1px solid var(--line);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: background 0.3s var(--ease);
    opacity: 0;
    transform: translateY(18px);
    animation: rise 0.7s var(--ease) forwards;
}
@keyframes rise {
    to { opacity: 1; transform: translateY(0); }
}
.card:hover {
    background: var(--blue-wash);
}
.thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: linear-gradient(135deg, var(--g1, #eaf0f8), var(--g2, #dce7f5));
    display: flex;
    align-items: center;
    justify-content: center;
}
.thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}
.card:hover .thumb img {
    transform: scale(1.06);
}
.thumb__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(15, 23, 38, 0.28));
}
.badges {
    position: absolute;
    top: 0.85rem;
    left: 0.85rem;
    display: flex;
    gap: 0.4rem;
    z-index: 2;
}
.badge {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.32rem 0.55rem;
    border-radius: 7px;
    backdrop-filter: blur(6px);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
}
.badge--official {
    background: var(--blue);
    color: #fff;
}
.badge--verified {
    background: rgba(255, 255, 255, 0.92);
    color: var(--blue-deep);
    border: 1px solid var(--blue-tint);
}
.price-tag {
    position: absolute;
    bottom: 0.85rem;
    right: 0.85rem;
    z-index: 2;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    color: var(--ink);
}
.price-tag.free {
    color: var(--blue-deep);
    border-color: var(--blue-tint);
}
.card__body {
    padding: 1.15rem 1.25rem 1.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    flex: 1;
}
.card__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}
.card__name {
    font-family: var(--font-display);
    font-weight: 450;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    text-transform: capitalize;
    line-height: 1.1;
}
.card__ver {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-faint);
    white-space: nowrap;
}
.card__desc {
    font-size: 0.88rem;
    color: var(--ink-dim);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.7em;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: auto;
}
.tag {
    font-family: var(--font-mono);
    font-size: 0.64rem;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    color: var(--ink-dim);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    background: var(--bg);
}
.tag--type {
    color: var(--blue-deep);
    border-color: var(--blue-tint);
    background: var(--blue-wash);
}
.card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--line);
    padding-top: 0.9rem;
    margin-top: 0.3rem;
}
.card__cta {
    font-size: 0.82rem;
    color: var(--blue);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: gap 0.3s var(--ease);
}
.card:hover .card__cta {
    gap: 0.7rem;
}
.card__cta svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
}
.card__meta {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.card__uses {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.card__uses svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
}

/* --- Skeleton ------------------------------------------------------------ */
.skeleton {
    outline: 1px solid var(--line);
    overflow: hidden;
    background: var(--card);
}
.skeleton .sk {
    background: linear-gradient(
        100deg,
        rgba(15, 23, 38, 0.04) 30%,
        rgba(15, 23, 38, 0.08) 50%,
        rgba(15, 23, 38, 0.04) 70%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer {
    to { background-position: -200% 0; }
}
.skeleton .sk-thumb { aspect-ratio: 1 / 1; }
.skeleton .sk-body { padding: 1.2rem; display: grid; gap: 0.7rem; }
.skeleton .sk-line { height: 14px; border-radius: 6px; }
.skeleton .sk-line.short { width: 45%; }
.skeleton .sk-line.mid { width: 75%; }

/* --- Empty / error ------------------------------------------------------- */
.state {
    grid-column: 1 / -1;
    text-align: center;
    padding: clamp(3rem, 8vw, 6rem) 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: 18px;
    background: var(--bg-soft);
}
.state__glyph {
    font-family: var(--font-display);
    font-size: 3.5rem;
    color: var(--blue);
    opacity: 0.55;
}
.state h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.6rem;
    margin: 0.75rem 0 0.5rem;
    letter-spacing: -0.02em;
}
.state p {
    color: var(--ink-dim);
    font-size: 0.92rem;
    max-width: 42ch;
    margin: 0 auto 1.25rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 11px;
    padding: 0.8rem 1.3rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.25s var(--ease);
}
.btn svg { width: 16px; height: 16px; stroke: currentColor; }
.btn--primary {
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow-blue);
}
.btn--primary:hover {
    background: var(--blue-deep);
    transform: translateY(-2px);
}
.btn--ghost {
    background: var(--bg-soft);
    color: var(--ink);
    border-color: var(--line);
}
.btn--ghost:hover {
    border-color: var(--blue);
    color: var(--blue);
}

/* =========================================================================
   THEME DETAIL PAGE
   ========================================================================= */
.back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: clamp(1.5rem, 4vw, 2.5rem) 0 0;
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 0.88rem;
    transition: gap 0.25s var(--ease), color 0.25s var(--ease);
}
.back svg { width: 16px; height: 16px; stroke: currentColor; }
.back:hover { color: var(--blue); gap: 0.75rem; }

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: clamp(1.75rem, 4vw, 3.5rem);
    align-items: start;
    margin-top: 1.75rem;
    opacity: 0;
    animation: rise 0.7s var(--ease) forwards;
}
.detail > * {
    min-width: 0;
}
@media (max-width: 900px) {
    .detail { grid-template-columns: minmax(0, 1fr); }
}

/* preview framed in a browser chrome */
.frame {
    position: sticky;
    top: 92px;
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-soft);
    box-shadow: var(--shadow-soft);
}
@media (max-width: 900px) {
    .frame { position: static; }
}
.frame__bar {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
    min-width: 0;
}
.frame__bar i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--line-strong);
    display: inline-block;
}
.frame__url {
    margin-left: 0.6rem;
    min-width: 0;
    flex: 1 1 auto;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.frame__media {
    position: relative;
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, var(--g1, #eaf0f8), var(--g2, #dce7f5));
    display: flex;
    align-items: center;
    justify-content: center;
}
.frame__media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shots-label {
    margin: 1.5rem 0 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
}
.shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
}
.shot {
    display: block;
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid var(--line);
    transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}
.shot:hover {
    border-color: var(--blue);
    transform: translateY(-2px);
}
.shot img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.detail__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.pill {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.pill--approved { background: #e7f6ec; color: #1a7f43; border: 1px solid #c7ebd4; }
.pill--pending { background: #fef6e6; color: #b5790f; border: 1px solid #f6e2b8; }
.pill--rejected { background: #fdecec; color: #c2342f; border: 1px solid #f5cccb; }
.pill--draft { background: #eef0f4; color: #5b6577; border: 1px solid var(--line); }
.pill--blue { background: var(--blue-wash); color: var(--blue-deep); border: 1px solid var(--blue-tint); }

.detail__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    letter-spacing: -0.03em;
    line-height: 1.02;
    text-transform: capitalize;
    overflow-wrap: anywhere;
}
.detail__sub {
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-dim);
}
.detail__sub .price {
    color: var(--blue-deep);
    font-weight: 600;
}
.detail__sub .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ink-faint);
}
.detail__desc {
    margin-top: 1.4rem;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--ink-dim);
}
.detail__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.75rem 0;
}

.specs {
    border-top: 1px solid var(--line);
    margin-top: 0.5rem;
}
.spec {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--line);
}
@media (max-width: 480px) {
    .spec { grid-template-columns: 1fr; gap: 0.35rem; }
}
.spec__key {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-faint);
    padding-top: 0.15rem;
}
.spec__val {
    font-size: 0.95rem;
    color: var(--ink);
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    align-items: center;
}
.spec__val.muted { color: var(--ink-faint); }
.spec__val code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 0.15em 0.5em;
    border-radius: 6px;
    word-break: break-all;
}

/* --- Footer -------------------------------------------------------------- */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--line);
    margin-top: 2rem;
    background: var(--bg-soft);
}
.footer__line {
    height: 2px;
    background: linear-gradient(90deg, var(--blue), transparent);
    width: 100%;
    margin-bottom: 2.5rem;
}
.footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 2.5rem 0;
}
.footer p {
    font-size: 0.8rem;
    color: var(--ink-faint);
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
}
.footer a {
    color: var(--ink-dim);
    text-decoration: none;
    font-size: 0.82rem;
    transition: color 0.25s var(--ease);
}
.footer a:hover {
    color: var(--blue);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .card,
    .detail { opacity: 1; transform: none; }
}
