/* Minimal, high-contrast style for writing-first content */
:root {
  --bg: #f5f4ef;
  --text: #151515;
  --muted: #4d4d4d;
  --rule: #c8c4b8;
  --accent: #0f4c5c;
  --card: #fbfaf6;
  --code-inline-bg: #ece9df;
  --table-head-bg: #ece8dd;
  --blockquote-text: #2a2a2a;
  --toggle-bg: #f1eee4;
  --toggle-bg-hover: #e9e4d4;
  --toggle-text: #303030;
  --code-bg: #1f1f1f;
  --code-text: #f5f5f5;
}

:root[data-theme="dark"] {
  --bg: #171818;
  --text: #e9e7e1;
  --muted: #bab6ac;
  --rule: #464138;
  --accent: #79becd;
  --card: #212222;
  --code-inline-bg: #2c2d2e;
  --table-head-bg: #2a2b2c;
  --blockquote-text: #d8d4cb;
  --toggle-bg: #2a2b2c;
  --toggle-bg-hover: #333537;
  --toggle-text: #ebe8df;
  --code-bg: #0f1010;
  --code-text: #ece8de;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top right, #efe9dc 0%, var(--bg) 45%);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  line-height: 1.6;
}

:root[data-theme="dark"] body {
  background: radial-gradient(circle at top right, #252621 0%, var(--bg) 48%);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.25rem 1.1rem 4rem;
}

.site-head {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
}

.site-head h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.9rem);
  letter-spacing: 0.02em;
}

.head-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.site-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.nav {
  margin-top: 1rem;
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
  flex-wrap: wrap;
}

.theme-toggle {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  width: 1.9rem;
  height: 1.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.2;
  cursor: pointer;
  opacity: 0.72;
}

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

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-icon {
  width: 1.12rem;
  height: 1.12rem;
}

.theme-icon--sun {
  display: none;
}

.theme-icon--moon {
  display: inline;
}

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

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

main h1, main h2, main h3 {
  line-height: 1.2;
}

main h1 {
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

main p, main li {
  font-size: 1.06rem;
}

main img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.9rem 0;
  border-radius: 4px;
}

main table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.2rem;
  background: #faf8f2;
}

main th, main td {
  border: 1px solid var(--rule);
  padding: 0.45rem 0.6rem;
  vertical-align: top;
}

main th {
  background: var(--table-head-bg);
  font-weight: 600;
}

main blockquote {
  margin: 1.2rem 0;
  padding: 0.4rem 0.9rem;
  border-left: 3px solid var(--rule);
  color: var(--blockquote-text);
}

main code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--code-inline-bg);
  padding: 0.12em 0.3em;
  border-radius: 4px;
}

main pre {
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.85rem;
  border-radius: 6px;
}

main pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

.recent {
  margin-top: 2.4rem;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-item {
  border: 1px solid var(--rule);
  background: var(--card);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.8rem;
}

.recent-item p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.footer {
  border-top: 1px solid var(--rule);
  margin-top: 3rem;
  padding-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
