:root {
    --family-bg: #faf8f3;
    --family-surface: #ffffff;
    --family-blue: #2f80ed;
    --family-blue-dark: #1f5faf;
    --family-blue-light: #eaf4ff;
    --family-blue-soft: #dceeff;
    --family-navy: #1e3a5f;
    --family-coral: #ff5c77;
    --family-coral-light: #ffe8ed;
    --family-orange: #f59e42;
    --family-orange-light: #fff0de;
    --family-cream: #f5f0e7;
    --family-text: #2f3542;
    --family-text-muted: #70757d;
    --family-border: #e7e9ee;
    --family-white: #ffffff;
    --family-shadow: 0 4px 16px rgba(30, 58, 95, 0.06);

    /* Compatibility aliases keep the existing component structure presentation-only. */
    --family-green: var(--family-blue);
    --family-green-dark: var(--family-blue-dark);
    --family-green-light: var(--family-blue-light);
    --family-brown: var(--family-navy);
    --family-beige: var(--family-cream);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    background: var(--family-bg);
    color: var(--family-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    line-height: 1.65;
}
a { color: var(--family-green-dark); text-decoration: none; }
a:hover { color: var(--family-green); }

.family-navbar {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--family-border);
    backdrop-filter: blur(12px);
    min-height: 76px;
}
.navbar-brand { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.navbar-brand:hover { color: var(--family-brown); }
.navbar-brand > span > span, .family-footer > span { color: var(--family-coral); }
.navbar-brand small { color: var(--family-text-muted); display: block; font-family: inherit; font-size: .64rem; font-style: italic; font-weight: 400; letter-spacing: .04em; margin-top: 4px; }
.navbar-nav { gap: .1rem; }
.navbar-nav .nav-link { color: var(--family-text-muted); font-size: .88rem; font-weight: 600; margin: 0 .1rem; padding: 1.15rem .45rem .9rem; position: relative; }
.navbar-nav .nav-link:hover { color: var(--family-blue-dark); }
.navbar-nav .nav-link.active { color: var(--family-blue); }
.navbar-nav .nav-link.active::after { background: var(--family-green); border-radius: 3px; bottom: .55rem; content: ""; height: 2px; left: .55rem; position: absolute; right: .55rem; }
.nav-account { align-items: center; display: flex; gap: .7rem; }
.nav-account form { display: flex; margin: 0; }
.nav-login, .nav-account .nav-login { color: var(--family-brown); font-size: .9rem; font-weight: 600; padding: .35rem; text-decoration: none; }
.nav-login:hover { color: var(--family-green); }
.admin-link { align-items: center; background: var(--family-green-light); border-radius: 50%; display: flex; height: 34px; justify-content: center; width: 34px; }
.user-chip { align-items: center; display: flex; font-size: .88rem; font-weight: 700; gap: .45rem; }
.navbar-toggler { border-color: var(--family-border); }

.page-shell { min-height: calc(100vh - 160px); padding-bottom: 3.5rem; padding-top: 2rem; }
.family-card { background: var(--family-surface); border: 1px solid var(--family-border); border-radius: 18px; box-shadow: var(--family-shadow); }
.sidebar-stack, .feed-stack { display: flex; flex-direction: column; gap: 1.25rem; }
.sidebar-card { padding: 1.25rem; }
.sidebar-card h2 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.08rem; font-weight: 700; margin: .8rem 0 .45rem; }
.sidebar-card p { color: var(--family-text-muted); font-size: .88rem; margin-bottom: 1rem; }

.profile-placeholder { align-items: center; background: var(--family-blue-light); border: 4px solid var(--family-white); border-radius: 50%; box-shadow: 0 0 0 2px var(--family-blue-soft), 0 4px 14px rgba(30,58,95,.1); color: var(--family-blue); display: flex; height: 92px; justify-content: center; overflow: hidden; width: 92px; }
.profile-placeholder i { font-size: 1.8rem; }
.sidebar-card:first-child .profile-placeholder i { color: var(--family-coral); }
.profile-placeholder img { height: 100%; object-fit: cover; width: 100%; }
.category-list { display: flex; flex-direction: column; gap: .3rem; }
.category-list a { align-items: center; border-radius: 10px; color: var(--family-text); display: flex; font-size: .9rem; gap: .7rem; padding: .52rem .65rem; }
.category-list a:hover { background: var(--family-green-light); color: var(--family-green-dark); }
.category-list i { color: var(--family-green); font-size: 1rem; width: 18px; }

.btn-family { background: var(--family-blue); border-color: var(--family-blue); border-radius: 11px; color: var(--family-white); font-weight: 650; }
.btn-family:hover, .btn-family:focus { background: var(--family-green-dark); border-color: var(--family-green-dark); color: var(--family-white); }
.btn-family-outline { background: var(--family-blue); border: 1px solid var(--family-blue); border-radius: 11px; color: var(--family-white); font-size: .85rem; font-weight: 650; }
.btn-family-outline:hover { background: var(--family-blue-dark); border-color: var(--family-blue-dark); color: var(--family-white); }

.composer-card { align-items: center; display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.25rem; padding: 1rem 1.1rem; }
.composer-prompt { background: #f5f8fc; border: 1px solid #edf1f6; border-radius: 30px; color: var(--family-text-muted); flex: 1; min-width: 190px; padding: .65rem 1rem; }
.composer-actions { align-items: center; display: flex; gap: .8rem; width: 100%; }
.composer-actions > a:first-child { border-top: 1px solid var(--family-border); color: var(--family-green-dark); flex: 1; font-size: .9rem; padding-top: .7rem; }
.composer-actions .btn { border-top: 0; padding: .45rem .85rem; }

.avatar { align-items: center; background: var(--family-blue-light); border: 1px solid var(--family-blue-soft); border-radius: 50%; color: var(--family-blue-dark); display: inline-flex; flex: 0 0 auto; font-family: Georgia, serif; font-size: 1rem; font-weight: 700; height: 42px; justify-content: center; width: 42px; }
.avatar-small { font-size: .78rem; height: 31px; width: 31px; }
.post-card { overflow: hidden; }
.post-header { align-items: center; display: flex; gap: .7rem; padding: 1.1rem 1.2rem .65rem; }
.post-author { flex: 1; line-height: 1.35; min-width: 0; }
.post-author strong { color: var(--family-brown); display: block; font-size: .92rem; }
.post-author div { color: var(--family-text-muted); font-size: .76rem; }
.post-badges { align-items: flex-end; display: flex; flex-direction: column; gap: .3rem; }
.category-badge { background: var(--family-green-light); color: var(--family-green-dark); font-size: .68rem; font-weight: 650; }
.category-quote .category-badge { background: #f8f5ee; color: var(--family-blue-dark); }
.category-funny .category-badge { background: var(--family-orange-light); color: #9a5d1e; }
.category-world .category-badge { background: var(--family-blue-soft); color: var(--family-navy); }
.privacy-label { background: #f3f6fa; border-radius: 20px; color: #687789; font-size: .71rem; padding: .12rem .45rem; }
.privacy-label i { margin-right: .2rem; }
.post-body { padding: .25rem 1.2rem 1.05rem; }
.post-body h2 { font-family: Georgia, serif; font-size: 1.35rem; line-height: 1.35; margin-bottom: .55rem; }
.post-body h2 a { color: var(--family-brown); }
.post-copy { color: #454c58; font-size: .95rem; overflow-wrap: anywhere; }

.photo-grid { display: grid; gap: 5px; padding: 0 5px; }
.photo-grid a { background: var(--family-blue-light); display: block; min-height: 0; overflow: hidden; }
.photo-grid img { display: block; height: 250px; object-fit: cover; transition: transform .35s ease; width: 100%; }
.photo-grid a:hover img { transform: scale(1.015); }
.photo-grid a:first-child { border-radius: 13px 0 0 13px; }
.photo-grid a:last-child { border-radius: 0 13px 13px 0; }
.photos-1 { grid-template-columns: 1fr; }
.photos-1 img { height: 430px; }
.photos-1 a:first-child { border-radius: 13px; }
.photos-2 { grid-template-columns: repeat(2, 1fr); }
.photos-2 img { height: 330px; }
.photos-3 { grid-template-columns: 1.35fr 1fr; grid-template-rows: repeat(2, 185px); }
.photos-3 a:first-child { grid-row: 1 / 3; }
.photos-3 a:first-child img { height: 375px; }
.photos-3 a:nth-child(n+2) img { height: 185px; }
.photos-3 a:nth-child(2) { border-radius: 0 13px 0 0; }
.photos-3 a:last-child { border-radius: 0 0 13px 0; }
.photos-4, .photos-5, .photos-6, .photos-7, .photos-8, .photos-9 { grid-template-columns: repeat(2, 1fr); }
.photos-4 img, .photos-5 img, .photos-6 img, .photos-7 img, .photos-8 img, .photos-9 img { height: 225px; }

.post-footer { align-items: center; border-top: 1px solid var(--family-border); display: flex; font-size: .8rem; justify-content: space-between; margin: 1rem 1.2rem 0; padding: .75rem 0; }
.post-footer a { color: var(--family-text-muted); }
.post-footer a:hover { color: var(--family-green-dark); }
.comment-preview { border-top: 1px solid var(--family-border); display: flex; flex-direction: column; gap: .6rem; margin: 0 1.2rem; padding: .9rem 0 1.15rem; }
.comment-row { align-items: flex-start; display: flex; gap: .55rem; }
.comment-row.reply { margin-left: 2.3rem; }
.comment-bubble { background: #f5f8fc; border: 1px solid #edf1f6; border-radius: 14px; display: flex; flex-direction: column; font-size: .84rem; max-width: 100%; padding: .5rem .75rem; overflow-wrap: anywhere; }
.comment-bubble strong { color: var(--family-brown); font-size: .78rem; }
.comment-row small { color: var(--family-text-muted); display: block; font-size: .68rem; margin: .18rem 0 0 .55rem; }

.eyebrow { color: var(--family-green); display: block; font-size: .72rem; font-weight: 800; letter-spacing: .1em; margin-bottom: .6rem; text-transform: uppercase; }
.mini-quote { background: var(--family-surface); border-top: 3px solid var(--family-blue-soft); position: relative; }
.mini-quote blockquote { color: var(--family-brown); font-family: Georgia, serif; font-size: 1rem; font-style: italic; line-height: 1.55; }
.mini-quote a, .mini-funny a { font-size: .78rem; font-weight: 700; }
.mini-funny { border-top: 3px solid var(--family-orange); }
.mini-funny .eyebrow { color: var(--family-orange); }
.album-grid { display: grid; gap: 5px; grid-template-columns: repeat(3, 1fr); }
.album-grid a { border: 1px solid var(--family-blue-soft); border-radius: 8px; overflow: hidden; }
.album-grid img { aspect-ratio: 1; display: block; object-fit: cover; transition: transform .25s ease; width: 100%; }
.album-grid a:hover img { transform: scale(1.035); }
.album-empty { align-items: center; background: var(--family-blue-light); border-radius: 12px; color: var(--family-text-muted); display: flex; flex-direction: column; font-size: .75rem; gap: .3rem; justify-content: center; min-height: 105px; text-align: center; }
.album-empty i { color: var(--family-green); font-size: 1.6rem; }
.stats-card { background: #fbfdff; display: flex; padding: 1rem; }
.stats-card div { align-items: center; display: flex; flex: 1; flex-direction: column; }
.stats-card div + div { border-left: 1px solid var(--family-border); }
.stats-card strong { color: var(--family-blue); font-family: Georgia, serif; font-size: 1.25rem; }
.stats-card span { color: var(--family-text-muted); font-size: .7rem; }
.empty-note { color: var(--family-text-muted); font-size: .85rem; margin: 0; }
.empty-state { color: var(--family-text-muted); padding: 3rem 1.5rem; text-align: center; }
.empty-state i { color: var(--family-green); display: block; font-size: 2.2rem; margin-bottom: .8rem; }
.empty-state h1, .empty-state h2 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.35rem; }

.section-hero { align-items: center; background: var(--family-blue-light); border: 1px solid var(--family-blue-soft); border-radius: 20px; display: flex; gap: 1rem; margin-bottom: 1.5rem; padding: 1.4rem 1.6rem; }
.section-hero.quote-page { background: #fffefa; border-color: var(--family-blue-soft); }
.section-hero.funny-page { background: var(--family-orange-light); border-color: #f8d9b8; }
.section-hero.world-page { background: var(--family-blue-light); border-color: var(--family-blue-soft); }
.section-icon { align-items: center; background: rgba(255,255,255,.65); border-radius: 50%; color: var(--family-green-dark); display: flex; flex: 0 0 auto; font-size: 1.4rem; height: 52px; justify-content: center; width: 52px; }
.funny-page .section-icon { color: #a56625; }
.world-page .section-icon { color: var(--family-green-dark); }
.section-hero.quote-page h1 { color: var(--family-blue-dark); }
.section-hero.funny-page h1 { color: #a56625; }
.section-hero h1 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.65rem; margin: 0 0 .1rem; }
.section-hero p { color: var(--family-text-muted); margin: 0; }
.quote-page .post-card { background: var(--family-surface); border-left: 4px solid var(--family-blue); position: relative; }
.quote-page .post-body { padding-left: 2.6rem; position: relative; }
.quote-page .post-body::before { color: var(--family-blue-soft); content: "“"; font-family: Georgia, serif; font-size: 4rem; left: .7rem; line-height: 1; position: absolute; top: -.2rem; }
.quote-page .post-copy { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.08rem; font-style: italic; }
.funny-page .post-card { border-top: 3px solid var(--family-orange); }

.site-about-card { margin: 1rem auto; max-width: 780px; padding: 2.5rem; text-align: center; }
.site-about-icon { align-items: center; background: var(--family-green-light); border-radius: 50%; color: var(--family-green-dark); display: flex; font-size: 2rem; height: 76px; justify-content: center; margin: 0 auto 1.1rem; width: 76px; }
.site-about-icon img { border-radius: 50%; height: 100%; object-fit: cover; width: 100%; }
.site-about-card h1 { color: var(--family-green-dark); font-family: Georgia, serif; font-size: 2rem; margin-bottom: 1.5rem; }
.site-about-copy { color: #504d47; margin: 0 auto 1.8rem; max-width: 640px; text-align: left; }
.site-about-copy p { margin-bottom: 1rem; }

.about-card { display: grid; gap: 3rem; grid-template-columns: minmax(280px, .8fr) 1.4fr; margin: 1rem auto; max-width: 1000px; overflow: hidden; padding: 2rem; }
.about-photo img, .about-placeholder { border-radius: 18px; height: 100%; min-height: 440px; object-fit: cover; width: 100%; }
.about-placeholder { align-items: center; background: var(--family-blue-light); color: var(--family-blue-dark); display: flex; flex-direction: column; gap: .8rem; justify-content: center; }
.about-placeholder i { font-size: 3rem; }
.about-content { align-self: center; }
.about-content h1 { color: var(--family-brown); font-family: Georgia, serif; font-size: 2.25rem; margin-bottom: 1rem; }
.about-lead { color: #4c5563; font-size: 1.03rem; }
.about-sections { display: grid; gap: 1rem; grid-template-columns: repeat(2, 1fr); margin: 1.5rem 0; }
.about-sections > div { background: #f7faff; border: 1px solid #edf3fa; border-radius: 14px; padding: 1rem; }
.about-sections i { color: var(--family-green); }
.about-sections h2 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1rem; margin: .4rem 0; }
.about-sections p { color: var(--family-text-muted); font-size: .84rem; margin: 0; }
.favorite-quote { border-left: 3px solid var(--family-coral); color: var(--family-brown); font-family: Georgia, serif; font-style: italic; margin: 1.4rem 0; padding-left: 1rem; }

.detail-column { margin: 0 auto; max-width: 780px; }
.back-link { display: inline-block; font-size: .85rem; margin-bottom: 1rem; }
.comments-section { margin-top: 1.25rem; padding: 1.35rem; }
.comments-section > h2 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.25rem; margin-bottom: 1.2rem; }
.main-comment-form { align-items: flex-start; display: flex; gap: .65rem; }
.comment-input, .form-control { background-color: #fbfdff; border-color: var(--family-border); border-radius: 12px; }
.comment-input:focus, .form-control:focus { border-color: var(--family-blue); box-shadow: 0 0 0 .2rem rgba(47,128,237,.14); }
.form-error { color: #a33b35; font-size: .8rem; margin-top: .3rem; }
.login-to-comment { align-items: center; background: var(--family-green-light); border-radius: 12px; color: var(--family-text-muted); display: flex; font-size: .88rem; gap: .7rem; padding: .85rem 1rem; }
.comments-list { border-top: 1px solid var(--family-border); display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.1rem; padding-top: 1.1rem; }
.comment-thread > .reply { margin-top: .65rem; }
.reply-control { margin: .3rem 0 0 2.3rem; }
.reply-control summary { color: var(--family-green-dark); cursor: pointer; font-size: .72rem; font-weight: 700; }
.reply-control form { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
.reply-control .btn { align-self: flex-end; }

.auth-card { margin: 2.5rem auto; max-width: 440px; padding: 2rem; text-align: center; }
.auth-icon { align-items: center; background: var(--family-green-light); border-radius: 50%; color: var(--family-green-dark); display: flex; font-size: 1.6rem; height: 60px; justify-content: center; margin: 0 auto 1rem; width: 60px; }
.auth-card h1 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.8rem; }
.auth-card > p, .auth-card > small { color: var(--family-text-muted); }
.auth-card form { margin: 1.5rem 0; text-align: left; }
.form-label { color: var(--family-brown); font-size: .82rem; font-weight: 700; }
.form-alert { background: #f9e7e3; border-radius: 10px; color: #8e3c34; font-size: .84rem; padding: .75rem; }

.error-card { margin: 4rem auto; max-width: 600px; padding: 3rem 2rem; text-align: center; }
.error-code { color: var(--family-green); font-family: Georgia, serif; font-size: 4rem; font-weight: 700; line-height: 1; }
.error-card h1 { color: var(--family-brown); font-family: Georgia, serif; font-size: 1.65rem; margin: 1rem 0 .6rem; }
.error-card p { color: var(--family-text-muted); }
.family-footer { border-top: 1px solid var(--family-border); color: var(--family-text-muted); font-family: Georgia, serif; font-size: .88rem; padding: 1.5rem; text-align: center; }

@media (max-width: 991.98px) {
    .family-navbar { min-height: 68px; }
    .navbar-nav .nav-link { padding: .55rem .2rem; }
    .navbar-nav .nav-link.active::after { bottom: .25rem; left: .2rem; right: auto; width: 30px; }
    .nav-account { border-top: 1px solid var(--family-border); margin-top: .6rem; padding: .7rem 0; }
    .about-card { gap: 2rem; grid-template-columns: .8fr 1.2fr; }
}

@media (max-width: 767.98px) {
    .page-shell { padding-left: .75rem; padding-right: .75rem; padding-top: 1rem; }
    .family-card { border-radius: 15px; }
    .post-header { align-items: flex-start; padding: 1rem .9rem .6rem; }
    .post-badges { max-width: 105px; }
    .post-body { padding: .2rem .9rem .9rem; }
    .post-body h2 { font-size: 1.22rem; }
    .photo-grid { padding: 0 3px; }
    .photos-1 img { height: min(72vw, 420px); }
    .photos-2 img, .photos-4 img, .photos-5 img, .photos-6 img, .photos-7 img, .photos-8 img, .photos-9 img { height: 48vw; max-height: 260px; }
    .photos-3 { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto; }
    .photos-3 a:first-child { grid-column: 1 / 3; grid-row: auto; }
    .photos-3 a:first-child img { height: 65vw; max-height: 380px; }
    .photos-3 a:nth-child(n+2) img { height: 44vw; max-height: 240px; }
    .photos-3 a:first-child { border-radius: 12px 12px 0 0; }
    .photos-3 a:nth-child(2) { border-radius: 0 0 0 12px; }
    .photos-3 a:last-child { border-radius: 0 0 12px 0; }
    .post-footer, .comment-preview { margin-left: .9rem; margin-right: .9rem; }
    .section-hero { align-items: flex-start; border-radius: 15px; padding: 1.1rem; }
    .section-hero h1 { font-size: 1.4rem; }
    .section-icon { height: 42px; width: 42px; }
    .about-card { display: block; padding: 1rem; }
    .about-photo img, .about-placeholder { height: 340px; min-height: 0; }
    .about-content { padding: 1.4rem .35rem .4rem; }
    .about-content h1 { font-size: 1.8rem; }
    .about-sections { grid-template-columns: 1fr; }
    .site-about-card { padding: 1.6rem 1.2rem; }
    .site-about-card h1 { font-size: 1.65rem; }
    .comments-section { padding: 1rem .85rem; }
    .main-comment-form .avatar { display: none; }
}

@media (max-width: 420px) {
    .post-header { flex-wrap: wrap; }
    .post-badges { align-items: center; flex-direction: row; margin-left: 48px; margin-top: -.35rem; max-width: none; width: 100%; }
    .post-footer { gap: .5rem; }
    .post-footer a { font-size: .74rem; }
    .comment-row.reply { margin-left: 1.4rem; }
}
