:root {
  --mono-font: "Berkeley Mono", "JetBrains Mono", "Fira Code", San Francisco Mono, Monaco, "Consolas", "Lucida Console", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", monospace;
  --sans-font: -apple-system, BlinkMacSystemFont, "avenir next", avenir, helvetica, "helvetica neue", ubuntu, roboto, noto, "segoe ui", arial, sans-serif;
  --bg: #fff;
  --bg: light-dark(#fff, #111);
  --bg-dim: #fff;
  --bg-dim: light-dark(#fff, #191919);
  --text: #111;
  --text: light-dark(#111, #ccc);
  --text-dim: #333;
  --text-dim: light-dark(#333, #999);
  --link: var(--text);
  --link-blue: blue;
  --link-blue: light-dark(blue, #b5b5ff);
  --link-visited: #333;
  --link-visited: light-dark(#333, #aaa);
  --border: #333;
  --border: light-dark(#333, #888);
  --border-dim: #eee;
  --border-dim: light-dark(#eee, #555);
  --mode-border: light-dark(#555, #eee);
  --mode-dark: #555;
  --mode-light: #fff;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
  font-size: 1rem;
  font-family: var(--sans-font);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-skip-ink: auto;
}

a:hover {
  text-decoration: underline;
}

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

theme-toggle {
  display: block;
  height: 0;
}

.mode-container {
  display: flex;
  align-items: center;
  gap: 5px;
  position: absolute;
  top: 50px;
  right: 20px;
}

@media screen and (max-width: 1024px) {
  .mode-container {
    top: 30px;
    gap: 10px;
  }
}

.mode {
  display: block;
  width: 18px;
  height: 18px;
  line-height: 0;
  text-indent: -10000px;
  border-width: 2px;
  border-style: solid;
  border-radius: 10px;
  border-color: var(--mode-border);
  opacity: .2;
}

.mode-container:hover .mode {
  opacity: 1;
}

.mode:hover {
  cursor: pointer;
}

.mode:focus-visible {
  outline: 1px solid var(--link-blue);
  opacity: 1;
}

.mode.auto {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20'><rect width='100%' height='100%' fill='white'/><path fill='%23777' d='M0,0L0,20L20,20L0,0'/></svg>");
  appearance: none;
}

a.front-page-title {
  display: block;
  padding-bottom: 5px;
  font-weight: 900;
  text-decoration: none;
}

a.front-page-title:hover {
  text-decoration: underline;
}

div.front-page-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  grid-gap: 5px;
}

div.front-page-images>div {
  display: flex;
  align-items: center;
  line-height: 0;
}

div.front-page-images>div img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

div.body img {
  width: 100%;
  max-width: 640px;
  height: auto;
}

.only-print {
  display: none;
}

ul {
  margin: 1rem 0;
}

ul ul {
  margin: 0;
}

br {
  line-height: 1em;
}

h1 {
  margin-bottom: .5rem;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .004em;
}

h2 {
  margin-bottom: .5rem;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: .009em;
}

.limiter {
  max-width: 640px;
  padding-right: 20px;
  padding-left: 20px;
  margin-right: auto;
  margin-left: auto;
}

.pad2y {
  padding-top: 20px;
  padding-bottom: 20px;
}

/* Lists */
.books,
.writing {
  display: grid;
  grid-row-gap: 5px;
  grid-column-gap: 5px;
}

.writing {
  grid-template-columns: 1fr min-content;
}

.books {
  grid-template-columns: 1fr 0.75fr min-content 70px;
}

.books a,
.writing a {
  font-weight: 500;
  letter-spacing: -.015em;
}

.books time,
.writing time {
  padding-right: .25em;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  letter-spacing: -.012em;
  white-space: nowrap;
}

div.books>div,
div.writing>div {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Micro / Notes Post Design */
div.notes-list>div {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 2px;
}

div.body li,
div.notes-list li {
  list-style-type: "-  ";
}

div.notes-list>div>div.body {
  padding: 20px;
  background-color: var(--bg-dim);
}

div.notes-list>div>div.body>p:first-child {
  margin-top: 0;
}

.notes-list>div>div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.notes-list time {
  line-height: 1rem;
  white-space: pre;
}

.notes-list>div>div:first-child>a {
  font-weight: 700;
}

.notes-list>div>div:first-child>h2 {
  margin: 0;
  font-size: inherit;
  line-height: 1rem;
}

.notes-list a {
  color: var(--link-blue);
}


/* Header & Nav */
nav.header-wrap {
  padding-bottom: 20px;
}

@media screen and (max-width: 1024px) {
  .header-wrap {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
}

@media screen and (min-width: 1025px) {
  .header {
    position: absolute;
    top: 57px;
    right: 50%;
    margin-right: 340px !important;
    letter-spacing: -.009em;
  }

  .content h1:first-child {
    margin-top: 0;
  }
}

nav.h {
  padding: 5px 5px 0 5px;
  color: #000;
  background: var(--bg);
}

@media (max-width: 480px) {
  nav.h h1 {
    display: block;
  }
}

nav.h a,
nav.h h1 {
  display: inline-block;
  padding: 3px 5px;
}

nav.h h1 {
  margin: 0;
  font-size: inherit;
  font-weight: 400;
}

nav.h a {
  text-decoration: none;
}

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

/* Blockquote */
blockquote {
  padding: 10px 20px;
  margin: 0;
  overflow-x: auto;
  background: var(--bg);
  font-size: 16px;
  font-style: italic;
  line-height: 25px;
}

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

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

/* Responsive adjust for index logs lists */
@media screen and (max-width: 640px) {
  .limiter {
    width: auto;
  }

  .books,
  .writing {
    grid-template-columns: 1fr;
    grid-row-gap: 0px;
  }

  .books div,
  .writing div {
    white-space: normal;
  }

  .books div:nth-child(4n),
  .writing time {
    padding-bottom: 20px;
  }
}

@media screen and (min-width: 640px) {
  .nu a {
    text-decoration: none;
  }

  .nu a:hover {
    text-decoration: underline;
  }
}

/* Media Specific View styles */
div.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  padding: 20px 10px;
}

@media screen and (min-width: 600px) {
  div.media-grid {
    grid-template-columns: 1fr 1fr;
  }
}

div.media-grid>div.media-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 15px 30px;
  /* noticeably larger margins on the sides than top/bottom */
  background: var(--bg-dim);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
}

div.media-grid .media-link {
  display: block;
  width: 100%;
  line-height: 0;
  text-align: center;
}

div.media-grid img {
  max-width: 100%;
  height: auto;
  max-height: 200px;
  /* roughly the same size */
  object-fit: contain;
}

div.media-grid .media-title {
  margin-top: 10px;
  font-size: 14px;
  text-align: center;
  color: var(--text-dim);
  text-decoration: none;
}

/* Media/Photo sections stack view (like drawingAndPhotosView.webarchive) */
section.media-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 100%;
  min-height: auto;
  padding: 30px 0;
}

section.media-section img {
  max-width: 100%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

@media (max-width: 480px) {
  section.media-section {
    padding: 15px 0;
  }

  section.media-section img {
    width: calc(100vw - 30px);
    max-height: 60vh;
  }
}

.meta {
  max-width: 640px;
  padding: 0 25px 25px 25px;
  margin: 20px auto 0 auto;
}

.post-content-container {
  max-width: 640px;
  padding: 0 25px 50px 25px;
  margin: 25px auto 0 auto;
}

@media (min-width: 480px) {
  .meta {
    display: flex;
    justify-content: space-between;
  }

  .meta div:nth-child(2) {
    text-align: right;
  }
}

/* Article Page styling */
.article-header-image {
  width: 100%;
  max-width: 640px;
  margin: 0 auto 20px auto;
  display: block;
}

.article-header-image img {
  width: 100%;
  height: auto;
  border-radius: 2px;
}

/* Printing style resets */
@media print {
  .no-print {
    display: none;
  }

  .only-print {
    display: block;
  }

  body {
    margin: 0;
  }

  .limiter {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

:root {
  color-scheme: light dark;
}