/*
 * Modern editorial layer for kunmei.github.io/blog
 * Loaded after the original Hux theme to preserve backwards compatibility.
 */

:root {
  --page-bg: #f4f6f3;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --ink: #18242f;
  --ink-soft: #344454;
  --muted: #74808c;
  --line: #e2e8e3;
  --accent: #137a75;
  --accent-dark: #0b5d59;
  --navy: #17324d;
  --navy-deep: #102638;
  --shadow-sm: 0 8px 28px rgba(25, 48, 59, 0.07);
  --shadow-md: 0 18px 55px rgba(25, 48, 59, 0.12);
  --radius: 18px;
  --content-width: 760px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--page-bg);
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--ink);
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease,
    box-shadow 180ms ease, transform 180ms ease;
}

a:hover,
a:focus {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(19, 122, 117, 0.28);
  outline-offset: 4px;
}

::selection {
  background: rgba(19, 122, 117, 0.22);
  color: var(--navy-deep);
}

/* Navigation */
.navbar-custom {
  min-height: 72px;
  font-family: var(--font-sans);
}

.navbar-custom .container-fluid {
  max-width: 1240px;
  padding-left: 28px;
  padding-right: 28px;
}

.navbar-custom .navbar-brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  height: 72px;
  padding: 14px 0;
}

.navbar-custom .brand-mark {
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 10px;
  color: #fff;
  display: inline-flex;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  height: 38px;
  justify-content: center;
  letter-spacing: 0;
  width: 38px;
}

.navbar-custom .brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.navbar-custom .nav > li > a {
  position: relative;
}

.navbar-custom .nav > li > a::after {
  background: #fff;
  border-radius: 999px;
  bottom: 14px;
  content: "";
  height: 2px;
  left: 20px;
  opacity: 0;
  position: absolute;
  right: 20px;
  transform: scaleX(0.5);
  transition: opacity 180ms ease, transform 180ms ease;
}

.navbar-custom .nav > li > a:hover::after,
.navbar-custom .nav > li.active > a::after {
  opacity: 1;
  transform: scaleX(1);
}

.navbar-custom .nav > li.active > a,
.navbar-custom .nav > li.active > a:hover,
.navbar-custom .nav > li.active > a:focus {
  background: transparent;
  color: #fff;
}

.navbar-custom.is-fixed .nav > li.active > a,
.navbar-custom.is-fixed .nav > li.active > a:hover,
.navbar-custom.is-fixed .nav > li.active > a:focus {
  color: var(--ink);
}

/* Hero */
.intro-header {
  background-position: center 42%;
  margin-bottom: 0;
  overflow: hidden;
  position: relative;
}

.intro-header::before {
  background:
    linear-gradient(120deg, rgba(13, 34, 51, 0.88), rgba(20, 77, 78, 0.6)),
    linear-gradient(0deg, rgba(8, 25, 39, 0.24), rgba(8, 25, 39, 0.08));
  content: "";
  inset: 0;
  position: absolute;
  z-index: 0;
}

.intro-header .container {
  position: relative;
  z-index: 1;
}

.intro-header .site-heading,
.intro-header .page-heading {
  padding: 148px 0 112px;
}

.intro-header .site-heading::before {
  color: rgba(255, 255, 255, 0.7);
  content: "MEIKUN · NOTES & IDEAS";
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.24em;
  margin-bottom: 18px;
}

.intro-header .site-heading h1,
.intro-header .page-heading h1 {
  font-size: clamp(44px, 6vw, 72px);
  font-weight: 750;
  letter-spacing: -0.035em;
  margin: 0;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.18);
}

.intro-header .site-heading .subheading,
.intro-header .page-heading .subheading {
  color: rgba(255, 255, 255, 0.82);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.7;
  margin: 16px auto 0;
  max-width: 640px;
}

/* Main two-column layout */
body > .container {
  padding-bottom: 56px;
  padding-top: 52px;
}

.postlist-container {
  margin-bottom: 0;
}

.post-list {
  display: grid;
  gap: 22px;
}

.post-card {
  background: var(--surface);
  border: 1px solid rgba(226, 232, 227, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0;
  overflow: hidden;
  position: relative;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.post-card::before {
  background: linear-gradient(180deg, var(--accent), #3c9a85);
  bottom: 0;
  content: "";
  left: 0;
  opacity: 0;
  position: absolute;
  top: 0;
  transition: opacity 180ms ease;
  width: 4px;
}

.post-card:hover {
  border-color: rgba(19, 122, 117, 0.26);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.post-card:hover::before {
  opacity: 1;
}

.post-card > .post-card-link {
  color: inherit;
  display: block;
  padding: 29px 32px 26px;
  text-decoration: none;
}

.post-card > .post-card-link:hover,
.post-card > .post-card-link:focus {
  color: inherit;
  text-decoration: none;
}

.post-card-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 650;
  gap: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.post-card-tag {
  background: rgba(19, 122, 117, 0.09);
  border-radius: 999px;
  color: var(--accent-dark);
  letter-spacing: 0.02em;
  padding: 3px 10px;
  text-transform: none;
}

.post-card > a > .post-title {
  color: var(--ink);
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.42;
  margin: 0 0 8px;
}

.post-card > a > .post-subtitle {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  margin: 0 0 10px;
}

.post-card .post-content-preview {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  line-height: 1.8;
  margin: 12px 0 18px;
}

.post-card:hover .post-content-preview {
  color: var(--ink-soft);
}

.post-card-action {
  color: var(--accent);
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.post-card-action span {
  transition: transform 180ms ease;
}

.post-card:hover .post-card-action span {
  transform: translateX(4px);
}

/* Sidebar */
.sidebar-container {
  color: var(--muted);
  font-size: 14px;
}

.sidebar-container > section,
.sidebar-container > h5,
.sidebar-container > ul {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(25, 48, 59, 0.05);
  padding: 24px;
}

.sidebar-container > section + section,
.sidebar-container > hr + h5 {
  margin-top: 18px;
}

.sidebar-container > h5 {
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  margin: 18px 0 0;
  padding-bottom: 8px;
}

.sidebar-container > h5 + ul {
  border-radius: 0 0 16px 16px;
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.sidebar-container hr {
  display: none;
}

.sidebar-container h5,
.sidebar-container h5 a {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.13em;
  margin: 0 0 17px;
}

.sidebar-container .short-about img {
  border: 4px solid #fff;
  box-shadow: 0 8px 24px rgba(23, 50, 77, 0.16);
  height: 88px;
  margin-bottom: 15px;
  object-fit: cover;
  width: 88px;
}

.sidebar-container .short-about p {
  line-height: 1.7;
  margin: 8px 0 12px;
}

.sidebar-container .tags a,
#tag_cloud a {
  background: var(--surface-soft) !important;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--ink-soft) !important;
  font-size: 12px;
  line-height: 1.5;
  margin: 0 5px 8px 0;
  padding: 6px 11px;
}

.sidebar-container .tags a:hover,
#tag_cloud a:hover {
  background: rgba(19, 122, 117, 0.12) !important;
  border-color: rgba(19, 122, 117, 0.2);
  color: var(--accent-dark) !important;
}

.sidebar-container .fa-stack {
  color: var(--navy);
  transform: scale(0.84);
}

/* Pagination */
.pager {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 30px !important;
}

.pager::before,
.pager::after {
  display: none;
}

.pager li > a,
.pager li > span {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 12px 18px;
}

.pager li > a:hover,
.pager li > a:focus {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  transform: translateY(-2px);
}

/* Article header and reading layout */
.intro-header .post-heading {
  padding: 140px 0 100px;
}

.intro-header .post-heading h1 {
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.3;
  margin: 16px 0 18px;
}

.intro-header .post-heading .subheading {
  color: rgba(255, 255, 255, 0.82);
  font-size: 19px;
  line-height: 1.65;
  margin: 0 0 22px;
}

.intro-header .post-heading .meta {
  color: rgba(255, 255, 255, 0.7);
  font-family: var(--font-sans);
  font-size: 13px;
  font-style: normal;
  letter-spacing: 0.04em;
}

article > .container {
  padding-bottom: 60px;
  padding-top: 62px;
}

.post-container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.9;
  padding: 48px 58px;
}

.post-container p {
  margin: 1.25em 0;
}

.post-container h1,
.post-container h2,
.post-container h3,
.post-container h4,
.post-container h5,
.post-container h6 {
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.45;
  margin-bottom: 0.7em;
  margin-top: 2em;
}

.post-container h2 {
  border-bottom: 1px solid var(--line);
  font-size: 28px;
  padding-bottom: 0.42em;
}

.post-container h3 {
  font-size: 22px;
}

.post-container a {
  color: var(--accent-dark);
  text-decoration: underline;
  text-decoration-color: rgba(19, 122, 117, 0.32);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-container a:hover,
.post-container a:focus {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.post-container blockquote {
  background: var(--surface-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  color: var(--ink-soft);
  font-family: var(--font-serif);
  font-style: normal;
  margin: 1.8em 0;
  padding: 18px 24px;
}

.post-container img {
  border-radius: 12px;
  height: auto;
  margin: 1.4em auto;
  max-width: 100%;
}

.post-container pre {
  background: #14222f;
  border: 0;
  border-radius: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #e6edf3;
  font-size: 13px;
  line-height: 1.7;
  margin: 1.8em 0;
  padding: 20px 22px;
}

.post-container :not(pre) > code {
  background: rgba(23, 50, 77, 0.07);
  border-radius: 5px;
  color: #b0444c;
  font-size: 0.88em;
  padding: 0.15em 0.38em;
}

.post-container table {
  background: #fff;
  border-collapse: separate;
  border-radius: 10px;
  border-spacing: 0;
  box-shadow: 0 0 0 1px var(--line);
  display: block;
  margin: 1.8em 0;
  max-width: 100%;
  overflow-x: auto;
}

.post-container th {
  background: var(--surface-soft);
  color: var(--ink);
  font-weight: 700;
}

.post-container th,
.post-container td {
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
}

.post-container ul,
.post-container ol {
  margin-bottom: 1.4em;
  padding-left: 1.4em;
}

.post-container li {
  margin: 0.35em 0;
}

/* Tag and about pages */
#tag_cloud {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin: 0 0 36px;
  padding: 24px;
}

.one-tag-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(25, 48, 59, 0.05);
  margin-bottom: 22px;
  padding: 24px 28px 12px;
}

.listing-seperator,
.listing-seperator .tag-text {
  color: var(--accent-dark);
  font-family: var(--font-sans);
  font-weight: 700;
}

.one-tag-list .post-preview > a .post-title {
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  margin: 16px 0;
}

.zh.post-container {
  float: none;
  width: 100%;
}

/* Footer */
footer {
  background: var(--navy-deep);
  color: rgba(255, 255, 255, 0.65);
  margin-top: 0;
  padding: 48px 0 42px;
}

footer .fa-stack {
  color: rgba(255, 255, 255, 0.84);
}

footer .fa-stack:hover {
  color: #fff;
  transform: translateY(-2px);
}

footer .copyright,
footer .copyright a {
  color: rgba(255, 255, 255, 0.55);
}

footer .copyright {
  line-height: 1.8;
  margin-top: 12px;
}

/* Desktop sticky sidebar */
@media (min-width: 992px) {
  body > .container > .row > .sidebar-container {
    position: sticky;
    top: 90px;
  }
}

/* Tablet and mobile */
@media (max-width: 991px) {
  body > .container {
    padding-top: 36px;
  }

  .postlist-container + .sidebar-container {
    margin-top: 34px;
  }

  .sidebar-container > section {
    padding: 22px;
  }

  .post-container {
    padding: 38px 40px;
  }
}

@media (max-width: 767px) {
  body {
    font-size: 15px;
  }

  .navbar-custom,
  .navbar-custom .navbar-brand {
    min-height: 62px;
  }

  .navbar-custom .container-fluid {
    padding-left: 18px;
    padding-right: 18px;
  }

  .navbar-custom .navbar-brand {
    height: 62px;
    padding: 11px 0;
  }

  .navbar-custom .brand-mark {
    border-radius: 9px;
    height: 36px;
    width: 36px;
  }

  .navbar-custom .navbar-toggle {
    border: 0;
    margin-right: 0;
    margin-top: 14px;
  }

  .navbar-custom .navbar-toggle .icon-bar {
    background: #fff;
    width: 21px;
  }

  .navbar-default .navbar-collapse {
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 8px;
    right: 14px;
    width: 156px;
  }

  #huxblog_navbar .navbar-collapse a {
    border-radius: 8px;
    color: var(--ink) !important;
    font-size: 13px;
    line-height: 30px;
    padding: 8px 14px;
  }

  #huxblog_navbar .navbar-collapse li.active a {
    background: var(--surface-soft);
    color: var(--accent-dark) !important;
  }

  .navbar-custom .nav > li > a::after {
    display: none;
  }

  .intro-header .site-heading,
  .intro-header .page-heading {
    padding: 112px 0 76px;
  }

  .intro-header .site-heading::before {
    font-size: 10px;
    letter-spacing: 0.18em;
    margin-bottom: 12px;
  }

  .intro-header .site-heading h1,
  .intro-header .page-heading h1 {
    font-size: 42px;
  }

  .intro-header .site-heading .subheading,
  .intro-header .page-heading .subheading {
    font-size: 14px;
    margin-top: 12px;
    max-width: 310px;
  }

  body > .container {
    padding: 26px 16px 42px;
  }

  .post-list {
    gap: 16px;
  }

  .post-card {
    border-radius: 15px;
  }

  .post-card > .post-card-link {
    padding: 23px 22px 21px;
  }

  .post-card > a > .post-title {
    font-size: 21px;
    line-height: 1.45;
  }

  .post-card .post-content-preview {
    font-size: 13px;
    line-height: 1.75;
  }

  .intro-header .post-heading {
    padding: 110px 0 72px;
  }

  .intro-header .post-heading h1 {
    font-size: 32px;
  }

  .intro-header .post-heading .subheading {
    font-size: 16px;
  }

  article > .container {
    padding: 24px 15px 44px;
  }

  .post-container {
    border-radius: 15px;
    font-size: 15px;
    line-height: 1.86;
    padding: 28px 22px;
  }

  .post-container h2 {
    font-size: 23px;
  }

  .post-container h3 {
    font-size: 19px;
  }

  .post-container pre {
    border-radius: 10px;
    margin-left: -10px;
    margin-right: -10px;
    padding: 16px;
  }

  .post-container .pager li {
    width: 100%;
  }

  .post-container .pager {
    flex-direction: column;
  }

  .one-tag-list {
    padding: 20px 20px 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
