:root {
    --paper: #f6efe4;
    --paper-2: #fffaf2;
    --ink: #2b2621;
    --muted: #76695a;
    --line: #e2d3bd;
    --terracotta: #9b4a2f;
    --terracotta-dark: #783621;
    --gold: #c9a46a;
    --shadow: 0 18px 45px rgba(61, 43, 31, .12);
    --radius: 22px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    background:
        radial-gradient(circle at top left, rgba(201,164,106,.18), transparent 35%),
        linear-gradient(135deg, #f8f0e3 0%, #efe0ca 100%);
    color: var(--ink);
    min-height: 100vh;
}

body, input, button { font-size: 16px; }

a { color: inherit; }

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

.login-body {
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-page { width: min(440px, 100%); }

.login-card,
.hero-card,
.empty-state,
.stat-card,
.album-card,
.family-card,
.timeline-item {
    background: rgba(255,250,242,.88);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.login-card {
    border-radius: 30px;
    padding: 42px;
    text-align: center;
}

.brand-mark {
    width: 76px;
    height: 76px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--terracotta);
    color: #fffaf2;
    font-weight: 800;
    letter-spacing: .08em;
    border: 4px solid #ead7bc;
}

.brand-mark.small {
    width: 48px;
    height: 48px;
    margin: 0;
    font-size: .9rem;
    border-width: 3px;
    flex: 0 0 auto;
}

.eyebrow {
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: var(--terracotta);
    font-size: .76rem;
    font-weight: 700;
    font-family: Arial, sans-serif;
}

h1, h2, h3, p { margin-top: 0; }

h1 { font-size: clamp(2.1rem, 5vw, 4.3rem); line-height: 1; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
h3 { font-size: 1.25rem; }

.login-intro { color: var(--muted); line-height: 1.6; }

.login-form { text-align: left; margin-top: 26px; }
.login-form label { display: block; margin-bottom: 8px; font-family: Arial, sans-serif; font-weight: 700; }
.login-form input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 15px;
    background: #fff;
    color: var(--ink);
}

button, .button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    border-radius: 999px;
    padding: 13px 22px;
    background: var(--terracotta);
    color: #fffaf2;
    text-decoration: none;
    font-weight: 800;
    font-family: Arial, sans-serif;
    cursor: pointer;
}

button { width: 100%; margin-top: 14px; }
button:hover, .button:hover { background: var(--terracotta-dark); }
.button.ghost { background: transparent; color: var(--terracotta); border: 1px solid var(--terracotta); }

.alert {
    margin: 18px 0;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fbe7df;
    border: 1px solid #e0a38f;
    color: #7b2d17;
    font-family: Arial, sans-serif;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 26px;
    border-right: 1px solid var(--line);
    background: rgba(255,250,242,.72);
    backdrop-filter: blur(10px);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 32px;
}

.sidebar-brand strong { display: block; font-size: 1.05rem; }
.sidebar-brand em { display: block; color: var(--muted); font-size: .88rem; }

.side-nav { display: grid; gap: 8px; font-family: Arial, sans-serif; }
.side-nav a {
    padding: 12px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 700;
}
.side-nav a:hover, .side-nav a.is-active {
    background: #f0dfc4;
    color: var(--terracotta);
}

.main-content {
    width: min(1180px, 100%);
    padding: 34px;
}

.hero-card {
    border-radius: 34px;
    padding: clamp(34px, 6vw, 74px);
    margin-bottom: 24px;
    background:
        linear-gradient(90deg, rgba(255,250,242,.96), rgba(255,250,242,.78)),
        radial-gradient(circle at right, rgba(155,74,47,.20), transparent 45%);
}

.hero-card p { max-width: 720px; color: var(--muted); line-height: 1.7; font-size: 1.08rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 34px;
}

.stat-card { border-radius: var(--radius); padding: 24px; }
.stat-card strong { display: block; color: var(--terracotta); font-size: 2.2rem; }
.stat-card span { color: var(--muted); font-family: Arial, sans-serif; font-weight: 700; }

.content-section { margin-top: 34px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; }

.year-block { margin: 28px 0 42px; }
.year-block > h3 {
    display: inline-flex;
    border-bottom: 3px solid var(--gold);
    padding-bottom: 4px;
}

.album-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.album-card {
    border-radius: var(--radius);
    padding: 12px 12px 18px;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease;
}
.album-card:hover { transform: translateY(-4px); }
.album-cover {
    display: grid;
    place-items: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 17px;
    background: #ead7bc;
    margin-bottom: 14px;
}
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.no-cover { font-size: 2rem; font-weight: 900; color: var(--terracotta); }
.album-title { display: block; font-size: 1.2rem; font-weight: 800; }
.album-meta { display: block; color: var(--muted); margin-top: 4px; font-family: Arial, sans-serif; }

.page-title {
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
}
.page-title p { color: var(--muted); line-height: 1.6; max-width: 760px; }
.back-link {
    display: inline-flex;
    margin-bottom: 18px;
    color: var(--terracotta);
    text-decoration: none;
    font-family: Arial, sans-serif;
    font-weight: 800;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.photo-card {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 8px solid #fffaf2;
    border-radius: 18px;
    box-shadow: 0 12px 26px rgba(61,43,31,.13);
    background: #fffaf2;
}
.photo-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .18s ease; }
.photo-card:hover img { transform: scale(1.04); }

.family-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}
.family-card {
    border-radius: var(--radius);
    padding: 18px;
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 16px;
    align-items: start;
}
.family-photo {
    width: 90px;
    height: 90px;
    border-radius: 24px;
    overflow: hidden;
    display: grid;
    place-items: center;
    background: #ead7bc;
    color: var(--terracotta);
    font-size: 2rem;
    font-weight: 900;
}
.family-photo img { width: 100%; height: 100%; object-fit: cover; }
.family-card h3 { margin-bottom: 4px; }
.relation { color: var(--terracotta); font-weight: 800; font-family: Arial, sans-serif; margin-bottom: 8px; }
.small-text { font-size: .92rem; color: var(--muted); }

.timeline { display: grid; gap: 12px; }
.timeline-item {
    border-radius: 18px;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 140px 1fr 130px;
    gap: 12px;
    align-items: center;
}
.timeline-item em { color: var(--terracotta); font-style: normal; font-family: Arial, sans-serif; font-weight: 800; }

.empty-state {
    border-radius: var(--radius);
    padding: 28px;
    color: var(--muted);
}
code {
    background: #efe0ca;
    padding: 2px 6px;
    border-radius: 6px;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: static;
        height: auto;
        padding: 18px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .sidebar-brand { margin-bottom: 16px; }
    .side-nav { display: flex; flex-wrap: wrap; }
    .main-content { padding: 22px; }
    .stats-grid, .album-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .family-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .login-card { padding: 28px; }
    .stats-grid, .album-grid, .photo-grid { grid-template-columns: 1fr; }
    .photo-card { aspect-ratio: 4 / 3; }
    .family-card { grid-template-columns: 1fr; }
    .timeline-item { grid-template-columns: 1fr; }
}

.next-birthday {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}
.next-birthday h2 { margin: 4px 0 8px; }
.next-birthday p { color: var(--muted); }
.birthday-countdown {
    min-width: 190px;
    border-radius: 22px;
    padding: 18px;
    text-align: center;
    background: #efe0ca;
    border: 1px solid var(--line);
}
.birthday-countdown strong {
    display: block;
    font-size: 1.45rem;
    color: var(--terracotta);
}
.birthday-countdown span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: .88rem;
}
.birthday-item small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-family: Arial, sans-serif;
    font-size: .86rem;
}
.birthday-pill {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 13px;
    background: #fff4df;
    color: var(--terracotta);
    border: 1px solid var(--line);
    font-family: Arial, sans-serif;
    font-weight: 800;
    white-space: nowrap;
}

@media (max-width: 700px) {
    .next-birthday { flex-direction: column; align-items: stretch; }
    .birthday-countdown { min-width: 0; }
    .birthday-pill { justify-self: start; }
}
