*, *::before, *::after { box-sizing: border-box; }
::selection { background: rgba(187,220,206,0.3); }

:root {
  --bg: #EFF0F3;
  --bg-secondary: #E4E5E9;
  --tx: #100F0F;
  --tx-2: #6F6E69;
  --tx-3: #B0B1B8;
  --ui: #D8D9DE;
  --ui-2: #CDCED4;
  --ui-3: #C2C3CA;
  --action: #24837B;
  --font: -apple-system, BlinkMacSystemFont, "Inter", "IBM Plex Sans",
          "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Code",
               "IBM Plex Mono", Menlo, Monaco, Consolas, monospace;
  --wrap: 37em;
  --radius: 4px;
  --lh: 1.5;
}

.theme-dark {
  --bg: #100F0F;
  --bg-secondary: #1C1B1A;
  --tx: #CECDC3;
  --tx-2: #878580;
  --tx-3: #575653;
  --ui: #282726;
  --ui-2: #343331;
  --ui-3: #403E3C;
  --action: #3AA99F;
}

html { font-size: 62.5%; height: 100%; }

body {
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-family: var(--font);
  background: var(--bg);
  color: var(--tx);
  line-height: var(--lh);
  font-size: 1.8rem;
  font-size: calc(1.5rem + 0.25vw);
  overflow-x: hidden;
}

.wrapper {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2rem 1.5rem 16rem;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  margin-bottom: 3em;
}
nav .site-name { flex-grow: 1; }
nav .site-name a {
  font-weight: 500;
  text-decoration: none;
  color: var(--tx);
}
nav .site-name .sep { color: var(--tx-3); margin: 0 0.15em; }
nav .nav-links a {
  color: var(--tx-2);
  text-decoration: none;
  margin-left: 1.5em;
}
nav .nav-links a:hover { color: var(--action); }

/* Theme toggle */
#theme-toggle {
  height: 20px; width: 36px;
  display: block; position: relative;
  cursor: pointer; margin-left: 1.5em;
  flex-shrink: 0;
}
.theme-toggle-slide {
  height: 20px;
  border: 1px solid var(--ui);
  border-radius: 24px;
  width: 100%; position: absolute;
}
.theme-toggle-switch {
  position: absolute; z-index: 9;
  top: 1px; left: 1px;
  width: 18px; height: 18px;
  transition: left 0.1s linear;
  background-color: var(--tx-2);
  border-radius: 50%;
}
#theme-toggle:hover .theme-toggle-switch { background-color: var(--action); }
.theme-dark .theme-toggle-switch {
  left: 16px;
  background-color: var(--tx);
}

/* Headings */
h1, h2, h3, h4, h5, h6 { margin: 0; padding: 0; line-height: 1.3; }
h1 {
  font-weight: 500;
  font-size: calc(1.35em + 0.55vw);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.25em;
}
h2 {
  font-weight: 500;
  font-size: calc(1em + 0.2vw);
  letter-spacing: -0.015em;
  margin-top: 2em;
  margin-bottom: 0.5em;
}
h3 {
  font-weight: 500;
  font-size: 1em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

/* Links */
a { color: var(--tx); text-decoration: underline; }
a:hover { color: var(--action); }

/* Paragraphs */
p { margin: 0 0 1em; }

/* Lists */
ol, ul {
  padding: 0.5rem 0 1rem 1em;
  margin: 0 0 0 0.5em;
}
li { padding: 0.15rem 0; }
li::marker { color: var(--tx-3); }
ul > li::marker { font-size: 85%; }
ul > li { list-style: disc; }

/* Blockquotes */
blockquote {
  padding-left: 1.5em;
  margin: 1.5em 0;
  border-left: 2px solid var(--tx);
}
blockquote p { margin: 0; }

/* Horizontal rules */
hr {
  border: 0; height: 1px;
  background: var(--ui);
  margin: 1.5em 0;
}
article hr, .post-content hr {
  background: none; height: auto;
  text-align: center;
  overflow: visible;
  margin: calc(2em + 2vh) 0;
}
article hr::before, .post-content hr::before {
  content: "\2022\2022\2022";
  display: inline-block;
  font-size: calc(0.8em + 0.2vw);
  letter-spacing: 1.25em;
  margin-left: 0.6em;
  color: var(--tx-3);
  position: relative;
  top: -0.75em;
}

/* Code */
code, kbd {
  font-family: var(--font-mono);
  background: var(--bg-secondary);
  padding: 0.1em 0.2em;
  border-radius: var(--radius);
  font-size: 90%;
}
pre {
  font-family: var(--font-mono);
  border-radius: var(--radius);
  padding: 1em;
  font-size: 90%;
  border: 1px solid var(--ui);
  white-space: pre-wrap;
  overflow-x: auto;
  margin: 1em 0;
}
pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* Images */
img {
  max-width: 100%;
  display: block;
  border-radius: 6px;
}
figure { margin: 0; padding: 1.5em 0; text-align: center; }
figcaption { font-size: 0.8em; color: var(--tx-2); padding: 1em; }

/* Tables */
table {
  margin: 1.5em 0 2.5em;
  width: 100%;
  border-collapse: collapse;
  font-size: 90%;
}
tr { border-bottom: 1px solid var(--ui); }
td { padding: 0.5em 1em 0.5em 0; line-height: 1.3; }
th {
  text-align: left;
  font-weight: 600;
  padding-bottom: 0.5em;
  padding-right: 1em;
}

/* Post list */
.post-list { padding: 0; margin: 0; list-style: none; }
.post-list li { list-style: none; padding: 0.4em 0; }
.post-list a { text-decoration: none; color: var(--tx); }
.post-list a:hover { color: var(--action); }
.post-date { color: var(--tx-2); font-size: 0.85em; }

/* Single post */
.post-header { margin-bottom: 0.5em; }
.post-meta {
  color: var(--tx-2);
  font-size: 0.85em;
  margin-bottom: 2em;
}

/* Footer */
footer {
  margin-top: 4em;
  padding-top: 1em;
  border-top: 1px solid var(--ui);
  color: var(--tx-2);
  font-size: 0.85em;
}

/* Responsive */
@media (max-width: 860px) {
  .wrapper { max-width: 88vw; }
}
@media (max-width: 600px) {
  h1 { font-weight: 600; }
}
