/* ──────────────────────────────────────────────────────────────
   Tree progress page
   ────────────────────────────────────────────────────────────── */

:root {
    --earth-dark: #2d3319;
    --earth-medium: #4a5a2f;
    --earth-light: #8b9862;
    --sand: #e8dcc4;
    --clay: #c4a572;
    --sprout: #a8c686;
    --leaf: #5a7a3a;
    --bg: #f5f3ef;
    --card: #ffffff;
}

body {
    font-family: 'Work Sans', sans-serif;
    background: var(--bg);
    color: var(--earth-dark);
    margin: 0;
    line-height: 1.6;
}

/* ── Header ─────────────────────────────────────────────── */
.tp-header {
    max-width: 720px;
    margin: 0 auto;
    padding: 3rem 1.5rem 1.5rem;
    text-align: center;
}
.tp-header h1 {
    font-family: 'Crimson Pro', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--earth-dark);
    margin: 0 0 0.6rem;
}
.tp-header p {
    color: var(--earth-medium);
    font-size: 1rem;
    margin: 0 auto;
    max-width: 560px;
}
.tp-intro {
    margin-top: 1rem !important;
    font-size: 0.82rem !important;
    color: var(--earth-light) !important;
    letter-spacing: 0.02em;
}

/* ── Grove grid ─────────────────────────────────────────── */
.tp-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
    gap: 1.1rem;
}

.tp-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 0;
    padding: 0;
    border-radius: 14px;
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(45,51,25,0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tp-card:hover,
.tp-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(45,51,25,0.13);
    outline: none;
}

.tp-card-img {
    position: relative;
    display: block;
    aspect-ratio: 4/3;
    background: var(--sand);
    overflow: hidden;
}
.tp-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder when a photo hasn't resolved — quiet, not an error state. */
.tp-noimg {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sprout);
    background: linear-gradient(135deg, var(--sand), rgba(168,198,134,0.25));
}

.tp-card-tag {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    padding: 0.18rem 0.5rem;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    background: rgba(45,51,25,0.72);
    color: #eae6db;
    backdrop-filter: blur(2px);
}

.tp-card-body {
    display: block;
    padding: 0.75rem 0.9rem 0.9rem;
}
.tp-card-species {
    display: block;
    font-family: 'Crimson Pro', serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--earth-dark);
}
.tp-card-meta {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--leaf);
    margin-top: 0.1rem;
}
.tp-card-since {
    display: block;
    font-size: 0.72rem;
    color: var(--earth-light);
    margin-top: 0.35rem;
}

.tp-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--earth-light);
    padding: 3rem 1rem;
}

/* ── Detail overlay ─────────────────────────────────────── */
.tp-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45,51,25,0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.tp-detail-overlay.open { display: flex; }

.tp-detail {
    position: relative;
    background: var(--card);
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(45,51,25,0.28);
}
.tp-detail-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: rgba(45,51,25,0.7);
    color: #fff;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.tp-detail-close:hover { background: rgba(45,51,25,0.9); }

.tp-detail-body { padding: 1.5rem; }

.tp-detail-head { margin-bottom: 1rem; padding-right: 2.5rem; }
.tp-detail-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0;
    color: var(--earth-dark);
}
.tp-detail-sub {
    margin: 0.2rem 0 0;
    font-size: 0.82rem;
    color: var(--earth-light);
}

/* Photo-type tabs */
.tp-tabs {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.1rem;
}
.tp-tab {
    padding: 0.35rem 0.85rem;
    border-radius: 18px;
    border: 1.5px solid #d9d4c9;
    background: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--earth-medium);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tp-tab:hover { border-color: var(--leaf); color: var(--leaf); }
.tp-tab.active {
    background: var(--earth-dark);
    border-color: var(--earth-dark);
    color: #fff;
}

/* Visit timeline */
.tp-timeline {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.tp-visit {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    align-items: start;
    padding-bottom: 1rem;
    border-bottom: 1px solid #ece8df;
}
.tp-visit:last-child { border-bottom: 0; padding-bottom: 0; }

.tp-visit-img {
    aspect-ratio: 3/4;
    border-radius: 10px;
    overflow: hidden;
    background: var(--sand);
}
.tp-visit-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tp-visit-date {
    font-family: 'Crimson Pro', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--earth-dark);
}
.tp-visit-ago {
    font-size: 0.74rem;
    color: var(--earth-light);
    margin-top: 0.1rem;
}
.tp-visit-notes {
    margin: 0.5rem 0 0;
    font-size: 0.9rem;
    color: var(--earth-medium);
    line-height: 1.6;
}

.tp-detail-foot {
    margin: 1.25rem 0 0;
    padding-top: 1rem;
    border-top: 1px solid #ece8df;
    font-size: 0.82rem;
    color: var(--earth-light);
    font-style: italic;
}

/* ── Footer ─────────────────────────────────────────────── */
.tp-footer {
    background: var(--earth-dark);
    color: var(--sand);
    text-align: center;
    padding: 2.5rem 1.5rem;
}
.tp-footer-name {
    font-family: 'Crimson Pro', serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}
.tp-footer-tagline {
    margin: 0.3rem 0 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}
.tp-footer-links {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.tp-footer-links a {
    color: var(--sprout);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.tp-footer-links a:hover { text-decoration: underline; }
.tp-footer-copyright {
    margin: 0;
    font-size: 0.78rem;
    opacity: 0.6;
}

@media (max-width: 560px) {
    .tp-visit { grid-template-columns: 100px 1fr; }
    .tp-detail-body { padding: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tp-card { transition: none; }
    .tp-card:hover { transform: none; }
}

/* ── Full-size photo viewer ─────────────────────────────── */
.tp-zoom { cursor: zoom-in; }
.tp-zoom:focus-visible { outline: 3px solid var(--sprout); outline-offset: 2px; }

.tp-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    /* Above .tp-detail-overlay (9999) so the timeline stays open behind. */
    z-index: 10001;
    background: rgba(20,24,12,0.92);
    align-items: center;
    justify-content: center;
    padding: 2rem;
    cursor: zoom-out;
}
.tp-lightbox.open { display: flex; }
.tp-lightbox img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
}
.tp-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.tp-lightbox-close:hover { background: rgba(255,255,255,0.3); }

@media (max-width: 560px) {
    .tp-lightbox { padding: 1rem; }
}

/* ── Toolbar: search + zone chips + count ───────────────── */
.tp-sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

.tp-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.tp-search-wrap { position: relative; flex: 0 1 260px; }
.tp-search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--earth-light);
    pointer-events: none;
}
.tp-search {
    width: 100%;
    padding: 0.5rem 0.85rem 0.5rem 2.4rem;
    font-family: inherit;
    font-size: 0.9rem;
    border: 1.5px solid #d9d4c9;
    border-radius: 10px;
    background: #fff;
    color: var(--earth-dark);
    outline: none;
}
.tp-search:focus { border-color: var(--leaf); }

.tp-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tp-chip {
    padding: 0.38rem 0.85rem;
    border-radius: 18px;
    border: 1.5px solid #d9d4c9;
    background: #fff;
    font-family: inherit;
    font-size: 0.82rem;
    color: var(--earth-medium);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tp-chip:hover { border-color: var(--leaf); color: var(--leaf); }
.tp-chip.active {
    background: var(--earth-dark);
    border-color: var(--earth-dark);
    color: #fff;
}
.tp-chip-n { opacity: 0.6; font-size: 0.75rem; margin-left: 0.15rem; }

.tp-count {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--earth-light);
}

/* ── Latest updates ─────────────────────────────────────── */
.tp-latest-section { margin-bottom: 2rem; }
.tp-section-title {
    font-family: 'Crimson Pro', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--earth-dark);
    margin: 0 0 0.75rem;
}
.tp-latest {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
}
.tp-latest-card {
    flex: 0 0 auto;
    width: 150px;
    border: 0;
    padding: 0;
    background: var(--card);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    box-shadow: 0 2px 8px rgba(45,51,25,0.06);
    transition: transform 0.15s ease;
}
.tp-latest-card:hover,
.tp-latest-card:focus-visible { transform: translateY(-2px); outline: none; }

.tp-latest-img {
    display: block;
    aspect-ratio: 1/1;
    background: var(--sand);
    overflow: hidden;
}
.tp-latest-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tp-latest-info { display: block; padding: 0.5rem 0.6rem 0.65rem; }
.tp-latest-tag {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--earth-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tp-latest-date {
    display: block;
    font-size: 0.7rem;
    color: var(--earth-light);
    margin-top: 0.1rem;
}

@media (max-width: 560px) {
    .tp-toolbar { gap: 0.6rem; }
    .tp-search-wrap { flex: 1 1 100%; }
    .tp-count { margin-left: 0; }
}

/* ── Prev / next between trees ──────────────────────────── */
.tp-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin: 0 0 1.1rem;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid #ece8df;
}
.tp-nav-btn {
    padding: 0.35rem 0.8rem;
    border-radius: 8px;
    border: 1.5px solid #d9d4c9;
    background: #fff;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--earth-medium);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.tp-nav-btn:hover:not(:disabled) { border-color: var(--leaf); color: var(--leaf); }
.tp-nav-btn:disabled { opacity: 0.35; cursor: default; }
.tp-nav-pos {
    font-size: 0.75rem;
    color: var(--earth-light);
    white-space: nowrap;
}

/* ── Breadcrumb: species index → one species ────────────── */
.tp-crumb {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}
.tp-crumb-back {
    border: 0;
    background: none;
    padding: 0.25rem 0;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--leaf);
    cursor: pointer;
}
.tp-crumb-back:hover { text-decoration: underline; }
.tp-crumb-current {
    font-family: 'Crimson Pro', serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--earth-dark);
}
.tp-crumb-current::before {
    content: '/';
    color: var(--earth-light);
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: 0.9rem;
    margin-right: 0.5rem;
}

/* A species card counts trees rather than naming one, so the corner
   label reads as a quantity instead of a tag. */
.tp-species-card .tp-card-tag {
    background: rgba(90,122,58,0.88);
}
