/* Reset & defaults
-------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --fg: #1a1a1a;
  --fg-muted: #6f6f6c;
  --fg-faint: #a8a6a0;
  --bg: #faf9f6;
  --rule: #e5e2dc;
  --rule-strong: #d8d4cc;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue",
    Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

.bio a,
.post__body a {
  overflow-wrap: break-word;
}

::selection {
  background: #f0e9d6;
  color: var(--fg);
}

/* Layout
-------------------------------------------------------------- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 88px 32px 128px;
}

.bookshelf {
  max-width: 880px;
}

@media (max-width: 600px) {
  main {
    padding: 48px 24px 80px;
  }
  body {
    font-size: 16px;
  }
}

/* Breadcrumb
-------------------------------------------------------------- */
.breadcrumb {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 56px;
  letter-spacing: 0.01em;
}

.breadcrumb a {
  color: var(--fg-muted);
  text-decoration-color: transparent;
}

.breadcrumb a:hover {
  color: var(--fg);
  text-decoration-color: var(--rule-strong);
}

.breadcrumb span {
  color: var(--fg-faint);
  margin: 0 8px;
}

/* Home page
-------------------------------------------------------------- */
.profile {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}

.profile__photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
}

.profile__name {
  font-size: 20px;
  font-weight: 500;
  margin: 0;
  letter-spacing: -0.005em;
}

.bio p {
  margin: 0 0 14px;
  max-width: 56ch;
}

.bio p:last-child {
  margin-bottom: 0;
}

.nav-list {
  margin-top: 64px;
  border-top: 1px solid var(--rule);
}

.nav-list__item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  color: var(--fg);
}

.nav-list__title {
  font-weight: 500;
  font-size: 17px;
}

.nav-list__item:hover .nav-list__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.nav-list__meta {
  color: var(--fg-muted);
  font-size: 14px;
  text-align: right;
}

/* Page header
-------------------------------------------------------------- */
.page-header {
  margin-bottom: 56px;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0;
}

.page-header__lede {
  margin: 12px 0 0;
  color: var(--fg-muted);
  font-size: 16px;
  max-width: 48ch;
}

/* Bookshelf
-------------------------------------------------------------- */
.bookshelf section {
  margin-bottom: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

.bookshelf section:first-of-type {
  border-top: 1px solid var(--rule-strong);
}

.bookshelf h2 {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin: 0 0 28px;
}

.book-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 36px 24px;
}

@media (max-width: 800px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px 20px;
  }
}

@media (max-width: 520px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 28px 16px;
  }
}

.book {
  display: block;
  text-decoration: none;
  color: inherit;
}

.book__cover {
  aspect-ratio: 2 / 3;
  background: #ece9e2;
  overflow: hidden;
  margin-bottom: 14px;
  position: relative;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book:hover .book__cover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.book__title {
  display: block;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 2px;
}

.book__author {
  display: block;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.4;
}

.book:hover .book__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Post list
-------------------------------------------------------------- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--rule-strong);
}

.post-list li {
  border-bottom: 1px solid var(--rule);
}

.post-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 20px 0;
  text-decoration: none;
  color: var(--fg);
}

.post-list a:hover .post-list__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.post-list__title {
  font-weight: 500;
  flex: 1;
}

.post-list__date {
  color: var(--fg-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .post-list a {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }
}

/* Aquarium
-------------------------------------------------------------- */
.aquarium-gallery {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.aquarium-gallery img {
  width: 100%;
}

/* Blog post
-------------------------------------------------------------- */
.post__header {
  margin-bottom: 40px;
}

.post__header h1 {
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 10px;
}

.post__header time {
  color: var(--fg-muted);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.post__body {
  font-size: 17px;
  line-height: 1.7;
}

.post__body h2 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 48px 0 14px;
  line-height: 1.3;
}

.post__body h3 {
  font-size: 18px;
  font-weight: 500;
  margin: 36px 0 10px;
}

.post__body p {
  margin: 0 0 20px;
}

.post__body ul,
.post__body ol {
  padding-left: 22px;
  margin: 0 0 20px;
}

.post__body li {
  margin-bottom: 6px;
}

.post__body img {
  margin: 32px auto;
}

.post__body blockquote {
  margin: 24px 0;
  padding: 2px 0 2px 20px;
  border-left: 1px solid var(--rule-strong);
  color: var(--fg-muted);
}

.post__body blockquote p {
  margin: 0 0 8px;
}

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

.post__body hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 40px 0;
}

.post__body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 5px;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .post__header h1 {
    font-size: 26px;
  }
  .post__body {
    font-size: 16px;
  }
  .post__body h2 {
    font-size: 20px;
    margin-top: 36px;
  }
  .post__body h3 {
    font-size: 17px;
  }
}

/* Dark mode
-------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e6e0;
    --fg-muted: #98948c;
    --fg-faint: #5a5854;
    --bg: #131210;
    --rule: #28261f;
    --rule-strong: #3a382f;
  }
  .book__cover {
    background: #1d1c18;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
  .book:hover .book__cover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
  ::selection {
    background: #4a4530;
    color: #f5f3ed;
  }
  .post__body code {
    background: rgba(255, 255, 255, 0.06);
  }
}
