/* ═══════════════════════════════════════════════════════════
   Journal — estebanguti.com
   GitBook-style shell: a contents sidebar that files every post
   under a topic heading, beside a Medium-style reading column.
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --bg-subtle: #f9f9f9;
  --text: #242424;              /* Medium ink */
  --text-2: #6b6b6b;            /* subtitles, meta */
  --text-3: #8f8f8f;            /* faint labels */
  --border: #f2f2f2;            /* story dividers */
  --border-2: #e6e6e6;          /* firmer rules */
  --accent: #1a8917;            /* Medium green */

  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --serif: 'Source Serif 4', Charter, 'Iowan Old Style', Georgia, 'Times New Roman', serif;

  --top-h: 57px;
  --sidebar-w: 17.5rem;
  --column-w: 680px;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body.page-journal {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

/* ─── Top bar (matches the front page) ─── */
.top { position: sticky; top: 0; z-index: 40; background: var(--bg); border-bottom: 1px solid var(--border); }
.top-inner {
  max-width: 1400px; margin: 0 auto; height: var(--top-h);
  padding: 0 clamp(1.25rem, 3vw, 2rem);
  display: flex; align-items: center; gap: 1rem;
}
.wordmark {
  font-family: var(--sans); font-weight: 600; font-size: 1.125rem; letter-spacing: -0.01em;
  text-decoration: none; color: var(--text); white-space: nowrap; margin-right: auto;
}
.top-nav { display: flex; align-items: center; gap: 1.25rem; }
.top-nav a { font-size: 0.875rem; color: var(--text-2); text-decoration: none; }
.top-nav a:hover, .top-nav a.is-active { color: var(--text); }
.nav-lang {
  font-family: var(--sans); font-size: 0.8rem; font-weight: 500;
  background: var(--bg); border: 1px solid var(--border-2); border-radius: 999px;
  color: var(--text-2); cursor: pointer; padding: 0.3rem 0.75rem; line-height: 1.3;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.nav-lang:hover { color: var(--text); border-color: var(--text); }
.top-menu { display: none; }

/* ─── Shell: contents + reading column ─── */
.shell { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* ═══════════ CONTENTS ═══════════ */
.sidebar {
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h));
  display: flex; flex-direction: column;
  padding: 1.5rem 1.25rem 1.5rem clamp(1.25rem, 3vw, 2rem);
  background: var(--bg);
}
.search {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.5rem 0.85rem; border-radius: 999px;
  background: var(--bg-subtle); color: var(--text-2);
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.search:focus-within { border-color: var(--border-2); background: var(--bg); color: var(--text); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font-family: var(--sans); font-size: 0.875rem; color: var(--text); outline: none; }
.search input::placeholder { color: var(--text-2); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.sidebar-nav {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  margin: 1.25rem -0.6rem 0; padding: 0 0.6rem 1rem;
  scrollbar-width: thin; scrollbar-color: var(--border-2) transparent;
}
.sidebar-group {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); margin: 1.5rem 0 0.4rem 0.6rem;
  padding-top: 1.25rem; border-top: 1px solid var(--border-2);
}
/* Posts sit indented under their section */
.sidebar-group ~ .sidebar-link { margin-left: 0.6rem; padding-left: 0.85rem; }
.sidebar-link {
  display: block; padding: 0.4rem 0.6rem;
  font-size: 0.875rem; font-weight: 400; line-height: 1.4; color: var(--text-2);
  text-decoration: none; border-radius: 6px;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.sidebar-link:hover { color: var(--text); background: var(--bg-subtle); }
.sidebar-link.is-active { color: var(--text); font-weight: 600; background: var(--bg-subtle); }
.sidebar-all { font-weight: 600; color: var(--text); }
.sidebar-empty { font-size: 0.85rem; color: var(--text-2); padding: 0.5rem 0.6rem; }

/* ═══════════ READING COLUMN ═══════════ */
.column { min-width: 0; display: flex; flex-direction: column; min-height: calc(100vh - var(--top-h)); }
.page { flex: 1; width: 100%; max-width: var(--column-w); margin: 0 auto; padding: 3.5rem clamp(1.25rem, 4vw, 2rem) 5rem; }

/* Article head */
.kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); margin-bottom: 0.75rem; }
.kicker:empty { display: none; }
.article-head h1 {
  font-family: var(--sans); font-weight: 700;
  font-size: clamp(2rem, 4.5vw, 2.625rem); line-height: 1.19; letter-spacing: -0.016em;
  text-wrap: balance; color: var(--text);
}
.lede {
  font-family: var(--sans); font-weight: 400;
  font-size: clamp(1.15rem, 2vw, 1.375rem); line-height: 1.4; color: var(--text-2);
  margin-top: 0.75rem; text-wrap: pretty;
}
.byline { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.75rem; }
.byline-avatar {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  background: var(--text); color: #fff; font-size: 0.85rem; font-weight: 600; letter-spacing: 0.03em;
}
.byline-avatar-sm { width: 1.5rem; height: 1.5rem; font-size: 0.55rem; }
.byline-text { display: flex; flex-direction: column; gap: 0.1rem; line-height: 1.3; }
.byline-name { font-size: 1rem; font-weight: 500; color: var(--text); }
.byline-meta { font-size: 0.875rem; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 0.35rem; }
.byline-sep { color: var(--text-3); }
/* ─── Share ─── */
.share { margin-left: auto; display: flex; align-items: center; gap: 0.4rem; }
.share-btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--sans); font-size: 0.82rem; font-weight: 500; line-height: 1;
  color: var(--text-2); background: var(--bg);
  border: 1px solid var(--border-2); border-radius: 999px;
  padding: 0.45rem 0.8rem; cursor: pointer; text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.share-btn:hover { color: var(--text); border-color: var(--text); }
.share-btn.is-done { color: var(--accent); border-color: var(--accent); }
.share-btn svg { flex: none; }

.article-head { padding-bottom: 1.75rem; margin-bottom: 2.25rem; border-bottom: 1px solid var(--border); }

/* Hero media (optional per post, unused today) */
.media { margin: 0 0 2.5rem; }
.media-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0b0d10; }
.media-frame iframe, .media-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.media-cover { display: block; width: 100%; height: auto; }
.media figcaption { margin-top: 0.6rem; font-size: 0.85rem; color: var(--text-2); text-align: center; }

/* Several videos in one post (audiovisuals), each under a heading */
.video-part-title {
  font-family: var(--sans); font-weight: 700; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.016em;
  margin: 0 0 0.9rem; text-wrap: balance;
}
.video-part-date { margin: -0.6rem 0 0.9rem; font-size: 0.875rem; color: var(--text-2); }

/* Prose */
.prose { font-family: var(--serif); font-size: 1.25rem; line-height: 1.58; letter-spacing: -0.003em; color: var(--text); }
.prose > * + * { margin-top: 1.6rem; }
.prose h2 {
  font-family: var(--sans); font-weight: 700; font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.016em;
  margin-top: 2.75rem; scroll-margin-top: calc(var(--top-h) + 1rem); text-wrap: balance;
}
.prose h2:first-child { margin-top: 0; }
.prose h2 + * { margin-top: 0.9rem; }
.prose a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { color: var(--accent); }
.prose ul { padding-left: 1.6rem; }
.prose li + li { margin-top: 0.6rem; }
.prose blockquote { margin-top: 1.8rem; padding-left: 1.4rem; border-left: 3px solid var(--text); font-style: italic; }
.prose strong { font-weight: 600; }

/* Author's note box (note_en / note_es), 2026-11-03 */
.author-note { margin: 2rem 0 2.5rem; padding: 1.25rem 1.5rem; background: var(--border); border-radius: 6px; font-family: var(--sans); font-size: 0.95rem; line-height: 1.6; color: var(--text-2); }
.author-note p { margin: 0; }
.author-note p + p { margin-top: 0.75rem; }
.author-note strong { font-weight: 600; color: var(--text); }

/* Collapsible section (+++ Label … +++), 2026-11-03 */
.prose details.eg-details { margin-top: 1.8rem; padding: 0 1.25rem; border: 1px solid var(--border-2); border-radius: 6px; }
.prose details.eg-details summary { cursor: pointer; padding: 0.9rem 0; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; color: var(--text); }
.prose details.eg-details[open] { padding-bottom: 1.25rem; }
.prose details.eg-details[open] summary { border-bottom: 1px solid var(--border-2); }

/* Article foot */
.article-foot { margin-top: 3.5rem; }

.author-card {
  display: flex; align-items: center; gap: 1rem;
  margin-top: 2rem; padding: 1.75rem 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.author-card-avatar { width: 4rem; height: 4rem; font-size: 1.1rem; }
.author-card-name { font-size: 1.05rem; font-weight: 600; }
.author-card-bio { font-family: var(--serif); font-size: 1rem; color: var(--text-2); margin-top: 0.15rem; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 2.5rem; }
.pager-link { display: flex; flex-direction: column; gap: 0.35rem; text-decoration: none; }
.pager-next { text-align: right; }
.pager-label { font-size: 0.8rem; color: var(--text-2); }
.pager-title { font-size: 1rem; line-height: 1.35; color: var(--text); font-weight: 700; letter-spacing: -0.01em; transition: color 0.12s ease; }
.pager-link:hover .pager-title { color: var(--accent); }

/* Index feed, grouped by the same sections as the sidebar */
.feed-head h1 { font-family: var(--sans); font-weight: 700; font-size: clamp(2rem, 4.5vw, 2.625rem); letter-spacing: -0.016em; line-height: 1.15; }
.feed-head .lede { font-family: var(--serif); font-size: 1.2rem; }
.feed-by { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.25rem; font-size: 0.875rem; color: var(--text-2); }

.entries { margin-top: 2.5rem; }
.entry-group + .entry-group { margin-top: 3rem; }
.entry-section {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3);
  padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-2);
  scroll-margin-top: calc(var(--top-h) + 1rem);
}
.entry { display: block; padding: 1.6rem 0; text-decoration: none; border-bottom: 1px solid var(--border); }
.entry h3 { font-family: var(--sans); font-weight: 700; font-size: 1.375rem; line-height: 1.25; letter-spacing: -0.016em; color: var(--text); text-wrap: balance; }
.entry:hover h3 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.entry-excerpt {
  font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; color: var(--text-2); margin-top: 0.5rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.entry-meta { margin-top: 0.75rem; font-size: 0.85rem; color: var(--text-2); display: flex; gap: 0.4rem; }
.entries-empty { color: var(--text-2); padding: 2rem 0; }

/* Foot */
.site-foot {
  border-top: 1px solid var(--border);
  padding: 1.5rem clamp(1.25rem, 4vw, 2rem);
  display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-2);
}

/* ─── Narrow screens: contents becomes a drawer ─── */
.scrim { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .top-menu {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 2.25rem; height: 2.25rem; margin-left: -0.5rem; padding: 0.5rem;
    background: none; border: 0; border-radius: 6px; cursor: pointer;
  }
  .top-menu:hover { background: var(--bg-subtle); }
  .top-menu span { display: block; height: 1.5px; background: var(--text); border-radius: 1px; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: min(20rem, 86vw); height: 100dvh;
    padding-top: 1.5rem; border-right: 1px solid var(--border);
    transform: translateX(-102%); transition: transform 0.22s ease;
  }
  .sidebar-open .sidebar { transform: none; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 45;
    background: rgba(0, 0, 0, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
  }
  .sidebar-open .scrim { opacity: 1; pointer-events: auto; }
  .sidebar-open { overflow: hidden; }
  @media (prefers-reduced-motion: reduce) { .sidebar, .scrim { transition: none; } }

  .page { padding-top: 2.25rem; }
  .byline { flex-wrap: wrap; }
  .share { margin-left: 0; width: 100%; padding-top: 0.25rem; }
  .prose { font-size: 1.125rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-next { text-align: left; }
}
