@font-face {
  font-family: Gloock;
  src: url('/fonts/gloock-latin.ttf') format('truetype');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --ink: #292d25;
  --muted: #64675f;
  --accent: #a7432f;
  --rule: #d8d9ce;
  --selection: #ead8b8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #1d211e;
  --ink: #f6f4ee;
  --muted: #b9beb3;
  --accent: #e6ab86;
  --rule: #444b40;
  --selection: #5c4938;
}

* { box-sizing: border-box; }

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

body { margin: 0; }

.page {
  min-height: 100svh;
  max-width: 1600px;
  margin-inline: auto;
  padding: 0 clamp(24px, 5.6vw, 88px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
}

.masthead {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  color: var(--ink);
  text-decoration: none;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.035em;
  text-underline-offset: 5px;
}

.wordmark span { color: var(--accent); }
.wordmark:hover { color: var(--accent); }

.wordmark:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 7px;
  border-radius: 2px;
}

main {
  display: grid;
  place-items: center;
  padding-block: 72px 88px;
}

.greeting { text-align: center; }

.theme-toggle {
  display: block;
  padding: 8px;
  margin: 0 auto 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle:hover:not(:disabled) { color: var(--ink); }
.theme-toggle:disabled { cursor: default; }
.sun { display: block; }

.sun-core {
  r: 12px;
  fill: transparent;
  transition: r 600ms ease, fill 600ms ease;
}

.sun-rays {
  transform-origin: 32px 32px;
  transition: opacity 350ms ease, transform 600ms ease;
}

.moon-cutout { transition: transform 600ms ease; }

[data-theme='dark'] .sun-core { r: 18px; fill: currentColor; }
[data-theme='dark'] .sun-rays { opacity: 0; transform: rotate(45deg) scale(0.65); }
[data-theme='dark'] .moon-cutout { transform: translate(-20px, 20px); }

h1 {
  margin: 0;
  font-family: Gloock, Georgia, serif;
  font-size: clamp(64px, 8.5vw, 96px);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

h1 span { color: var(--accent); }

.intro {
  margin: 28px auto 0;
  max-width: 65ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.8;
  letter-spacing: 0.005em;
}

.little-line {
  width: 28px;
  height: 1px;
  margin: 40px auto 0;
  background: var(--accent);
}

footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  min-height: 88px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.signature {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.signature svg { color: var(--accent); }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 5px;
  border-radius: 2px;
}

.site-nav { display: flex; align-items: center; gap: 24px; }
.site-nav a { color: var(--ink); font-size: 14px; text-decoration: none; padding-block: 12px; }
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--accent); }
.theme-toggle--compact { margin: 0; padding: 6px; }
.theme-toggle--compact .sun { width: 32px; height: 32px; }

.reading-main {
  display: block;
  min-width: 0;
  place-items: normal;
  width: 100%;
  max-width: 68ch;
  margin-inline: auto;
  padding-block: 64px 96px;
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.blog-index, .article { width: 100%; min-width: 0; }

.reading-main h1 { font-size: 48px; line-height: 1.15; text-wrap: pretty; }
.post-list { list-style: none; margin: 48px 0 0; padding: 0; }
.post-list li { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 24px; padding-block: 28px; border-top: 1px solid var(--rule); }
.post-list h2 { margin: 0; font-size: 22px; line-height: 1.4; font-weight: 600; }
.post-list a { color: var(--ink); text-decoration: none; }
.post-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; }
.post-list p { margin: 8px 0 0; color: var(--muted); font-size: 16px; }
.reading-main time { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.empty-posts { margin: 32px 0 0; color: var(--muted); font-size: 16px; }
.back-link { color: var(--muted); font-size: 14px; text-underline-offset: 4px; }
.back-link:hover { color: var(--accent); }
.article-header { margin-block: 32px 40px; }
.article-header time { display: block; margin-top: 16px; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre { margin-block: 0 24px; }
.prose h2, .prose h3, .prose h4 { margin: 48px 0 16px; line-height: 1.3; font-weight: 600; }
.prose h2 { font-size: 28px; }
.prose h3 { font-size: 22px; }
.prose h4 { font-size: 18px; }
.prose a { color: var(--accent); text-underline-offset: 4px; }
.prose img { display: block; max-width: 100%; height: auto; margin-block: 32px; }
.prose blockquote { margin-inline: 0; padding-left: 24px; border-left: 1px solid var(--rule); color: var(--muted); }
.prose code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.875em; }
.prose pre { padding: 20px; border: 1px solid var(--rule); overflow-x: auto; scrollbar-color: var(--muted) var(--paper); }
.prose pre code { white-space: pre; overflow-wrap: normal; }
.prose hr { margin-block: 40px; border: 0; border-top: 1px solid var(--rule); }
.prose li + li { margin-top: 8px; }

@media (max-width: 600px) {
  .masthead { min-height: 88px; }
  main { padding-block: 64px; }
  .greeting .theme-toggle { margin-bottom: 24px; }
  .sun { width: 52px; height: 52px; }
  h1 { font-size: clamp(64px, 17vw, 88px); }
  h1 span { display: block; }
  .intro { margin-top: 24px; font-size: 14px; }
  .little-line { margin-top: 32px; }
  footer { min-height: 100px; gap: 12px; font-size: 12px; }
  .signature { gap: 8px; }
  .site-nav { gap: 16px; }
  .reading-main { padding-block: 40px 64px; font-size: 17px; }
  .reading-main h1 { font-size: 36px; }
  .post-list { margin-top: 32px; }
  .post-list li { grid-template-columns: minmax(0, 1fr); gap: 8px; padding-block: 24px; }
  .post-list h2 { font-size: 21px; }
  .article-header { margin-block: 28px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .sun-core, .sun-rays, .moon-cutout { transition: none; }
}
