/* LAYOUT */

:root {
  --bg: #fff;
  --text: #333;
  --link: #0645ad;
  --border: #ddd;
}

[data-theme="dark"] {
  --bg: #121212;
  --text: #e6e6e6;
  --link: #8ab4f8;
  --border: #333;
}

body {
  color: var(--text);
  background: var(--bg);
  font-size: 118.75%;
  line-height: 1.5;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  max-width: 45rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 1rem;
  margin: 0 auto;
}

.content {
  padding-top: 0;
  margin-bottom: 2rem;
  flex: 1 0 auto;
}

.content a {
  color: var(--link);
  text-decoration: underline;
}

.content a:hover {
  text-decoration: none;
}

.content section {
  margin: 1.5rem 0;
}

.content h1,
.content h2,
.content h3,
.home-split h2,
.route-map h2 {
  margin: 0 0 0.5rem;
}

.content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem 0;
}

@media screen and (max-width: 48rem) {
  .content {
    padding-top: 1rem;
  }

  .content section {
    margin: 1rem 0;
  }
}

@media screen and (min-width: 48rem) {
  .content {
    padding-top: 3rem;
  }
}

/* NAVIGATION */

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.site-nav .logo {
  font-weight: bold;
  padding: 0;
}

.main-menu {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
}

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

.theme-toggle {
  padding: 0.5rem 0.75rem;
  margin-left: 0.5rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle__icon {
  display: none;
  font-size: 1.2rem;
  line-height: 1;
}

.theme-toggle__icon::before {
  content: "🌞";
}

[data-theme="dark"] .theme-toggle__icon::before {
  content: "🌜";
}

.theme-toggle__label {
  display: inline-block;
}

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

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
}

.post-nav__prev,
.post-nav__next {
  flex: 1;
}

.post-nav__prev {
  text-align: left;
}

.post-nav__next {
  text-align: right;
}

@media screen and (max-width: 48rem) {
  .site-nav {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    position: relative;
  }

  .site-nav .logo {
    order: 1;
    padding: 0.5rem;
  }

  .theme-toggle {
    order: 2;
    margin-left: 0;
    padding: 0.4rem 0.6rem;
    font-size: 0.9rem;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
  }

  .theme-toggle__icon {
    display: inline-block;
  }

  .theme-toggle__label {
    display: none;
  }

  .main-menu {
    order: 3;
    width: 100%;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0;
  }

  .site-nav a {
    padding: 0.5rem 0.75rem;
  }
}

/* POSTS & LISTS */

.post-snippet {
  margin-bottom: 1rem;
}

.post-snippet h3 {
  margin-bottom: 0.25rem;
}

.post-meta {
  margin: 0.25rem 0 0.5rem;
}

/* JOURNAL */

.journal-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(12rem, 1fr);
  gap: 1.75rem;
  align-items: start;
}

.journal-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.journal-title-row h1 {
  margin: 0;
}

.journal-title-row .journal-tags__toggle {
  display: none;
}

.journal-list {
  min-width: 0;
}

.journal-tags {
  border: 1px solid var(--border);
  padding: 1rem;
}

.journal-tags__toggle {
  display: none;
}

.journal-tags h3 {
  margin-top: 0;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tag-list a {
  color: var(--link);
  text-decoration: underline;
}

.tag-list a:hover {
  text-decoration: none;
}

.tag-list__empty {
  margin: 0.5rem 0 0;
  color: var(--text);
  opacity: 0.7;
}

@media screen and (max-width: 42rem) {
  .journal-layout {
    grid-template-columns: 1fr;
  }

  .journal-tags {
    order: -1;
    overflow: hidden;
    max-height: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.2s ease;
  }

  .journal-tags.is-open {
    border: 1px solid var(--border);
    padding: 1rem;
    opacity: 1;
    visibility: visible;
  }

  .journal-title-row .journal-tags__toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    background: transparent;
    color: inherit;
    cursor: pointer;
    width: fit-content;
  }

  .journal-tags__toggle {
    display: none;
  }
}

/* PHOTO GRID */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

@media screen and (max-width: 48rem) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

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

.photo-grid__thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.photo-grid__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-grid__title {
  display: none;
}

.photo-full img {
  width: 100%;
  height: auto;
}

.photo-full figcaption {
  text-align: center;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ABOUT */

.about-blurb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
}

.about-avatar {
  flex: 0 0 128px;
}

.about-avatar img {
  width: 128px;
  height: 128px;
  object-fit: cover;
  display: block;
}

.about-blurb p {
  flex: 1;
  margin: 0;
  text-align: center;
}

.about-links {
  list-style: none;
  display: flex;
  gap: 1rem;
  padding: 0;
  margin: 0.5rem 0 0;
  justify-content: center;
}

.about-links a {
  color: var(--link);
  text-decoration: underline;
}

.about-links a:hover {
  text-decoration: none;
}

@media screen and (max-width: 40rem) {
  .about-blurb {
    flex-direction: column;
    align-items: flex-start;
  }

  .about-avatar {
    margin-inline: auto;
  }
}

/* HOME */

.home-split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 2rem;
}

.home-split .posts-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.latest-photo {
  display: flex;
  flex-direction: column;
}

.latest-photo__content {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.latest-photo__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}

.latest-photo__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.latest-photo__caption {
  margin: 0.5rem 0 0;
}

.more-posts {
  margin-top: auto;
  padding-top: 0.5rem;
  align-self: flex-start;
}

.more-photos {
  margin-top: auto;
  padding-top: 0.5rem;
  align-self: flex-start;
}

@media screen and (max-width: 48rem) {
  .home-split {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .home-split .posts-list,
  .latest-photo {
    align-items: center;
    text-align: center;
  }

  .post-snippet,
  .latest-photo__content,
  .more-posts,
  .more-photos {
    width: 100%;
  }

  .route-map h2 {
    text-align: center;
  }

  footer p {
    text-align: center;
  }
}
