:root {
  color-scheme: light dark;
  --bg: #f5f2eb;
  --surface: #ece8de;
  --text: #20221f;
  --muted: #6d7068;
  --line: #d5d0c4;
  --accent: #b54a2f;
  --code: #e8e3d8;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171816;
    --surface: #22231f;
    --text: #e9e6de;
    --muted: #a5a69f;
    --line: #383a34;
    --accent: #e07859;
    --code: #242620;
  }
}

* { box-sizing: border-box; }

html {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(circle at 80% 0%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 32rem);
  color: var(--text);
  font-size: 1rem;
}

::selection {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .18em;
}

a:hover { color: var(--accent); }

.skip-link {
  position: fixed;
  z-index: 10;
  top: .75rem;
  left: .75rem;
  padding: .6rem .9rem;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-150%);
}

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

.site-footer,
.page-shell {
  width: min(calc(100% - 2.5rem), 70rem);
  margin-inline: auto;
}

.site-header {
  width: 100%;
  min-height: 5.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: max(1.25rem, calc((100% - 70rem) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  font-weight: 750;
  letter-spacing: -.035em;
  text-decoration: none;
}

nav { display: flex; gap: 1.35rem; }
nav a { color: var(--muted); font-size: .9rem; text-decoration: none; }

.page-shell { min-height: calc(100vh - 13rem); }

.hero {
  padding: clamp(5rem, 12vw, 10rem) 0 clamp(4rem, 8vw, 7rem);
  max-width: 58rem;
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--accent);
  font-size: .75rem;
  font-weight: 750;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero h1,
.page-header h1,
.article-header h1,
.not-found h1 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -.055em;
  line-height: 1.08;
}

.hero h1 { font-size: clamp(3rem, 8vw, 6.7rem); text-wrap: balance; }
.hero > p:last-child { max-width: 35rem; margin: 2rem 0 0; color: var(--muted); font-size: 1.1rem; }

.latest { padding-bottom: clamp(5rem, 10vw, 8rem); }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--text);
}

.section-heading h2 { margin: 0; font-size: 1rem; }
.section-heading a { color: var(--muted); font-size: .85rem; }

.post-list { margin: 0; padding: 0; list-style: none; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  margin-inline: -.75rem;
  padding: 1.4rem .75rem;
  border-radius: .35rem;
  text-decoration: none;
  transition: color 150ms ease, background-color 150ms ease;
}
.post-list a:hover { background: var(--surface); }
.post-list time { color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.post-list a > span:nth-child(2) { font-weight: 600; }
.arrow { color: var(--muted); }

.about {
  display: grid;
  grid-template-columns: 10rem 1fr 2fr;
  gap: 2rem;
  padding: clamp(4rem, 8vw, 7rem) 0;
  border-top: 1px solid var(--line);
}
.about h2, .about p { margin: 0; }
.about > p:last-child { max-width: 37rem; color: var(--muted); }

.page-header {
  padding: clamp(4rem, 10vw, 8rem) 0 3rem;
  border-bottom: 1px solid var(--text);
}
.page-header h1 { font-size: clamp(2.8rem, 7vw, 5rem); }
.page-header > p:last-child { color: var(--muted); }
.post-list-wide { padding-bottom: 6rem; }

.article { width: min(100%, var(--measure)); margin-inline: auto; }
.article-header { padding: clamp(4rem, 10vw, 8rem) 0 3rem; border-bottom: 1px solid var(--line); }
.article-header h1 { font-size: clamp(2.4rem, 7vw, 4.6rem); overflow-wrap: anywhere; }
.article-meta { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; margin-top: 1.6rem; color: var(--muted); font-size: .85rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.tag-list a { text-decoration: none; }

.prose { padding: 3rem 0 5rem; font-family: ui-serif, "Noto Serif JP", "Yu Mincho", serif; }
.prose > * { margin-block: 0 1.45rem; }
.prose h2, .prose h3 { font-family: Inter, ui-sans-serif, "Noto Sans JP", sans-serif; line-height: 1.35; letter-spacing: -.025em; }
.prose h2 { margin-top: 3.8rem; padding-top: .8rem; border-top: 1px solid var(--line); font-size: 1.65rem; }
.prose h3 { margin-top: 2.8rem; font-size: 1.25rem; }
.prose img { display: block; width: 100%; height: auto; margin: 2.5rem 0; border: 1px solid var(--line); border-radius: .35rem; }
.prose pre { overflow-x: auto; padding: 1.2rem; border-radius: .35rem; background: var(--code); line-height: 1.55; }
.prose code { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: .88em; }
.prose :not(pre) > code { padding: .15em .35em; background: var(--code); border-radius: .2rem; }
.prose blockquote { margin-inline: 0; padding-left: 1.25rem; border-left: 3px solid var(--accent); color: var(--muted); }

.article-footer { padding: 2rem 0 6rem; border-top: 1px solid var(--line); }
.article-footer a { color: var(--muted); }

.tag-sections { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; margin-bottom: 6rem; background: var(--line); }
.tag-sections section { padding: 2rem; background: var(--bg); scroll-margin-top: 2rem; }
.tag-sections h2 { margin-top: 0; font-size: 1.1rem; }
.tag-sections ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }

.not-found { padding: clamp(6rem, 15vw, 12rem) 0; text-align: center; }
.not-found h1 { font-size: clamp(2.5rem, 7vw, 5rem); }
.not-found > p:not(.eyebrow) { color: var(--muted); }
.button { display: inline-block; margin-top: 1rem; padding: .65rem 1rem; border: 1px solid var(--line); text-decoration: none; }

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .82rem;
}

@media (max-width: 42rem) {
  .site-header { min-height: 4.5rem; }
  nav { gap: .85rem; }
  .post-list a { grid-template-columns: 1fr auto; gap: .35rem 1rem; }
  .post-list time { grid-column: 1 / -1; }
  .about { grid-template-columns: 1fr; gap: .5rem; }
  .about > p:last-child { margin-top: 1rem; }
  .tag-sections { grid-template-columns: 1fr; }
  .site-footer { gap: 1rem; }
}

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