/* =====================================================================
   Contributors tab (index-enhanced.html #profile), in the same paper and
   serif style as the recipe journal cards. Markup comes from
   loadContributors in script.js. Loaded after styles.css; the id-plus-class
   selectors are what outrank its older .contributors-grid rules.
   ===================================================================== */
#profile {
    --cc-green: var(--primary-color, #1f4836);
    --cc-green-2: #2d5a44;
    --cc-gold: #bf9b30;
    --cc-gold-ink: #6b5210;
    --cc-gold-soft: #f6ecc9;
    --cc-sage-soft: #e8eee0;
    --cc-paper: #fffdf7;
    --cc-ink: #24302a;
    --cc-muted: #6b7263;
    --cc-line: #e2dccb;
    --cc-serif: var(--heading-font, 'Cormorant Garamond', Georgia, serif);
    --cc-sans: var(--body-font, 'Inter', -apple-system, 'Segoe UI', sans-serif);
}

#profile > h2 {
    max-width: 1100px;
    margin: 1.5rem auto 0.25rem;
    padding: 0 16px;
    box-sizing: border-box;
    text-align: left;
    font-family: var(--cc-serif);
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--cc-green);
}
#profile > h2::after {
    content: "The cooks behind the recipes, and where they cook from.";
    display: block;
    margin-top: 2px;
    font: 400 0.95rem var(--cc-sans);
    color: var(--cc-muted);
}
#profile .profile-container { max-width: 1100px; margin: 0 auto; padding: 0 16px 2rem; box-sizing: border-box; }

/* ---- Search, sort and following ---- */
#profile .contributors-controls {
    justify-content: flex-start;
    gap: 10px 14px;
    margin: 0.75rem 0 1.1rem;
    padding: 0;
    background: none;
    box-shadow: none;
}
#profile .contributors-controls .control-group { gap: 8px; }
#profile .contributors-controls label { font: 600 0.8rem var(--cc-sans); color: var(--cc-muted); }
#profile .contributors-controls .filter-select {
    border: 1px solid var(--cc-line) !important;
    border-radius: 999px !important;
    background-color: var(--cc-paper) !important;
    font: 500 0.85rem var(--cc-sans);
    color: var(--cc-ink);
}
#profile #contributor-search { min-width: 260px; padding-left: 2.3rem !important; }
#profile .contributors-controls .filter-select:focus { outline: 2px solid var(--cc-gold); outline-offset: 1px; }
#profile .toggle-buttons { background: var(--cc-sage-soft); }
#profile .toggle-btn { padding: 0.4rem 1.1rem; font: 600 0.8rem var(--cc-sans); color: var(--cc-muted); }
#profile .toggle-btn.active { background: var(--cc-paper); color: var(--cc-green); }

/* ---- The grid ---- */
#contributors-list.contributors-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    align-items: start;
}
#contributors-list > p { grid-column: 1 / -1; color: var(--cc-muted); }

/* ---- One cook ---- */
.cc {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 18px;
    border-radius: 16px;
    background: var(--cc-paper);
    box-shadow: 0 2px 12px rgba(31, 72, 54, 0.08);
    font-family: var(--cc-sans);
    color: var(--cc-ink);
    text-align: left;
}
.cc-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.cc-av-link { flex: 0 0 auto; text-decoration: none; }
.cc-av {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-grid;
    place-items: center;
    background: var(--cc-sage-soft);
    color: var(--cc-green);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(31, 72, 54, 0.18);
    font: 700 1.6rem var(--cc-serif);
    box-sizing: border-box;
}
.cc-id { display: grid; gap: 3px; min-width: 0; }
.cc-name { margin: 0; font: 600 1.55rem/1.1 var(--cc-serif); overflow-wrap: anywhere; }
.cc-name a { color: var(--cc-green); text-decoration: none; }
.cc-name a:hover { text-decoration: underline; text-underline-offset: 4px; }
.cc-place { margin: 0; font-size: 0.8rem; color: var(--cc-muted); }
.cc-place i { color: var(--cc-gold); margin-right: 2px; }
.cc-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.78rem; color: var(--cc-muted); font-variant-numeric: tabular-nums; }
.cc-stats b { color: var(--cc-ink); font-weight: 700; }

.cc-bio {
    margin: 0;
    font: italic 1.05rem/1.4 var(--cc-serif);
    color: var(--cc-ink);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cc-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.cc-label { margin-right: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--cc-muted); }
.cc-pill { padding: 2px 9px; border-radius: 999px; background: var(--cc-sage-soft); color: var(--cc-green); font-size: 0.74rem; font-weight: 600; }
.cc-pill-more { background: var(--cc-gold-soft); color: var(--cc-gold-ink); }

/* The shelf of recipes */
.cc-shelf { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-top: 12px; border-top: 1px dashed var(--cc-line); }
.cc-dish { display: grid; gap: 5px; align-content: start; min-width: 0; text-decoration: none; color: var(--cc-ink); }
.cc-dish-photo {
    position: relative;
    display: block;
    aspect-ratio: 1;
    max-width: 100%;
    border-radius: 10px;
    overflow: hidden;
    background: #e9e4d6;
}
.cc-dish-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.cc-dish:hover .cc-dish-photo img { transform: scale(1.04); }
.cc-dish-photo b { display: none; }
.cc-dish-none { background: repeating-linear-gradient(135deg, #f6ecc9 0 10px, #f1e3b6 10px 20px); }
.cc-dish-none b { position: absolute; inset: 0; display: grid; place-items: center; font: 600 1.8rem var(--cc-serif); color: var(--cc-gold); }
.cc-star {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--cc-paper);
    color: var(--cc-gold);
    font-size: 0.65rem;
}
.cc-dish-title {
    font: 600 0.92rem/1.2 var(--cc-serif);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.cc-dish:hover .cc-dish-title { color: var(--cc-green); text-decoration: underline; }

.cc-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.cc-open {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--cc-green);
    color: #fff !important;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}
.cc-open:hover { background: var(--cc-green-2); }
.cc-when { font-size: 0.76rem; color: var(--cc-muted); }
.cc-when a { color: var(--cc-green); font-weight: 600; }

/* ---- People who haven't shared yet ---- */
.cc-new {
    grid-column: 1 / -1;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px dashed var(--cc-line);
    background: rgba(255, 253, 247, 0.6);
    text-align: left;
}
.cc-new h3 { margin: 0 0 10px; font: 600 1.2rem var(--cc-serif); color: var(--cc-green); }
.cc-new h3 span { margin-left: 6px; font: 400 0.8rem var(--cc-sans); color: var(--cc-muted); }
.cc-new-list { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-new-cook {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    background: var(--cc-paper);
    border: 1px solid var(--cc-line);
    color: var(--cc-ink);
    font: 600 0.8rem var(--cc-sans);
    text-decoration: none;
}
.cc-new-cook:hover { border-color: var(--cc-green); color: var(--cc-green); }
.cc-av-sm { width: 28px; height: 28px; font-size: 0.85rem; border-width: 1px; }

.cc a:focus-visible,
.cc-new a:focus-visible { outline: 2px solid var(--cc-gold); outline-offset: 2px; }

/* ---- Narrower screens ---- */
@media (max-width: 860px) {
    #contributors-list.contributors-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
.cc-open-short { display: none; }

/* Phones: "compact cards". Photo beside name, roots and numbers; two lines
   of bio; the countries on one row that scrolls sideways; the four recipes
   as one row of small photos; a short "Cookbook" button. Search and sort
   share a row. */
@media (max-width: 600px) {
    #profile > h2 { font-size: 1.6rem; }
    #profile > h2::after { font-size: 0.8rem; }

    #profile .contributors-controls {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 8px;
        align-items: center;
        margin: 0.5rem 0 0.9rem;
    }
    #profile .contributors-controls .control-group { display: block; min-width: 0; }
    #profile .contributors-controls .control-group:first-child > div { width: 100%; }
    #profile #contributor-search { min-width: 0 !important; width: 100%; box-sizing: border-box; font-size: 0.8rem; }
    /* The visible "Sort by" label goes; the select keeps it as its name. */
    #profile .contributors-controls label[for="contributor-sort"] {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    #profile #contributor-sort { min-width: 0 !important; width: auto; padding: 0.45rem 0.7rem !important; font-size: 0.76rem; }
    #profile #following-filter-group { grid-column: 1 / -1; justify-self: start; }

    #contributors-list.contributors-grid { gap: 12px !important; }
    .cc { gap: 9px; padding: 12px; border-radius: 14px; }
    .cc-head { gap: 11px; }
    .cc-av { width: 52px; height: 52px; font-size: 1.3rem; }
    .cc-id { gap: 1px; }
    .cc-name { font-size: 1.3rem; }
    .cc-place { font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .cc-stats { gap: 0 10px; font-size: 0.7rem; }
    .cc-bio { font-size: 0.95rem; -webkit-line-clamp: 2; }

    .cc-pills { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .cc-pills::-webkit-scrollbar { display: none; }
    .cc-pill, .cc-label { flex: 0 0 auto; white-space: nowrap; }
    .cc-label { font-size: 0.6rem; }
    .cc-pill { font-size: 0.68rem; }

    .cc-shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; padding-top: 0; border-top: 0; }
    .cc-dish { gap: 3px; }
    .cc-dish-photo { border-radius: 9px; }
    .cc-dish-none b { font-size: 1.2rem; }
    .cc-star { top: 3px; right: 3px; width: 16px; height: 16px; font-size: 0.5rem; }
    .cc-dish-title { font-size: 0.72rem; -webkit-line-clamp: 1; white-space: nowrap; text-overflow: ellipsis; display: block; }

    .cc-foot { flex-wrap: nowrap; padding-top: 8px; border-top: 1px dashed var(--cc-line); }
    .cc-when { order: -1; min-width: 0; font-size: 0.68rem; }
    .cc-open { flex: 0 0 auto; padding: 7px 13px; font-size: 0.76rem; }
    .cc-open-long { display: none; }
    .cc-open-short { display: inline; }

    .cc-new { padding: 12px; }
    .cc-new h3 { font-size: 1.05rem; }
    .cc-new h3 span { display: block; margin: 2px 0 0; font-size: 0.7rem; }
}

/* The newcomer chips' photo must stay small at every width: it shares the
   .cc-av class, so this comes after every .cc-av size rule above. */
.cc-new .cc-av.cc-av-sm { width: 24px; height: 24px; font-size: 0.7rem; border-width: 1px; }
