/*
|--------------------------------------------------------------------------
| CUiHub Portfolio  [cuihub_portfolio] / [cuihub_portfolio_detail]
|--------------------------------------------------------------------------
*/

.cph-portfolio,
.cph-detail {
    --cph-text: #111827;
    --cph-muted: #6b7280;
    --cph-border: #e5e7eb;
    --cph-bg-soft: #f9fafb;
    --cph-accent: #ec4899;
    --cph-accent-soft: #fce7f3;
    --cph-radius: 20px;
    --cph-shadow: 0 4px 20px rgba(0, 0, 0, .05);
    --cph-shadow-hover: 0 10px 30px rgba(0, 0, 0, .08);
    color: var(--cph-text);
}

/* ---------- Toolbar ---------- */

.cph-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 24px;
    margin-bottom: 28px;
    padding: 20px;
    background: #fff;
    border-radius: var(--cph-radius);
    box-shadow: var(--cph-shadow);
}

.cph-search {
    position: relative;
    flex: 1 1 260px;
}

.cph-search svg {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--cph-muted);
    pointer-events: none;
}

.cph-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 16px 11px 42px;
    border: 1px solid var(--cph-border);
    border-radius: 999px;
    font-size: 15px;
    background: var(--cph-bg-soft);
    color: var(--cph-text);
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

.cph-search input:focus {
    border-color: var(--cph-accent);
    box-shadow: 0 0 0 3px var(--cph-accent-soft);
    background: #fff;
}

.cph-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.cph-filter-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--cph-muted);
    margin-right: 2px;
}

.cph-chip {
    padding: 6px 14px;
    border: 1px solid var(--cph-border);
    border-radius: 999px;
    background: #fff;
    color: var(--cph-text);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    transition: background .2s, color .2s, border-color .2s;
}

.cph-chip:hover {
    border-color: var(--cph-accent);
    color: var(--cph-accent);
}

.cph-chip.is-active {
    background: var(--cph-accent);
    border-color: var(--cph-accent);
    color: #fff;
}

.cph-count {
    margin-left: auto;
    font-size: 13px;
    color: var(--cph-muted);
}

/* ---------- Card grid ---------- */

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

.cph-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    background: #fff;
    border-radius: var(--cph-radius);
    box-shadow: var(--cph-shadow);
    color: var(--cph-text);
    text-decoration: none;
    transition: transform .25s ease, box-shadow .25s ease;
}

.cph-card:hover,
.cph-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--cph-shadow-hover);
    color: var(--cph-text);
}

.cph-card[hidden] {
    display: none;
}

.cph-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cph-year {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--cph-accent-soft);
    color: #be185d;
    font-size: 13px;
    font-weight: 700;
}

.cph-year-soft {
    background: #f3f4f6;
    color: #374151;
}

.cph-card-title {
    margin: 0;
    font-size: 20px;
    line-height: 1.4;
    font-weight: 700;
}

.cph-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cph-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}

.cph-tag-green {
    background: #dcfce7;
    color: #166534;
}

.cph-tag-purple {
    background: #ede9fe;
    color: #6d28d9;
}

.cph-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--cph-border);
    color: var(--cph-muted);
    font-size: 14px;
}

.cph-card-meta svg {
    flex-shrink: 0;
}

.cph-no-result {
    padding: 40px 0;
    text-align: center;
    color: var(--cph-muted);
}

.cph-empty {
    color: #9ca3af;
}

/* ---------- Detail ---------- */

.cph-detail {
    max-width: 960px;
    margin: 0 auto;
}

.cph-hero {
    padding: 36px;
    margin-bottom: 24px;
    border-radius: var(--cph-radius);
    background: linear-gradient(135deg, #fdf2f8 0%, #f5f3ff 100%);
}

.cph-hero-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.cph-hero-badges .cph-year {
    background: #fff;
}

.cph-hero-title {
    margin: 0 0 16px;
    font-size: 34px;
    line-height: 1.3;
    font-weight: 700;
}

.cph-sections {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.cph-section {
    padding: 24px;
    background: #fff;
    border-radius: var(--cph-radius);
    box-shadow: var(--cph-shadow);
}

.cph-section-wide {
    grid-column: 1 / -1;
}

.cph-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    font-size: 18px;
    font-weight: 700;
}

.cph-section-title::before {
    content: "";
    width: 4px;
    height: 18px;
    border-radius: 2px;
    background: var(--cph-accent);
}

.cph-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 20px;
    margin: 0;
}

.cph-fields-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cph-field {
    min-width: 0;
}

.cph-field-wide {
    grid-column: 1 / -1;
}

.cph-field dt {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--cph-muted);
}

.cph-field dd {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cph-field dd a {
    color: var(--cph-accent);
}

.cph-founders {
    margin: 0;
    padding: 0;
    list-style: none;
}

.cph-founders li {
    padding: 8px 0;
    border-bottom: 1px dashed var(--cph-border);
}

.cph-founders li:last-child {
    border-bottom: 0;
}

.cph-description {
    font-size: 16px;
    line-height: 1.8;
    color: #374151;
}

/* ---------- Prev / Next ---------- */

/* Scoped + reset so theme / site-wide nav rules cannot pull it out of the page flow */
.cph-detail .cph-nav {
    position: static;
    inset: auto;
    width: auto;
    height: auto;
    z-index: auto;
    transform: none;
    background: none;
    box-shadow: none;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--cph-border);
}

.cph-nav-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 16px 20px;
    border: 1px solid var(--cph-border);
    border-radius: 16px;
    background: #fff;
    color: var(--cph-text);
    text-decoration: none;
    transition: border-color .2s, box-shadow .2s;
}

a.cph-nav-btn:hover {
    border-color: var(--cph-accent);
    box-shadow: var(--cph-shadow-hover);
    color: var(--cph-text);
}

.cph-nav-next {
    text-align: right;
}

.cph-nav-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--cph-accent);
}

.cph-nav-name {
    font-size: 14px;
    color: var(--cph-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cph-nav-btn.is-disabled {
    opacity: .45;
    cursor: not-allowed;
}

.cph-nav-btn.is-disabled .cph-nav-label {
    color: var(--cph-muted);
}

.cph-nav-list,
.cph-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--cph-bg-soft);
    border: 1px solid var(--cph-border);
    color: var(--cph-text);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.cph-nav-list:hover,
.cph-btn:hover {
    border-color: var(--cph-accent);
    color: var(--cph-accent);
}

/* ---------- Responsive ---------- */

@media (max-width: 767px) {

    .cph-grid,
    .cph-sections,
    .cph-fields,
    .cph-fields-3 {
        grid-template-columns: 1fr;
    }

    .cph-toolbar {
        padding: 16px;
    }

    .cph-count {
        margin-left: 0;
    }

    .cph-card,
    .cph-section {
        padding: 20px;
    }

    .cph-hero {
        padding: 24px;
    }

    .cph-hero-title {
        font-size: 24px;
    }

    .cph-detail .cph-nav {
        grid-template-columns: 1fr 1fr;
    }

    .cph-nav-list {
        grid-column: 1 / -1;
        grid-row: 2;
        justify-self: center;
    }
}
