/* ==========================================================================
   吴文正 · 运维学习站 —— 样式表

   组织方式：
   1. 设计变量（颜色 / 间距 / 字体）
   2. 基础重置与通用元素
   3. 布局与公共组件（导航、页脚、按钮、标签）
   4. 页面模块（首页、学习记录、打卡日历、关于、错误页）
   5. 响应式与打印
   ========================================================================== */

/* 1. 设计变量 ------------------------------------------------------------ */

:root {
    color-scheme: dark;

    --bg: #0d1117;
    --bg-elevated: #161b22;
    --bg-soft: #12171f;
    --border: #252c35;
    --border-strong: #323a45;

    --text: #d7dde5;
    --text-strong: #f0f4f8;
    --muted: #8b949e;

    --accent: #58c98b;
    --accent-soft: rgba(88, 201, 139, 0.12);
    --accent-2: #6cb6ff;
    --accent-3: #d2a8ff;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.28);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono",
        Menlo, monospace;

    --width: 1080px;
}

[data-theme="light"] {
    color-scheme: light;

    --bg: #f6f8fa;
    --bg-elevated: #ffffff;
    --bg-soft: #eef1f5;
    --border: #d8dee4;
    --border-strong: #c3cbd4;

    --text: #1f2328;
    --text-strong: #0b0f14;
    --muted: #59636e;

    --accent: #1a7f37;
    --accent-soft: rgba(26, 127, 55, 0.1);
    --accent-2: #0969da;
    --accent-3: #8250df;

    --shadow: 0 8px 24px rgba(31, 35, 40, 0.08);
}

/* 2. 基础 ---------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-2);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1,
h2,
h3,
h4 {
    color: var(--text-strong);
    line-height: 1.35;
    margin: 0 0 0.6em;
}

p {
    margin: 0 0 1em;
}

code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.1em 0.4em;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

.container {
    width: 100%;
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 20px;
}

.visually-hidden {
    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: absolute;
    left: 50%;
    top: -60px;
    transform: translateX(-50%);
    background: var(--accent);
    color: #06120b;
    padding: 10px 18px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 100;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

.muted {
    color: var(--muted);
}

.center {
    text-align: center;
}

.dot {
    color: var(--border-strong);
    margin: 0 8px;
}

.empty {
    background: var(--bg-elevated);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

/* 3. 公共组件 ------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    /* 支持 color-mix 的浏览器使用半透明 + 毛玻璃效果，不支持时回退到纯色 */
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 62px;
}

.nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-strong);
    font-weight: 600;
}

.nav__brand:hover {
    text-decoration: none;
}

.nav__logo {
    font-family: var(--font-mono);
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2px 8px;
    font-size: 0.9em;
}

.nav__menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav__list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav__link {
    display: inline-block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 0.95em;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav__link:hover {
    background: var(--bg-elevated);
    color: var(--text-strong);
    text-decoration: none;
}

.nav__link.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 36px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.nav__toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
}

.theme-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    cursor: pointer;
    font-size: 1em;
}

.theme-toggle:hover {
    color: var(--text-strong);
    border-color: var(--border-strong);
}

.site-footer {
    margin-top: 72px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}

.site-footer__inner {
    padding-top: 28px;
    padding-bottom: 28px;
}

.site-footer__line {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 0.9em;
}

.site-footer__meta {
    margin: 0;
    color: var(--muted);
    font-size: 0.82em;
}

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    color: var(--text);
    font-size: 0.95em;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button:hover {
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.button--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #06120b;
    font-weight: 600;
}

[data-theme="light"] .button--primary {
    color: #ffffff;
}

.button--ghost {
    background: transparent;
}

.link-button {
    background: none;
    border: 0;
    padding: 0;
    color: var(--accent-2);
    font: inherit;
    font-size: 0.9em;
    cursor: pointer;
}

.link-button:hover {
    text-decoration: underline;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--bg-soft);
    color: var(--muted);
    font-size: 0.8em;
    font-family: var(--font-mono);
}

.tag:hover {
    color: var(--text-strong);
    border-color: var(--accent);
    text-decoration: none;
}

.tag.is-active {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

.tag--plain {
    font-family: var(--font-sans);
}

.tag__count {
    opacity: 0.65;
    margin-left: 2px;
}

/* 4. 页面模块 ------------------------------------------------------------ */

.hero {
    padding: 64px 0 24px;
    max-width: 780px;
}

.hero__badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 0.82em;
    font-family: var(--font-mono);
}

.pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(88, 201, 139, 0.5);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(88, 201, 139, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(88, 201, 139, 0);
    }
}

.hero__name {
    font-size: clamp(2rem, 5vw, 2.75rem);
    margin: 20px 0 8px;
    letter-spacing: -0.02em;
}

.hero__headline {
    font-size: 1.15em;
    color: var(--accent);
    margin-bottom: 12px;
}

.hero__summary {
    color: var(--muted);
    font-size: 1.02em;
    max-width: 62ch;
}

.hero__contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    color: var(--muted);
    font-size: 0.92em;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.section {
    margin-top: 56px;
}

.section__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.section__title {
    font-size: 1.15em;
    margin: 0;
}

.section__more {
    font-size: 0.88em;
    color: var(--muted);
    white-space: nowrap;
}

.section__more:hover {
    color: var(--accent-2);
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
}

.stat {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat__value {
    font-family: var(--font-mono);
    font-size: 1.9em;
    color: var(--text-strong);
    line-height: 1.2;
}

.stat__value small {
    font-size: 0.42em;
    color: var(--muted);
    margin-left: 6px;
}

.stat__label {
    color: var(--muted);
    font-size: 0.85em;
}

.skill-groups {
    display: grid;
    gap: 20px;
}

.skill-group__title {
    font-size: 0.9em;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 10px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.card__title {
    font-size: 1.02em;
    margin-bottom: 8px;
}

.card__meta {
    color: var(--muted);
    font-size: 0.82em;
    font-family: var(--font-mono);
    margin-bottom: 10px;
}

.card__text {
    color: var(--muted);
    font-size: 0.92em;
    margin-bottom: 12px;
}

.log-list {
    display: grid;
    gap: 14px;
}

.log-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.log-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
}

.log-card__link {
    display: block;
    color: inherit;
}

.log-card__link:hover {
    text-decoration: none;
}

.log-card__meta {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--muted);
    font-size: 0.82em;
    font-family: var(--font-mono);
    margin-bottom: 8px;
}

.log-card__weekday {
    margin-left: 6px;
    color: var(--border-strong);
}

.log-card__time {
    color: var(--accent-2);
}

.log-card__duration {
    color: var(--accent);
}

.log-card__title {
    font-size: 1.08em;
    margin-bottom: 6px;
}

.log-card__summary {
    color: var(--muted);
    font-size: 0.92em;
    margin-bottom: 14px;
}

.log-card .tag-list {
    margin-top: 12px;
}

.link-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.link-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.link-list__item:last-child {
    border-bottom: 0;
}

.link-list__meta {
    color: var(--muted);
    font-size: 0.82em;
    white-space: nowrap;
}

.page-head {
    padding: 48px 0 8px;
    max-width: 720px;
}

.page-head__title {
    font-size: clamp(1.6rem, 4vw, 2.1rem);
    margin-bottom: 10px;
}

.page-head__lead {
    color: var(--muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
}

/* 打卡日历 */

.calendar {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px 22px;
}

.calendar__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.calendar__label {
    font-family: var(--font-mono);
    color: var(--text-strong);
    font-size: 1.05em;
}

.calendar__count {
    color: var(--muted);
    font-size: 0.82em;
}

.calendar__grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 6px;
}

.calendar__grid th {
    color: var(--muted);
    font-size: 0.75em;
    font-weight: 500;
    padding-bottom: 6px;
}

.calendar__cell {
    width: 14.28%;
    height: 46px;
    text-align: center;
    vertical-align: middle;
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    border: 1px solid transparent;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--muted);
}

.calendar__cell a {
    display: block;
    line-height: 44px;
    color: inherit;
}

.calendar__cell a:hover {
    text-decoration: none;
}

.calendar__cell--empty {
    background: transparent;
}

.calendar__cell.is-studied {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.calendar__cell.is-today {
    border-color: var(--accent-2);
    box-shadow: inset 0 0 0 1px var(--accent-2);
}

/* 步骤列表（关于本站） */

.step-list {
    counter-reset: step;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.step-list li {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px 16px 58px;
    color: var(--muted);
    font-size: 0.94em;
}

.step-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 18px;
    top: 16px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.8em;
}

.step-list strong {
    color: var(--text-strong);
    margin-right: 8px;
}

/* 文章与正文排版 */

.post {
    padding-top: 40px;
    max-width: 780px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.85em;
    margin-bottom: 18px;
}

.post__header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 28px;
}

.post__title {
    font-size: clamp(1.5rem, 4vw, 1.9rem);
    margin-bottom: 10px;
}

.post__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: 0.88em;
    margin-bottom: 14px;
}

.prose {
    font-size: 1rem;
}

.prose h2 {
    font-size: 1.25em;
    margin-top: 2em;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.prose h3 {
    font-size: 1.08em;
    margin-top: 1.6em;
}

.prose ul,
.prose ol {
    padding-left: 22px;
}

.prose li {
    margin-bottom: 6px;
}

.prose blockquote {
    margin: 1.5em 0;
    padding: 4px 18px;
    border-left: 3px solid var(--accent);
    background: var(--bg-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--muted);
}

.prose pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    overflow-x: auto;
}

.prose pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: 0.86em;
    line-height: 1.6;
}

.prose img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92em;
    margin: 1.5em 0;
}

.prose th,
.prose td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.prose th {
    background: var(--bg-soft);
}

.post-nav {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 48px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.post-nav__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 48%;
}

.post-nav__item--right {
    text-align: right;
    margin-left: auto;
}

.post-nav__label {
    color: var(--muted);
    font-size: 0.78em;
}

.code-block {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85em;
    line-height: 1.65;
    color: var(--text);
}

.plain-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    font-size: 0.92em;
}

.plain-list li {
    margin-bottom: 6px;
}

/* 错误页 */

.error-page {
    padding: 88px 0;
    text-align: center;
}

.error-page__code {
    font-family: var(--font-mono);
    font-size: 4rem;
    color: var(--accent);
    margin: 0;
    line-height: 1;
}

.error-page__title {
    font-size: 1.5em;
    margin: 16px 0 10px;
}

.error-page__text {
    color: var(--muted);
    margin-bottom: 26px;
}

.error-page .hero__actions {
    justify-content: center;
}

/* 5. 响应式与打印 -------------------------------------------------------- */

@media (max-width: 760px) {
    .nav__toggle {
        display: flex;
    }

    .nav__menu {
        position: absolute;
        left: 0;
        right: 0;
        top: 62px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px 20px 22px;
        background: var(--bg-elevated);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        display: none;
    }

    .nav__menu.is-open {
        display: flex;
    }

    .nav__list {
        flex-direction: column;
        align-items: stretch;
    }

    .nav__link {
        display: block;
        padding: 10px 12px;
    }

    .hero {
        padding-top: 40px;
    }

    .resume__header {
        flex-direction: column;
    }

    .post-nav {
        flex-direction: column;
    }

    .post-nav__item,
    .post-nav__item--right {
        max-width: 100%;
        text-align: left;
        margin-left: 0;
    }
}

@media print {
    :root {
        --bg: #ffffff;
        --bg-elevated: #ffffff;
        --text: #111111;
        --text-strong: #000000;
        --muted: #444444;
        --border: #cccccc;
    }

    .site-header,
    .site-footer,
    .no-print,
    .skip-link {
        display: none !important;
    }

    body {
        font-size: 12pt;
    }

    .container {
        max-width: none;
        padding: 0;
    }

    .resume,
    .post {
        padding-top: 0;
        max-width: none;
    }
}
