@font-face {
  font-family: 'MiSans';
  src: url('../fonts/MiSans/MiSans-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

/* The home index has its own scale; article reading styles stay independent. */
:root {
  --home-font: 'MiSans', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --home-ink: #292927;
  --home-muted: #666661;
  --home-rule: #e9e9e5;
  --home-paper: #fff;
  --home-width: 800px;
  --home-category-width: 96px;
  --home-category-gap: 48px;
  --home-row-height: 52px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 32px; }
body.site-home {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: 72px max(40px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(40px, env(safe-area-inset-left));
  background: var(--home-paper);
  color: var(--home-ink);
  font: 400 14px/1.5 var(--home-font);
  -webkit-font-smoothing: auto;
}
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
a:focus-visible { outline: 2px solid var(--home-muted); outline-offset: 5px; }
.skip-link { position: fixed; z-index: 2000; top: -80px; left: 24px; padding: 10px 16px; background: var(--home-paper); border: 2px solid; }
.skip-link:focus { top: 12px; }

.site-window {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: min(100%, var(--home-width));
  margin-inline: auto;
}
.site-menu { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }
.site-brand img { flex: none; width: 24px; height: 24px; object-fit: contain; image-rendering: pixelated; }
.site-brand h1 { margin: 0; font-size: 24px; font-weight: 400; line-height: 1.25; letter-spacing: 0; }
.site-description { max-width: 480px; margin: 0; color: var(--home-muted); font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; text-wrap: wrap; }

.list-main { padding: 64px 0; }
.list-main:focus-visible { outline: 1px solid var(--home-rule); outline-offset: 12px; }
.record-group {
  display: grid;
  grid-template-columns: var(--home-category-width) minmax(0, 1fr);
  column-gap: var(--home-category-gap);
  align-items: start;
}
.record-group + .record-group { margin-top: 32px; }
.record-group h2 { margin: 0; padding-top: 14px; color: var(--home-muted); font-size: 12px; font-weight: 400; line-height: 20px; }
.record-list { list-style: none; margin: 0; padding: 0; }
.record-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  column-gap: 24px;
  align-items: baseline;
  min-height: var(--home-row-height);
  margin-inline: -8px;
  padding: 12px 8px;
}
.record-link:focus-visible { outline-offset: 0; }
.record-link:is(:hover, :focus-visible) .record-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.record-title { font-size: 14px; line-height: 24px; overflow-wrap: anywhere; }
.record-link time { color: var(--home-muted); font-size: 11px; line-height: 18px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

.site-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 20px; margin-top: auto; padding: 4px 0; border-top: 1px solid var(--home-rule); color: var(--home-muted); font-size: 12px; line-height: 1.5; }
.site-footer a { display: inline-flex; align-items: center; min-height: 24px; }
.site-footer a:hover { color: var(--home-ink); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 680px), (max-width: 960px) and (max-height: 500px) and (orientation: landscape) {
  body.site-home {
    --home-gutter: clamp(28px, 8.5vw, 40px);
    --home-row-height: 48px;
    padding: 40px max(var(--home-gutter), env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(var(--home-gutter), env(safe-area-inset-left));
  }
  .site-menu { gap: 14px; }
  .site-brand h1 { font-size: 22px; }
  .site-description { font-size: 12px; line-height: 1.8; }
  .list-main { padding: 44px 0 48px; }
  .record-group { display: block; }
  .record-group + .record-group { margin-top: 28px; }
  .record-group h2 { padding: 0; margin-bottom: 8px; font-size: 12px; line-height: 20px; }
  .record-link { grid-template-columns: minmax(0, 1fr) 76px; column-gap: 12px; padding-block: 11px; }
  .record-title { font-size: 14px; line-height: 24px; }
  .record-link time { font-size: 11px; line-height: 18px; }
  .site-footer { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(24px, auto); gap: 0; }
}

/* Give long Chinese titles room to wrap naturally on the smallest phones. */
@media (max-width: 359px) {
  .record-link { grid-template-columns: minmax(0, 1fr) 70px; column-gap: 10px; }
}

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