:root {
  color-scheme: light;
  --ink: #21244b;
  --muted: #525a76;
  --paper: #f2f4ff;
  --white: #ffffff;
  --violet: #342d77;
  --peach: #ffbd9f;
  --rule: #d3d8ee;
  --display: "Noto Serif SC", "Songti SC", SimSun, serif;
  --body: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
  --panel-radius: 1.5rem;
  --page-max: 70rem;
  --reading-max: 44rem;
  --scroll-thumb: var(--muted);
  --scroll-track: var(--paper);
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: auto;
}

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

body {
  min-height: 100vh;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.75 var(--body);
}

main { flex: 1; }

h1, h2, h3, p, figure, dl, dd { margin: 0; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.3;
}

a {
  color: var(--violet);
  cursor: pointer;
  text-underline-offset: 0.23em;
  text-decoration-thickness: 0.07em;
}

a:hover { text-decoration-thickness: 0.14em; }
a:active { opacity: 0.8; }
a:focus-visible { outline: 3px solid var(--violet); outline-offset: 4px; }

code, time { font-family: var(--mono); }
code { overflow-wrap: anywhere; }

::selection { color: var(--ink); background: var(--peach); }

::-webkit-scrollbar-track { background: var(--scroll-track); }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }
::-webkit-scrollbar-thumb:active { background: var(--ink); }

.frame {
  width: min(calc(100% - 4rem), var(--page-max));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  z-index: 1;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--white);
  transform: translateY(-150%);
}

.skip-link:focus { transform: none; }

.site-header, .site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  min-height: 4.75rem;
  border-bottom: 1px solid var(--rule);
}

.site-header nav { display: flex; gap: clamp(0.75rem, 3vw, 1.75rem); }

.site-header a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: none;
}

.site-header a:hover { text-decoration: underline; }
.brand { gap: 0.65rem; font-weight: 700; }

.brand-mark {
  width: 1.25rem;
  aspect-ratio: 1;
  border-radius: 0.25rem;
  background: var(--violet);
  display: grid;
  place-items: center;
}

.brand-mark::after {
  content: "";
  width: 0.55rem;
  height: 0.38rem;
  border-block: 2px solid var(--peach);
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  align-items: center;
  gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(3rem, 8vw, 6.75rem);
}

.hero > * { min-width: 0; }

.hero h1 {
  font-size: clamp(3.5rem, 8.2vw, 7rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.hero-copy p {
  max-width: 24rem;
  margin-block: 1.7rem 1.6rem;
  color: var(--muted);
  font-size: 1.125rem;
}

.primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.875rem;
  padding: 0.6rem 1.15rem;
  border-radius: 0.4rem;
  background: var(--violet);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
}

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

.record-panel {
  padding: clamp(1.25rem, 4vw, 2.5rem);
  border-radius: var(--panel-radius);
  background-color: var(--violet);
  background-image: radial-gradient(circle, rgb(255 255 255 / 0.25) 1px, transparent 1.4px);
  background-size: 18px 18px;
}

.record-panel figcaption {
  display: table;
  margin-bottom: 0.95rem;
  padding-inline: 0.35rem;
  color: var(--white);
  background: var(--violet);
  font-size: 0.9375rem;
  font-weight: 700;
}

.record-sheet {
  background: var(--white);
  border-radius: 0.8rem;
  padding: clamp(1rem, 3vw, 1.65rem);
}

.record-type {
  display: inline-block;
  margin-bottom: 0.4rem;
  border-radius: 0.25rem;
  padding-inline: 0.55rem;
  background: var(--peach);
  font-weight: 700;
}

.record-sheet dl > div {
  display: grid;
  gap: 0.15rem;
  padding-block: 0.65rem;
}

.record-sheet dl > div + div { border-top: 1px solid var(--rule); }
.record-sheet dt { color: var(--muted); font-size: 0.875rem; }
.record-sheet dd { font-size: clamp(0.9375rem, 1.7vw, 1.2rem); }

.logs { border-top: 1px solid var(--rule); }
.logs h2, .about h2 { font-size: 1.5rem; }
.logs h2 { margin-block: 1.35rem 0.8rem; }

.journal-entry {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1rem;
  align-items: baseline;
  padding-block: 1.2rem 1.65rem;
  border-bottom: 1px solid var(--rule);
}

.journal-entry time, .post-header time { color: var(--muted); font-size: 0.9375rem; }
.journal-entry h3 { font-size: clamp(1.35rem, 2.7vw, 1.9rem); }
.journal-entry p { margin-top: 0.6rem; color: var(--muted); }

.about { max-width: var(--reading-max); padding-block: 3rem 3.5rem; }
.about p { margin-top: 0.7rem; color: var(--muted); }

.site-footer {
  min-height: 4rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9375rem;
}

.reading {
  max-width: var(--reading-max);
  margin-inline: auto;
  padding-block: clamp(2.75rem, 7vw, 5.5rem);
  font-size: 1.0625rem;
}

.reading h1 { font-size: clamp(2.25rem, 6.2vw, 4.25rem); }
.post-header { padding-bottom: 1.6rem; border-bottom: 1px solid var(--rule); }
.post-header h1 { margin-top: 0.75rem; }
.reading h2 { margin-top: 2rem; font-size: 1.5rem; }
.reading p { margin-top: 0.75rem; }
.reading li + li { margin-top: 0.3rem; }

.reading code {
  padding: 0.12em 0.23em;
  border-radius: 0.18rem;
  background: var(--white);
  font-size: 0.93em;
}

.reading .back-link { margin-top: 2.25rem; }
.error-page .primary-link { margin-top: 1rem; }

@media (max-width: 47rem) {
  .frame { width: calc(100% - 2.5rem); }
  .hero, .journal-entry { grid-template-columns: 1fr; }
  .hero { gap: 2.25rem; }
  .journal-entry { gap: 0.35rem; }
  .wide-break { display: none; }
}

@media (forced-colors: active) {
  :root { scrollbar-color: auto; }
  .primary-link, .record-panel { border: 1px solid; }
  .brand-mark { display: none; }
}
