:root {
  --ink: #1f2933;
  --muted: #66727d;
  --line: #e4e8eb;
  --paper: #ffffff;
  --canvas: #f5f7f8;
  --accent: #087e8b;
  --accent-dark: #075f68;
  --warm: #e99f32;
}

body { background: var(--canvas); color: var(--ink); }
body, .intro-summary, .post-card, .content-tabs, .profile-links a, footer, table, th, td { transition: background-color .25s ease, color .25s ease, border-color .25s ease; }
.theme-switch a { min-width: 50px; text-align: center; }
.search-page #search-input {
  box-sizing: border-box;
  min-height: 64px;
  padding: 12px 18px;
  color: #ffffff;
  caret-color: #71d6da;
  background: #26333b;
  border: 2px solid #5cc3c8;
  border-radius: 5px;
}
.search-page #search-input::placeholder { color: #c3ccd1; opacity: 1; }
.search-page #search-input:focus { border-color: #e5a847; box-shadow: 0 0 0 3px rgba(229, 168, 71, .2); }
.intro-header { margin-bottom: 0; }
.sky-hero { position: relative; overflow: hidden; background: #75b9dd; }
.sky-hero .intro-header { position: relative; z-index: 1; }
.sky-wave { position: absolute; z-index: 2; right: -8%; bottom: -42px; left: -8%; height: 115px; pointer-events: none; border-radius: 50% 50% 0 0 / 100% 100% 0 0; background: rgba(255,255,255,.66); transform-origin: center bottom; }
.sky-wave-back { bottom: -60px; opacity: .5; transform: rotate(-2deg) scaleX(1.08); animation: sky-wave-drift-back 15s ease-in-out infinite alternate; }
.sky-wave-front { bottom: -76px; opacity: .8; transform: rotate(2deg) scaleX(1.12); animation: sky-wave-drift-front 11s ease-in-out infinite alternate; }
@keyframes sky-wave-drift-back { from { transform: translateX(-2.5%) rotate(-2deg) scaleX(1.08); } to { transform: translateX(2.5%) rotate(1deg) scaleX(1.08); } }
@keyframes sky-wave-drift-front { from { transform: translateX(2%) rotate(2deg) scaleX(1.12); } to { transform: translateX(-2%) rotate(-1deg) scaleX(1.12); } }
@media (prefers-reduced-motion: reduce) { .sky-wave { animation: none; } }
.intro-header .site-heading { padding: 112px 0 82px; }
.intro-header .site-heading h1 { font-size: 48px; letter-spacing: 0; }
.intro-header .site-heading .subheading { line-height: 1.6; }

.home-shell { padding-top: 38px; padding-bottom: 20px; }
.home-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 42px; align-items: start; }
.profile-panel { position: sticky; top: 82px; padding: 24px 0; }
.profile-avatar-link { display: block; width: 112px; height: 112px; margin-bottom: 18px; }
.profile-avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 4px solid var(--paper); box-shadow: 0 6px 18px rgba(31, 41, 51, .12); }
.profile-panel h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: 0; }
.profile-role { margin: 0 0 20px; color: var(--muted); font-size: 14px; line-height: 1.75; }
.profile-links { display: grid; gap: 5px; }
.profile-links a { display: flex; align-items: center; gap: 10px; padding: 8px 9px; color: var(--ink); font-size: 14px; border-radius: 6px; }
.profile-links a:hover { background: var(--paper); color: var(--accent); text-decoration: none; }
.profile-links i { width: 18px; color: var(--accent); text-align: center; }
.side-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.side-section h3 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; color: var(--muted); letter-spacing: 0; }
.category-list { display: grid; gap: 7px; }
.category-list a { display: flex; justify-content: space-between; color: var(--ink); font-size: 14px; }
.category-list a:hover { color: var(--accent); text-decoration: none; }
.category-list strong { min-width: 24px; color: var(--muted); text-align: right; }

.home-content { min-width: 0; }
.intro-summary { padding: 30px 34px; background: var(--paper); border-top: 3px solid var(--warm); box-shadow: 0 4px 18px rgba(31, 41, 51, .06); }
.section-kicker { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 1.4px; }
.intro-summary h2, .section-heading-row h2 { margin: 6px 0 15px; font-size: 28px; letter-spacing: 0; }
.intro-summary p { font-size: 16px; line-height: 1.9; color: #43505b; }
.summary-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 22px; }
.summary-actions a { font-size: 14px; font-weight: 600; color: var(--accent); }
.summary-actions .primary-action { padding: 10px 15px; color: #fff; background: var(--accent); border-radius: 5px; }
.summary-actions a:hover { color: var(--accent-dark); text-decoration: none; }
.summary-actions .primary-action:hover { color: #fff; background: var(--accent-dark); }
.summary-actions i, .read-more i { margin-left: 5px; }

.content-tabs { display: flex; gap: 4px; margin: 28px 0 32px; padding: 5px; overflow-x: auto; background: #e9edef; border-radius: 6px; }
.content-tabs a { flex: 1 0 auto; padding: 9px 14px; color: #53606b; font-size: 14px; font-weight: 600; text-align: center; border-radius: 4px; }
.content-tabs a:hover, .content-tabs a.active { color: var(--ink); background: var(--paper); text-decoration: none; box-shadow: 0 1px 4px rgba(31, 41, 51, .08); }
.section-heading-row { display: flex; align-items: end; justify-content: space-between; margin-bottom: 15px; }
.section-heading-row h2 { margin-bottom: 0; }
.post-count { color: var(--muted); font-size: 13px; }
.post-feed { min-width: 0; }
.post-card { padding: 24px 28px; margin-bottom: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; transition: border-color .2s, transform .2s, box-shadow .2s; }
.post-card:hover { border-color: #b8ced1; transform: translateY(-2px); box-shadow: 0 7px 20px rgba(31, 41, 51, .07); }
.post-card-meta { display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 12px; }
.post-card-meta span { padding-left: 9px; border-left: 1px solid var(--line); color: var(--accent); }
.post-card h3 { margin: 10px 0 8px; font-size: 23px; letter-spacing: 0; }
.post-card h3 a { color: var(--ink); }
.post-card h3 a:hover { color: var(--accent); text-decoration: none; }
.post-card p { margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.post-card .post-subtitle { color: #3f4d57; font-weight: 600; }
.read-more { display: inline-block; margin-top: 7px; color: var(--accent); font-size: 13px; font-weight: 700; }
.empty-state { padding: 30px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); }
.home-pager { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; color: var(--muted); font-size: 13px; }

.archive-summary { display: flex; align-items: end; justify-content: space-between; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.archive-summary h2 { margin: 5px 0 0; font-size: 28px; letter-spacing: 0; }
.archive-summary strong { color: var(--muted); font-size: 14px; }
.archive-year { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 28px; padding: 30px 0; border-bottom: 1px solid var(--line); }
.archive-year > h2 { margin: 0; color: var(--accent); font-size: 25px; letter-spacing: 0; }
.archive-year-content > h3 { margin: 2px 0 10px; color: var(--muted); font-size: 14px; letter-spacing: 0; }
.archive-entry { display: grid; grid-template-columns: 55px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-top: 1px solid #edf0f2; }
.archive-entry time { padding-top: 3px; color: var(--muted); font-size: 13px; }
.archive-entry h4 { margin: 0; font-size: 18px; letter-spacing: 0; }
.archive-entry h4 a { color: var(--ink); }
.archive-entry h4 a:hover { color: var(--accent); text-decoration: none; }
.archive-entry p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.archive-entry p span { margin-left: 8px; color: var(--accent); }

@media (max-width: 767px) {
  .intro-header .site-heading { padding: 90px 16px 55px; }
  .intro-header .site-heading h1 { font-size: 34px; }
  .home-shell { padding: 22px 18px 10px; }
  .home-grid { grid-template-columns: 1fr; gap: 22px; }
  .profile-panel { position: static; display: grid; grid-template-columns: 82px 1fr; column-gap: 17px; padding: 5px 0 18px; }
  .profile-avatar-link, .profile-avatar { width: 82px; height: 82px; }
  .profile-panel h2 { align-self: end; font-size: 22px; }
  .profile-role { grid-column: 2; margin-bottom: 12px; }
  .profile-links { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); margin-top: 8px; }
  .profile-links a { justify-content: center; padding: 9px 4px; background: var(--paper); }
  .profile-links span { font-size: 12px; }
  .side-section { grid-column: 1 / -1; }
  .intro-summary { padding: 24px 20px; }
  .intro-summary h2, .section-heading-row h2 { font-size: 24px; }
  .intro-summary p { font-size: 15px; }
  .content-tabs { margin: 20px 0 26px; }
  .post-card { padding: 20px; }
  .post-card h3 { font-size: 20px; }
  .archive-summary h2 { font-size: 24px; }
  .archive-year { grid-template-columns: 1fr; gap: 12px; padding: 25px 0; }
  .archive-year > h2 { font-size: 22px; }
  .archive-entry { grid-template-columns: 48px minmax(0, 1fr); }
}

@media (min-width: 768px) and (max-width: 991px) {
  .home-grid { grid-template-columns: 210px minmax(0, 1fr); gap: 28px; }
}

html[data-theme="dark"] {
  --ink: #e8edf0;
  --muted: #aab4bc;
  --line: #354149;
  --paper: #20282e;
  --canvas: #161c20;
  --accent: #64c3c8;
  --accent-dark: #8ed7da;
  --warm: #e5a847;
  color-scheme: dark;
}
html[data-theme="dark"] body { background: var(--canvas); color: var(--ink); }
html[data-theme="dark"] .search-page { color: var(--ink); background: var(--canvas); }
html[data-theme="dark"] .search-icon-close { color: var(--ink); }
html[data-theme="dark"] .search-page #search-results .post-title { color: var(--ink); }
html[data-theme="dark"] a { color: var(--accent); }
html[data-theme="dark"] hr { border-color: var(--line); }
html[data-theme="dark"] .intro-summary p,
html[data-theme="dark"] .post-container,
html[data-theme="dark"] .post-container p,
html[data-theme="dark"] .postlist-container,
html[data-theme="dark"] .sidebar-container { color: #cbd3d8; }
html[data-theme="dark"] .content-tabs { background: #293239; }
html[data-theme="dark"] .content-tabs a { color: var(--muted); }
html[data-theme="dark"] .content-tabs a:hover,
html[data-theme="dark"] .content-tabs a.active { color: var(--ink); background: var(--paper); }
html[data-theme="dark"] .post-card,
html[data-theme="dark"] .intro-summary { box-shadow: 0 5px 20px rgba(0, 0, 0, .22); }
html[data-theme="dark"] .post-card h3 a,
html[data-theme="dark"] .archive-entry h4 a,
html[data-theme="dark"] .profile-links a,
html[data-theme="dark"] .category-list a { color: var(--ink); }
html[data-theme="dark"] table { background: var(--paper); }
html[data-theme="dark"] table > thead > tr > th,
html[data-theme="dark"] table > tbody > tr > th,
html[data-theme="dark"] table > tfoot > tr > th,
html[data-theme="dark"] table > thead > tr > td,
html[data-theme="dark"] table > tbody > tr > td,
html[data-theme="dark"] table > tfoot > tr > td { border-color: var(--line); }
html[data-theme="dark"] code { color: #f1bd70; background: #283239; }
html[data-theme="dark"] footer { color: var(--muted); }
html[data-theme="dark"] .navbar-custom.is-fixed { background: rgba(22, 28, 32, .96); border-color: var(--line); }
html[data-theme="dark"] .navbar-custom.is-fixed .navbar-brand,
html[data-theme="dark"] .navbar-custom.is-fixed .nav li a { color: var(--ink); }
html[data-theme="dark"] .navbar-custom.invert .navbar-brand,
html[data-theme="dark"] .navbar-custom.invert .nav li a { color: var(--ink); }
html[data-theme="dark"] .navbar-custom.invert .navbar-toggle .icon-bar { background-color: var(--ink); }

/* Full-screen entrance */
.landing-page { margin: 0; min-height: 100vh; overflow-x: hidden; background: #0b2438; }
.entrance { position: relative; display: flex; min-height: 100vh; flex-direction: column; padding: 0 max(28px, calc((100vw - 1180px) / 2)); color: #fff; background: url('/img/sky-banner.png') center 72% / cover no-repeat; isolation: isolate; }
.entrance-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(4, 18, 33, .86) 0%, rgba(5, 24, 42, .68) 48%, rgba(7, 30, 48, .34) 100%); }
.entrance-nav { display: flex; align-items: center; justify-content: space-between; min-height: 82px; border-bottom: 1px solid rgba(255, 255, 255, .16); }
.entrance-brand { display: flex; align-items: center; gap: 11px; color: #fff; font-size: 16px; font-weight: 700; }
.entrance-brand:hover, .entrance-nav a:hover { color: #9ee7e6; text-decoration: none; }
.entrance-brand img { width: 38px; height: 38px; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; object-fit: cover; }
.entrance-nav nav { display: flex; align-items: center; gap: 27px; }
.entrance-nav nav > a, .entrance-nav .theme-switch a { color: rgba(255,255,255,.86); font-size: 14px; }
.entrance-nav .theme-switch a { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; }
.entrance-content { display: grid; flex: 1; grid-template-columns: minmax(0, 1.3fr) minmax(310px, .7fr); gap: 80px; align-items: center; padding: 72px 0 90px; }
.entrance-kicker { color: #8edcde; font-size: 12px; font-weight: 700; letter-spacing: 1.6px; }
.entrance-intro h1 { max-width: 720px; margin: 15px 0 18px; color: #fff; font-size: clamp(42px, 6vw, 74px); line-height: 1.15; letter-spacing: 0; }
.entrance-quote { margin: 0; padding-left: 17px; color: rgba(255,255,255,.86); border-left: 3px solid #e5a847; font-size: 20px; line-height: 1.7; }
.entrance-tags { display: flex; flex-wrap: wrap; gap: 9px; margin: 27px 0 34px; }
.entrance-tags span { padding: 7px 12px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; background: rgba(255,255,255,.08); font-size: 13px; }
.entrance-button { display: inline-flex; align-items: center; gap: 8px; padding: 13px 18px; color: #0f2935; background: #f4f7f7; border-radius: 5px; font-size: 15px; font-weight: 700; }
.entrance-button:hover { color: #075f68; background: #fff; text-decoration: none; }
.entrance-profile { align-self: center; padding: 28px; border: 1px solid rgba(255,255,255,.18); border-radius: 8px; background: rgba(9, 27, 41, .58); box-shadow: 0 18px 45px rgba(0,0,0,.2); backdrop-filter: blur(9px); }
.entrance-profile > img { width: 68px; height: 68px; margin-bottom: 16px; border: 3px solid rgba(255,255,255,.72); border-radius: 50%; object-fit: cover; }
.entrance-profile h2 { margin: 0 0 12px; color: #fff; font-size: 23px; letter-spacing: 0; }
.entrance-profile p { margin: 7px 0; color: rgba(255,255,255,.76); font-size: 14px; line-height: 1.75; }
.entrance-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
.entrance-links a { padding: 8px 11px; color: #fff; border: 1px solid rgba(255,255,255,.24); border-radius: 4px; font-size: 13px; }
.entrance-links a:hover { color: #fff; border-color: #8edcde; text-decoration: none; }
.entrance-footnote { margin: 0; padding: 0 0 25px; color: rgba(255,255,255,.58); font-size: 12px; }

@media (max-width: 767px) {
  .entrance { padding: 0 22px; background-position: 62% center; }
  .entrance-nav { min-height: 68px; }
  .entrance-brand span { max-width: 130px; font-size: 13px; }
  .entrance-nav nav { gap: 15px; }
  .entrance-nav nav > a:nth-child(2) { display: none; }
  .entrance-nav nav > a { font-size: 13px; }
  .entrance-content { grid-template-columns: 1fr; gap: 38px; align-content: center; padding: 50px 0 55px; }
  .entrance-intro h1 { font-size: 40px; }
  .entrance-quote { font-size: 16px; }
  .entrance-profile { padding: 22px; }
  .entrance-footnote { padding-bottom: 18px; }
}

/* Category interactions and reading helpers */
.scroll-progress { position: fixed; top: 0; left: 0; z-index: 1100; width: 100%; height: 3px; pointer-events: none; }
.scroll-progress span { display: block; width: 0; height: 100%; background: var(--warm); transition: width .08s linear; }
.back-to-top { position: fixed; right: 22px; bottom: 22px; z-index: 20; display: grid; width: 44px; height: 44px; padding: 0; place-items: center; color: #fff; background: var(--accent); border: 0; border-radius: 50%; box-shadow: 0 7px 18px rgba(31, 41, 51, .2); opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .2s, visibility .2s, transform .2s, background-color .2s; }
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover, .back-to-top:focus { background: var(--accent-dark); outline: 2px solid var(--warm); outline-offset: 2px; }
.category-overview { display: flex; gap: 14px; margin-bottom: 22px; }
.category-overview > div { display: flex; min-width: 120px; align-items: baseline; gap: 7px; padding: 15px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; }
.category-overview strong { color: var(--accent); font-size: 25px; }
.category-overview span { color: var(--muted); font-size: 13px; }
.category-hint { margin: 20px 0; color: var(--muted); font-size: 14px; }
.category-grid { display: grid; gap: 13px; }
.category-card { overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; opacity: 0; transform: translateY(14px); transition: opacity .45s, transform .45s, border-color .2s, box-shadow .2s; }
.category-card.is-revealed { opacity: 1; transform: translateY(0); }
.category-card:hover { border-color: #9bc5c8; box-shadow: 0 7px 20px rgba(31, 41, 51, .07); }
.category-toggle { display: grid; width: 100%; grid-template-columns: 42px minmax(0, 1fr) auto 20px; gap: 12px; align-items: center; padding: 18px 20px; color: var(--ink); text-align: left; background: transparent; border: 0; }
.category-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.category-icon { display: grid; width: 38px; height: 38px; place-items: center; color: var(--accent); background: rgba(8, 126, 139, .1); border-radius: 5px; }
.category-name { min-width: 0; font-size: 18px; font-weight: 700; }
.category-total { color: var(--muted); font-size: 13px; }
.category-arrow { color: var(--muted); transition: transform .25s; }
.category-toggle[aria-expanded="true"] .category-arrow { transform: rotate(180deg); }
.category-posts { padding: 0 20px 12px 74px; }
.category-posts[hidden] { display: none; }
.category-posts a { display: grid; grid-template-columns: 92px minmax(0, 1fr) 18px; gap: 12px; align-items: center; padding: 13px 0; color: var(--ink); border-top: 1px solid var(--line); font-size: 14px; }
.category-posts a:hover { color: var(--accent); text-decoration: none; }
.category-posts time { color: var(--muted); font-size: 12px; }
.category-posts .fa-arrow-right { opacity: 0; transform: translateX(-5px); transition: opacity .2s, transform .2s; }
.category-posts a:hover .fa-arrow-right { opacity: 1; transform: translateX(0); }
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .category-overview > div { box-shadow: 0 5px 20px rgba(0, 0, 0, .18); }

@media (max-width: 767px) {
  .back-to-top { right: 15px; bottom: 15px; }
  .category-overview > div { min-width: 0; flex: 1; padding: 12px 14px; }
  .category-toggle { grid-template-columns: 38px minmax(0, 1fr) auto 16px; gap: 9px; padding: 15px; }
  .category-posts { padding: 0 15px 10px; }
  .category-posts a { grid-template-columns: 75px minmax(0, 1fr) 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .reveal-item { opacity: 1; transform: none; }
}
