/* ── Public front page + group blogs ──────────────────────────────
   Standalone, light, responsive — no admin framework dependencies.
   Modern glass-morphism accents, gradient hero, animated cards.
   ───────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    /* Palette — green-yellow tint */
    --accent:       #65a30d;
    --accent-light: #a3e635;
    --accent-dark:  #4d7c0f;
    --accent-glow:  rgba(101, 163, 13, .18);

    --ink:      #1a2e05;
    --muted:    #6b7c5f;
    --faint:    #9ca894;
    --line:     #dce5d6;
    --line-warm:#edf3ea;

    --bg:       #f7faf5;
    --card:     #ffffff;
    --card-alt: #f7faf5;

    /* Tokens */
    --radius-sm:  8px;
    --radius:     14px;
    --radius-lg:  20px;
    --radius-xl:  28px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,.06),   0 1px 2px rgba(0,0,0,.04);
    --shadow-md:  0 4px 12px rgba(0,0,0,.07),  0 2px 4px  rgba(0,0,0,.04);
    --shadow-lg:  0 12px 36px rgba(0,0,0,.10), 0 4px 12px rgba(0,0,0,.05);
    --shadow-glow:0 4px 16px var(--accent-glow);

    --wrap:   820px;
    --header-h: 68px;

    /* Transitions */
    --ease: cubic-bezier(.4,0,.2,1);
}

/* ── Reset & base ──────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--accent-dark); }

/* Modern focus ring for keyboard navigation */
a:focus-visible {
    outline: 2px solid var(--accent-light);
    outline-offset: 3px;
    border-radius: 3px;
}

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

/* ── Layout shell ──────────────────────────────────────────────── */

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 24px;
}

/* ── Header ────────────────────────────────────────────────────── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.82);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-bottom: 1px solid var(--line);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    min-height: var(--header-h);
}

.site-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
}

.site-title::before {
    content: "";
    display: inline-block;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
}

.site-title:hover { text-decoration: none; color: var(--accent); }

main.wrap { padding-top: 40px; padding-bottom: 64px; min-height: calc(100vh - var(--header-h) - 80px); }

/* ── Footer ────────────────────────────────────────────────────── */

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-size: .85rem;
    padding: 24px 0;
    text-align: center;
}

/* ── Hero section (front page) ─────────────────────────────────── */

.hero {
    position: relative;
    text-align: center;
    padding: 48px 32px 44px;
    margin-bottom: 40px;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: linear-gradient(160deg, #f0f7e6 0%, #e2ecd8 40%, #f7faf5 100%);
    color: var(--ink);
    border: 1px solid var(--line);
}

.hero::before {
    content: "";
    position: absolute;
    top: -40%; right: -20%;
    width: 60%; height: 140%;
    background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

.hero h1 {
    position: relative;
    margin: 0 0 12px;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .lead {
    position: relative;
    margin: 0 auto;
    max-width: 480px;
    color: var(--muted);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ── Group grid (front page) ───────────────────────────────────── */

.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.group-button {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 24px 20px;
    text-align: center;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    color: var(--ink);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: -.01em;
    gap: 10px;
    transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .25s var(--ease);
    overflow: hidden;
}

.group-button::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    opacity: 0;
    transition: opacity .25s var(--ease);
}

.group-button:hover {
    text-decoration: none;
    color: var(--ink);
    border-color: var(--accent-light);
    box-shadow: var(--shadow-md), 0 4px 16px var(--accent-glow);
    transform: translateY(-3px);
}

.group-button:hover::before { opacity: 1; }

.group-button__icon {
    font-size: 1.8rem;
    line-height: 1;
}

.group-button__image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: var(--radius);
}

.group-button__name {
    display: block;
    line-height: 1.3;
}

/* ── Breadcrumb ────────────────────────────────────────────────── */

.breadcrumb {
    color: var(--muted);
    font-size: .88rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--muted);
    font-weight: 500;
    background-image: linear-gradient(90deg, var(--accent), var(--accent-light));
    background-size: 0% 1.5px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size .25s var(--ease), color .2s var(--ease);
}
.breadcrumb a:hover { color: var(--accent); background-size: 100% 1.5px; }
.breadcrumb .sep { margin: 0 6px; color: var(--faint); user-select: none; }
.breadcrumb [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ── Page title (group page) ───────────────────────────────────── */

.page-title-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--line);
}

.page-title-bar .title-icon {
    flex-shrink: 0;
    width: 48px; height: 48px;
    border-radius: var(--radius);
}

.page-title-bar .title-icon[alt] {
    object-fit: cover;
}

.page-title-bar .title-icon:not([alt]) {
    background: linear-gradient(135deg, rgba(101,163,13,.12), rgba(163,230,53,.08));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.4rem;
}

.page-title {
    margin: 0;
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
}

/* ── Blog list (group page) ────────────────────────────────────── */

.post-list { display: flex; flex-direction: column; gap: 24px; }

.post-card {
    position: relative;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease), border-color .2s var(--ease);
}

.post-card::after {
    content: "";
    position: absolute;
    bottom: 0; left: 32px; right: 32px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
    border-radius: 3px 3px 0 0;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s var(--ease);
}

.post-card:hover {
    border-color: var(--accent-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-card:hover::after { transform: scaleX(1); }

.post-card__title {
    margin: 0 0 8px;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1.3;
}

.post-card__title a { color: var(--ink); }
.post-card__title a:hover { color: var(--accent); text-decoration: none; }

.post-card__date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 500;
}

.post-card__date::before {
    content: "";
    display: inline-block;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.post-card__excerpt { margin: 0 0 18px; color: #475569; font-size: .98rem; line-height: 1.7; }

.post-card__more { margin: 0; }
.post-card__more a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: .9rem;
    color: var(--accent);
    background: rgba(79, 70, 229, .08);
    border-radius: 999px;
    transition: background .25s var(--ease), color .2s var(--ease),
                gap .2s var(--ease), box-shadow .25s var(--ease), transform .15s var(--ease);
}

.post-card__more a::after {
    content: "→";
    transition: transform .2s var(--ease);
}

.post-card__more a:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff;
    gap: 12px;
    box-shadow: 0 4px 12px var(--accent-glow);
    text-decoration: none;
}

.post-card__more a:hover::after { transform: translateX(3px); }
.post-card__more a:active { transform: translateY(1px); }

/* ── Single post ───────────────────────────────────────────────── */

.post {
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-sm);
}

.post__header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1.5px solid var(--line-warm);
}

.post__title {
    margin: 0 0 12px;
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.2;
}

.post__date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 500;
}

.post__date::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* Post body typography */
.post__body { font-size: 1.06rem; line-height: 1.8; }
.post__body p { margin: 0 0 1.2em; }
.post__body p:last-child { margin-bottom: 0; }
.post__body h2 { font-size: 1.5rem; font-weight: 700; margin: 1.8em 0 .6em; letter-spacing: -.02em; }
.post__body h3 { font-size: 1.25rem; font-weight: 600; margin: 1.4em 0 .5em; }
.post__body ul, .post__body ol { margin: 0 0 1.2em 1.6em; padding: 0; }
.post__body li { margin-bottom: .4em; }
/* Modern animated underline: gradient wipes in from the left on hover */
.post__body a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    background-image: linear-gradient(90deg, var(--accent), var(--accent-light));
    background-size: 0% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    padding-bottom: 1px;
    transition: background-size .3s var(--ease), color .2s var(--ease);
}
.post__body a:hover {
    color: var(--accent-dark);
    background-size: 100% 2px;
}
.post__body blockquote {
    margin: 1.5em 0;
    padding: 16px 20px;
    border-left: 4px solid var(--accent-light);
    background: var(--card-alt);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
    font-style: italic;
}
.post__body pre, .post__body code {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: var(--radius-sm);
    font-size: .9em;
}
.post__body code { padding: 2px 6px; }
.post__body pre { padding: 16px; overflow-x: auto; margin: 1.2em 0; }
.post__body pre code { background: none; padding: 0; }
.post__body hr { border: none; height: 1.5px; background: var(--line); margin: 2em 0; }
.post__body table { width: 100%; border-collapse: collapse; margin: 1.2em 0; font-size: .96rem; }
.post__body th, .post__body td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; }
.post__body th { background: var(--card-alt); font-weight: 600; }

/* Post images */
.post__images { margin-top: 32px; display: flex; flex-direction: column; gap: 16px; }
.post__image { margin: 0; }
.post__image img {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

/* Inline images (from [filename;width=400] shortcodes in the body) */
.post__body { overflow: hidden; } /* contain floated inline images */
.post-inline-img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin: 1.2em 0;
}
.post-inline-img--center { margin-left: auto; margin-right: auto; }
.post-inline-img--left  { float: left;  margin: .3em 1.4em 1em 0; }
.post-inline-img--right { float: right; margin: .3em 0 1em 1.4em; }

/* Post attachments */
.post__attachments {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1.5px solid var(--line-warm);
}

.post__attachments h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.attachment-list { list-style: none; margin: 0; padding: 0; }
.attachment-list li { margin-bottom: 10px; }
.attachment-list a {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--card-alt);
    border: 1.5px solid var(--line);
    border-radius: var(--radius);
    font-weight: 500;
    color: var(--ink);
    transition: border-color .2s var(--ease), box-shadow .25s var(--ease),
                transform .15s var(--ease), background .2s var(--ease);
}

.attachment-list a::after {
    content: "↓";
    font-weight: 700;
    color: var(--accent);
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity .2s var(--ease), transform .2s var(--ease);
}

.attachment-list a:hover {
    border-color: var(--accent-light);
    background: var(--card);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--accent);
}

.attachment-list a:hover::after { opacity: 1; transform: translateY(0); }

.attachment-icon { font-size: 1.2rem; }
.attachment-name { min-width: 0; word-break: break-word; }
.attachment-size { color: var(--muted); font-size: .82rem; margin-left: auto; padding-left: 8px; white-space: nowrap; }

.post__back { margin-top: 36px; }
.post__back a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
    color: var(--muted);
    background: var(--card-alt);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    transition: color .2s var(--ease), background .2s var(--ease),
                border-color .2s var(--ease), box-shadow .25s var(--ease);
}

.post__back a::before {
    content: "←";
    font-weight: 700;
    transition: transform .2s var(--ease);
}

.post__back a:hover {
    color: var(--accent);
    background: var(--card);
    border-color: var(--accent-light);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.post__back a:hover::before { transform: translateX(-4px); }

/* ── Empty state ───────────────────────────────────────────────── */

.empty {
    color: var(--muted);
    text-align: center;
    padding: 60px 24px;
    font-size: 1.05rem;
}

.empty::before {
    content: "";
    display: block;
    width: 80px; height: 3px;
    margin: 0 auto 24px;
    background: linear-gradient(90deg, transparent, var(--line), transparent);
    border-radius: 3px;
}

/* ── Flash messages ────────────────────────────────────────────── */

.flash {
    padding: 14px 20px;
    margin-bottom: 28px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: .95rem;
}

.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Animations ────────────────────────────────────────────────── */

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hero, .group-button, .post-card {
    animation: fadeUp .5s var(--ease) both;
}

.group-grid .group-button:nth-child(2) { animation-delay: .06s; }
.group-grid .group-button:nth-child(3) { animation-delay: .12s; }
.group-grid .group-button:nth-child(4) { animation-delay: .18s; }
.group-grid .group-button:nth-child(5) { animation-delay: .24s; }
.group-grid .group-button:nth-child(6) { animation-delay: .30s; }

.post-list .post-card:nth-child(1) { animation-delay: .05s; }
.post-list .post-card:nth-child(2) { animation-delay: .10s; }
.post-list .post-card:nth-child(3) { animation-delay: .15s; }
.post-list .post-card:nth-child(4) { animation-delay: .20s; }
.post-list .post-card:nth-child(5) { animation-delay: .25s; }

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 768px) {
    :root { --wrap: 100%; }

    .wrap { padding: 0 18px; }

    .hero { padding: 48px 24px 40px; border-radius: var(--radius-lg); margin-left: -6px; margin-right: -6px; }
    .hero h1 { font-size: 2rem; }
    .hero .lead { font-size: 1rem; }

    .group-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .group-button { min-height: 110px; padding: 22px 16px; font-size: 1.05rem; }

    .post { padding: 28px 22px; }
    .post__title { font-size: 1.7rem; }

    .page-title { font-size: 1.6rem; }
}

@media (max-width: 480px) {
    .hero { padding: 36px 18px 32px; }
    .hero h1 { font-size: 1.7rem; }

    .group-grid { grid-template-columns: 1fr; gap: 12px; }
    .group-button { flex-direction: row; min-height: auto; padding: 16px 20px; gap: 14px; }
    .group-button__icon { font-size: 1.6rem; }

    .post { padding: 22px 18px; border-radius: var(--radius); }
    .post__title { font-size: 1.5rem; }

    .page-title-bar { gap: 12px; }
    .page-title-bar .title-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .page-title { font-size: 1.4rem; }

    .post-card { padding: 24px 20px; }
}
