/* ============================================================
   Promontory — The Last Promontory anthology theme
   ============================================================ */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

/* ---- Layout ---- */

.layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */

.sidebar {
  width: 420px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  background-image: url('../images/sidebar.jpg');
  background-size: cover;
  background-position: right top;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem 1.5rem;
  overflow: hidden;
}

.sidebar-title {
  display: block;
  margin-bottom: 1.25rem;
}

.title-sidebar,
.title-topbar {
  display: block;
}

.title-topbar {
  display: none;
}

.title-topbar svg path {
  fill: white;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav a {
  color: #fff;
  text-decoration: none;
  font-family: 'Libertinus Serif', Georgia, serif;
  font-size: 0.95rem;
  line-height: 1.4;
  opacity: 0.85;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  opacity: 1;
  text-decoration: underline;
}

/* ---- Main content column ---- */

.content {
  flex: 1;
  min-width: 0;
  padding: 3rem 4rem 3rem 3rem;
  font-family: 'Libertinus Serif', Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.7;
  color: #1a1a1a;
}

/* ---- Landing page ---- */

.home-title {
  max-width: 42ch;
  margin-bottom: 1.5rem;
}

.home-title svg path {
  fill: #1a1a1a;
}

.subtitle {
  font-size: 1.65rem;
  font-style: italic;
  color: #444;
  margin: 0 0 2.5rem;
}

.toc {
  list-style: none;
  padding: 0;
  margin: 0 0 3rem;
}

.toc-entry {
  margin-bottom: 1.5rem;
}

.toc-entry a {
  display: block;
  font-weight: 700;
  color: #1a1a1a;
  text-decoration: none;
}

.toc-entry a:hover {
  text-decoration: underline;
}

.toc-meta {
  display: block;
  font-size: 1.3rem;
  font-style: italic;
  color: #666;
  margin-top: 0.15rem;
}

/* ---- Text pages ---- */

.text-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  line-height: 1.2;
}

.text-byline {
  font-size: 1.45rem;
  font-weight: 400;
  font-style: italic;
  margin: 0 0 2.5rem;
  color: #555;
}

.text-content {
  max-width: 68ch;
}

.text-content p {
  margin: 0 0 1em;
}

.text-content h2,
.text-content h3,
.text-content h4 {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 1.75em 0 0.5em;
}

/* Poem variant */
.is-poem .text-content {
  max-width: 42ch;
  text-align: left;
  margin-left: clamp(0px, calc((100% - 42ch) / 2), 140px);
}

.is-poem .text-content p {
  white-space: pre;
}

/* ---- Prev / Next navigation ---- */

.text-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
  font-size: 1.3rem;
  gap: 2rem;
}

.text-nav-next {
  text-align: right;
  margin-left: auto;
}

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

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

/* ---- Prose links ---- */

.text-content a,
.text-content a:visited,
.page-body a,
.page-body a:visited {
  color: #4D7BB2;
}

/* ---- Utility pages ---- */

.page-body {
  max-width: 68ch;
}

.page-body h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  line-height: 1.2;
}

.page-body h2 {
  font-size: 1.65rem;
  font-weight: 700;
  margin: 1.75em 0 0.5em;
}

.page-body p {
  margin: 0 0 1em;
}

/* ---- Sitewide footer ---- */

.site-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #ddd;
  font-size: 0.9rem;
  color: #888;
}

.site-footer a {
  color: inherit;
}

/* ---- Responsive: mobile ---- */

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 240px;
    position: static;
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    padding: 1.5rem;
    background-position: center center;
  }

  .sidebar-title {
    margin-bottom: 0;
    width: 50%;
  }

  .title-sidebar { display: none; }
  .title-topbar  { display: block; }

  .sidebar-nav {
    align-items: flex-end;
    margin-left: auto;
  }

  .content {
    padding: 2rem 1.5rem;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .sidebar {
    height: 320px;
  }
}
