:root {
    --ink: #1d201f;
    --muted: #666b68;
    --paper: #f6f5f1;
    --surface: #fffefa;
    --line: #d8d7d1;
    --accent: #2f6652;
    --accent-soft: #e4ece7;
    --dark: #181a1b;
    --max: 1080px;
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.75;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.page-shell,
.reading-shell {
    width: min(calc(100% - 40px), var(--max));
    margin: 0 auto;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 54px;
    background: rgba(246, 245, 241, .94);
    border-bottom: 1px solid rgba(29, 32, 31, .1);
    backdrop-filter: blur(14px);
}

.header-inner {
    width: min(calc(100% - 40px), var(--max));
    height: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 15px;
    font-weight: 750;
    text-decoration: none;
}

.header-inner nav { display: flex; gap: 24px; }
.header-inner nav a { color: var(--muted); font-size: 13px; text-decoration: none; cursor: pointer; }
.header-inner nav a:hover,
.header-inner nav a[aria-current="page"] { color: var(--ink); }

.masthead {
    min-height: 410px;
    color: #f6f5f1;
    background: var(--dark);
    display: flex;
    align-items: flex-end;
}

.masthead-inner { padding: 76px 0 72px; }

.eyebrow {
    margin: 0 0 18px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .14em;
}

.masthead .eyebrow { color: #8fbaa8; }

.masthead h1 {
    margin: 0;
    font-family: Georgia, "Songti SC", "SimSun", serif;
    font-size: clamp(48px, 7vw, 82px);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: 0;
}

.subtitle { margin: 20px 0 0; color: #d7d8d5; font-size: 18px; }
.intro { margin: 42px 0 0; color: #9da19d; font-size: 15px; line-height: 1.8; }

.overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 36px 0;
    border-bottom: 1px solid var(--line);
}

.stat { min-height: 78px; padding: 0 24px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat strong { display: block; font-family: Georgia, serif; font-size: 30px; font-weight: 500; line-height: 1.15; }
.stat span { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; }

.archive-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 72px;
    padding: 70px 0 110px;
}

.filters { align-self: start; position: sticky; top: 84px; }
.filter-heading h2,
.timeline-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 500; }
.filters form { display: grid; gap: 18px; margin-top: 28px; }
.filters label > span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; }

select,
button {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 13px;
}

select { padding: 0 34px 0 12px; }
button { margin-top: 2px; background: var(--dark); border-color: var(--dark); color: #fff; cursor: pointer; font-weight: 650; }
button:hover { background: #303332; }
.reset-link { display: block; color: var(--muted); font-size: 12px; text-align: center; }

.timeline-heading {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: end;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ink);
}
.timeline-heading .eyebrow { grid-column: 1 / -1; }
.timeline-heading > span { color: var(--muted); font-size: 12px; }

.year-marker { margin: 54px 0 0; border-top: 1px solid var(--line); }
.year-marker span { position: relative; top: -17px; display: inline-block; padding-right: 16px; background: var(--paper); font-family: Georgia, serif; font-size: 22px; }
.month-marker { margin: 8px 0 20px; color: var(--muted); font-size: 12px; font-weight: 650; }

.entry-card {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 18px;
    overflow: hidden;
}

.date-block { padding: 24px 14px; background: #eeede8; border-right: 1px solid var(--line); text-align: center; }
.date-block time strong { display: block; font-family: Georgia, serif; font-size: 30px; font-weight: 500; line-height: 1; }
.date-block time span { display: block; margin-top: 9px; color: var(--muted); font-size: 10px; }
.card-content { min-width: 0; padding: 24px 26px 26px; }
.card-content h4 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 550; line-height: 1.4; }
.card-content h4 a { text-decoration: none; }
.card-content h4 a:hover { color: var(--accent); }
.card-summary { margin: 12px 0 20px; color: var(--muted); font-size: 14px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pills span { padding: 2px 8px; background: #eeede8; border-radius: 999px; color: #555a57; font-size: 11px; line-height: 1.7; }
.pills.projects span { background: var(--accent-soft); color: #285543; }
.meta-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 10px; }
.meta-row > span { flex: 0 0 32px; padding-top: 1px; color: var(--muted); font-size: 11px; }

.card-change { margin-top: 20px; padding: 14px 16px; background: #f1f5f2; border-left: 2px solid var(--accent); }
.card-change > span { color: var(--accent); font-size: 10px; font-weight: 750; }
.card-change p { margin: 6px 0 0; color: #454a47; font-size: 12px; line-height: 1.65; }
.card-change b { padding: 0 4px; color: var(--accent); }
.read-link { display: inline-block; margin-top: 20px; color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: none; }
.no-results { padding: 54px 0; color: var(--muted); font-size: 14px; }

.reading-shell { max-width: 760px; padding: 58px 0 110px; }
.back-link { display: inline-block; margin-bottom: 52px; color: var(--muted); font-size: 13px; text-decoration: none; }
.back-link:hover { color: var(--ink); }
.entry-header { padding-bottom: 44px; border-bottom: 1px solid var(--ink); }
.entry-header time { color: var(--accent); font-family: Georgia, serif; font-size: 16px; }
.entry-header h1 { margin: 16px 0 20px; font-family: Georgia, "Songti SC", serif; font-size: 42px; font-weight: 500; line-height: 1.25; }
.entry-summary { max-width: 650px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.8; }
.entry-taxonomy { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.prose-section { padding: 38px 0 4px; }
.prose-section h2 { margin: 0 0 18px; font-family: Georgia, "Songti SC", serif; font-size: 24px; font-weight: 500; }
.prose-section p { margin: 0 0 18px; color: #383c3a; font-size: 16px; line-height: 1.95; }

.change-block { margin: 52px 0 18px; padding: 32px; background: var(--dark); border-radius: 8px; color: #f3f2ee; }
.change-block .eyebrow { margin-bottom: 8px; color: #8fbaa8; }
.change-block > h2 { margin: 0 0 26px; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 500; }
.change-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid #3b3e3d; }
.change-grid > div { padding: 22px 24px 0 0; }
.change-grid > div + div { padding-left: 24px; border-left: 1px solid #3b3e3d; }
.change-grid h3 { margin: 0 0 10px; color: #8fbaa8; font-size: 12px; }
.change-grid p { margin: 0; color: #d5d6d2; font-size: 14px; line-height: 1.85; }
.entry-tools { margin-top: 54px; padding-top: 24px; border-top: 1px solid var(--line); }
.entry-tools > span { display: block; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.time-ledger { margin: 52px 0 18px; padding: 30px 32px; background: #edf1ed; border: 1px solid #d2dcd5; border-radius: 8px; }
.time-ledger-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.time-ledger-header .eyebrow { margin-bottom: 6px; }
.time-ledger-header h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 27px; font-weight: 500; }
.time-total { display: flex; align-items: baseline; gap: 5px; color: var(--accent); }
.time-total strong { font-family: Georgia, serif; font-size: 34px; font-weight: 500; line-height: 1; }
.time-total span { font-size: 11px; }
.time-ledger-intro { margin: 18px 0 24px; color: var(--muted); font-size: 13px; }
.time-ledger-intro b { color: var(--ink); }
.time-task-breakdown { display: grid; gap: 15px; padding: 20px 0 26px; border-top: 1px solid #cbd7ce; }
.time-task-row > div { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 7px; font-size: 12px; }
.time-task-row > div b { color: var(--muted); font-weight: 500; }
.time-task-row i { display: block; height: 5px; background: #d8e0da; border-radius: 999px; overflow: hidden; }
.time-task-row em { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.time-detail-table-wrap { overflow-x: auto; border-top: 1px solid #cbd7ce; }
.time-detail-table { width: 100%; border-collapse: collapse; min-width: 590px; font-size: 12px; }
.time-detail-table th { padding: 15px 10px 9px; color: var(--muted); font-size: 10px; font-weight: 650; text-align: left; }
.time-detail-table td { padding: 10px; border-top: 1px solid #d9e1db; vertical-align: top; }
.time-detail-table th:first-child,
.time-detail-table td:first-child { padding-left: 0; }

.empty-state { min-height: 65vh; }
.empty-state h1 { font-family: Georgia, "Songti SC", serif; font-size: 38px; font-weight: 500; }
.empty-state > p:not(.eyebrow) { color: var(--muted); }
.text-link { color: var(--accent); font-size: 13px; font-weight: 700; }

.site-footer { background: #e9e8e3; border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; padding: 32px 0; color: var(--muted); font-size: 11px; }
.footer-inner p { margin: 0; }

@media (max-width: 760px) {
    .page-shell,
    .reading-shell,
    .header-inner { width: min(calc(100% - 32px), var(--max)); }
    .masthead { min-height: 350px; }
    .masthead-inner { padding: 58px 0 52px; }
    .masthead h1 { font-size: 52px; }
    .intro { margin-top: 32px; }
    .overview { grid-template-columns: 1fr 1fr; padding: 14px 0; }
    .stat { min-height: 84px; padding: 16px; border-bottom: 1px solid var(--line); }
    .stat:first-child { padding-left: 16px; border-left: 0; }
    .stat:nth-child(3) { border-left: 0; border-bottom: 0; }
    .stat:nth-child(4) { border-bottom: 0; }
    .stat strong { font-size: 26px; }
    .archive-layout { display: block; padding: 52px 0 80px; }
    .filters { position: static; margin-bottom: 54px; }
    .filters form { grid-template-columns: 1fr 1fr; gap: 12px; }
    .filters button { margin-top: 0; align-self: end; }
    .reset-link { align-self: center; }
    .timeline-heading { margin-top: 8px; }
    .entry-card { grid-template-columns: 62px minmax(0, 1fr); }
    .date-block { padding: 20px 8px; }
    .date-block time strong { font-size: 25px; }
    .card-content { padding: 20px 18px 22px; }
    .card-content h4 { font-size: 19px; }
    .meta-row { display: block; }
    .meta-row > span { display: block; margin-bottom: 5px; }
    .card-change p { overflow-wrap: anywhere; }
    .reading-shell { padding: 38px 0 80px; }
    .back-link { margin-bottom: 34px; }
    .entry-header h1 { font-size: 34px; }
    .entry-summary { font-size: 16px; }
    .change-block { padding: 24px 20px; }
    .time-ledger { padding: 24px 20px; }
    .time-ledger-header { align-items: flex-start; }
    .time-ledger-header h2 { font-size: 23px; }
    .change-grid { display: block; }
    .change-grid > div { padding: 18px 0; }
    .change-grid > div + div { padding-left: 0; border-top: 1px solid #3b3e3d; border-left: 0; }
    .footer-inner { display: block; }
    .footer-inner p + p { margin-top: 5px; }
}

@media (max-width: 420px) {
    .header-inner nav { gap: 16px; }
    .filters form { grid-template-columns: 1fr; }
    .overview { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* LuckyCat editor */
.editor-body { background: #efefeb; }
.editor-shell { width: min(calc(100% - 40px), 1240px); margin: 0 auto; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; padding: 48px 0 90px; }
.editor-index { align-self: start; position: sticky; top: 82px; }
.editor-index h1 { margin: 0 0 24px; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 500; }
.new-entry-link { display: block; padding: 11px 12px; background: var(--dark); border-radius: 6px; color: #fff; font-size: 13px; font-weight: 650; text-decoration: none; text-align: center; }
.editor-entry-list { margin-top: 22px; border-top: 1px solid var(--line); }
.editor-entry-list a { position: relative; display: block; padding: 13px 8px; border-bottom: 1px solid var(--line); text-decoration: none; }
.editor-entry-list a[aria-current="page"] { background: var(--accent-soft); }
.editor-entry-list time { display: block; color: var(--muted); font-size: 10px; }
.editor-entry-list span { display: block; margin-top: 2px; font-size: 13px; line-height: 1.45; }
.editor-entry-list em { position: absolute; top: 13px; right: 8px; color: var(--accent); font-size: 10px; font-style: normal; }
.editor-form-wrap { min-width: 0; padding: 34px 38px 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.editor-title-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--ink); }
.editor-title-row h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 30px; font-weight: 500; }
.editor-title-row > span { color: var(--muted); font-size: 11px; }
.editor-form { display: grid; gap: 20px; margin-top: 28px; }
.editor-form label > span { display: block; margin-bottom: 6px; color: #555a57; font-size: 12px; font-weight: 650; }
.editor-form input,
.editor-form textarea,
.editor-form select { width: 100%; border: 1px solid #cbc9c2; border-radius: 6px; background: #fff; color: var(--ink); font: inherit; font-size: 14px; }
.editor-form input,
.editor-form select { min-height: 44px; padding: 8px 11px; }
.editor-form textarea { display: block; padding: 11px 12px; line-height: 1.7; resize: vertical; }
.editor-form input:focus,
.editor-form textarea:focus,
.editor-form select:focus { outline: 2px solid rgba(47, 102, 82, .2); border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.field-row-three { grid-template-columns: repeat(3, 1fr); }
.change-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 8px 0; padding: 24px; border: 0; border-radius: 8px; background: var(--dark); }
.change-fields legend { padding: 0 8px; color: #8fbaa8; font-family: Georgia, "Songti SC", serif; font-size: 20px; }
.change-fields label > span { color: #b9bcb8; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 10px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-actions button { width: auto; min-width: 150px; min-height: 44px; padding: 0 22px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.form-actions a { color: var(--muted); font-size: 13px; }
.form-notice { margin-top: 20px; padding: 11px 14px; border-radius: 6px; font-size: 13px; }
.form-notice.success { background: var(--accent-soft); color: #285543; }
.form-notice.error { background: #f8e8e5; color: #922c21; }
.time-log-editor { margin: 8px 0; padding: 24px; border: 1px solid #cbd7ce; border-radius: 8px; background: #f2f5f2; }
.time-log-editor legend { padding: 0 8px; color: var(--accent); font-family: Georgia, "Songti SC", serif; font-size: 20px; }
.field-hint { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
#time-blocks { display: grid; gap: 10px; }
.time-block-row { display: grid; grid-template-columns: 1.35fr 1fr 1fr 90px 1.4fr 34px; gap: 8px; align-items: center; }
.time-block-row input { min-width: 0; }
.time-block-row .remove-time-row { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 0; border: 1px solid #d4cbc7; border-radius: 50%; background: transparent; color: #8b3a2d; font-size: 20px; line-height: 1; cursor: pointer; }
.add-time-row { width: auto; min-height: 38px; margin-top: 14px; padding: 0 14px; border: 1px solid #b9c9be; border-radius: 6px; background: #fff; color: var(--accent); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }

@media (max-width: 850px) {
    .editor-shell { width: min(calc(100% - 32px), 1240px); display: block; padding-top: 28px; }
    .editor-index { position: static; margin-bottom: 28px; }
    .editor-entry-list { display: none; }
    .editor-form-wrap { padding: 26px 20px 32px; }
    .editor-title-row { display: block; }
    .editor-title-row > span { display: block; margin-top: 10px; }
    .field-row,
    .field-row-three,
    .change-fields { grid-template-columns: 1fr; }
    .change-fields { padding: 20px 16px; }
    .time-log-editor { padding: 20px 14px; }
    .time-block-row { grid-template-columns: 1fr 1fr; padding-bottom: 14px; border-bottom: 1px solid #d7dfd9; }
    .time-block-row input:nth-child(5) { grid-column: 1 / -1; }
    .time-block-row .remove-time-row { grid-column: 2; justify-self: end; }
}
