/* === Registered Custom Properties (enables smooth color transitions) === */
@property --bg {
    syntax: "<color>";
    inherits: true;
    initial-value: #f5f4f0;
}
@property --text {
    syntax: "<color>";
    inherits: true;
    initial-value: #1a1a18;
}
@property --mid {
    syntax: "<color>";
    inherits: true;
    initial-value: #5a554d;
}
@property --line {
    syntax: "<color>";
    inherits: true;
    initial-value: #c8c4ba;
}
@property --accent {
    syntax: "<color>";
    inherits: true;
    initial-value: #8a8580;
}

/* === Scene Palettes === */
[data-scene="sunny"] {
    --bg: #f5f4f0;
    --text: #1a1a18;
    --mid: #5a554d;
    --line: #c8c4ba;
    --accent: #8a8580;
}

[data-scene="rainy"] {
    --bg: #0a0e14;
    --text: #b4b4b4;
    --mid: #505862;
    --line: #1c2028;
    --accent: #7a8fa6;
}

/* === Transition === */
html {
    transition:
        --bg 0.3s ease,
        --text 0.3s ease,
        --mid 0.3s ease,
        --line 0.3s ease,
        --accent 0.3s ease;
}

/* === Reset === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Base === */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC",
        "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

/* === Typography === */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}

h1 {
    font-size: 1.75rem;
    margin-bottom: 0.6em;
}
h2 {
    font-size: 1.35rem;
    margin-bottom: 0.5em;
}
h3 {
    font-size: 1.15rem;
    margin-bottom: 0.4em;
}

p {
    margin-bottom: 1.2em;
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text);
}

code {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Menlo", monospace;
    font-size: 0.85em;
    background: var(--line);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

pre {
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 1.5em;
    line-height: 1.6;
    transition: background-color 0.3s ease;
}

pre code {
    background: none;
    padding: 0;
    font-size: 0.82rem;
    border-radius: 0;
}

/* Hugo Chroma highlight wrapper */
.highlight {
    margin-bottom: 1.5em;
}

.highlight pre {
    margin: 0;
    padding: 1em 1.2em;
}

.chroma {
    background: var(--line) !important;
    border-radius: 6px;
    padding: 1em 1.2em;
    overflow-x: auto;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Standalone pre (no Chroma wrapper) */
pre:not(.chroma) {
    background: var(--line);
    padding: 1em 1.2em;
}

blockquote {
    border-left: 2px solid var(--mid);
    padding-left: 1em;
    margin: 1.2em 0;
    color: var(--mid);
    font-style: italic;
    transition:
        border-color 0.3s ease,
        color 0.3s ease;
}

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2em 0;
    transition: border-color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* === Layout === */
.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.site-main {
    position: relative;
    z-index: 10;
    padding: 2rem 0 4rem;
    flex: 1;
}

.site-main > .container {
    max-width: 720px;
}

/* === Scene Layer (atmospheric effects overlay) === */
.scene-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* === Rainy cloud/fog overlay === */
.scene-cloud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    background:
        radial-gradient(ellipse 120% 50% at 50% -5%, rgba(55, 65, 80, 0.35) 0%, transparent 70%),
        radial-gradient(ellipse 80% 40% at 25% 0%, rgba(50, 60, 75, 0.2) 0%, transparent 60%),
        radial-gradient(ellipse 80% 40% at 75% 0%, rgba(50, 60, 75, 0.15) 0%, transparent 55%),
        linear-gradient(180deg, rgba(35, 45, 58, 0.25) 0%, transparent 40%);
}

[data-scene="rainy"] .scene-cloud {
    opacity: 1;
}

/* === Footer === */
.site-footer {
    position: relative;
    z-index: 10;
    padding: 2rem 0;
    text-align: center;
    color: var(--mid);
    font-size: 0.82rem;
    border-top: 1px solid var(--line);
    transition:
        border-color 0.3s ease,
        color 0.3s ease;
}

/* === Audio Toggle === */
.audio-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--mid);
    font-size: 16px;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color 0.3s ease,
        color 0.3s ease,
        background-color 0.3s ease,
        opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
    line-height: 0;
}

.audio-toggle:hover {
    border-color: var(--mid);
    color: var(--text);
}

.audio-toggle.visible {
    opacity: 1;
    pointer-events: auto;
}

.audio-toggle.muted {
    opacity: 0.4;
}

.audio-toggle.muted:hover {
    opacity: 0.7;
}

/* === Selection === */
::selection {
    background: var(--accent);
    color: var(--bg);
}

/* === 404 === */
.error-page {
    text-align: center;
    padding: 8rem 0 4rem;
}

.error-code {
    font-size: 4rem;
    font-weight: 300;
    color: var(--mid);
    margin-bottom: 0.3rem;
}

.error-message {
    color: var(--mid);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.error-link {
    font-size: 0.88rem;
    color: var(--mid);
    border: 1px solid var(--line);
    padding: 0.4em 1em;
    border-radius: 6px;
    transition: color 0.2s ease, border-color 0.3s ease;
}

.error-link:hover {
    color: var(--text);
}
.site-header {
  position: relative;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  transition: border-color 0.3s ease;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-nav {
  display: flex;
  gap: 1.6rem;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--mid);
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  position: relative;
}

.nav-link:hover { color: var(--text); }
.nav-link.is-active { color: var(--text); }

.nav-link.is-active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: var(--text);
  transition: background-color 0.3s ease;
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Search button */
.search-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--mid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.3s ease;
  line-height: 0;
}

.search-btn:hover { color: var(--text); }

/* Scene toggle */
.scene-toggle {
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  color: var(--mid);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.3s ease;
  line-height: 0;
}

.scene-toggle:hover { color: var(--text); }

[data-scene="sunny"] .icon-sun { display: block; }
[data-scene="sunny"] .icon-rain { display: none; }
[data-scene="rainy"] .icon-sun { display: none; }
[data-scene="rainy"] .icon-rain { display: block; }

/* === Search Overlay === */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, background 0.3s ease, backdrop-filter 0.3s ease;
}

.search-overlay.open {
  opacity: 1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.search-container {
  width: 100%;
  max-width: 560px;
  margin: 0 1rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  transform: scale(0.96) translateY(-12px);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease,
              background-color 0.3s ease, border-color 0.3s ease;
}

.search-overlay.open .search-container {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--mid);
  transition: border-color 0.3s ease;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
}

.search-input::placeholder {
  color: var(--mid);
}

.search-kbd {
  font-size: 0.7rem;
  padding: 0.15em 0.5em;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--mid);
  font-family: inherit;
  line-height: 1;
}

.search-results {
  max-height: 50vh;
  overflow-y: auto;
}

.search-result-item {
  display: block;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: background-color 0.1s ease;
}

.search-result-item:hover {
  background: var(--line);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-title {
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.search-result-meta {
  font-size: 0.78rem;
  color: var(--mid);
}

.search-result-snippet {
  font-size: 0.8rem;
  color: var(--mid);
  margin-top: 0.2rem;
  line-height: 1.4;
}

.search-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--mid);
  font-size: 0.88rem;
}
/* === Code Syntax Highlighting === */

/* --- Sunny (light) --- */

/* */ [data-scene="sunny"] .bg { color:#272822;background-color:#fafafa; }
/* */ [data-scene="sunny"] .chroma { color:#272822;background-color:#fafafa; }
/* */ [data-scene="sunny"] .chroma .err { color:#960050;background-color:#1e0010 }
/* */ [data-scene="sunny"] .chroma .lnlinks { outline:none;text-decoration:none;color:inherit }
/* */ [data-scene="sunny"] .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; }
/* */ [data-scene="sunny"] .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; }
/* */ [data-scene="sunny"] .chroma .hl { background-color:#e1e1e1 }
/* */ [data-scene="sunny"] .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* */ [data-scene="sunny"] .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* */ [data-scene="sunny"] .chroma .line { display:flex; }
/* */ [data-scene="sunny"] .chroma .k { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .kc { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .kd { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .kn { color:#f92672 }
/* */ [data-scene="sunny"] .chroma .kp { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .kr { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .kt { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .n { color:#111 }
/* */ [data-scene="sunny"] .chroma .na { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .nc { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .no { color:#00a8c8 }
/* */ [data-scene="sunny"] .chroma .nd { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .ni { color:#111 }
/* */ [data-scene="sunny"] .chroma .ne { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .nl { color:#111 }
/* */ [data-scene="sunny"] .chroma .nn { color:#111 }
/* */ [data-scene="sunny"] .chroma .nx { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .py { color:#111 }
/* */ [data-scene="sunny"] .chroma .nt { color:#f92672 }
/* */ [data-scene="sunny"] .chroma .nb { color:#111 }
/* */ [data-scene="sunny"] .chroma .bp { color:#111 }
/* */ [data-scene="sunny"] .chroma .nv { color:#111 }
/* */ [data-scene="sunny"] .chroma .vc { color:#111 }
/* */ [data-scene="sunny"] .chroma .vg { color:#111 }
/* */ [data-scene="sunny"] .chroma .vi { color:#111 }
/* */ [data-scene="sunny"] .chroma .vm { color:#111 }
/* */ [data-scene="sunny"] .chroma .nf { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .fm { color:#75af00 }
/* */ [data-scene="sunny"] .chroma .l { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .ld { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .s { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sa { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sb { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sc { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .dl { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sd { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .s2 { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .se { color:#8045ff }
/* */ [data-scene="sunny"] .chroma .sh { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .si { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sx { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .sr { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .s1 { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .ss { color:#d88200 }
/* */ [data-scene="sunny"] .chroma .m { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .mb { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .mf { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .mh { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .mi { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .il { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .mo { color:#ae81ff }
/* */ [data-scene="sunny"] .chroma .o { color:#f92672 }
/* */ [data-scene="sunny"] .chroma .ow { color:#f92672 }
/* */ [data-scene="sunny"] .chroma .p { color:#111 }
/* */ [data-scene="sunny"] .chroma .c { color:#75715e }
/* */ [data-scene="sunny"] .chroma .ch { color:#75715e }
/* */ [data-scene="sunny"] .chroma .cm { color:#75715e }
/* */ [data-scene="sunny"] .chroma .c1 { color:#75715e }
/* */ [data-scene="sunny"] .chroma .cs { color:#75715e }
/* */ [data-scene="sunny"] .chroma .cp { color:#75715e }
/* */ [data-scene="sunny"] .chroma .cpf { color:#75715e }
/* */ [data-scene="sunny"] .chroma .ge { font-style:italic }
/* */ [data-scene="sunny"] .chroma .gs { font-weight:bold }

/* --- Rainy (dark) --- */

/* */ [data-scene="rainy"] .bg { color:#f8f8f2;background-color:#282a36; }
/* */ [data-scene="rainy"] .chroma { color:#f8f8f2;background-color:#282a36; }
/* */ [data-scene="rainy"] .chroma .lnlinks { outline:none;text-decoration:none;color:inherit }
/* */ [data-scene="rainy"] .chroma .lntd { vertical-align:top;padding:0;margin:0;border:0; }
/* */ [data-scene="rainy"] .chroma .lntable { border-spacing:0;padding:0;margin:0;border:0; }
/* */ [data-scene="rainy"] .chroma .hl { background-color:#3d3f4a }
/* */ [data-scene="rainy"] .chroma .lnt { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* */ [data-scene="rainy"] .chroma .ln { white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f }
/* */ [data-scene="rainy"] .chroma .line { display:flex; }
/* */ [data-scene="rainy"] .chroma .k { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .kc { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .kd { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .kn { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .kp { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .kr { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .kt { color:#8be9fd }
/* */ [data-scene="rainy"] .chroma .na { color:#50fa7b }
/* */ [data-scene="rainy"] .chroma .nc { color:#50fa7b }
/* */ [data-scene="rainy"] .chroma .nl { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .nt { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .nb { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .bp { font-style:italic }
/* */ [data-scene="rainy"] .chroma .nv { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .vc { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .vg { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .vi { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .vm { color:#8be9fd;font-style:italic }
/* */ [data-scene="rainy"] .chroma .nf { color:#50fa7b }
/* */ [data-scene="rainy"] .chroma .fm { color:#50fa7b }
/* */ [data-scene="rainy"] .chroma .s { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sa { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sb { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sc { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .dl { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sd { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .s2 { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .se { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sh { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .si { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sx { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .sr { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .s1 { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .ss { color:#f1fa8c }
/* */ [data-scene="rainy"] .chroma .m { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .mb { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .mf { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .mh { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .mi { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .il { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .mo { color:#bd93f9 }
/* */ [data-scene="rainy"] .chroma .o { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .ow { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .c { color:#6272a4 }
/* */ [data-scene="rainy"] .chroma .ch { color:#6272a4 }
/* */ [data-scene="rainy"] .chroma .cm { color:#6272a4 }
/* */ [data-scene="rainy"] .chroma .c1 { color:#6272a4 }
/* */ [data-scene="rainy"] .chroma .cs { color:#6272a4 }
/* */ [data-scene="rainy"] .chroma .cp { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .cpf { color:#ff79c6 }
/* */ [data-scene="rainy"] .chroma .gd { color:#f55 }
/* */ [data-scene="rainy"] .chroma .ge { text-decoration:underline }
/* */ [data-scene="rainy"] .chroma .gh { font-weight:bold }
/* */ [data-scene="rainy"] .chroma .gi { color:#50fa7b;font-weight:bold }
/* */ [data-scene="rainy"] .chroma .go { color:#44475a }
/* */ [data-scene="rainy"] .chroma .gu { font-weight:bold }
/* */ [data-scene="rainy"] .chroma .gl { text-decoration:underline }