/* ============================================================
   Midnight Instrument — design system for 明菜の笔记
   ------------------------------------------------------------
   Visual anchor: the article covers are an indigo field with
   cyan signal nodes, hairline grids and a cyan vertical rule.
   This sheet carries that language into the whole site.

   Palette
     ink       #111B33   midnight indigo (dark surfaces)
     paper     #F6F8FC   cool paper white (light background)
     signal    #1BA5B5   cyan (links, accents, the vertical rule)
     coral     #E8735A   the one warm accent (hover, code fg)
     graphite  #2B3551   body text, blue-black not pure black
     mist      #7C8AA5   meta text, blue-grey not pure grey

   Type: two clearly distinct families.
     UI / body  -> system sans (screen reading, Chinese crisp)
     Display    -> serif (Georgia + Songti), a nod to the poetry
                   section and the "明菜" literary persona.

   Loaded before mobile-fix.css so the mobile touch fixes win.
   ============================================================ */

/* ---------- 1. Theme variables ---------- */
:root {
  --ink: #111B33;
  --paper: #F6F8FC;
  --signal: #1BA5B5;
  --signal-soft: rgba(27, 165, 181, 0.1);
  --signal-line: rgba(27, 165, 181, 0.16);
  --coral: #E8735A;
  --graphite: #2B3551;
  --mist: #7C8AA5;

  --global-bg: var(--paper);
  --font-color: var(--graphite);
  --card-bg: #FFFFFF;
  --sidebar-bg: #F0F4FA;
  --card-meta: var(--mist);
  --card-box-shadow: 0 1px 2px rgba(17, 27, 51, 0.04), 0 6px 20px rgba(17, 27, 51, 0.04);
  --card-hover-box-shadow: 0 2px 6px rgba(17, 27, 51, 0.06), 0 14px 36px rgba(17, 27, 51, 0.09);
  --hr-border: rgba(27, 165, 181, 0.28);
  --hr-before-color: var(--signal);
  --blockquote-bg: var(--signal-soft);
  --blockquote-color: var(--graphite);
  --default-bg-color: var(--signal);
  --scrollbar-color: var(--signal);
  --headline-presudo: var(--signal);
}

[data-theme='dark'] {
  --paper: #111B33;
  --graphite: rgba(233, 240, 252, 0.82);
  --mist: #8B9AB8;
  --signal: #35BBC8;
  --signal-soft: rgba(53, 187, 200, 0.12);
  --signal-line: rgba(53, 187, 200, 0.2);

  --global-bg: var(--ink);
  --font-color: var(--graphite);
  --card-bg: #192542;
  --sidebar-bg: #152039;
  --card-meta: var(--mist);
  --card-box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
  --card-hover-box-shadow: 0 6px 28px rgba(0, 0, 0, 0.34);
  --hr-border: rgba(53, 187, 200, 0.3);
  --hr-before-color: var(--signal);
  --blockquote-bg: var(--signal-soft);
  --blockquote-color: var(--graphite);
  --search-bg: #152039;
  --tab-button-bg: #192542;
  --tab-button-hover-bg: #22304f;
  --tab-button-active-bg: #111B33;
  --reward-pop: #192542;
}

/* ---------- 2. Typography ---------- */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

/* Display family — serif, used only for headings. */
#site-title,
.post-title,
#article-container h1,
#article-container h2,
#article-container h3,
#article-container h4,
.item-headline > span:first-child {
  font-family: Georgia, 'Songti SC', 'STSong', 'SimSun', serif;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Give Chinese body text a touch more breathing room than the default 2.0 */
#article-container {
  line-height: 1.9;
  font-size: 1em;
}

#article-container p {
  margin: 0 0 1.15em;
}

/* Reasonable measure: ~40 Chinese characters per line in the article column. */
#article-container > p,
#article-container > ul,
#article-container > ol {
  max-width: 44em;
}

/* Headings: structure, not decoration. Thin cyan rule under h2. */
#article-container h2 {
  position: relative;
  padding-bottom: 0.35em;
  margin-top: 1.8em;
}

#article-container h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.2em;
  height: 2px;
  background: var(--signal);
}

#article-container h3 {
  margin-top: 1.5em;
}

/* Links: cyan, underline only on hover. */
a {
  color: var(--signal);
}

#article-container a {
  text-decoration: none;
  border-bottom: 1px solid var(--signal-line);
  transition: border-color 0.2s ease;
}

#article-container a:hover {
  border-bottom-color: var(--signal);
}

/* Inline code — coral, quiet background, no harsh border. */
#article-container code {
  color: var(--coral);
  background: rgba(232, 115, 90, 0.08);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

/* Blockquote — cyan spine, echoing the cover's vertical rule. */
#article-container blockquote {
  border-left: 3px solid var(--signal);
  border-radius: 0 4px 4px 0;
  color: var(--mist);
  font-style: normal;
}

/* Tables — hairline rows, cyan header spine. */
#article-container table {
  border-collapse: collapse;
}

#article-container thead th {
  border-bottom: 2px solid var(--signal);
  font-weight: 600;
}

#article-container tbody tr:nth-child(even) {
  background: var(--signal-soft);
}

/* ---------- 3. Hero ---------- */
/* Indigo wash + a faint 40px grid, borrowed from the cover artwork. */
#page-header.full_page:not(.not-top-img)::before {
  background-color: rgba(17, 27, 51, 0.58);
  background-image:
    linear-gradient(155deg, rgba(17, 27, 51, 0.82) 0%, rgba(17, 27, 51, 0.42) 58%, rgba(27, 165, 181, 0.18) 100%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, 0.035) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255, 255, 255, 0.035) 39px 40px);
}

#page-header #site-title {
  font-size: 2.6em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
}

#page-header #site-subtitle {
  color: var(--signal);
  letter-spacing: 0.12em;
  font-size: 1.05em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.5);
}

#site_social_icons .social-icon {
  color: #fff !important;
}

/* Nav wordmark in serif to match the hero. */
#nav .site-name {
  font-family: Georgia, 'Songti SC', 'STSong', 'SimSun', serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- 4. Article list cards ---------- */
/* Small radius + hairline border instead of Butterfly's rounded grey-shadow kit. */
.recent-post-item,
#aside-content .card-widget {
  border: 1px solid var(--signal-line);
  border-radius: 4px;
  box-shadow: var(--card-box-shadow);
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.recent-post-item:hover,
#aside-content .card-widget:hover {
  border-color: var(--signal);
  box-shadow: var(--card-hover-box-shadow);
}

/* The cyan vertical rule — the single memorable gesture, from the covers. */
.recent-post-item {
  position: relative;
  overflow: hidden;
}

.recent-post-item::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--signal);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.28s cubic-bezier(0.2, 0.7, 0.3, 1);
}

.recent-post-item:hover::before {
  transform: scaleY(1);
}

.recent-post-info .article-title {
  font-family: Georgia, 'Songti SC', 'STSong', 'SimSun', serif;
  font-weight: 600;
  font-size: 1.35em;
  line-height: 1.45;
  color: var(--graphite);
}

.recent-post-info .article-title:hover {
  color: var(--signal);
}

.recent-post-info .article-meta-wrap,
.recent-post-info .article-meta {
  color: var(--mist);
  font-size: 0.85em;
}

/* Category pill: outlined cyan, matching the cover's "框架与工具" tag. */
.recent-post-info .article-meta-wrap .article-category,
#article-container .post-tags {
  color: var(--signal);
}

/* Aside headlines get a short cyan tick. */
#aside-content .card-widget .item-headline::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--signal);
  margin-right: 8px;
  vertical-align: -0.12em;
}

/* ---------- 5. Post header ---------- */
#page-header.post-bg::before {
  background-image: linear-gradient(160deg, rgba(17, 27, 51, 0.86) 0%, rgba(17, 27, 51, 0.5) 100%);
}

#post-info .post-title {
  font-size: 2em;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

#post-info #post-meta {
  color: rgba(255, 255, 255, 0.82);
}

/* ---------- 6. Pagination & footer ---------- */
.pagination .page-number,
.pagination .extend,
.pagination .prev,
.pagination .next {
  border-radius: 3px;
  border: 1px solid var(--signal-line);
  background: var(--card-bg);
  color: var(--graphite);
}

.pagination .page-number:hover,
.pagination .prev:hover,
.pagination .next:hover {
  border-color: var(--signal);
  color: var(--signal);
}

.pagination .current {
  background: var(--signal);
  border-color: var(--signal);
  color: #fff;
}

/* Theme hardcodes the comment switch blue; override for consistency. */
#post-comment .comment-head .comment-switch .first-comment {
  color: var(--signal);
}

#post-comment .comment-head .comment-switch .comment-switch-round {
  background-color: var(--signal);
}

/* Buttons use --btn-bg from the compiled theme CSS; pin them to the
   design-system signal colour so a stale index.css can't drift them. */
#aside-content .card-info #card-info-btn,
#rightside > div > button,
#rightside > div > a {
  background-color: var(--signal);
  color: #fff;
}

#aside-content .card-info #card-info-btn:hover {
  background-color: var(--coral);
}

/* Footer: midnight indigo with a restrained cyan top rule. */
#footer {
  background: var(--ink);
}

#footer::before {
  content: '';
  display: block;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--signal) 18%, var(--signal) 82%, transparent 100%);
}

#footer-wrap {
  color: rgba(255, 255, 255, 0.72);
  opacity: 1;
}

#footer-wrap a {
  color: var(--signal);
}

/* ---------- 7. Motion: one orchestrated moment only ---------- */
/* The hero settles in once on load; no scattered per-card reveals. */
@media (prefers-reduced-motion: no-preference) {
  #page-header.full_page #site-info {
    animation: hero-settle 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  }
}

@keyframes hero-settle {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 8. Small screens ---------- */
@media screen and (max-width: 768px) {
  #page-header #site-title {
    font-size: 1.7em;
  }

  #page-header #site-subtitle {
    font-size: 0.95em;
  }

  .recent-post-info .article-title {
    font-size: 1.2em;
  }

  #post-info .post-title {
    font-size: 1.5em;
  }

  /* Keep the grid subtle on phones (denser pixels). */
  #page-header.full_page:not(.not-top-img)::before {
    background-image:
      linear-gradient(155deg, rgba(17, 27, 51, 0.8) 0%, rgba(17, 27, 51, 0.45) 60%, rgba(27, 165, 181, 0.16) 100%),
      repeating-linear-gradient(0deg, transparent 0 27px, rgba(255, 255, 255, 0.028) 27px 28px),
      repeating-linear-gradient(90deg, transparent 0 27px, rgba(255, 255, 255, 0.028) 27px 28px);
  }
}
