:root {
  --ink: #1a365d;
  --ink-deep: #10263f;
  --ink-soft: #2a4e77;
  --mist: #e8f1f4;
  --paper: #ffffff;
  --accent: #f4b37a;
  --accent-strong: #ea9a53;
  --text: #16324a;
  --muted: #597084;
  --line: #d2dfe7;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 14px 40px rgba(20, 52, 84, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Libre Franklin', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(244,179,122,0.18), transparent 44%),
    radial-gradient(circle at 80% 5%, rgba(44,99,145,0.16), transparent 38%),
    #f7fbfd;
  line-height: 1.65;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(26,54,93,.03) 1px, transparent 1px), linear-gradient(90deg, rgba(26,54,93,.03) 1px, transparent 1px);
  background-size: 24px 24px;
  z-index: -1;
}

h1, h2, h3, h4 {
  font-family: 'Spectral', serif;
  color: var(--ink-deep);
  line-height: 1.2;
  margin: 0 0 12px;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

.portal-shell { width: min(1180px, calc(100% - 44px)); margin: 0 auto; }
.site-main { min-height: 52vh; }

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #ffd1a8);
  z-index: 1300;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: all .25s ease;
}
.portal-header.is-scrolled {
  background: rgba(19,46,74,.95);
  border-bottom-color: rgba(255,255,255,.15);
}
.portal-header.is-scrolled .site-title,
.portal-header.is-scrolled .portal-nav-list a { color: #f0f6fa; }
.portal-header.is-scrolled .portal-nav-list a:hover { color: #fff; }
.portal-header.is-scrolled .portal-nav-list a::after { background: #ffd4ad; }

.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 76px; gap: 20px; }
.site-title { font-weight: 800; letter-spacing: .02em; font-size: 1rem; color: var(--ink-deep); }
.portal-nav-list { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; gap: 28px; }
.portal-nav-list li { position: relative; }
.portal-nav-list a { font-weight: 700; color: var(--ink-soft); font-size: .95rem; transition: color .2s ease; padding: 6px 0; display: inline-block; }
.portal-nav-list a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .22s ease;
}
.portal-nav-list li:hover a::after,
.portal-nav-list .current-menu-item > a::after,
.portal-nav-list .current_page_item > a::after { transform: scaleX(1); }
.portal-nav-list a:hover,
.portal-nav-list .current-menu-item > a,
.portal-nav-list .current_page_item > a { color: var(--ink-deep); }
.mobile-toggle { display: none; border: 0; background: transparent; color: var(--ink-deep); font-size: 1.5rem; }

.hero {
  padding: 92px 0 82px;
  animation: heroFade .7s ease both;
}
.hero-inner {
  background:
    linear-gradient(130deg, rgba(21, 55, 90, .96), rgba(34, 76, 116, .95) 52%, rgba(84, 128, 152, .82)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0 6px, transparent 6px 20px);
  border-radius: 28px;
  padding: 76px 68px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-inner::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -42px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244,179,122,.37), rgba(244,179,122,0));
}
.hero-copy { max-width: 720px; position: relative; z-index: 2; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; color: rgba(255,255,255,.76); margin-bottom: 10px; }
.hero h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.3rem); margin-bottom: 14px; }
.hero-lead { color: #d8e8f4; max-width: 620px; font-size: 1.05rem; margin-bottom: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; }

.portal-btn {
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  font-size: .92rem;
  border: 1px solid transparent;
  transition: all .22s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.portal-btn-primary,
.portal-btn-accent { background: var(--accent); color: #2e1a0e; }
.portal-btn-primary:hover,
.portal-btn-accent:hover { background: var(--accent-strong); transform: translateY(-2px); }
.portal-btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.portal-btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,.09); }

.portal-section { padding: 42px 0; }
.section-soft { background: linear-gradient(180deg, rgba(231,242,247,.72), rgba(247,251,253,.45)); border-top: 1px solid rgba(39,78,117,.08); border-bottom: 1px solid rgba(39,78,117,.08); }
.section-title { font-size: clamp(1.45rem, 2.2vw, 2rem); margin-bottom: 20px; }

.topic-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; }
.topic-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 24px rgba(21,56,90,.08);
  transition: transform .2s ease, box-shadow .2s ease;
}
.topic-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.topic-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,54,93,.1);
  margin-bottom: 12px;
  font-size: 1.25rem;
}

.post-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 20px; }
.post-grid.three-col { grid-template-columns: repeat(3, minmax(0,1fr)); }
.post-card {
  background: #fff;
  border: 1px solid #d8e5ee;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(20,52,84,.08);
  transition: transform .22s ease, box-shadow .22s ease;
}
.post-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.post-card-image {
  display: block;
  height: 190px;
  background-size: cover;
  background-position: center;
  background-color: #d8e5ee;
  position: relative;
}
.post-card-image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10,30,49,.2), transparent 45%);
  opacity: .6;
}
.fallback-thumb { display: block; width: 100%; height: 100%; background: linear-gradient(145deg, #8da8be, #cfdfe9); }
.post-card-body { padding: 18px; }
.post-date { margin: 0 0 8px; font-size: .82rem; color: var(--muted); font-weight: 700; }
.post-card h3 { font-size: 1.12rem; margin-bottom: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.7em; }
.post-card p { margin: 0; color: #435d72; }

.state-filter {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 18px;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}
.state-chip {
  border: 1px solid #bbcedd;
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  color: #315271;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
}
.state-chip.active,
.state-chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.featured-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  align-items: center;
}
.featured-image {
  display: block;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.featured-image img, .single-featured img { width: 100%; height: auto; }
.featured-copy p { color: #4d6579; }

.page-wrap { padding: 56px 0; }
.page-header-block { margin-bottom: 20px; }
.page-content-card {
  background: #fff;
  border: 1px solid var(--line);
  padding: 28px;
  border-radius: var(--radius);
}

.portal-breadcrumbs { margin-bottom: 16px; color: #5f7487; font-weight: 700; font-size: .85rem; }
.portal-breadcrumbs a { color: #355676; }
.portal-breadcrumbs span { margin: 0 4px; }

.single-grid { display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start; }
.single-toc {
  position: sticky;
  top: 100px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.single-toc h3 { font-size: 1rem; margin-bottom: 10px; }
.single-toc ul { margin: 0; padding-left: 16px; }
.single-toc li { margin-bottom: 8px; }
.single-toc a { color: #2d4f6f; font-weight: 700; font-size: .88rem; }
.single-toc a.active { color: var(--ink-deep); text-decoration: underline; text-underline-offset: 3px; }

.single-content-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
}
.single-header h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); margin-bottom: 8px; }
.single-meta { display: flex; gap: 14px; color: var(--muted); font-weight: 700; font-size: .9rem; margin-bottom: 18px; }
.single-content { font-size: 1.02rem; }
.single-content h2, .single-content h3 { margin-top: 24px; }
.share-row { margin-top: 28px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 700; }
.share-row a {
  border: 1px solid #bfd1df;
  border-radius: 999px;
  padding: 6px 12px;
  color: #2d4d6a;
}

.related-posts { margin-top: 34px; }
.pagination-wrap { margin-top: 24px; }

.subscribe-band {
  margin-top: 48px;
  padding: 34px 0;
  background: linear-gradient(90deg, #173452, #264f76);
}
.subscribe-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.subscribe-inner h2 { color: #fff; margin-bottom: 5px; }
.subscribe-inner p { color: #d8e5ef; margin: 0; }

.portal-footer {
  background: linear-gradient(180deg, #0f2740, #0b1d31);
  color: #d4e1ec;
  padding: 44px 0 12px;
}
.footer-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr 1fr; gap: 28px; }
.portal-footer h3, .portal-footer h4 { color: #fff; margin-bottom: 10px; }
.portal-footer ul { list-style: none; margin: 0; padding: 0; }
.portal-footer li { margin-bottom: 8px; }
.portal-footer a { color: #d4e1ec; transition: color .2s ease; }
.portal-footer a:hover { color: #fff; }
.footer-text { color: #b2c7d8; max-width: 340px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); margin-top: 22px; padding-top: 12px; font-size: .9rem; }

.back-top {
  position: fixed;
  right: 18px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all .2s ease;
  z-index: 1000;
}
.back-top.visible { opacity: 1; pointer-events: auto; }

@media (max-width: 1050px) {
  .topic-grid, .post-grid.three-col { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .featured-layout, .single-grid, .footer-grid { grid-template-columns: 1fr; }
  .single-toc { position: static; }
}
@media (max-width: 760px) {
  .mobile-toggle { display: block; }
  .portal-nav {
    position: absolute;
    top: 76px;
    right: 16px;
    left: 16px;
    background: #fff;
    border: 1px solid #d4e2eb;
    border-radius: 14px;
    padding: 10px 16px;
    display: none;
  }
  .portal-nav.open { display: block; }
  .portal-nav-list { flex-direction: column; align-items: flex-start; gap: 12px; }
  .portal-header.is-scrolled .portal-nav { background: #173654; border-color: rgba(255,255,255,.14); }
  .portal-header.is-scrolled .portal-nav-list a { color: #e5eef6; }
  .hero-inner { padding: 48px 26px; }
  .topic-grid, .post-grid, .post-grid.three-col { grid-template-columns: 1fr; }
  .subscribe-inner { flex-direction: column; align-items: flex-start; }
  .state-chip { padding: 9px 14px; }
  .page-wrap { padding: 38px 0; }
}

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