/* Global Styles */
:root {
    --primary-color: #2d3436;
    --accent-color: #0984e3;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-color: #2d3436;
    --text-muted: #636e72;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.15);
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --radii: 16px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    margin: 0;
    min-height: 100vh;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

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

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 40px 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3.5rem;
    background: linear-gradient(135deg, #2d3436 0%, #636e72 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

header p {
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Family Grid (Main Page) */
.family-grid {
    display: grid;
    /* Increased min-width to prevent squishing, increased gap */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 40px;
    width: 100%;
    margin-bottom: 80px;
    padding: 0 20px;
    /* Add side padding */
    box-sizing: border-box;
}

.member-card {
    background: var(--card-bg);
    border-radius: var(--radii);
    overflow: hidden;
    position: relative;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px;
    height: auto;
    /* Allow height to fit content */
    min-height: 200px;
    /* Minimum height for consistency */
    cursor: pointer;
    z-index: 1;
    /* Ensure distinct stacking context */
}

/* ... unused hover styles ... */

.member-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: rgba(9, 132, 227, 0.3);
    z-index: 2;
    /* Lift above others on hover */
}

/* ... */

/* Photo Gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    /* Increased gap */
    width: 100%;
    max-width: 1000px;
    /* Slightly wider */
    margin: 40px 0;
}

.photo-gallery img {
    border-radius: var(--radii);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    object-fit: cover;
    object-position: top center;
    /* Fixes "heads cut off" by anchoring to top */
    width: 100%;
    height: 100%;
    max-height: 500px;
    /* constrain height */
    aspect-ratio: auto;
    /* Allow natural aspect ratio if needed, or stick to 16/9 but top aligned */
}


/* Subdomain Page Styles */
.profile-header {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeInUp 0.8s ease-out;
}

.profile-img {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    width: 100%;
    max-width: 900px;
}

.link-card {
    background: var(--card-bg);
    border-radius: var(--radii);
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.link-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    background: #fafbfc;
}

.link-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 8px;
    /* Softer square for logos */
}

.link-content h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.link-content p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.back-home {
    margin-top: 60px;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.7;
}

.back-home:hover {
    opacity: 1;
    color: var(--accent-color);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem;
    }

    .photo-gallery {
        grid-template-columns: 1fr;
    }

    .member-card {
        padding: 30px;
    }
}