:root,
:root[data-theme="light"] {
  color-scheme: light;
  --text: #1a1a1a;
  --muted: #666;
  --link: #2185d0;
  --bg: #fafafa;
  --toggle-hover: rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --text: #e8e8e8;
  --muted: #999;
  --link: #5cb3ff;
  --bg: #111;
  --toggle-hover: rgba(255, 255, 255, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --text: #e8e8e8;
    --muted: #999;
    --link: #5cb3ff;
    --bg: #111;
    --toggle-hover: rgba(255, 255, 255, 0.08);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
}

main {
  padding: 2rem;
  max-width: 24rem;
}

.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.avatar {
  flex-shrink: 0;
  border-radius: 50%;
  display: block;
}

.identity {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}

.handle {
  margin: 0.25rem 0 0;
}

.bio {
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.handle a {
  color: var(--muted);
  text-decoration: none;
}

.handle a:hover {
  color: var(--link);
}

.meta {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.meta li + li {
  margin-top: 0.25rem;
}

a {
  color: var(--link);
}

nav {
  display: flex;
  gap: 1.25rem;
}

nav a {
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

.empty {
  margin: 1.5rem 0 0;
  color: var(--muted);
}

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--toggle-hover);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  display: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle .icon-moon {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]):not([data-theme="dark"]) .theme-toggle .icon-moon {
    display: none;
  }
}

.theme-consent {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.theme-consent-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.theme-consent-dialog {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  max-width: 22rem;
  margin-left: auto;
  padding: 1.25rem;
  border: 1px solid var(--toggle-hover);
  border-radius: 0.625rem;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.2);
}

.theme-consent-dialog h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.theme-consent-dialog p {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  line-height: 1.5;
}

.theme-consent-note {
  color: var(--muted);
  font-size: 0.8125rem !important;
}

.theme-consent code {
  font-size: 0.8125rem;
}

.theme-consent-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.theme-consent button {
  padding: 0.5rem 0.875rem;
  border: none;
  border-radius: 0.375rem;
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.theme-consent [data-action="decline"] {
  color: var(--text);
  background: var(--toggle-hover);
}

.theme-consent [data-action="accept"] {
  color: var(--bg);
  background: var(--text);
}

body.top {
  display: block;
}

body.top main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 4.5rem 1.5rem 4rem;
}

.back {
  display: flex;
  align-items: center;
  height: 1.25rem;
  margin: 0 0 1.25rem;
}

.back a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.25rem;
}

.back a:hover {
  color: var(--link);
}

.back svg {
  display: block;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.posts {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.posts li + li {
  margin-top: 1.15rem;
}

.posts > li > a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.posts > li > a:hover {
  color: var(--link);
}

.posts time,
.posts .summary {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

.posts time {
  margin-top: 0.15rem;
}

.posts .summary {
  margin: 0.2rem 0 0;
}

.post-date {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.post-body {
  margin-top: 1.5rem;
  line-height: 1.65;
}

.post-body > :first-child {
  margin-top: 0;
}

.post-body h2,
.post-body h3,
.post-body h4 {
  margin: 1.75rem 0 0.5rem;
  font-weight: 600;
  line-height: 1.3;
}

.post-body h2 { font-size: 1.25rem; }
.post-body h3 { font-size: 1.1rem; }
.post-body h4 { font-size: 1rem; }

.post-body p,
.post-body ul,
.post-body ol,
.post-body blockquote,
.post-body pre,
.post-body .table-wrap {
  margin: 0.9rem 0;
}

.post-body li + li {
  margin-top: 0.25rem;
}

.post-body ul,
.post-body ol {
  padding-left: 1.25rem;
}

.post-body blockquote {
  margin-left: 0;
  padding-left: 0.9rem;
  border-left: 2px solid var(--muted);
  color: var(--muted);
}

.post-body blockquote > :first-child {
  margin-top: 0;
}

.post-body blockquote > :last-child {
  margin-bottom: 0;
}

.post-body hr {
  margin: 1.75rem 0;
  border: none;
  border-top: 1px solid var(--toggle-hover);
}

.post-body code {
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 0.9em;
}

.post-body :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  background: var(--toggle-hover);
}

.post-body pre {
  padding: 0.85rem 1rem;
  overflow-x: auto;
  border-radius: 0.5rem;
  background: var(--toggle-hover);
  line-height: 1.45;
}

.post-body pre code {
  font-size: 0.875rem;
}

.post-body img {
  display: block;
  max-width: 100%;
  height: auto;
}

.post-body input[type="checkbox"] {
  margin: 0 0.35rem 0 0;
  vertical-align: -0.1em;
}

.table-wrap {
  overflow-x: auto;
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

.post-body th,
.post-body td {
  padding: 0.35rem 0.75rem 0.35rem 0;
  border-bottom: 1px solid var(--toggle-hover);
  text-align: left;
  vertical-align: top;
}
