/* Fonts loaded via <link> in baseof.html */

/* ============================================================
   The Edge of Somewhere — main.css
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  background-color: #faf9f7;
  color: #1a1a1a;
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1rem;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Shared container --- */
.site-container {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Invisible spacer in header to align site name with content column */
.site-header-spacer {
  width: 160px;
  flex-shrink: 0;
  margin-right: 4rem;
}

/* ============================================================
   Header — site name only, generous top space
   ============================================================ */
.site-header {
  padding: 2.75rem 0 2rem;
  border-bottom: 1px solid #e8e5e0;
}

.site-header .site-container {
  display: flex;
  align-items: baseline;
}

.site-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 48px;
  font-weight: 300;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  color: #1a1a1a;
  text-decoration: none;
  line-height: 1.1;
}

.site-name:hover {
  color: #7a6a5a;
}

/* ============================================================
   Body layout — sidebar + main
   ============================================================ */
.site-body {
  flex: 1;
}

.site-body .site-container {
  display: flex;
  gap: 4rem;
  padding-top: 2.5rem;
  padding-bottom: 4rem;
  align-items: flex-start;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: 160px;
  flex-shrink: 0;
  position: sticky;
  top: 2rem;
}

.sidebar-toggle {
  display: none;
}

.sidebar-nav {
  list-style: none;
  margin-bottom: 2rem;
}

.sidebar-nav li {
  margin-bottom: 0.1rem;
}

.sidebar-nav a {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #888;
  text-decoration: none;
  display: block;
  padding: 0.3rem 0;
  transition: color 0.15s;
  line-height: 1.4;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  color: #1a1a1a;
}

.sidebar-nav a.active {
  color: #7a6a5a;
}

.sidebar-search {
  border-top: 1px solid #e8e5e0;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
}

.sidebar-about {
  margin-top: 0;
}

.sidebar-search-link,
.sidebar-about-link {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #888;
  text-decoration: none;
  display: block;
  padding: 0.3rem 0;
  margin-bottom: 0.1rem;
  transition: color 0.15s;
  line-height: 1.4;
}

.sidebar-search-link:hover,
.sidebar-about-link:hover {
  color: #1a1a1a;
}

/* ============================================================
   Main content column
   ============================================================ */
main {
  flex: 1;
  min-width: 0;
  max-width: 700px;
}

/* ============================================================
   Post Lists
   ============================================================ */
.post-list {
  list-style: none;
}

.post-item {
  padding: 2rem 0;
  border-bottom: 1px solid #e8e5e0;
}

.post-item:first-child {
  padding-top: 0;
}

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

.post-image img {
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.post-meta {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: #888;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.post-meta .category-label {
  color: #7a6a5a;
}

.post-title {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.6rem;
}

.post-title a {
  color: #1a1a1a;
  text-decoration: none;
}

.post-title a:hover {
  color: #7a6a5a;
}

.post-excerpt {
  font-size: 0.95rem;
  color: #333;
  line-height: 1.7;
  margin-bottom: 0.25rem;
}

.read-more {
  display: inline-block;
  margin-top: 0.6rem;
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6a5a;
  text-decoration: none;
}

.read-more:hover {
  color: #5a4a3a;
}

/* ============================================================
   Page / section header
   ============================================================ */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e8e5e0;
}

.page-header h1 {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

.section-heading {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  margin-bottom: 2rem;
}

/* ============================================================
   Single post
   ============================================================ */
.article-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e8e5e0;
}

.article-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: #888;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.article-meta .category-label {
  color: #7a6a5a;
}

.article-meta .reading-time::before {
  content: "·";
  margin-right: 0.75rem;
}

.article-body {
  font-size: 1rem;
  line-height: 1.8;
  color: #1a1a1a;
}

.article-body p {
  margin-bottom: 1.4em;
}

.article-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 2em 0 0.6em;
}

.article-body h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.75em 0 0.5em;
}

.article-body blockquote {
  border-left: 3px solid #d0c8be;
  padding-left: 1.25rem;
  margin: 1.5em 0;
  color: #555;
  font-style: italic;
}

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1.4em;
}

.article-body li {
  margin-bottom: 0.4em;
}

.article-body a {
  color: #7a6a5a;
  text-decoration: underline;
  text-decoration-color: rgba(122, 106, 90, 0.4);
  text-underline-offset: 2px;
}

.article-body a:hover {
  color: #5a4a3a;
  text-decoration-color: rgba(90, 74, 58, 0.7);
}

.article-body img {
  max-width: 100%;
  width: 100%;
  height: auto;
  margin: 1.5em 0;
  display: block;
}

.article-body figure {
  margin: 1.5em 0;
}

.article-body figcaption {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.78rem;
  color: #888;
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

.article-body hr {
  border: none;
  border-top: 1px solid #e0dbd4;
  margin: 2.5em 0;
}

/* --- Post navigation --- */
.post-navigation {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid #e8e5e0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.post-nav-prev,
.post-nav-next {
  font-size: 0.85rem;
}

.post-nav-next {
  text-align: right;
}

.post-nav-label {
  display: block;
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 0.3rem;
}

.post-nav-title {
  color: #1a1a1a;
  text-decoration: none;
  line-height: 1.35;
}

.post-nav-title:hover {
  color: #7a6a5a;
}

/* ============================================================
   About / static pages
   ============================================================ */
.page-body {
  font-size: 1rem;
  line-height: 1.8;
}

.page-body p {
  margin-bottom: 1.4em;
}

.page-body a {
  color: #7a6a5a;
  text-decoration: underline;
  text-decoration-color: rgba(122, 106, 90, 0.4);
  text-underline-offset: 2px;
}

.page-body a:hover {
  color: #5a4a3a;
}

.page-body hr {
  border: none;
  border-top: 1px solid #e0dbd4;
  margin: 2rem 0;
}

/* ============================================================
   Search page
   ============================================================ */
.search-page h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e8e5e0;
}

/* Pagefind UI overrides */
.pagefind-ui {
  --pagefind-ui-font: 'Source Serif 4', Georgia, serif;
  --pagefind-ui-primary: #7a6a5a;
  --pagefind-ui-text: #1a1a1a;
  --pagefind-ui-background: #faf9f7;
  --pagefind-ui-border: #e8e5e0;
  --pagefind-ui-border-radius: 2px;
  --pagefind-ui-scale: 0.85;
}

/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 0 1rem;
  margin-top: 1rem;
  border-top: 1px solid #e8e5e0;
}

.pagination-arrow {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.9rem;
  color: #7a6a5a;
  text-decoration: none;
  padding: 0.1rem 0.25rem;
  flex-shrink: 0;
}

.pagination-arrow:hover {
  color: #5a4a3a;
}

.pagination-disabled {
  color: #ccc;
  cursor: default;
}

.pagination-numbers {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.pagination-number {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: #888;
  text-decoration: none;
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  transition: color 0.15s;
}

.pagination-number:hover {
  color: #1a1a1a;
}

.pagination-current {
  color: #1a1a1a;
  font-weight: 500;
  background: #f0ede8;
}

.pagination-ellipsis {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  color: #bbb;
  padding: 0 0.2rem;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  padding: 1.75rem 0;
  border-top: 1px solid #e8e5e0;
}

.site-footer .site-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-text {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  color: #aaa;
  letter-spacing: 0.03em;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
}

.footer-links a {
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.72rem;
  color: #aaa;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.footer-links a:hover {
  color: #7a6a5a;
}

/* ============================================================
   Accessibility
   ============================================================ */
:focus-visible {
  outline: 2px solid #7a6a5a;
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: #1a1a1a;
  color: #faf9f7;
  padding: 0.5rem 1rem;
  font-family: 'Jost', system-ui, sans-serif;
  font-size: 0.85rem;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 1rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 640px) {
  html {
    font-size: 17px;
  }

  .site-container {
    padding: 0 1.25rem;
  }

  .site-header {
    padding: 1.75rem 0 1.25rem;
  }

  .site-name {
    font-size: 1.75rem;
  }

  .site-header-spacer {
    display: none;
  }

  /* Stack sidebar above content on mobile */
  .site-body .site-container {
    flex-direction: column;
    gap: 0;
    padding-top: 1.5rem;
  }

  .sidebar {
    width: 100%;
    position: static;
    border-bottom: 1px solid #e8e5e0;
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
  }

  .sidebar-toggle {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    text-align: left;
    font-family: 'Jost', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #888;
    cursor: pointer;
  }

  .sidebar-inner {
    display: none;
    padding-top: 1rem;
  }

  .sidebar-inner.open {
    display: block;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin-bottom: 1rem;
  }

  .sidebar-nav li {
    margin-bottom: 0;
  }

  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-nav-next {
    text-align: left;
  }

  .site-footer .site-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .article-header h1 {
    font-size: 1.4rem;
  }
}

/* ============================================================
   Footnotes
   ============================================================ */
.article-body .footnotes {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e8e5e0;
  font-size: 0.82rem;
  line-height: 1.6;
  color: #6a5e52;
}

.article-body .footnotes ol {
  padding-left: 1.5rem;
}

.article-body .footnotes li {
  margin-bottom: 0.4rem;
}

/* The ↩ back-reference link */
.article-body .footnotes .footnote-backref {
  margin-left: 0.3em;
  text-decoration: none;
  opacity: 0.6;
}

/* Superscript reference in body text */
.article-body sup a {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
  text-decoration: none;
  color: #7a6a5a;
}

.article-body sup a:hover {
  text-decoration: underline;
}

/* ============================================================
   Image Gallery / Slider
   ============================================================ */
.image-gallery {
  position: relative;
  margin: 2rem 0;
  background: #f0ede8;
  border-radius: 4px;
  overflow: hidden;
}

.image-gallery-track {
  display: flex;
  transition: transform 0.35s ease;
}

.image-gallery-slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-gallery-slide img {
  max-width: 100%;
  max-height: 480px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  cursor: zoom-in;
}

.image-gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(250, 249, 247, 0.85);
  border: 1px solid #d4cfc8;
  border-radius: 50%;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: #5a4e40;
  z-index: 10;
  transition: background 0.2s;
  line-height: 1;
}

.image-gallery-btn:hover {
  background: rgba(250, 249, 247, 1);
}

.image-gallery-btn.prev { left: 0.5rem; }
.image-gallery-btn.next { right: 0.5rem; }

.image-gallery-counter {
  text-align: center;
  padding: 0.4rem 0 0.6rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.75rem;
  color: #9a8e82;
  letter-spacing: 0.04em;
  background: #f0ede8;
}

/* Lightbox */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.92);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}

.gallery-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  display: block;
  border-radius: 2px;
}

.gallery-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

.gallery-lightbox-close:hover { opacity: 1; }
