/* Styles for the Projects showcase (/projects/) and individual project pages.
   Loaded after /sass/researcher.min.css, so it reuses the site's fonts and colors. */

:root {
    --accent: #0b7285;
    --ink: #222;
    --muted: #666;
    --line: #ddd;
    --soft: #f8f8f8;
}

/* ---------- Showcase grid (projects/index.html) ---------- */

#content .projects-intro { color: var(--ink); margin-bottom: 1.5rem; }

.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    margin: 1.5rem 0 2rem;
}
@media (min-width: 576px) {
    .project-grid { grid-template-columns: 1fr 1fr; }
}

#content a.project-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
    transition: box-shadow .15s ease, transform .15s ease;
    text-decoration: none;
}
#content a.project-card:hover,
#content a.project-card:focus-visible {
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
    transform: translateY(-2px);
    text-decoration: none;
}
#content a.project-card:hover .project-card-title { color: var(--accent); }

#content .project-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    margin: 0;
    background: var(--soft);
}
.project-card-body { padding: .8rem 1rem 1rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
#content .project-card-title { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--ink); }
#content .project-card-summary { margin: 0; font-size: .9rem; color: var(--ink); line-height: 1.35; }
#content .project-card-years { font-size: .8rem; color: var(--muted); margin-top: auto; }

/* ---------- Tags (cards and project pages) ---------- */

.tags { display: flex; flex-wrap: wrap; gap: .35rem; margin: .2rem 0 0; padding: 0; }
#content .tag {
    font-size: .72rem;
    line-height: 1;
    padding: .3rem .5rem;
    border-radius: 999px;
    background: var(--soft);
    border: 1px solid var(--line);
    color: #555;
}

/* ---------- Individual project page ---------- */

#content .back-link { font-size: .9rem; }

.project-header { margin: 1rem 0 1.25rem; }
#content .project-header h2 { margin: 0 0 .4rem; font-size: 1.6rem; }
#content .project-tagline { font-size: 1.05rem; color: var(--ink); margin: 0 0 .6rem; }

#content figure { margin: 1rem 0 1.5rem; }
#content figure img { margin: 0 auto; border-radius: 6px; }
#content figcaption { font-size: .85rem; color: var(--muted); margin-top: .45rem; text-align: center; }

#content .project-hero img { width: 100%; max-height: 380px; object-fit: cover; }

.project-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .3rem 1rem;
    font-size: .9rem;
    margin: 0 0 1.25rem;
    padding: .8rem 1rem;
    background: var(--soft);
    border-radius: 6px;
}
#content .project-meta dt { font-weight: 700; color: var(--ink); }
#content .project-meta dd { margin: 0; color: #444; }

.project-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.5rem; }
#content a.btn-link-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .35rem .8rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    font-size: .85rem;
    color: var(--accent);
}
#content a.btn-link-pill * { color: var(--accent); }
#content a.btn-link-pill:hover { background: var(--accent); color: #fff; text-decoration: none; }
#content a.btn-link-pill:hover * { color: #fff; }

.figure-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0 1.5rem;
}
@media (min-width: 576px) {
    .figure-grid { grid-template-columns: 1fr 1fr; }
}
#content .figure-grid figure { margin: 0; }
/* Figures keep their whole frame (no cropping); a soft background fills any gap. */
#content .figure-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--soft); }
#content .figure-grid a { display: block; }
#content .figure-grid a:hover img { outline: 2px solid var(--accent); outline-offset: 2px; }

.video-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    margin: 1rem 0 1.5rem;
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

#content ul.pub-list > li,
#content ul.slide-list > li { margin-bottom: .6rem; line-height: 1.35; }

#content .slide-list li { display: flex; gap: .8rem; align-items: center; }
#content .slide-list img { width: 140px; aspect-ratio: 16 / 9; object-fit: cover; margin: 0; border: 1px solid var(--line); border-radius: 4px; flex-shrink: 0; }

#content .placeholder-note {
    border-left: 4px solid var(--accent);
    background: #eef7f8;
    padding: .6rem .9rem;
    font-size: .85rem;
    margin: 1rem 0;
}

/* ---------- Card without an image: icon block ---------- */

.project-card-icon {
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e3f2f4, var(--soft));
}
#content .project-card-icon i { font-size: 2.6rem; color: var(--accent); opacity: .75; }

/* ---------- Section tabs on project pages ---------- */
/* A tab bar: every project sits on one baseline; the current one is dark with a
   thick accent underline, the others are muted links that light up on hover. */

.project-tabs {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    margin: .5rem 0 1.5rem;
    border-bottom: 1px solid var(--line);
}
#content .project-tabs a {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: .5rem .3rem .55rem;
    font-size: .88rem;
    line-height: 1.25;
    text-align: center;
    color: #666;
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    transition: color .15s, border-color .15s, background .15s;
}
#content .project-tabs a:hover { color: var(--accent); border-bottom-color: rgba(11, 114, 133, .35); background: #f4f9fa; }
#content .project-tabs a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
    border-bottom-color: var(--accent);
    background: none;
}
/* Phones: one scrolling row of the same two-line tabs. */
@media (max-width: 575px) {
    .project-tabs { grid-template-columns: repeat(7, 6.2rem); overflow-x: auto; scrollbar-width: none; }
    .project-tabs::-webkit-scrollbar { display: none; }
}

#content .project-summary p { line-height: 1.5; }

/* ---------- Numbered media previews (temporary, for sorting) ---------- */

.media-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: .6rem;
    margin: .8rem 0 2rem;
}
#content .media-tile { position: relative; margin: 0; }
#content .media-tile a { display: block; }
#content .media-tile img,
#content .media-tile video {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin: 0;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 4px;
}
#content .media-tile figcaption {
    position: absolute;
    top: 4px;
    left: 4px;
    margin: 0;
    padding: .15rem .45rem;
    font-size: .8rem;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, .7);
    border-radius: 4px;
}
#content h3 small { font-size: .7em; font-weight: 400; color: var(--muted); }
/* A row of exactly three tiles side by side (e.g. Haines jumps sequence). */
.media-previews.media-row-3 { grid-template-columns: repeat(3, 1fr); }
.media-previews.media-row-2 { grid-template-columns: repeat(2, 1fr); }


/* A single tile spanning the full row, shown at its natural aspect ratio. */
.media-previews.media-row-1 { grid-template-columns: 1fr; }
#content .media-row-1 .media-tile img,
#content .media-row-1 .media-tile video { aspect-ratio: auto; height: auto; max-height: 75vh; }
/* Full width with no height cap: the image spans the whole column. */
#content .media-row-1.full-width .media-tile img,
#content .media-row-1.full-width .media-tile video { max-height: none; }
/* Tiles shown at their natural shape, filling the column width (no square letterboxing). */
#content .media-previews.natural .media-tile img,
#content .media-previews.natural .media-tile video { aspect-ratio: auto; height: auto; }
/* Justified row: tiles share one height and fill the width; each figure sets --ar (width/height). */
.media-previews.justify { display: flex; }
#content .media-previews.justify .media-tile { flex: var(--ar, 1) 1 0; min-width: 0; }
#content .media-previews.justify .media-tile img,
#content .media-previews.justify .media-tile video { aspect-ratio: var(--ar); height: auto; object-fit: cover; }

/* Tile numbers were for sorting only; hidden on the published site. */
#content .media-tile figcaption.tile-num,
#content .media-tile figcaption:empty { display: none; }
/* Any other figcaption is a real caption, shown under the image (and in the overlay). */
#content .media-tile figcaption:not(.tile-num) {
    position: static;
    margin: .4rem 0 0;
    padding: 0;
    background: none;
    border-radius: 0;
    color: var(--muted);
    font-family: 'Source Sans 3', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: .85rem;
    font-weight: 400;
    line-height: 1.35;
    text-align: left;
}

/* ---------- Overlay viewer (lightbox.js) ---------- */

#content .media-tile a { cursor: zoom-in; }
html.lb-open { overflow: hidden; }
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 16, .85);
}
.lightbox[hidden] { display: none; }
.lightbox .lb-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3.5rem 4.5rem;
}
.lightbox .lb-stage img,
.lightbox .lb-stage video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.lightbox .lb-btn {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-family: 'Junicode', Georgia, serif;
    line-height: 1;
    cursor: pointer;
    border-radius: 999px;
    transition: background .15s;
}
.lightbox .lb-btn:hover,
.lightbox .lb-btn:focus-visible { background: var(--accent); outline: none; }
.lightbox .lb-prev,
.lightbox .lb-next { top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 2.2rem; padding-bottom: .25rem; }
.lightbox .lb-prev { left: 1rem; }
.lightbox .lb-next { right: 1rem; }
.lightbox .lb-close { top: 1rem; right: 1rem; width: 2.5rem; height: 2.5rem; font-size: 1.8rem; }
.lightbox .lb-count {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .75);
    font-size: .85rem;
}
.lightbox .lb-caption {
    position: absolute;
    bottom: 2.6rem;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(46rem, calc(100vw - 2rem));
    color: #fff;
    font-family: 'Source Sans 3', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: .95rem;
    line-height: 1.4;
    text-align: center;
}
.lightbox .lb-caption[hidden] { display: none; }
.lightbox.has-cap .lb-stage { padding-bottom: 7.5rem; }
@media (max-width: 575px) {
    .lightbox .lb-stage { padding: 3.5rem .5rem; }
    .lightbox .lb-caption { bottom: 4rem; }
    .lightbox.has-cap .lb-stage { padding-bottom: 9.5rem; }
    .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: .5rem; transform: none; }
}

/* ---------- Previous / next project links at the foot of each page ---------- */

.project-pager {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin: 2.5rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}
#content .project-pager a {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    padding: .7rem .9rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
}
#content .project-pager a:hover { border-color: var(--accent); box-shadow: 0 4px 12px rgba(0, 0, 0, .08); }
#content .project-pager .pager-next { text-align: right; grid-column: 3; }
#content .project-pager .pager-all { text-align: center; grid-column: 2; }
@media (max-width: 575px) {
    .project-pager { grid-template-columns: 1fr 1fr; }
    #content .project-pager .pager-all { grid-column: 1 / -1; grid-row: 2; }
    #content .project-pager .pager-next { grid-column: 2; }
}
#content .project-pager .pager-label { font-size: .8rem; color: var(--muted); }
#content .project-pager .pager-title { font-weight: 600; color: var(--accent); line-height: 1.3; }

/* ---------- Back to top button (lightbox.js) ---------- */

.to-top {
    position: fixed;
    right: 1rem;
    bottom: 2rem;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .2rem .6rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: #fff;
    color: var(--accent);
    font-family: 'Source Sans 3', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: .85rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s, transform .2s, visibility .2s, background .15s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover, .to-top:focus-visible { background: #eef7f8; outline: none; }
html.lb-open .to-top { display: none; }
