/* ============================================================================
   Wall of Portfolios.
   Hero follows the Good deals pattern (same starfield, same type scale); the
   grid below is this page's own. Uses the global theme tokens from /style.css,
   so it follows dark/light automatically.
   ============================================================================ */

/* Wider than the site's --content-width (1300px): this page is a wall, and
   Karthik asked for four cards across, which needs the extra room to keep each
   thumbnail big enough to read. The hero inside still centres on its own
   max-widths, so only the grid actually uses the width. */
.wop-main {
    max-width: 1680px;
    margin: 0 auto;
    padding: 64px 24px 96px;
}

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

/* ── Hero ─────────────────────────────────────────────────────────────── */
.wop-hero {
    position: relative;          /* anchors the absolutely-positioned starfield */
    overflow: hidden;            /* orbits run up to ~1000px wide — clip them */
    text-align: center;
    margin-bottom: 56px;
}

/* The field is positioned with z-index 0, so it would paint over the in-flow
   copy. Lifting every sibling above it keeps the stars behind the text without
   restructuring the markup. .stars-field itself is already hidden below 760px
   by the global rule in style.css. */
.wop-hero > :not(.stars-field) {
    position: relative;
    z-index: 1;
}

.wop-eyebrow {
    font-family: "Geist", sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.72rem;
    color: var(--muted);
    margin: 0 0 18px;
}

.wop-title {
    font-family: "Geist", sans-serif;
    font-weight: 200;
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--text);
    margin: 0 auto 20px;
}

.wop-subtitle {
    max-width: 52ch;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.6;
    margin: 0 auto 30px;
}

.wop-hero-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wop-submit-btn {
    text-decoration: none;
}

/* The portfolio count, aligned to the grid's right edge. `margin-left: auto`
   rather than `text-align: right` so it sits against the last column even
   though the paragraph itself spans the full width. */
.wop-count {
    width: fit-content;
    margin: 0 0 14px auto;
    font-size: 0.85rem;
    color: var(--muted);
}

.wop-count:empty {
    display: none;
}

/* ── Status line ──────────────────────────────────────────────────────── */
.wop-status {
    margin: 0 0 24px;
    text-align: center;
    font-size: 0.92rem;
    color: var(--muted);
}

.wop-status.is-error {
    color: var(--muted-strong);
}

/* ── Grid ─────────────────────────────────────────────────────────────── */
/* Four across, stepping down explicitly rather than by auto-fill. auto-fill
   picks the column count from a min width, so the count drifts with the
   viewport and lands on 3 at exactly the sizes this page is read at. */
.wop-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}

@media (max-width: 1400px) {
    .wop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .wop-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The whole card is a single <a>, so every child is inline-level markup turned
   into a block here. That is what makes the entire surface clickable without
   nesting interactive elements. */
.wop-card {
    display: flex;
    flex-direction: column;
    /* A grid item defaults to min-width:auto, so a long unbroken name would
       stretch the whole column past the viewport instead of ellipsing. This is
       the top of the min-width:0 chain that .wop-name's ellipsis depends on. */
    min-width: 0;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--panel);
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.wop-card:hover,
.wop-card:focus-visible {
    border-color: var(--border-strong);
    background: var(--panel-strong);
    transform: translateY(-3px);
}

.wop-card-head {
    display: flex;
    align-items: center;
    min-width: 0;                /* continues the chain down to .wop-identity */
    gap: 10px;
}

/* ── Avatar ───────────────────────────────────────────────────────────── */
.wop-avatar {
    position: relative;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--panel-soft);
}

.wop-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* The lettered circle sits underneath the image and only shows through when
   there is no image, or when the image 404s (onerror adds .is-fallback). */
.wop-avatar-letter {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    font-family: "Geist", sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted-strong);
    background: var(--surface-4);
}

.wop-avatar.is-fallback .wop-avatar-img { display: none; }
.wop-avatar.is-fallback .wop-avatar-letter { display: grid; }

.wop-identity {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;                /* lets the ellipsis below actually apply */
    flex: 1 1 auto;
}

.wop-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wop-host {
    font-size: 0.76rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wop-arrow {
    flex: 0 0 auto;
    color: var(--muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.wop-card:hover .wop-arrow,
.wop-card:focus-visible .wop-arrow {
    color: var(--text);
    transform: translate(2px, -2px);
}

/* ── Thumbnail ────────────────────────────────────────────────────────── */
.wop-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

.wop-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;  /* portfolios lead with the hero — keep it */
    transition: transform 0.35s ease;
}

.wop-card:hover .wop-thumb-img {
    transform: scale(1.03);
}

/* Shown when a portfolio has no thumbnail yet, so the card keeps its shape
   instead of collapsing to a bare name. */
.wop-thumb-fallback {
    position: absolute;
    inset: 0;
    display: none;
    place-items: center;
    padding: 16px;
    text-align: center;
    font-family: "Geist", sans-serif;
    font-weight: 200;
    font-size: 1.1rem;
    line-height: 1.3;
    color: var(--muted);
    background: linear-gradient(140deg, var(--surface-2), var(--surface-4));
}

.wop-thumb.is-fallback .wop-thumb-img { display: none; }
.wop-thumb.is-fallback .wop-thumb-fallback { display: grid; }

/* ── Narrow screens ───────────────────────────────────────────────────── */
@media (max-width: 760px) {
    .wop-main {
        padding: 40px 16px 72px;
    }

    .wop-hero {
        margin-bottom: 36px;
    }

    .wop-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wop-card,
    .wop-arrow,
    .wop-thumb-img {
        transition: none;
    }

    .wop-card:hover,
    .wop-card:focus-visible {
        transform: none;
    }

    .wop-card:hover .wop-thumb-img {
        transform: none;
    }
}
