/* =====================================================
   Somers & Hime Family Photos — index_AI stylesheet
   ===================================================== */

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --color-primary:   #4f46e5;   /* indigo */
    --color-primary-d: #3730a3;
    --color-accent:    #0ea5e9;   /* sky */
    --color-photos:    #059669;   /* emerald */
    --color-trips:     #d97706;   /* amber */
    --color-bg:        #f8fafc;
    --color-surface:   #ffffff;
    --color-border:    #e2e8f0;
    --color-text:      #1e293b;
    --color-muted:     #64748b;
    --radius:          12px;
    --shadow-sm:       0 1px 3px rgba(0,0,0,.08);
    --shadow-md:       0 4px 16px rgba(0,0,0,.10);
    --shadow-lg:       0 8px 32px rgba(0,0,0,.14);
    --transition:      0.2s ease;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

img { display: block; max-width: 100%; }

/* ----- Layout ----- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ----- SITE HEADER ----- */
.site-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
    color: white;
    padding: 36px 20px 28px;
    text-align: center;
    position: relative;
}

.header-inner { max-width: 800px; margin: 0 auto; }

.site-header h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0,0,0,.2);
}

.header-sub {
    font-size: 1.05rem;
    opacity: 0.88;
}

.header-crests {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 18px;
}

.header-crests .crest {
    height: 64px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

.back-home {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    font-size: 0.9rem;
    margin-bottom: 14px;
    transition: background var(--transition);
}
.back-home:hover { background: rgba(255,255,255,0.28); }

/* ----- GLOBAL SEARCH SECTION ----- */
.global-search-section {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.search-wrap {
    display: flex;
    align-items: center;
    background: var(--color-bg);
    border: 2px solid var(--color-border);
    border-radius: 50px;
    padding: 0 18px;
    gap: 10px;
    max-width: 680px;
    margin: 0 auto;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.12);
}

.search-icon { font-size: 1.1rem; flex-shrink: 0; }

.search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 13px 0;
    font-size: 1rem;
    color: var(--color-text);
    outline: none;
}

.clear-btn {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-muted);
    padding: 4px;
    flex-shrink: 0;
}
.clear-btn:hover { color: var(--color-text); }

/* ----- SEARCH RESULTS DROPDOWN ----- */
.search-results {
    max-width: 680px;
    margin: 8px auto 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 400px;
    overflow-y: auto;
}

.sr-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--color-border);
    transition: background var(--transition);
    cursor: pointer;
}
.sr-item:last-child { border-bottom: none; }
.sr-item:hover { background: #f1f5f9; }

.sr-icon { font-size: 1.3rem; flex-shrink: 0; }
.sr-text { flex: 1; }
.sr-text strong { display: block; font-size: 0.95rem; }
.sr-text small { color: var(--color-muted); font-size: 0.82rem; }
.sr-arrow { color: var(--color-muted); flex-shrink: 0; }

.no-hits { padding: 20px 18px; color: var(--color-muted); text-align: center; }

/* ----- BRANCH GRID (homepage) ----- */
.branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 28px;
    padding: 40px 0 20px;
}

.branch-card {
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    background: var(--color-surface);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}
.branch-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.branch-card-img {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #7c3aed 100%);
    overflow: hidden;
}
.branch-jean-iva .branch-card-img { background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%); }
.branch-jpa .branch-card-img      { background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%); }

.branch-card-img img { width: 100%; height: 100%; object-fit: cover; }
.branch-card-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,.45));
}

.branch-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.branch-icon { font-size: 2.2rem; }

.branch-card-body h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-text);
}

.branch-card-body p { color: var(--color-muted); font-size: 0.95rem; line-height: 1.5; }

.branch-decades {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.decade-pill {
    background: #ede9fe;
    color: var(--color-primary);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

.branch-cta {
    display: inline-block;
    margin-top: 8px;
    color: var(--color-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

/* ----- QUICK LINKS (homepage) ----- */
.quick-links-section { padding: 20px 0 10px; }
.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-border);
}

.quick-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.ql-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}
.ql-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(79,70,229,.15);
    transform: translateY(-2px);
}
.ql-highlight {
    background: linear-gradient(135deg, var(--color-primary), #7c3aed);
    color: white;
    border-color: transparent;
}
.ql-highlight:hover { opacity: 0.92; }

.ql-icon { font-size: 1.8rem; }
.ql-label { font-size: 0.88rem; font-weight: 600; line-height: 1.4; }
.ql-label small { font-weight: 400; opacity: 0.75; }

/* ----- TIMELINE SECTION (homepage) ----- */
.timeline-section { padding: 20px 0 40px; }

.timeline { display: flex; flex-direction: column; gap: 0; }

.tl-decade {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 0 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--color-border);
    align-items: start;
}
.tl-decade:last-child { border-bottom: none; }

.tl-year-badge {
    background: var(--color-primary);
    color: white;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 6px 8px;
    border-radius: 8px;
    text-align: center;
    align-self: start;
    margin-top: 4px;
}

.tl-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tl-branch-label {
    width: 100%;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 6px;
    margin-bottom: 2px;
}
.jean-iva-label { color: #0ea5e9; }
.jpa-label { color: #f59e0b; }

.tl-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    border-radius: 20px;
    font-size: 0.83rem;
    font-weight: 600;
    transition: all var(--transition);
    border: 1.5px solid;
}
.tl-photos {
    background: #ecfdf5;
    border-color: #6ee7b7;
    color: #065f46;
}
.tl-photos:hover {
    background: var(--color-photos);
    color: white;
    border-color: var(--color-photos);
}
.tl-trips {
    background: #fffbeb;
    border-color: #fcd34d;
    color: #92400e;
}
.tl-trips:hover {
    background: var(--color-trips);
    color: white;
    border-color: var(--color-trips);
}

/* ----- TAB BAR (branch pages) ----- */
.tab-bar {
    display: flex;
    gap: 8px;
    padding: 16px 0 0;
}

.tab {
    padding: 9px 22px;
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-muted);
    transition: all var(--transition);
}
.tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* ----- DECADE SECTIONS (branch pages) ----- */
.decade-section { padding: 28px 0 12px; border-bottom: 1px solid var(--color-border); }
.decade-section:last-child { border-bottom: none; }

.decade-header-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.decade-badge {
    background: var(--color-primary);
    color: white;
    font-size: 0.82rem;
    font-weight: 800;
    padding: 5px 14px;
    border-radius: 20px;
    flex-shrink: 0;
}

.decade-header-bar h2 {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--color-text);
}

.decade-note {
    font-size: 0.82rem;
    color: var(--color-muted);
    background: #f1f5f9;
    padding: 3px 10px;
    border-radius: 12px;
}

.subsection-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 18px 0 10px;
}

/* ----- ALBUM ROW ----- */
.album-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 8px;
}

/* ----- ALBUM TILE ----- */
.album-tile {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    width: 220px;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    cursor: pointer;
}
.album-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.album-tile.compact { width: 200px; }

.album-tile-img {
    height: 130px;
    background: linear-gradient(135deg, #c7d2fe, #a5f3fc);
    overflow: hidden;
    flex-shrink: 0;
}
.album-tile-img img { width: 100%; height: 100%; object-fit: cover; }
.album-tile-img.no-img {
    background: linear-gradient(135deg, #e0e7ff 0%, #dbeafe 100%);
    height: 60px;
}

.album-tile.compact .album-tile-img { height: 100px; }

.album-tile-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.album-tile-body h3 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.3;
}

.album-tile-body p {
    font-size: 0.8rem;
    color: var(--color-muted);
    line-height: 1.4;
}

/* Type-specific tile accents */
.type-photos { border-top: 3px solid var(--color-photos); }
.type-trips  { border-top: 3px solid var(--color-trips); }

.album-tile.highlight-tile {
    border-top-color: var(--color-primary);
    background: linear-gradient(135deg, #ede9fe 0%, #dbeafe 100%);
}

/* ----- TYPE BADGES ----- */
.type-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.photos-badge { background: #d1fae5; color: #065f46; }
.trips-badge  { background: #fef3c7; color: #92400e; }
.new-badge    { background: #ede9fe; color: var(--color-primary); }

/* ----- SITE FOOTER ----- */
.site-footer {
    background: var(--color-text);
    color: rgba(255,255,255,0.7);
    text-align: center;
    padding: 28px 20px;
    margin-top: 48px;
    font-size: 0.88rem;
    line-height: 1.8;
}
.site-footer a { color: rgba(255,255,255,0.85); text-decoration: underline; }
.site-footer a:hover { color: white; }

/* ----- RESPONSIVE ----- */
@media (max-width: 768px) {
    .site-header h1 { font-size: 1.6rem; }
    .branch-grid { grid-template-columns: 1fr; gap: 20px; }
    .quick-links-grid { grid-template-columns: repeat(2, 1fr); }
    .tl-decade { grid-template-columns: 58px 1fr; gap: 0 12px; }
    .album-tile { width: calc(50% - 7px); }
    .album-tile.compact { width: calc(50% - 7px); }
}

@media (max-width: 480px) {
    .album-tile, .album-tile.compact { width: 100%; }
    .tab { padding: 7px 14px; font-size: 0.82rem; }
    .quick-links-grid { grid-template-columns: 1fr 1fr; }
}
