/*
Theme Name: 光影随行
Description: 面向长文章阅读的简洁 Typecho 主题。
Version: 1.0.0
Author: 光影随行
*/

:root {
  --accent: #536f8d;
  --accent-strong: #395a78;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --text: #25282d;
  --muted: #747b84;
  --line: #e4e7eb;
  --code: #202630;
  --shadow: 0 14px 35px rgba(33, 43, 54, 0.07);
  --radius: 14px;
  color-scheme: light;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #12161b;
  --surface: #1a2027;
  --surface-muted: #202730;
  --text: #ecf0f3;
  --muted: #a0a9b3;
  --line: #2d3540;
  --code: #0c1117;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 14% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

.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;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--surface);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(18px);
}

.header-inner,
.site-main,
.site-footer > div {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.header-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  border-radius: 11px;
  background: linear-gradient(145deg, var(--surface), color-mix(in srgb, var(--accent) 15%, var(--surface)));
  color: var(--accent-strong);
  font-family: "Songti SC", "SimSun", serif;
  font-size: 22px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.08em;
  font-size: 18px;
}

.brand small {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a,
.theme-toggle,
.nav-toggle {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 12px;
  font-size: 14px;
}

.site-nav a:hover,
.site-nav a.active,
.theme-toggle:hover {
  background: var(--surface);
  color: var(--accent-strong);
}

.nav-toggle {
  display: none;
}

.site-main {
  padding-block: 42px 70px;
}

.intro-panel {
  position: relative;
  display: grid;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  align-items: end;
  gap: 46px;
  margin-bottom: 26px;
  padding: clamp(30px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-panel::before {
  position: absolute;
  top: -90px;
  right: 6%;
  width: 260px;
  height: 260px;
  border: 46px solid color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.intro-panel h1,
.archive-header h1 {
  margin: 6px 0 10px;
  font-family: "Songti SC", "SimSun", serif;
  font-size: clamp(34px, 5vw, 58px);
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.intro-panel p {
  max-width: 650px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.search-form {
  position: relative;
  z-index: 1;
  display: flex;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.search-form input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
}

.search-form button,
.comment-form button,
.button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  padding: 9px 18px;
  font-weight: 700;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
  gap: 24px;
}

.post-feed {
  display: grid;
  gap: 15px;
}

.post-card {
  padding: 28px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(31, 43, 55, 0.035);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow);
}

.post-card-meta,
.post-card-footer,
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 12px;
}

.post-card-meta a,
.article-kicker a {
  color: var(--accent-strong);
  font-weight: 700;
}

.post-card h2 {
  margin: 10px 0 8px;
  font-family: "Songti SC", "SimSun", serif;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.4;
}

.post-card h2 a:hover {
  color: var(--accent);
}

.post-card > p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 16px;
  color: var(--muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.post-card-footer {
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.post-card-footer a {
  margin-left: auto;
  color: var(--accent-strong);
  font-weight: 700;
}

.sidebar {
  position: sticky;
  top: 98px;
  display: grid;
  gap: 15px;
}

.side-card,
.toc-card {
  padding: 21px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(31, 43, 55, 0.03);
}

.side-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 800;
}

.side-card-title small {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.category-list,
.recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.category-list li + li,
.recent-list li + li {
  border-top: 1px dashed var(--line);
}

.category-list a,
.recent-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  color: var(--muted);
  font-size: 13px;
}

.category-list a:hover,
.recent-list a:hover {
  color: var(--accent);
}

.category-list small,
.recent-list time {
  flex: 0 0 auto;
  font-size: 10px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-cloud a,
.article-tags a {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  padding: 4px 9px;
  font-size: 11px;
}

.tag-cloud a:hover,
.article-tags a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.archive-header {
  margin-bottom: 26px;
}

.archive-header h1 {
  font-size: clamp(30px, 5vw, 48px);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 12px;
}

.pagination a,
.pagination span {
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  padding-inline: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.pagination .current,
.pagination a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 830px) 270px;
  align-items: start;
  justify-content: center;
  gap: 28px;
}

.article,
.page-article {
  min-width: 0;
  padding: clamp(28px, 5vw, 58px);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.page-article {
  width: min(880px, 100%);
  margin-inline: auto;
}

.article-header {
  margin-bottom: 36px;
  padding-bottom: 27px;
  border-bottom: 1px solid var(--line);
}

.article-header h1 {
  max-width: 760px;
  margin: 8px 0 14px;
  font-family: "Songti SC", "SimSun", serif;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: 0.015em;
  line-height: 1.3;
}

.article-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.article-body {
  color: color-mix(in srgb, var(--text) 94%, transparent);
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  font-size: 17px;
  line-height: 1.95;
  overflow-wrap: break-word;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  scroll-margin-top: 100px;
  color: var(--text);
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.45;
}

.article-body h2 {
  margin: 2.5em 0 0.9em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--line);
  font-size: 1.55em;
}

.article-body h3 {
  margin: 2em 0 0.7em;
  font-size: 1.25em;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin-block: 1.15em;
}

.article-body a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  text-underline-offset: 3px;
}

.article-body blockquote {
  margin: 1.6em 0;
  padding: 0.7em 1.25em;
  border-left: 4px solid var(--accent);
  background: var(--surface-muted);
  color: var(--muted);
}

.article-body blockquote p {
  margin: 0.45em 0;
}

.article-body pre {
  overflow-x: auto;
  margin: 1.7em 0;
  padding: 20px;
  border-radius: 10px;
  background: var(--code);
  color: #e6edf3;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.article-body :not(pre) > code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-muted);
  color: #b34545;
  padding: 0.12em 0.4em;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.86em;
}

.article-body table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  margin: 1.7em 0;
  border-collapse: collapse;
  font-family: "Inter", "PingFang SC", sans-serif;
  font-size: 14px;
}

.article-body th,
.article-body td {
  min-width: 110px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  text-align: left;
}

.article-body th {
  background: var(--surface-muted);
}

.article-body hr {
  height: 1px;
  margin: 3em 0;
  border: 0;
  background: var(--line);
}

.article-body img {
  display: block;
  margin: 1.8em auto;
  border-radius: 10px;
}

.article-footer {
  margin-top: 42px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.article-license {
  margin-top: 22px;
  padding: 17px 19px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
}

.article-license p {
  margin: 4px 0 0;
}

.article-aside {
  position: sticky;
  top: 98px;
}

.toc-card > strong {
  display: block;
  margin: 3px 0 12px;
}

.toc-card ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc-card li {
  margin: 7px 0;
}

.toc-card .toc-sub {
  padding-left: 13px;
}

.toc-card a {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toc-card a:hover {
  color: var(--accent);
}

.post-near {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.post-near > div {
  min-width: 0;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
}

.post-near > div:last-child {
  text-align: right;
}

.comments {
  margin-top: 38px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.comments h2 {
  font-size: 20px;
}

.comment-list,
.comment-list ol {
  padding-left: 0;
  list-style: none;
}

.comment-list ol {
  margin-left: 28px;
}

.comment-body {
  margin: 15px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.comment-author .avatar {
  float: left;
  margin-right: 10px;
  border-radius: 50%;
}

.comment-meta {
  color: var(--muted);
  font-size: 11px;
}

.comment-content {
  clear: both;
  padding-top: 8px;
}

.comment-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.comment-form label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.comment-form input,
.comment-form textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 12px;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--accent);
}

.archive-list {
  display: grid;
  gap: 24px;
}

.archive-year h2 {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 28px;
}

.archive-year ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.archive-year li {
  display: flex;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.archive-year time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.archive-year a:hover {
  color: var(--accent);
}

.empty-state {
  padding: 80px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}

.empty-state h1,
.empty-state h2 {
  margin: 8px 0;
  font-family: "Songti SC", "SimSun", serif;
}

.empty-state p {
  margin-bottom: 24px;
  color: var(--muted);
}

.not-found {
  width: min(720px, 100%);
  margin: 30px auto;
}

.site-footer {
  padding: 38px 0 50px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 0 0 5px;
  color: var(--text);
}

.site-footer small {
  font-size: 11px;
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: minmax(0, 1fr) 250px;
  }

  .article-layout {
    display: block;
  }

  .article-aside {
    display: none;
  }
}

@media (max-width: 760px) {
  .header-inner,
  .site-main,
  .site-footer > div {
    width: min(100% - 28px, 1180px);
  }

  .header-inner {
    min-height: 66px;
  }

  .brand small {
    max-width: 185px;
  }

  .nav-toggle {
    display: block;
  }

  .site-nav {
    position: absolute;
    top: calc(100% + 1px);
    right: 14px;
    left: 14px;
    display: none;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .site-nav.open {
    display: grid;
  }

  .site-nav a,
  .theme-toggle {
    text-align: left;
  }

  .site-main {
    padding-block: 24px 46px;
  }

  .intro-panel {
    grid-template-columns: 1fr;
    gap: 26px;
    padding: 30px 24px;
  }

  .content-grid {
    display: block;
  }

  .sidebar {
    position: static;
    margin-top: 18px;
  }

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

  .post-card-footer a {
    width: 100%;
    margin-left: 0;
  }

  .article,
  .page-article {
    padding: 29px 21px;
  }

  .article-body {
    font-size: 16px;
    line-height: 1.88;
  }

  .article-header {
    margin-bottom: 27px;
  }

  .post-near,
  .comment-fields {
    grid-template-columns: 1fr;
  }

  .post-near > div:last-child {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
