/* ============================================================
   custom.css — Design overhaul for lingzhenzhu.github.io
   All pages now share the SAME HTML structure:
     .wrapper > header > .main > .container > article.post-wrap.page
   This file assumes that structure and applies unified styles.
   ============================================================ */

/* ---------- Google Fonts Import ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400;500&display=swap');

/* ---------- Base Typography ---------- */
html {
  font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', sans-serif;
  letter-spacing: 0.01em;
}

body {
  font-size: 10.5pt;
  line-height: 1.9em;
  color: #1a1a1a;
  background-color: #fafaf8;
  /* Narrow column: constrains the entire .wrapper including navbar */
  max-width: 800px;
  margin: 0 auto;
  padding: 0 !important;
}

body.dark-theme {
  background-color: #1e1e1e;
  color: #c8c8c0;
}

/* ---------- Navbar ---------- */
.navbar {
  height: 3.5rem;
  line-height: 3.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  background-color: rgba(250, 250, 248, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dark-theme .navbar {
  background-color: rgba(30, 30, 30, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Hide the old toggle checkbox — replaced by a11y panel */
.switch_default,
.toggleBtn {
  display: none !important;
}

.navbar-header.header-logo a {
  font-family: 'Cormorant Garamond', 'lanting', serif;
  font-size: 1.15em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #1a1a1a;
}

.dark-theme .navbar-header.header-logo a {
  color: #e0e0d8;
}

.menu.navbar-right {
  display: flex;
  align-items: center;
  gap: 0.2em;
}

.menu-item {
  font-family: 'Inter', sans-serif;
  font-size: 0.78em;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 0.9em;
  color: #555;
  position: relative;
  transition: color 0.2s ease;
}

.menu-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  right: 50%;
  height: 1px;
  background-color: #1a1a1a;
  transition: left 0.25s ease, right 0.25s ease;
}

.menu-item:hover { color: #1a1a1a; }
.menu-item:hover::after { left: 0.9em; right: 0.9em; }

.dark-theme .menu-item { color: #999; }
.dark-theme .menu-item:hover { color: #e0e0d8; }
.dark-theme .menu-item::after { background-color: #e0e0d8; }

/* ============================================================
   UNIFIED LAYOUT
   All pages now use: .main > .container > article.post-wrap.page
   We neutralise .container's own padding so .post-wrap can
   centre itself freely within .main.
   ============================================================ */

.main .container {
  max-width: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 100%;
}

.main .container .post-wrap {
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2em 3rem;
  box-sizing: border-box;
}

/* ---------- Post Title (all pages) ---------- */
.post-wrap .post-title,
article.post-wrap.page h2.post-title {
  font-family: 'Cormorant Garamond', 'lanting', serif;
  font-size: 2em;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.3em;
  color: #1a1a1a;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
  padding-bottom: 0.5em;
  margin-bottom: 1.5em;
}

.dark-theme .post-wrap .post-title {
  color: #e0e0d8;
  border-bottom-color: rgba(255, 255, 255, 0.07);
}

/* ---------- Home Page ---------- */
.home-content .home-profile {
  text-align: center;
  margin-bottom: 2rem;
}

.home-content .home-profile .avatar img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.04), 0 4px 20px rgba(0, 0, 0, 0.08);
  object-fit: cover;
}

.home-content .links {
  margin-top: 1.5rem;
}

.home-content .links a {
  padding: 0 0.5em;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.home-content .links a:hover {
  opacity: 1;
  background-color: transparent;
}

.home-content .links .iconfont {
  font-size: 1.5em;
}

/* ---------- Post Content ---------- */
.post-content {
  font-size: 1em;
  line-height: 1.9em;
  color: #2a2a2a;
}

.dark-theme .post-content {
  color: #b8b8b0;
}

.post-content h2,
.post-content h3 {
  font-family: 'Cormorant Garamond', 'lanting', serif;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---------- Archive List (Blog page) ---------- */
.archive-list h3 {
  font-family: 'Cormorant Garamond', 'lanting', serif;
  font-size: 1.4em;
  font-weight: 300;
  letter-spacing: 0.08em;
  color: #888;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.dark-theme .archive-list h3 {
  color: #666;
}

.archive-item {
  margin-left: 1.5rem;
  padding: 0.15em 0;
}

.archive-item-link {
  font-size: 0.95em;
  letter-spacing: 0.01em;
}

.archive-item-date {
  font-size: 0.8em;
  letter-spacing: 0.03em;
  color: #aaa;
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.78em;
  letter-spacing: 0.04em;
  color: #aaa;
  height: 3.5rem;
  line-height: 3.5rem;
}

.dark-theme .footer {
  border-top-color: rgba(255, 255, 255, 0.06);
  color: #555;
}

/* ---------- Links ---------- */
a:hover {
  color: #8b7355;
}

.dark-theme a:hover {
  color: #c8a97e;
}

.post-content a {
  color: #6b8cba;
  border-bottom: 1px solid rgba(107, 140, 186, 0.3);
  transition: border-color 0.2s ease, color 0.2s ease;
}

.post-content a:hover {
  color: #4a6fa5;
  border-bottom-color: rgba(74, 111, 165, 0.6);
}

/* ---------- Blockquote ---------- */
.post-content blockquote {
  border-left: 2px solid #c8a97e;
  background-color: rgba(200, 169, 126, 0.05);
  color: #555;
  font-style: italic;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.05em;
}

.dark-theme .post-content blockquote {
  border-left-color: #8b7355;
  background-color: rgba(139, 115, 85, 0.08);
  color: #999;
}

/* ============================================================
   ACCESSIBILITY PANEL
   ============================================================ */

.a11y-panel {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.a11y-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background-color: #1a1a1a;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  transition: background-color 0.2s ease, transform 0.15s ease;
  padding: 0;
}

.a11y-btn:hover {
  background-color: #8b7355;
  transform: scale(1.08);
}

.a11y-btn svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.dark-theme .a11y-btn {
  background-color: #3a3a3a;
}

.dark-theme .a11y-btn:hover {
  background-color: #8b7355;
}

.a11y-menu {
  display: none;
  flex-direction: column;
  background-color: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 10px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  min-width: 180px;
  order: -1; /* appears above the button */
}

.a11y-menu.open {
  display: flex;
}

.dark-theme .a11y-menu {
  background-color: #2a2a2a;
  border-color: rgba(255, 255, 255, 0.08);
}

.a11y-menu-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.72em;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  padding: 0.75rem 1rem 0.4rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark-theme .a11y-menu-title {
  color: #666;
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.a11y-option {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.88em;
  color: #333;
  width: 100%;
  text-align: left;
  transition: background-color 0.15s ease;
}

.a11y-option:hover {
  background-color: rgba(0, 0, 0, 0.04);
}

.a11y-option.active {
  color: #8b7355;
  font-weight: 500;
}

.a11y-option.active .a11y-icon {
  color: #8b7355;
}

.dark-theme .a11y-option {
  color: #c0c0b8;
}

.dark-theme .a11y-option:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.dark-theme .a11y-option.active {
  color: #c8a97e;
}

.a11y-icon {
  font-size: 1em;
  width: 1.4em;
  text-align: center;
  color: #888;
  flex-shrink: 0;
}

/* ============================================================
   ACCESSIBILITY FEATURE CLASSES
   ============================================================ */

/* Larger text */
body.a11y-large-text {
  font-size: 12.5pt;
}

body.a11y-large-text .post-wrap .post-title {
  font-size: 2.3em;
}

/* High contrast */
body.a11y-high-contrast {
  background-color: #fff !important;
  color: #000 !important;
}

body.a11y-high-contrast.dark-theme {
  background-color: #000 !important;
  color: #fff !important;
}

body.a11y-high-contrast .navbar {
  background-color: #fff !important;
  border-bottom: 2px solid #000 !important;
}

body.a11y-high-contrast.dark-theme .navbar {
  background-color: #000 !important;
  border-bottom: 2px solid #fff !important;
}

body.a11y-high-contrast .post-content,
body.a11y-high-contrast .post-wrap .post-title {
  color: #000 !important;
}

body.a11y-high-contrast.dark-theme .post-content,
body.a11y-high-contrast.dark-theme .post-wrap .post-title {
  color: #fff !important;
}

/* Reduce motion */
body.a11y-reduce-motion *,
body.a11y-reduce-motion *::before,
body.a11y-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  transition-duration: 0.001ms !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media screen and (max-width: 860px) {
  .main .container .post-wrap {
    padding-left: 1.5em;
    padding-right: 1.5em;
  }
}

@media screen and (max-width: 479px) {
  .main .container .post-wrap {
    padding-left: 1em;
    padding-right: 1em;
  }

  .a11y-panel {
    bottom: 1rem;
    right: 1rem;
  }
}
