:root {
  color-scheme: light dark;
  --font-body: "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-code: "MonoLisa", ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --page-width: 800px;
  --page-padding-block: 2rem;
  --page-padding-inline: 1rem;
  --space-2xs: 0.1rem;
  --space-xs: 0.3rem;
  --space-sm: 0.55rem;
  --space-md: 0.75rem;
  --space-nav-row: 0.2rem;
  --space-lg: 1rem;
  --space-xl: 1.25rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --space-4xl: 4rem;
  --heading-margin-top: 2.5rem;
  --heading-margin-bottom: 1rem;
  --font-size-copyright: 0.85rem;
  --font-size-meta: 0.9rem;
  --font-size-caption: 0.9rem;
  --font-size-author-description: 0.95rem;
  --font-size-inline-code: 0.9em;
  --font-size-code-block: 0.9rem;
  --font-size-icon: 1.25rem;
  --line-height-body: 1.6;
  --line-height-title: 1.15;
  --line-height-code: 1.5;
  --font-weight-bold: 700;
  --radius-inline-code: 4px;
  --radius-code-block: 6px;
  --radius-round: 50%;
  --border-width: 1px;
  --theme-toggle-size: 2rem;
  --author-image-width: 7rem;
  --social-icon-size: 1.15rem;
  --post-image-max-height: 800px;
  --lightbox-padding: var(--space-3xl);
  --map-height: 28rem;
  --transparent: transparent;
}

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --background: #fafafa;
  --text: #1d1d1f;
  --muted: #666;
  --accent: #0b6bcb;
  --line: #ddd;
  --image-border: var(--line);
  --lightbox-background: rgba(250, 250, 250, 0.94);
  --table-border: var(--line);
  --table-row: #f1f1f1;
  --quote-border: #d0d7de;
  --quote-accent: #d4a72c;
  --quote-background: #f6f8fa;
  --code-background: #f0f0f0;
  --author-background: #f4f4f4;
  --code-text: #24292f;
  --code-border: #d8dee4;
  --ai-disclaimer-background: #fff8c5;
  --ai-disclaimer-border: #d4a72c;
  --ai-disclaimer-text: #3b2300;
  --syntax-background: #f7f7f7;
  --syntax-text: #1f2328;
  --syntax-error-text: #f6f8fa;
  --syntax-error-background: #82071e;
  --syntax-line-highlight: #dedede;
  --syntax-line-number: #7f7f7f;
  --syntax-keyword: #cf222e;
  --syntax-name: #1f2328;
  --syntax-constant: #0550ae;
  --syntax-entity: #6639ba;
  --syntax-label: #990000;
  --syntax-namespace: #24292e;
  --syntax-variable: #953800;
  --syntax-string: #0a3069;
  --syntax-string-symbol: #032f62;
  --syntax-comment: #57606a;
  --syntax-deleted-text: #82071e;
  --syntax-deleted-background: #ffebe9;
  --syntax-inserted-text: #116329;
  --syntax-inserted-background: #dafbe1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --background: #121212;
    --text: #f4f4f4;
    --muted: #aaa;
    --accent: #74b7ff;
    --line: #333;
    --image-border: var(--line);
    --lightbox-background: rgba(18, 18, 18, 0.94);
    --table-border: var(--line);
    --table-row: #1c1c1c;
    --quote-border: #30363d;
    --quote-accent: #9e6a03;
    --quote-background: #161b22;
    --code-background: #1c1c1c;
    --author-background: #222;
    --code-text: #f0f0f0;
    --code-border: #30363d;
    --ai-disclaimer-background: #2d2614;
    --ai-disclaimer-border: #9e6a03;
    --ai-disclaimer-text: #f0d98c;
    --syntax-background: #0d1117;
    --syntax-text: #e6edf3;
    --syntax-error-text: #f85149;
    --syntax-error-background: transparent;
    --syntax-line-highlight: #6e7681;
    --syntax-line-number: #6e7681;
    --syntax-keyword: #ff7b72;
    --syntax-name: #e6edf3;
    --syntax-constant: #79c0ff;
    --syntax-entity: #ffa657;
    --syntax-label: #79c0ff;
    --syntax-namespace: #ff7b72;
    --syntax-variable: #79c0ff;
    --syntax-string: #a5d6ff;
    --syntax-string-symbol: #a5d6ff;
    --syntax-comment: #8b949e;
    --syntax-deleted-text: #ffa198;
    --syntax-deleted-background: #490202;
    --syntax-inserted-text: #56d364;
    --syntax-inserted-background: #0f5323;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #121212;
  --text: #f4f4f4;
  --muted: #aaa;
  --accent: #74b7ff;
  --line: #333;
  --image-border: var(--line);
  --lightbox-background: rgba(18, 18, 18, 0.94);
  --table-border: var(--line);
  --table-row: #1c1c1c;
  --quote-border: #30363d;
  --quote-accent: #9e6a03;
  --quote-background: #161b22;
  --code-background: #1c1c1c;
  --author-background: #222;
  --code-text: #f0f0f0;
  --code-border: #30363d;
  --ai-disclaimer-background: #2d2614;
  --ai-disclaimer-border: #9e6a03;
  --ai-disclaimer-text: #f0d98c;
  --syntax-background: #0d1117;
  --syntax-text: #e6edf3;
  --syntax-error-text: #f85149;
  --syntax-error-background: transparent;
  --syntax-line-highlight: #6e7681;
  --syntax-line-number: #6e7681;
  --syntax-keyword: #ff7b72;
  --syntax-name: #e6edf3;
  --syntax-constant: #79c0ff;
  --syntax-entity: #ffa657;
  --syntax-label: #79c0ff;
  --syntax-namespace: #ff7b72;
  --syntax-variable: #79c0ff;
  --syntax-string: #a5d6ff;
  --syntax-string-symbol: #a5d6ff;
  --syntax-comment: #8b949e;
  --syntax-deleted-text: #ffa198;
  --syntax-deleted-background: #490202;
  --syntax-inserted-text: #56d364;
  --syntax-inserted-background: #0f5323;
}

* {
  box-sizing: border-box;
}

body {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--page-padding-block) var(--page-padding-inline);
  background: var(--background);
  color: var(--text);
  font-family: var(--font-body);
  line-height: var(--line-height-body);
}

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

h1 {
  line-height: var(--line-height-title);
}

h2,
h3,
h4,
h5,
h6 {
  margin-top: var(--heading-margin-top);
  margin-bottom: var(--heading-margin-bottom);
}

blockquote {
  margin: var(--space-2xl) 0;
  padding: var(--space-md) var(--space-lg);
  border: var(--border-width) solid var(--quote-border);
  border-left: 0.25rem solid var(--quote-accent);
  border-radius: var(--radius-code-block);
  background: var(--quote-background);
  color: var(--text);
}

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

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

.post-image {
  margin: var(--space-2xl) 0;
}

.post-image-link {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-code-block);
}

.post-image img {
  display: block;
  width: 100%;
  max-height: var(--post-image-max-height);
  height: auto;
  object-fit: contain;
}

.post-image figcaption {
  margin-top: var(--space-sm);
  color: var(--muted);
  font-size: var(--font-size-caption);
}

.sauna-map {
  width: 100%;
  height: var(--map-height);
  margin: var(--space-2xl) 0;
  overflow: hidden;
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-code-block);
}

.has-lightbox {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: var(--lightbox-padding);
  background: var(--lightbox-background);
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  max-width: calc(100vw - (var(--lightbox-padding) * 2));
  max-height: calc(100vh - (var(--lightbox-padding) * 2));
  max-height: calc(100dvh - (var(--lightbox-padding) * 2));
  width: auto;
  height: auto;
  object-fit: contain;
  border: var(--border-width) solid var(--image-border);
  border-radius: var(--radius-code-block);
  background: var(--background);
}

.lightbox-close {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  width: var(--theme-toggle-size);
  height: var(--theme-toggle-size);
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-round);
  background: var(--background);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--accent);
}

.ai-disclaimer {
  margin: var(--space-2xl) 0;
  padding: var(--space-lg);
  border: var(--border-width) solid var(--ai-disclaimer-border);
  border-radius: var(--radius-code-block);
  background: var(--ai-disclaimer-background);
  color: var(--ai-disclaimer-text);
}

.ai-disclaimer-title {
  margin: 0;
  font-weight: var(--font-weight-bold);
}

.ai-disclaimer-text {
  margin: var(--space-2xs) 0 0;
  font-size: var(--font-size-author-description);
}

.site-header {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding-bottom: var(--space-lg);
  border-bottom: var(--border-width) solid var(--line);
}

.header-content {
  display: flex;
  min-width: 0;
  flex: 1;
  flex-direction: column;
  gap: var(--space-sm);
}

.site-title {
  color: var(--text);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-nav-row) var(--space-lg);
}

.site-nav a,
.footer-nav a {
  text-decoration: none;
}

.site-nav a[aria-current="page"],
.footer-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: var(--font-weight-bold);
}

.theme-toggle {
  display: inline-flex;
  width: var(--theme-toggle-size);
  height: var(--theme-toggle-size);
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-round);
  background: var(--transparent);
  color: var(--text);
  cursor: pointer;
}

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

.site-main {
  padding-top: var(--space-3xl);
}

.site-footer {
  margin-top: var(--space-4xl);
  padding-top: var(--space-xl);
  border-top: var(--border-width) solid var(--line);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-lg);
}

.copyright {
  margin: var(--space-md) 0 0;
  color: var(--muted);
  font-size: var(--font-size-copyright);
}

.intro {
  margin-bottom: var(--space-3xl);
}

.author-box {
  display: flex;
  align-items: stretch;
  gap: var(--space-lg);
  margin: var(--space-2xl) 0;
  overflow: hidden;
  border: var(--border-width) solid var(--code-border);
  border-radius: var(--radius-code-block);
  background: var(--author-background);
}

.post-author {
  margin-top: var(--space-4xl);
  padding-top: var(--space-2xl);
  border-top: var(--border-width) solid var(--line);
}

.author-image {
  width: var(--author-image-width);
  height: auto;
  flex: 0 0 auto;
  align-self: stretch;
  object-fit: cover;
}

.author-content {
  min-width: 0;
  padding: var(--space-lg) var(--space-lg) var(--space-lg) 0;
}

.author-name {
  margin: 0;
  font-weight: var(--font-weight-bold);
}

.author-description {
  margin: var(--space-2xs) 0 0;
  color: var(--muted);
  font-size: var(--font-size-author-description);
}

.author-social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.author-social-link {
  display: inline-flex;
  width: var(--theme-toggle-size);
  height: var(--theme-toggle-size);
  align-items: center;
  justify-content: center;
  border: var(--border-width) solid var(--line);
  border-radius: var(--radius-round);
  color: var(--muted);
  text-decoration: none;
}

.author-social-link:hover {
  color: var(--accent);
}

.author-social-link svg {
  width: var(--social-icon-size);
  height: var(--social-icon-size);
}

.post-list {
  padding-left: var(--space-xl);
}

.post-list li {
  margin-bottom: var(--space-md);
}

.post-list time,
.post time {
  display: block;
  color: var(--muted);
  font-size: var(--font-size-meta);
}

.post li > p:has(+ p > em:only-child) {
  margin-bottom: var(--space-2xs);
}

.post li > p:has(> em:only-child) {
  margin: 0 0 var(--space-sm);
  color: var(--muted);
  font-size: var(--font-size-meta);
  font-style: normal;
}

.post li > p:has(> em:only-child) em {
  font-style: normal;
}

code,
kbd,
pre,
samp {
  font-family: var(--font-code);
}

:not(pre) > code {
  padding: var(--space-2xs) var(--space-xs);
  border-radius: var(--radius-inline-code);
  background: var(--code-background);
  color: var(--code-text);
  font-size: var(--font-size-inline-code);
}

pre {
  overflow-x: auto;
  padding: var(--space-lg);
  border: var(--border-width) solid var(--code-border);
  border-radius: var(--radius-code-block);
  background: var(--code-background);
  color: var(--code-text);
  font-size: var(--font-size-code-block);
  line-height: var(--line-height-code);
}

pre code {
  padding: 0;
  background: var(--transparent);
  color: inherit;
  font-size: inherit;
}

.highlight {
  margin: var(--space-2xl) 0;
}

.highlight pre {
  margin: 0;
}

table {
  width: 100%;
  margin: var(--space-2xl) 0;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  border: var(--border-width) solid var(--table-border);
  border-radius: var(--radius-code-block);
}

th,
td {
  padding: var(--space-sm) var(--space-md);
  border-right: var(--border-width) solid var(--table-border);
  border-bottom: var(--border-width) solid var(--table-border);
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  background: var(--table-row);
  font-weight: var(--font-weight-bold);
}

tbody tr:nth-child(even) {
  background: var(--table-row);
}
