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

/* ── CSS custom properties — Shiny Navy Blue theme ──────────── */
:root {
    --color-primary:    #1a6bb5;
    --color-primary-dk: #0d3d6b;
    --color-accent:     #2e8de0;
    --color-text:       #0f2540;
    --color-text-light: #4a6080;
    --color-bg:         #f0f5fb;
    --color-white:      #ffffff;
    --color-border:     #c8d8ea;
    --color-navy:       #0d2d4f;
    --color-navy-mid:   #1a4a7a;
    --color-shine:      #5aafe8;
    --radius:           8px;
    --shadow:           0 2px 14px rgba(13,45,79,.10);
}

/* ── Reset / Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }

body {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-top: 42px;
    font-family: 'Inter', sans-serif;
    margin: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    position: relative;
}

/* ── Ent SVG background watermark ───────────────────────────
   Light-blue ink line-drawing of an ancient Ent — the wise
   tree-shepherd of Middle-earth — as a full-page watermark. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.055;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 800 900' fill='none' stroke='%231a6bb5' stroke-linecap='round' stroke-linejoin='round'%3E%3C!-- Trunk --%3E%3Cpath d='M400 850 C395 780 390 720 385 660 C380 600 388 560 400 520 C412 560 420 600 415 660 C410 720 405 780 400 850Z' stroke-width='8'/%3E%3Cpath d='M400 700 C400 700 380 690 365 680' stroke-width='6'/%3E%3Cpath d='M400 700 C400 700 420 690 435 675' stroke-width='6'/%3E%3Cpath d='M400 650 C400 650 375 640 355 625 C340 613 330 595 320 575' stroke-width='5'/%3E%3Cpath d='M400 650 C400 650 425 640 445 625 C460 613 470 595 480 575' stroke-width='5'/%3E%3C!-- Main branches --%3E%3Cpath d='M400 520 C390 500 375 480 355 455 C335 430 310 415 285 405' stroke-width='7'/%3E%3Cpath d='M400 520 C410 500 425 480 445 455 C465 430 490 415 515 405' stroke-width='7'/%3E%3Cpath d='M400 490 C395 470 390 445 385 415 C380 385 382 360 388 330' stroke-width='6'/%3E%3C!-- Secondary branches left --%3E%3Cpath d='M355 455 C340 440 320 425 295 415 C270 405 248 403 225 408' stroke-width='5'/%3E%3Cpath d='M355 455 C345 435 338 410 335 385' stroke-width='4'/%3E%3Cpath d='M285 405 C268 392 248 382 225 375 C205 368 185 368 165 372' stroke-width='4'/%3E%3Cpath d='M285 405 C278 385 275 362 278 338' stroke-width='3'/%3E%3C!-- Secondary branches right --%3E%3Cpath d='M445 455 C460 440 480 425 505 415 C530 405 552 403 575 408' stroke-width='5'/%3E%3Cpath d='M445 455 C455 435 462 410 465 385' stroke-width='4'/%3E%3Cpath d='M515 405 C532 392 552 382 575 375 C595 368 615 368 635 372' stroke-width='4'/%3E%3Cpath d='M515 405 C522 385 525 362 522 338' stroke-width='3'/%3E%3C!-- Upper crown branches --%3E%3Cpath d='M388 330 C375 310 358 290 335 272 C315 255 290 245 265 240' stroke-width='5'/%3E%3Cpath d='M388 330 C392 305 393 278 390 250 C388 228 382 210 374 190' stroke-width='5'/%3E%3Cpath d='M388 330 C400 310 415 292 432 278 C450 263 472 252 495 248' stroke-width='5'/%3E%3C!-- Crown twigs left --%3E%3Cpath d='M335 272 C318 258 298 248 275 242 C255 237 233 237 212 240' stroke-width='3'/%3E%3Cpath d='M335 272 C325 255 318 234 316 212' stroke-width='3'/%3E%3Cpath d='M265 240 C248 228 228 220 206 216 C186 212 166 214 148 220' stroke-width='3'/%3E%3Cpath d='M265 240 C258 222 255 200 256 178 C257 160 261 144 268 130' stroke-width='3'/%3E%3C!-- Crown twigs right --%3E%3Cpath d='M432 278 C448 264 468 254 490 248 C510 243 532 243 552 248' stroke-width='3'/%3E%3Cpath d='M432 278 C442 260 448 238 448 216' stroke-width='3'/%3E%3Cpath d='M495 248 C512 236 532 228 554 225 C574 222 594 225 612 232' stroke-width='3'/%3E%3Cpath d='M495 248 C502 228 505 206 502 184' stroke-width='3'/%3E%3C!-- Topmost twigs --%3E%3Cpath d='M374 190 C362 172 346 158 326 148 C308 138 288 134 268 136' stroke-width='3'/%3E%3Cpath d='M374 190 C378 168 378 146 374 124 C370 104 362 86 350 72' stroke-width='3'/%3E%3Cpath d='M374 190 C388 170 402 152 418 138 C434 124 452 114 472 108' stroke-width='3'/%3E%3Cpath d='M350 72 C342 55 330 42 316 32 C304 22 290 16 276 14' stroke-width='2.5'/%3E%3Cpath d='M350 72 C354 52 355 32 352 14' stroke-width='2.5'/%3E%3Cpath d='M350 72 C360 54 372 38 386 26 C398 16 412 10 428 8' stroke-width='2.5'/%3E%3C!-- Root system --%3E%3Cpath d='M395 840 C385 855 370 865 350 872 C332 878 312 880 292 876' stroke-width='5'/%3E%3Cpath d='M405 840 C415 855 430 865 450 872 C468 878 488 880 508 876' stroke-width='5'/%3E%3Cpath d='M390 830 C378 848 360 860 338 866 C318 872 295 870 274 862' stroke-width='4'/%3E%3Cpath d='M410 830 C422 848 440 860 462 866 C482 872 505 870 526 862' stroke-width='4'/%3E%3Cpath d='M385 820 C370 838 350 852 326 858 C305 864 282 860 260 850' stroke-width='3'/%3E%3Cpath d='M415 820 C430 838 450 852 474 858 C495 864 518 860 540 850' stroke-width='3'/%3E%3C!-- Beard-like hanging moss/bark tendrils --%3E%3Cpath d='M370 560 C365 575 364 592 366 608 C368 622 372 634 370 648' stroke-width='2'/%3E%3Cpath d='M430 560 C435 575 436 592 434 608 C432 622 428 634 430 648' stroke-width='2'/%3E%3Cpath d='M355 500 C348 515 344 532 344 550' stroke-width='2'/%3E%3Cpath d='M445 500 C452 515 456 532 456 550' stroke-width='2'/%3E%3C!-- Face/eye hint (knot patterns) --%3E%3Cellipse cx='385' cy='475' rx='8' ry='5' stroke-width='2'/%3E%3Cellipse cx='415' cy='475' rx='8' ry='5' stroke-width='2'/%3E%3Cpath d='M385 488 C390 494 400 496 415 488' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center 60px;
}

/* All direct children except header and footer expand to fill space */
body > *:not(.header):not(.footer) { flex: 1 0 auto; position: relative; z-index: 1; }

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dk); }

/* ── Header ──────────────────────────────────────────────── */
.header {
    background: linear-gradient(90deg, var(--color-navy) 0%, var(--color-navy-mid) 60%, #1e5a9a 100%);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 12px rgba(13,45,79,.35);
    height: 42px;
    flex-shrink: 0;
}

/* ── Logo ─────────────────────────────────────────────────── */
.logo-link { text-decoration: none; }
.logo-text {
    font-size: 1.05rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -.02em;
    cursor: pointer;
    text-shadow: 0 0 18px rgba(90,175,232,.5);
}
.logo-text::before {
    content: '🌳 ';
    font-size: 0.9rem;
}

/* ── Desktop nav ─────────────────────────────────────────── */
.nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 2px;
    padding-right: 4px;
}
.nav a {
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    transition: background .18s, color .18s;
    white-space: nowrap;
}
.nav a:hover { background: rgba(255,255,255,.14); color: #fff; }
.nav a.active { color: #fff; background: rgba(90,175,232,.22); }

.nav-parent-link {
    border-right: 1px solid rgba(255,255,255,.2) !important;
    padding-right: 12px !important;
    margin-right: 6px !important;
    color: rgba(255,255,255,.7) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
}
.nav-parent-link:hover { color: #fff !important; background: none !important; }

/* ── Nav dropdown ────────────────────────────────────────── */
.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255,255,255,.85);
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    transition: background .18s, color .18s;
    display: flex;
    align-items: center;
    gap: 3px;
}
.nav-dropdown-toggle::after { content: ' ▾'; font-size: 10px; }
.nav-dropdown-toggle:hover, .nav-dropdown-toggle.active {
    background: rgba(255,255,255,.14); color: #fff;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}
.nav-dropdown-menu a {
    display: block;
    padding: 11px 18px;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 500;
    border-radius: 0;
    transition: background .15s;
    text-decoration: none;
}
.nav-dropdown-menu a:hover { background: #eaf3fb; color: var(--color-primary); }
.nav-dropdown-menu a.active { color: var(--color-primary); font-weight: 700; }

/* ── Hero section ────────────────────────────────────────── */
.hero-section {
    width: 100%;
    padding: 80px 5% 70px;
    text-align: center;
    color: var(--color-white);
    background-color: var(--color-navy);
    background-size: cover;
    background-position: center;
    position: relative;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 30, 55, 0.68);
}
.hero-section > * { position: relative; z-index: 1; }
.hero-section h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin: 0;
    line-height: 1.2;
    letter-spacing: -.02em;
    color: #ffffff;
    /* Deep blue outline (paint-stroke) + grey drop-shadow beneath */
    text-shadow:
        /* blue outline — all 8 directions */
        -1px -1px 0   #0d3d6b,
         1px -1px 0   #0d3d6b,
        -1px  1px 0   #0d3d6b,
         1px  1px 0   #0d3d6b,
        -2px  0   0   #0d3d6b,
         2px  0   0   #0d3d6b,
         0   -2px 0   #0d3d6b,
         0    2px 0   #0d3d6b,
        /* grey drop-shadow beneath */
         3px  5px 8px  rgba(60, 60, 80, 0.55),
         2px  3px 16px rgba(0,  0,  0,  0.45);
}

/* Topic / site badge above the h1 — shared by index and post hero */
.hero-topic-badge {
    display: inline-block;
    background: #1a6bb5;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 20px;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin-bottom: 16px;
    /* Matching outline + shadow so it pops too */
    text-shadow: 0 1px 4px rgba(0,0,0,.4);
    box-shadow: 0 2px 10px rgba(13,45,79,.45);
}

/* Subtitle line beneath h1 — shared by index, post, and static pages */
.hero-subtitle-text {
    margin-top: 14px;
    font-size: 1.1em;
    max-width: 780px;
    margin-left: auto;
    margin-right: auto;
    opacity: .92;
    line-height: 1.5;
    /* Lighter version of the same shadow treatment */
    text-shadow:
        -1px -1px 0  rgba(13,45,79,.7),
         1px -1px 0  rgba(13,45,79,.7),
        -1px  1px 0  rgba(13,45,79,.7),
         1px  1px 0  rgba(13,45,79,.7),
         2px  3px 8px rgba(0,0,0,.35);
}

.hero-section--plain {
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
    background-image: none;
}
.hero-section--plain::before { display: none; }

/* ── Content sections ────────────────────────────────────── */
.content-section {
    padding: 56px 5%;
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-primary-dk);
    margin-bottom: 28px;
    padding-left: 16px;
    border-left: 4px solid var(--color-primary);
}

/* ── Cards ───────────────────────────────────────────────── */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.card {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: box-shadow .2s, transform .2s;
}
.card:hover { box-shadow: 0 6px 24px rgba(13,45,79,.14); transform: translateY(-2px); }

.card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-primary-dk);
    margin-bottom: 10px;
}

/* ── Blog listing ────────────────────────────────────────── */
.blog-month-group  { margin-bottom: 48px; }
.blog-month-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-border);
}
.blog-year  { font-size: 0.8rem; font-weight: 700; color: #999; letter-spacing: .08em; }
.blog-month { font-size: 1.1rem; font-weight: 800; color: var(--color-primary-dk); }

.blog-card { margin-bottom: 18px; }
.blog-card-body {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 22px 26px;
    box-shadow: var(--shadow);
    transition: box-shadow .18s, border-color .18s, transform .18s;
}
.blog-card-body:hover {
    box-shadow: 0 6px 24px rgba(26,107,181,.14);
    border-color: var(--color-accent);
    transform: translateY(-1px);
}
.blog-card-topic {
    display: inline-block;
    background: #ddeeff;
    color: var(--color-primary-dk);
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 10px;
}
.blog-card-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--color-text);
    text-decoration: none;
}
.blog-card-title:hover { color: var(--color-primary); }
.blog-card-summary { font-size: 0.9rem; color: var(--color-text-light); line-height: 1.6; margin-bottom: 14px; }
.blog-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}
.blog-meta-left { display: flex; gap: 14px; font-size: 12px; color: #888; }
.blog-meta-left span { white-space: nowrap; }
.blog-read-more {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
}
.blog-read-more:hover { color: var(--color-primary-dk); }

/* ── Spinner ─────────────────────────────────────────────── */
.blog-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Contact form ────────────────────────────────────────── */
.contact-form label {
    display: block; font-size: 13px; font-weight: 600;
    color: #444; margin-bottom: 5px; margin-top: 16px;
}
.contact-form input[type=text],
.contact-form input[type=email],
.contact-form input[type=number],
.contact-form textarea {
    width: 100%; padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: 6px; font-size: 14px;
    color: var(--color-text); outline: none;
    transition: border .15s; font-family: inherit;
}
.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(26,107,181,.15);
}
.contact-form textarea { height: 130px; resize: vertical; }
.contact-form button[type=submit] {
    margin-top: 22px;
    background: var(--color-primary);
    color: #fff; border: none;
    padding: 12px 32px;
    border-radius: 6px; font-size: 14px;
    font-weight: 700; cursor: pointer;
    transition: background .15s;
    font-family: inherit;
}
.contact-form button[type=submit]:hover { background: var(--color-primary-dk); }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    background: linear-gradient(90deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
    color: rgba(255,255,255,.65);
    text-align: center;
    padding: 12px 20px;
    font-size: 12px;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}
.footer a { color: rgba(255,255,255,.8); text-decoration: none; }
.footer a:hover { color: #fff; }

/* ── Mobile sticky nav ───────────────────────────────────── */
#mobile-nav-bar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(90deg, var(--color-navy) 0%, var(--color-navy-mid) 100%);
    border-top: 1px solid rgba(255,255,255,.12);
    z-index: 900;
    box-shadow: 0 -2px 10px rgba(0,0,0,.2);
}
#mobile-nav-bar nav {
    display: flex;
    justify-content: space-around;
    padding: 0;
}
#mobile-nav-bar .nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,.7);
    text-decoration: none;
    border-right: 1px solid rgba(255,255,255,.07);
}
#mobile-nav-bar .nav-item:last-child { border-right: none; }
#mobile-nav-bar .nav-item.active,
#mobile-nav-bar .nav-item:hover { color: #fff; background: rgba(255,255,255,.1); }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    .nav { display: none; }
    #mobile-nav-bar { display: block; }
    body { padding-bottom: 50px; }
    .content-section { padding: 36px 5%; }
    .hero-section { padding: 56px 5% 48px; }
}

/* ── Post body typography ────────────────────────────────── */
.content-section h2 { color: var(--color-primary-dk); font-size: 1.4rem; margin-top: 2rem; }
.content-section h3 { color: var(--color-primary); font-size: 1.15rem; margin-top: 1.5rem; }
.content-section p  { margin-bottom: 1rem; }
.content-section ul, .content-section ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.content-section li { margin-bottom: .4rem; }
.content-section blockquote {
    border-left: 4px solid var(--color-accent);
    margin: 1.5rem 0; padding: .8rem 1.2rem;
    background: #eaf3fb; border-radius: 0 6px 6px 0;
    color: var(--color-navy-mid); font-style: italic;
}

/* ── CMS post topic tag pill (blue) ─────────────────────── */
/* .post-topic-tag — aliased to .hero-topic-badge (see hero section above) */
.post-topic-tag { /* kept for backward compatibility */ }

/* ── Prev/Next link override ─────────────────────────────── */
.post-nav-link {
    background: var(--color-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-decoration: none;
    color: var(--color-text);
    display: block;
    transition: border-color .15s, box-shadow .15s;
}
.post-nav-link:hover {
    border-color: var(--color-accent);
    box-shadow: 0 4px 14px rgba(26,107,181,.12);
}
