:root {
  color-scheme: dark;
  --paper: #194fa0;
  --ink: #ffffff;
  --muted: #c8d7ee;
  --accent: #ffffff;
  --accent-hover: #dce8ff;
  --line: #688cc0;
  --error: #ffcfb9;
  --gutter: clamp(24px, 5.6vw, 96px);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Arial, "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 400;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; text-underline-offset: .25em; }
button, input, textarea { font: inherit; color: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
a:hover { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
::selection { background: white; color: var(--paper); }

.page { width: 100%; max-width: 1560px; padding: 0 var(--gutter); margin: 0 auto; min-height: 100svh; display: flex; flex-direction: column; }
main { min-width: 0; }
.site-header { padding-top: 40px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.site-title { display: block; flex-shrink: 0; }
.site-title img { display: block; width: 92px; height: auto; }
.site-header nav { display: flex; align-items: center; gap: 30px; color: var(--accent); font-size: 16px; }
.site-header nav > a, .site-header .text-button { min-height: 44px; display: inline-flex; align-items: center; }
.site-header nav form { margin: 0; }
.site-header nav a:hover, .text-button:hover { text-decoration: underline; }

/* The brand stays in place while the right-hand reading column scrolls. */
.intro { position: fixed; top: 76px; left: max(var(--gutter), calc((100vw - 1560px) / 2 + var(--gutter))); width: clamp(170px, 17vw, 220px); max-height: calc(100svh - 180px); overflow-y: auto; }
.brand-heading { margin: 0; line-height: 1; }
.brand-heading a { display: inline-block; }
.wordmark { display: block; width: 128px; height: auto; }
.intro > p { margin: 32px 0 0; max-width: 240px; font-size: clamp(17px, 1.55vw, 20px); line-height: 1.9; }
.intro-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin-top: 18px; }
.rss-link, .about-link, .back-link { display: inline-flex; align-items: center; gap: 14px; min-height: 44px; font-family: var(--mono); font-size: 18px; font-weight: 500; line-height: 1.5; letter-spacing: .025em; }
.rss-link, .about-link { padding: 0; border: 0; background: none; }
.home-feed { margin-left: 25%; max-width: 860px; padding: 72px 0 140px; }
.note { display: block; }
.note + .note { margin-top: 88px; }
.note-meta { display: flex; flex-direction: column; gap: 12px; margin-bottom: 32px; font-family: var(--mono); font-weight: 400; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.note-meta a { width: fit-content; }
.note-meta a:hover { text-decoration: underline; }
.post-date { display: inline-block; width: fit-content; padding: 7px 11px 6px; background: var(--ink); color: var(--paper); font-size: 28px; letter-spacing: -.035em; line-height: 1.15; }
.date-heading { margin: 0; font: inherit; }
.note-meta > span { font-family: inherit; font-size: 13px; letter-spacing: 0; color: var(--muted); }
.note-content { min-width: 0; max-width: 820px; }
.note-title { margin: 0 0 12px; font-size: 21px; font-weight: 400; line-height: 1.85; overflow-wrap: anywhere; }
.note-title a:hover { text-decoration: underline; }
.note-body { font-size: 21px; line-height: 1.85; font-weight: 400; white-space: pre-wrap; overflow-wrap: anywhere; }
.post-feed .back-link { margin-top: 40px; }
.pagination { display: flex; justify-content: space-between; gap: 24px; margin: 76px 0 32px; color: var(--accent); font-size: 17px; }
.pagination a { display: inline-flex; align-items: center; min-height: 44px; gap: 12px; }
.pagination a:hover { text-decoration: underline; }
.numbered-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 64px; font-family: var(--mono); font-size: 20px; }
.page-numbers { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px; }
.page-number, .page-step, .page-gap { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 48px; color: var(--muted); }
.page-number { padding: 0 6px; border-bottom: 1px solid transparent; }
.page-number[aria-current=page] { color: var(--ink); border-color: var(--ink); }
.page-number:hover { color: var(--ink); }
.page-step { flex-shrink: 0; font-size: 26px; }
.page-step.disabled { opacity: .3; }
.page-gap { min-width: 16px; }
.site-footer { color: var(--ink); font-family: var(--mono); font-size: 16px; font-weight: 500; line-height: 1.5; letter-spacing: .025em; }
.site-footer { margin-top: auto; padding: 100px 0 36px; }
.home-page .site-footer { position: fixed; bottom: 23px; padding: 8px 0; min-height: 44px; display: flex; align-items: center; max-width: clamp(170px, 17vw, 220px); background: var(--paper); }
.rss-link span, .about-link span, .back-link span { display: inline-block; font-size: 22px; line-height: 1; transition: transform .18s ease; }
.rss-link:hover, .about-link:hover, .back-link:hover { color: var(--accent-hover); }
.rss-link:hover span, .about-link:hover span, .back-link:hover span { transform: translate(2px, -2px); }
.empty { padding: 16px 0 48px; color: var(--muted); line-height: 1.7; }
.empty p { margin: 0; font-size: 21px; }
.empty a { display: inline-block; margin-top: 22px; color: var(--accent); font-size: 18px; }
.empty a:hover { text-decoration: underline; }
.back-link { margin-top: 62px; color: var(--ink); }
.error-page { padding: 110px 0 70px; max-width: 850px; }
.error-page .error-code { color: var(--accent); font-size: 20px; font-weight: 600; }
.error-page h1 { color: var(--accent); margin: 26px 0; font-size: clamp(32px, 4vw, 58px); font-weight: 600; line-height: 1.4; letter-spacing: -.025em; }
.building-page { padding: clamp(72px, 14vh, 150px) 0; }
.building-page h1 { margin: 0 0 20px; font-size: clamp(32px, 4vw, 54px); font-weight: 400; letter-spacing: -.025em; }
.building-page p { margin: 0; color: var(--muted); font-size: 19px; line-height: 1.8; }
.building-page .back-link { margin-top: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 10; top: 12px; left: 12px; background: var(--accent); color: var(--paper); padding: 12px 20px; transform: translateY(-160%); }
.skip-link:focus { transform: none; color: var(--paper); }

/* The modal uses the same blue and white, with the reading surface blurred behind it. */
html.about-open { overflow: hidden; }
.about-dialog { width: min(780px, calc(100% - 48px)); max-width: none; max-height: calc(100svh - 64px); padding: 32px 48px 48px; border: 1px solid rgba(255, 255, 255, .6); background: var(--paper); color: var(--ink); overflow: hidden; }
.about-dialog[open] { display: flex; flex-direction: column; }
.about-dialog::backdrop { background: rgba(6, 25, 57, .38); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.about-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-shrink: 0; margin-bottom: 24px; }
.about-header h2 { margin: 0; font-size: 24px; font-weight: 400; line-height: 1.2; letter-spacing: -.02em; }
.about-close { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 64px; height: 64px; margin-right: -12px; padding: 0; border: 0; background: none; color: var(--ink); font-family: Arial, sans-serif; font-size: 64px; font-weight: 300; line-height: 1; }
.about-close:hover { color: var(--muted); }
.about-copy { min-height: 0; padding: 6px; margin: -6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; font-size: 20px; line-height: 1.85; overflow-wrap: anywhere; }
.about-copy p { margin: 0 0 24px; white-space: pre-wrap; }
.about-copy p:last-child { margin-bottom: 0; }
.about-copy a { text-decoration: underline; text-decoration-thickness: 1px; }
.about-copy a:hover { color: var(--muted); }

/* Compact controls leave the available space for writing. */
.admin-page .page { max-width: 1100px; }
.admin-page .site-header { padding-top: 32px; }
.admin-page .site-title img { width: 64px; }
.admin-page main { padding-top: 48px; }
.admin-page .site-footer { padding-top: 44px; padding-bottom: 24px; font-size: 14px; }
.admin-toolbar, .editor-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.admin-toolbar { flex-wrap: wrap; }
.admin-actions { display: flex; gap: 8px; margin-left: auto; }
.admin-actions form { margin: 0; }
.build-hint { margin: 0 0 18px; font-size: 12px; line-height: 1.8; color: var(--muted); }
.build-hint a { color: var(--ink); text-decoration: underline; }
.editor-toolbar { position: sticky; top: 0; z-index: 4; padding: 12px 0; margin-top: -12px; background: var(--paper); }
.editor-back { display: inline-flex; align-items: center; min-height: 44px; flex-shrink: 0; font-size: 14px; }
.editor-back:hover { text-decoration: underline; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 1px solid var(--accent); border-radius: 2px; padding: 8px 15px; color: var(--paper); background: var(--accent); font-size: 14px; font-weight: 500; line-height: 1.5; white-space: nowrap; transition: background .15s, color .15s; }
.button:hover { color: var(--paper); background: var(--accent-hover); }
.button.secondary { color: var(--accent); background: transparent; border-color: var(--line); }
.button.secondary:hover { border-color: var(--accent); background: #2b5fa9; }
.button:disabled { opacity: .6; cursor: wait; }
.text-button { border: 0; padding: 0; color: var(--accent); background: none; font-size: 14px; }
.filters { display: flex; gap: 24px; font-size: 14px; color: var(--muted); }
.filters a { display: inline-flex; align-items: center; min-height: 44px; }
.filters [aria-current=page] { color: var(--accent); text-decoration: underline; text-underline-offset: 7px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 15px 0; }
.admin-row-main { min-width: 0; flex: 1; }
.admin-row h2 { margin: 0; color: var(--ink); font-size: 17px; font-weight: 400; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-row-main:hover h2 { text-decoration: underline; }
.admin-row p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.admin-row-meta { display: flex; align-items: center; gap: 22px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.admin-row-meta time { font-family: var(--mono); font-size: 11px; }
.status { min-width: 36px; text-align: right; }
.status.published { color: var(--ink); }
.notice { margin: 0 0 18px; padding: 8px 0 8px 12px; border-left: 2px solid var(--accent); color: var(--accent); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.notice.error { color: var(--error); border-color: var(--error); }
input, textarea { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 0; background: transparent; line-height: 1.7; }
input:focus, textarea:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: #bfcee4; opacity: 1; }
.editor-form input { color: var(--accent); font-size: 20px; font-weight: 400; }
.publication-field { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 8px; font-size: 12px; }
.publication-field label span, #publication-hint { color: var(--muted); font-size: 11px; }
.editor-form .publication-field input { width: 230px; max-width: 100%; padding: 7px 0; font-family: var(--mono); font-size: 13px; }
.editor-form textarea { display: block; min-height: 240px; height: clamp(240px, 43svh, 520px); resize: vertical; margin-top: 12px; font-size: 18px; line-height: 1.85; }
.editor-actions { display: flex; align-items: center; gap: 8px; }
.editor-meta { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 36px; font-size: 12px; color: var(--muted); }
#word-count { font-family: var(--mono); font-size: 11px; }
.preview-link { color: var(--ink); }
.preview-link:hover { text-decoration: underline; }
.editor-bottom { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 16px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.editor-bottom form { margin: 0; }
.danger { min-height: 36px; color: var(--error); font-size: 12px; }

@media (max-width: 1000px) {
  .intro > p { max-width: 210px; }
  .home-feed { margin-left: 30%; }
}

@media (max-width: 720px) {
  .site-header { padding-top: 28px; gap: 18px; }
  .site-title img { width: 80px; }
  .site-header nav { gap: 23px; font-size: 15px; }
  .intro { position: static; width: auto; max-height: none; overflow: visible; padding: 28px 0 40px; }
  .wordmark { width: 80px; }
  .intro > p { max-width: none; margin-top: 18px; font-size: 21px; line-height: 1.65; text-wrap: balance; }
  .intro > p br { display: none; }
  .intro-links { margin-top: 8px; }
  .rss-link, .about-link, .back-link { gap: 10px; }
  .about-dialog { width: calc(100% - 32px); max-height: calc(100svh - 32px); padding: 20px 24px 28px; }
  .about-header { margin-bottom: 20px; }
  .about-header h2 { font-size: 22px; }
  .about-close { width: 56px; height: 56px; font-size: 58px; }
  .about-copy { font-size: 17px; line-height: 1.8; }
  .about-copy p { margin-bottom: 20px; }
  .home-feed { margin-left: 0; padding: 0 0 20px; }
  .note + .note { margin-top: 52px; }
  .note-meta { flex-direction: row; flex-wrap: wrap; margin-bottom: 26px; }
  .post-date { font-size: 25px; padding: 6px 10px 5px; }
  .numbered-pagination { flex-wrap: wrap; gap: 4px; margin-top: 44px; font-size: 18px; }
  .page-numbers { gap: 2px; }
  .page-number, .page-step { min-width: 36px; }
  .numbered-pagination[data-many-pages=true] .page-numbers { order: -1; width: 100%; }
  .note-title, .note-detail .note-title { margin-bottom: 12px; font-size: 19px; line-height: 1.85; }
  .note-body, .note-detail .note-body { font-size: 19px; line-height: 1.85; }
  .back-link { margin-top: 42px; }
  .pagination { margin-top: 52px; font-size: 16px; }
  .site-footer { padding-top: 76px; padding-bottom: 29px; font-size: 14px; }
  .home-page .site-footer { position: static; max-width: none; padding: 56px 0 29px; }
  .empty p { font-size: 19px; }
  .admin-page .site-header { padding-top: 28px; }
  .admin-page main { padding-top: 36px; }
  .admin-toolbar { gap: 12px; margin-bottom: 12px; }
  .filters { gap: 18px; font-size: 13px; }
  .admin-row { gap: 16px; padding: 13px 0; }
  .admin-row h2 { font-size: 16px; }
  .admin-row p { font-size: 12px; }
  .admin-row-meta { flex-direction: column; align-items: flex-end; gap: 5px; font-size: 11px; }
  .admin-row-meta time { font-size: 10px; }
  .editor-toolbar { gap: 10px; margin-bottom: 10px; }
  .editor-actions { gap: 6px; }
  .editor-actions .button { padding: 9px 11px; font-size: 13px; }
  .editor-form input { font-size: 19px; }
  .editor-form textarea { font-size: 17px; }
  .publication-field { gap: 8px 12px; }
  .publication-field label { width: 100%; }
  .error-page { padding-top: 78px; }
  .error-page h1 { font-size: 34px; }
}

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