/* ------------------------------------
 * Google Material Design 3 主题
 *
 * @package Google MD3
 * @link   https://m3.material.io
 * --------------------------------- */

/* ------------------
 * MD3 Design Tokens
 * (源自 Material 3 基准方案 / Tonal)
 * --------------- */
:root {
  /* === Color: Primary (Baseline) === */
  --md-primary:            #6750A4;
  --md-on-primary:         #FFFFFF;
  --md-primary-container:  #EADDFF;
  --md-on-primary-container:#21005D;

  /* === Color: Secondary === */
  --md-secondary:            #625B71;
  --md-on-secondary:         #FFFFFF;
  --md-secondary-container:  #E8DEF8;
  --md-on-secondary-container:#1D192B;

  /* === Color: Tertiary === */
  --md-tertiary:             #7D5260;
  --md-tertiary-container:   #FFD8E4;

  /* === Color: Error === */
  --md-error:                #B3261E;
  --md-on-error:             #FFFFFF;
  --md-error-container:      #F9DEDC;
  --md-on-error-container:   #410E0B;

  /* === Color: Neutral / Surface === */
  --md-background:           #FEF7FF;
  --md-surface:              #FEF7FF;
  --md-surface-dim:          #DED8E1;
  --md-surface-bright:       #FEF7FF;
  --md-surface-container-lowest: #FFFFFF;
  --md-surface-container-low:    #F7F2FA;
  --md-surface-container:        #F3EDF7;
  --md-surface-container-high:   #ECE6F0;
  --md-surface-container-highest:#E6E0E9;
  --md-on-surface:           #1D1B20;
  --md-on-surface-variant:   #49454F;
  --md-outline:              #79747E;
  --md-outline-variant:      #CAC4D0;
  --md-inverse-surface:      #322F35;
  --md-inverse-on-surface:   #F5EFF7;

  /* === Typography === */
  --md-font-family: "Roboto","Roboto Flex","Noto Sans SC","PingFang SC","Hiragino Sans GB","Microsoft Yahei",sans-serif;
  --md-font-family-serif:"Roboto Slab",Georgia,"Songti SC","SimSun",serif;
  --md-font-family-mono: "Roboto Mono",Menlo,Consolas,"Courier New",monospace;

  /* === 形状 Shape Scale === */
  --shape-xs: 4px;
  --shape-sm: 8px;
  --shape-md: 12px;
  --shape-lg: 16px;
  --shape-xl: 28px;
  --shape-full: 9999px;

  /* === Elevation (MD3 shadow) === */
  --elev-1: 0 1px 2px rgba(0,0,0,.30), 0 1px 3px 1px rgba(0,0,0,.15);
  --elev-2: 0 1px 2px rgba(0,0,0,.30), 0 2px 6px 2px rgba(0,0,0,.15);
  --elev-3: 0 1px 3px rgba(0,0,0,.30), 0 4px 8px 3px rgba(0,0,0,.15);

  /* === Motion === */
  --md-motion-standard: cubic-bezier(.2,0,0,1);
  --md-motion-duration: .2s;

  /* === State layers === */
  --state-hover: rgba(103,80,164,.08);
  --state-focus: rgba(103,80,164,.12);
  --state-pressed:rgba(103,80,164,.12);
}

/* 深色配色方案 */
@media (prefers-color-scheme: dark) {
  :root {
    --md-primary:            #D0BCFF;
    --md-on-primary:         #381E72;
    --md-primary-container:  #4F378B;
    --md-on-primary-container:#EADDFF;

    --md-secondary:            #CCC2DC;
    --md-on-secondary:         #332D41;
    --md-secondary-container:  #4A4458;
    --md-on-secondary-container:#E8DEF8;

    --md-tertiary:             #EFB8C8;
    --md-tertiary-container:   #633B48;

    --md-error:                #F2B8B5;
    --md-on-error:             #601410;
    --md-error-container:      #8C1D18;
    --md-on-error-container:   #F9DEDC;

    --md-background:           #141218;
    --md-surface:              #141218;
    --md-surface-dim:          #141218;
    --md-surface-bright:       #3B383E;
    --md-surface-container-lowest:#0F0D13;
    --md-surface-container-low:    #1D1B20;
    --md-surface-container:        #211F26;
    --md-surface-container-high:   #2B2930;
    --md-surface-container-highest:#36343B;
    --md-on-surface:           #E6E0E9;
    --md-on-surface-variant:   #CAC4D0;
    --md-outline:              #938F99;
    --md-outline-variant:      #49454F;
    --md-inverse-surface:      #E6E0E9;
    --md-inverse-on-surface:   #322F35;

    --state-hover: rgba(208,188,255,.08);
    --state-focus: rgba(208,188,255,.12);
    --state-pressed:rgba(208,188,255,.12);
  }
}

/* ------------------
 * Global
 * --------------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background-color: var(--md-background);
  color: var(--md-on-surface);
  font-family: var(--md-font-family);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--md-primary);
  text-decoration: none;
  transition: color var(--md-motion-duration) var(--md-motion-standard);
}
a:hover  { color: var(--md-on-surface); }
a:active { color: var(--md-primary); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--md-font-family);
  font-weight: 500;
  line-height: 1.3;
  color: var(--md-on-surface);
}

/* === 代码块 === */
pre, code {
  font-family: var(--md-font-family-mono);
  font-size: .875em;
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
}
code {
  padding: 2px 6px;
  border-radius: var(--shape-xs);
  color: var(--md-primary);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}
pre {
  padding: 16px;
  overflow: auto;
  max-height: 400px;
  border-radius: var(--shape-md);
  background: var(--md-surface-container-high);
}
pre code {
  display: block;
  padding: 3px;
  background: transparent;
  color: inherit;
}

/* === 引用 === */
blockquote {
  margin: 1.5em 0;
  padding: 12px 16px 12px 20px;
  border-left: 4px solid var(--md-primary);
  background: var(--md-surface-container-low);
  border-radius: 0 var(--shape-md) var(--shape-md) 0;
  color: var(--md-on-surface-variant);
  font-family: var(--md-font-family-serif);
}

/* === 表格 === */
table {
  border: none;
  width: 100%;
  border-collapse: collapse;
  background: var(--md-surface-container-low);
  border-radius: var(--shape-md);
  overflow: hidden;
  font-size: .9375em;
}
table th,
table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-outline-variant);
}
table th {
  background: var(--md-surface-container-high);
  font-weight: 500;
  color: var(--md-on-surface);
}
table tr:last-child td { border-bottom: none; }

/* === 输入 === */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea {
  padding: 12px 16px;
  border: 1px solid var(--md-outline);
  width: 100%;
  color: var(--md-on-surface);
  background: var(--md-surface-container-lowest);
  border-radius: var(--shape-sm);
  font-family: var(--md-font-family);
  font-size: 1em;
  transition: border-color var(--md-motion-duration) var(--md-motion-standard),
              box-shadow  var(--md-motion-duration) var(--md-motion-standard);
  box-sizing: border-box;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 1px var(--md-primary);
}
textarea { resize: vertical; min-height: 120px; }

/* === 按钮 === */
button, .submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 24px;
  border: none;
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-family: var(--md-font-family);
  font-size: .875rem;
  font-weight: 500;
  letter-spacing: .1px;
  border-radius: var(--shape-full);
  cursor: pointer;
  transition: box-shadow var(--md-motion-duration) var(--md-motion-standard),
              background var(--md-motion-duration) var(--md-motion-standard);
}
button:hover, .submit:hover { box-shadow: var(--elev-1); }
button:active,.submit:active{ box-shadow: none; background: var(--md-primary-container); color: var(--md-on-primary-container); }

/* Special link style */
.post-meta a,
.post-content a,
.widget a,
.comment-content a {
  border-bottom: 1px solid var(--md-outline-variant);
  transition: border-color var(--md-motion-duration) var(--md-motion-standard);
}
.post-meta a:hover,
.post-content a:hover,
.widget a:hover,
.comment-content a:hover {
  border-bottom-color: var(--md-primary);
}

/* ------------------
 * Layout / Container
 * --------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ------------------
 * Header (MD3 Top App Bar)
 * --------------- */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: 0;
  background: var(--md-surface-container);
  color: var(--md-on-surface);
  border-bottom: none;
  box-shadow: var(--elev-1);
}
#header .row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 0;
}
.site-name {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1 1 auto;
}
#logo {
  color: var(--md-on-surface);
  font-size: 1.5em;
  font-weight: 500;
  line-height: 44px;
  border-bottom: none;
}
#logo img { max-height: 44px; vertical-align: middle; }
.description {
  margin: 0;
  color: var(--md-on-surface-variant);
  font-style: normal;
  font-size: .875rem;
}

/* MD3 Search field */
.site-search {
  flex: 0 0 auto;
}
#search {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  background: var(--md-surface-container-high);
  border-radius: var(--shape-full);
  padding: 0 12px;
  height: 44px;
}
#search input {
  border: none;
  background: transparent;
  padding: 0 8px;
  color: var(--md-on-surface);
  height: 100%;
}
#search input:focus { box-shadow: none; }
#search button {
  position: relative;
  right: auto; top: auto;
  border: none;
  width: 36px; height: 36px;
  padding: 0;
  background: transparent;
  text-indent: 0;
  color: var(--md-on-surface-variant);
  border-radius: var(--shape-full);
  box-shadow: none;
}
#search button:hover { background: var(--state-hover); box-shadow: none; }
#search button::before {
  content: "search";
  font-family: "Material Symbols Outlined";
  font-size: 24px;
  line-height: 1;
}

/* Navigation — MD3 Tabs */
#nav-menu {
  margin: 0;
  padding: 0 0 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
#nav-menu a {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 24px;
  margin: 0;
  border: none;
  border-radius: var(--shape-full);
  color: var(--md-on-surface-variant);
  font-weight: 500;
  float: none;
  position: relative;
  transition: background var(--md-motion-duration) var(--md-motion-standard),
              color   var(--md-motion-duration) var(--md-motion-standard);
}
#nav-menu a:hover {
  background: var(--state-hover);
  color: var(--md-on-surface);
}
#nav-menu .current {
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
}

/* ------------------
 * Main
 * --------------- */
#body {
  padding: 24px 0;
}
#main { padding: 0; }

/* === Card / Post === */
.post {
  margin-bottom: 16px;
  padding: 24px;
  background: var(--md-surface-container-low);
  color: var(--md-on-surface);
  border-bottom: none;
  border-radius: var(--shape-lg);
  box-shadow: var(--elev-1);
  transition: box-shadow var(--md-motion-duration) var(--md-motion-standard);
}
.post:hover { box-shadow: var(--elev-2); }

.post-title {
  margin: 0 0 8px;
  font-size: 1.5em;
  font-weight: 500;
  color: var(--md-on-surface);
}
.post-title a { color: var(--md-on-surface); border-bottom: none; }
.post-title a:hover { color: var(--md-primary); }

.post-meta {
  margin: 0 0 16px;
  padding: 0;
  color: var(--md-on-surface-variant);
  font-size: .8125rem;
}
.post-meta li {
  display: inline-flex;
  align-items: center;
  margin: 0 8px 0 0;
  padding-left: 12px;
  border-left: 1px solid var(--md-outline-variant);
}
.post-meta li:first-child {
  margin-left: 0;
  padding-left: 0;
  border: none;
}

.post-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--md-on-surface);
}
.post-content h2,
.comment-content h2 { font-size: 1.375em; margin: 1.2em 0 .5em; }
.post-content h3,
.comment-content h3 { font-size: 1.125em; margin: 1em 0 .4em; }
.post-content img, .comment-content img,
.post-content video, .comment-content video {
  max-width: 100%;
  border-radius: var(--shape-md);
}
.post-content a img, .comment-content a img {
  background: var(--md-surface);
  position: relative;
  bottom: -4px;
}
.post-content hr, .comment-content hr {
  margin: 2em auto;
  width: 80px;
  border: none;
  border-top: 1px solid var(--md-outline-variant);
}
.post .tags {
  clear: both;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--md-outline-variant);
  color: var(--md-on-surface-variant);
  font-size: .875em;
}

/* === 文章邻近链接 === */
.post-near {
  list-style: none;
  margin: 24px 0 0;
  padding: 20px 24px;
  background: var(--md-surface-container-low);
  color: var(--md-on-surface-variant);
  border-radius: var(--shape-lg);
  box-shadow: var(--elev-1);
}
.post-near li {
  margin: 8px 0;
  font-size: .875rem;
}

/* === 归档标题 === */
.archive-title {
  margin: 0 0 16px;
  padding: 16px 24px;
  background: var(--md-secondary-container);
  color: var(--md-on-secondary-container);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--shape-lg);
}

.more {
  text-align: center;
  margin: 24px 0;
}
.more a {
  display: inline-flex;
  padding: 10px 24px;
  border: 1px solid var(--md-outline);
  color: var(--md-primary);
  border-radius: var(--shape-full);
  border-bottom: 1px solid var(--md-outline);
  transition: background var(--md-motion-duration) var(--md-motion-standard);
}
.more a:hover { background: var(--state-hover); border-bottom-color: var(--md-outline); }

.protected .text { width: 60%; max-width: 320px; }

/* === 分页 Page navigator === */
.page-navigator {
  list-style: none;
  margin: 32px 0 8px;
  padding: 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.page-navigator li { display: inline-block; margin: 0; }
.page-navigator a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  color: var(--md-on-surface-variant);
  border-radius: var(--shape-full);
  font-weight: 500;
  background: transparent;
}
.page-navigator a:hover {
  background: var(--md-surface-container-high);
  text-decoration: none;
  border-bottom: none;
}
.page-navigator .current a {
  color: var(--md-on-primary);
  background: var(--md-primary);
}

/* ------------------
 * Comments
 * --------------- */
#comments { padding-top: 16px; }
#comments > h3,
.respond h3 {
  margin: 16px 0;
  font-size: 1.125em;
  color: var(--md-on-surface);
}
.comment-list, .comment-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.comment-list li {
  padding: 16px 20px;
  margin-top: 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--shape-md);
  background: var(--md-surface-container-low);
}
.comment-list li.comment-level-odd  { background: var(--md-surface-container-low); }
.comment-list li.comment-level-even { background: var(--md-surface-container); }
.comment-list li.comment-by-author  { background: var(--md-primary-container); color: var(--md-on-primary-container); }
.comment-list li .comment-reply {
  text-align: right;
  font-size: .8125rem;
}
.comment-meta a {
  color: var(--md-on-surface-variant);
  font-size: .8125rem;
  border-bottom: none;
}
.comment-author {
  display: block;
  margin-bottom: 4px;
  color: var(--md-on-surface);
}
.comment-author .avatar {
  float: left;
  margin-right: 12px;
  border-radius: var(--shape-full);
}
.comment-author cite {
  font-weight: 500;
  font-style: normal;
}

/* Comment reply */
.comment-list .respond {
  margin-top: 16px;
  border-top: 1px solid var(--md-outline-variant);
  padding-top: 16px;
}
.respond .cancel-comment-reply {
  float: right;
  margin-top: 16px;
  font-size: .8125rem;
}
#comment-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  font-size: .875rem;
}
#comment-form .required:after {
  content: " *";
  color: var(--md-error);
}
#comment-form p { margin: 0 0 16px; }

/* ------------------
 * Sidebar
 * --------------- */
#secondary {
  padding-top: 0;
  word-wrap: break-word;
}
.widget {
  margin-bottom: 16px;
  padding: 20px 24px;
  background: var(--md-surface-container-low);
  border-radius: var(--shape-lg);
  box-shadow: var(--elev-1);
  color: var(--md-on-surface-variant);
}
.widget-title {
  margin: 0 0 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--md-outline-variant);
  font-size: .8125rem;
  font-weight: 500;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--md-on-surface-variant);
}
.widget-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.widget-list li {
  margin: 4px 0;
  line-height: 1.6;
  border-radius: var(--shape-sm);
  transition: background var(--md-motion-duration) var(--md-motion-standard);
}
.widget-list li a {
  display: block;
  padding: 6px 12px;
  margin: 0 -12px;
  border-radius: var(--shape-sm);
  border-bottom: none;
  color: var(--md-on-surface);
}
.widget-list li a:hover {
  background: var(--state-hover);
  border-bottom: none;
}
.widget-list li ul {
  margin-left: 16px;
  padding-top: 4px;
}

/* ------------------
 * Footer
 * --------------- */
#footer {
  margin-top: 24px;
  padding: 32px 24px;
  background: var(--md-surface-container);
  color: var(--md-on-surface-variant);
  text-align: center;
  line-height: 1.6;
  font-size: .8125rem;
  border-radius: var(--shape-lg) var(--shape-lg) 0 0;
  box-shadow: var(--elev-1);
}
#footer a {
  color: var(--md-on-surface);
  border-bottom: none;
  font-weight: 500;
}
#footer a:hover { color: var(--md-primary); }

/* ------------------
 * Error page
 * -------------- */
.error-page {
  margin: 80px auto;
  max-width: 480px;
  padding: 32px 24px;
  background: var(--md-error-container);
  color: var(--md-on-error-container);
  border-radius: var(--shape-xl);
  text-align: center;
}
.error-page .post-title { color: var(--md-on-error-container); }
.error-page form { margin-top: 16px; }

/* -----------------
 * Misc
 *--------------- */
.aligncenter, div.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.alignleft { float: left; }
.alignright { float: right; }
img.alignleft  { margin: 0 16px 0 0; }
img.alignright { margin: 0 0 0 16px; }

.hidden    { display: none !important; visibility: hidden; }
.invisible { visibility: hidden; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* -----------------
 * Responsive
 *--------------- */
@media (max-width: 767px) {
  body { font-size: 15px; }
  .container { padding: 0 16px; }
  #header .row { gap: 8px; }
  #nav-menu a { padding: 0 16px; }
  .post { padding: 20px; }
}

@media (max-width: 768px) {
  #header, .post-title, .post-meta { text-align: left; }
}

@media (min-width: 1200px) {
  .container { max-width: 1100px; }
}