/* ============================================
   Blog — post pages + index cards
   Extends the design tokens in style.css
   ============================================ */

/* --- Index: make cards real links, give them breathing room --- */
.blog-preview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

a.blog-card {
  display: block;
  text-decoration: none;
  color: inherit;
}

.draft-tag,
.post-draft-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-hover);
  background: var(--accent-light);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* --- Post page --- */
.post {
  padding: calc(var(--nav-height) + 4.5rem) 0 5rem;
  background: var(--bg);
  min-height: 100vh;
}

.post-container {
  max-width: 680px;
}

.post-back {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-softer);
  margin-bottom: 2.25rem;
  letter-spacing: 0.01em;
}

.post-back:hover {
  color: var(--accent);
}

.post-header {
  margin-bottom: 2.5rem;
}

.post-date {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--text-softer);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 0.6rem;
}

.post-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* --- Article body: serif, generous, essayish --- */
.post-body {
  font-family: var(--sans);
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
}

.post-body p {
  margin-bottom: 1.5rem;
}

.post-body a {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-body h2 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
}

.post-body h3 {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin: 2.25rem 0 0.75rem;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.75rem 0;
}

.post-body figure {
  margin: 1.75rem 0;
}

.post-body figcaption {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--text-softer);
  text-align: center;
  margin-top: 0.6rem;
}

.post-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin: 1.75rem 0;
  color: var(--text-soft);
  font-style: italic;
}

/* Pull quote: larger than body text, with the attribution on its own line. */
.post-body .pullquote {
  margin: 2.25rem 0;
  color: var(--text);
}
.post-body .pullquote p {
  font-size: 1.35rem;
  line-height: 1.5;
  margin-bottom: 0.7rem;
}
.post-body .pullquote cite {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-softer);
  letter-spacing: 0.02em;
}

.post-body ul,
.post-body ol {
  margin: 0 0 1.5rem 1.4rem;
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.75rem 0;
}

/* --- Narrow single figure (portrait photos) --- */
.post-body .fig-narrow {
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Results table (the TTT rankings) --- */
.post-body .ttt-results {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.95rem;
  margin: 1.75rem 0;
}
.post-body .ttt-results th,
.post-body .ttt-results td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
.post-body .ttt-results th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-softer);
  font-weight: 600;
}
.post-body .ttt-results td:first-child,
.post-body .ttt-results th:first-child {
  width: 3.5rem;
  color: var(--text-softer);
}
.post-body .ttt-results td:last-child,
.post-body .ttt-results th:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.post-body .ttt-results .winner td {
  background: var(--accent-light);
  color: var(--text);
  font-weight: 600;
}
.post-body .ttt-results .winner td:first-child { color: var(--accent-hover); }

/* --- Logo (announcement posts) --- */
.post-body .post-logo {
  display: block;
  width: auto;
  max-width: 320px;
  height: auto;
  margin: 1.75rem 0;
  border-radius: 0;
}

/* --- Side-by-side photos (e.g. two graduation shots) --- */
.post-figs {
  display: flex;
  gap: 1rem;
  margin: 1.75rem 0;
}
.post-figs > * {
  flex: 1;
  min-width: 0;
  margin-top: 0;
  margin-bottom: 0;
}
.post-figs figure { margin: 0; }
.post-figs img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
@media (max-width: 560px) {
  .post-figs { flex-direction: column; }
}

/* --- Two photos sharing one caption --- */
.post-body .fig-pair { margin: 1.75rem 0; }
.post-body .fig-pair-imgs {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.post-body .fig-pair-imgs > * { flex: 1; min-width: 0; margin: 0; }
.post-body .fig-pair-imgs img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
@media (max-width: 560px) {
  .post-body .fig-pair-imgs { flex-direction: column; }
}

/* --- Image placeholder (until real art lands) --- */
.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-softer);
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 3rem 1.25rem;
  margin: 1.75rem 0;
}

@media (max-width: 640px) {
  .post-title {
    font-size: 1.9rem;
  }
  .post-body {
    font-size: 1rem;
  }
}

/* ============================================
   Ledger — post list (home teaser + blog page)
   ============================================ */
.postlist {
  list-style: none;
}

.postlist-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.25rem;
  align-items: baseline;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}

.postlist li:last-child .postlist-row {
  border-bottom: 1px solid var(--border);
}

.postlist-date {
  font-family: var(--sans);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-softer);
  padding-top: 0.35rem;
  white-space: nowrap;
}

.postlist-main {
  display: block;
}

.postlist-title {
  display: block;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
  transition: color 0.18s ease;
}

.postlist-sum {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.65;
}

.postlist-row:hover .postlist-title { color: var(--accent-hover); }

.blog-all-link {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-hover);
  text-decoration: none;
  margin-top: 1.5rem;
}
.blog-all-link:hover { text-decoration: underline; }

/* --- Dedicated blog page --- */
.bloglist {
  padding: calc(var(--nav-height) + 4.5rem) 0 5rem;
  background: var(--bg);
  min-height: 100vh;
}

.bloglist-container {
  max-width: 720px;
}

.bloglist-title {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 1.75rem;
}

.bloglist-intro {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--text-soft);
  line-height: 1.7;
  margin: 0.6rem 0 1.5rem;
}

/* match the Research page's text width (.about-content is 680px) */
.section-blog .blog-preview { max-width: 680px; }

/* Give the section a full viewport of height so a nav jump can scroll it all
   the way to the top — landing the title at the same offset as Research,
   instead of stopping short at the bottom of a short page. */
.section-blog { min-height: 100vh; }

/* Research carried a slightly darker tone (--bg-alt); match the rest of the site. */
.section-research { background: var(--bg); }

/* Шара-бара: left-align the header (title + phonetic + translation) like the
   other pages. The project cards below are left untouched. */
.sharabara-header { text-align: left; }
.sharabara-def { margin-left: 0; margin-right: 0; }

@media (max-width: 560px) {
  .postlist-row { grid-template-columns: 1fr; gap: 0.4rem; }
}

/* Gentle staggered entrance — the .nav-enter class is added by main.js ONLY
   when a section is opened from the nav bar, so manual scrolling never triggers
   it. Skipped entirely when the visitor prefers reduced motion. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes navEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .nav-enter .section-title,
  .nav-enter .section-intro,
  .nav-enter .postlist li,
  .nav-enter .about-content p,
  .nav-enter .sharabara-header,
  .nav-enter .sharabara-row {
    animation: navEnter 0.5s ease both;
  }

  /* Blog: title, intro, then each post cascades */
  .section-blog.nav-enter .section-title { animation-delay: 0.05s; }
  .section-blog.nav-enter .section-intro { animation-delay: 0.11s; }
  .section-blog.nav-enter .postlist li:nth-child(1) { animation-delay: 0.17s; }
  .section-blog.nav-enter .postlist li:nth-child(2) { animation-delay: 0.23s; }
  .section-blog.nav-enter .postlist li:nth-child(3) { animation-delay: 0.29s; }
  .section-blog.nav-enter .postlist li:nth-child(4) { animation-delay: 0.35s; }
  .section-blog.nav-enter .postlist li:nth-child(5) { animation-delay: 0.41s; }
  .section-blog.nav-enter .postlist li:nth-child(6) { animation-delay: 0.47s; }
  .section-blog.nav-enter .postlist li:nth-child(7) { animation-delay: 0.53s; }
  .section-blog.nav-enter .postlist li:nth-child(8) { animation-delay: 0.59s; }

  /* Research: title, then each paragraph */
  .section-research.nav-enter .section-title { animation-delay: 0.05s; }
  .section-research.nav-enter .about-content p:nth-child(1) { animation-delay: 0.11s; }
  .section-research.nav-enter .about-content p:nth-child(2) { animation-delay: 0.17s; }
  .section-research.nav-enter .about-content p:nth-child(3) { animation-delay: 0.23s; }
  .section-research.nav-enter .about-content p:nth-child(4) { animation-delay: 0.29s; }
  .section-research.nav-enter .about-content p:nth-child(5) { animation-delay: 0.35s; }
  .section-research.nav-enter .about-content p:nth-child(6) { animation-delay: 0.41s; }

  /* Шара-бара: dictionary header, then each project row */
  .section-sharabara.nav-enter .sharabara-header { animation-delay: 0.05s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(1) { animation-delay: 0.13s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(2) { animation-delay: 0.20s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(3) { animation-delay: 0.27s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(4) { animation-delay: 0.34s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(5) { animation-delay: 0.41s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(6) { animation-delay: 0.48s; }
  .section-sharabara.nav-enter .sharabara-row:nth-child(7) { animation-delay: 0.55s; }

  /* Home / hero: photo + name, then each tagline line, then the links */
  .section-home.nav-enter .home-header { animation: navEnter 0.55s ease both 0.05s; }
  .section-home.nav-enter .tagline p   { animation: navEnter 0.55s ease both; }
  .section-home.nav-enter .tagline p:nth-child(1) { animation-delay: 0.14s; }
  .section-home.nav-enter .tagline p:nth-child(2) { animation-delay: 0.21s; }
  .section-home.nav-enter .tagline p:nth-child(3) { animation-delay: 0.28s; }
  .section-home.nav-enter .home-links  { animation: navEnter 0.55s ease both 0.36s; }
}

/* See-more chevron: green, and a real button that opens Blog like the nav. */
.scroll-hint {
  color: var(--accent);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.scroll-hint:hover { color: var(--accent-hover); }

/* Hairline between the hero and the blog section. It lives near the bottom of
   the hero, so it shows while scrolling down the homepage but is scrolled
   off-screen (and so invisible) when Blog is opened solo from the nav. It also
   disappears with the hero on the Research / Шара-бара views. */
.section-home::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4.5rem;
  transform: translateX(-50%);
  width: min(680px, 78%);
  height: 1px;
  background: var(--border);
}

/* Blog post pages: gentle entrance on load, echoing the section animations. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes postPageEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .post .post-back   { animation: postPageEnter 0.5s ease both 0.02s; }
  .post .post-header { animation: postPageEnter 0.55s ease both 0.10s; }
  .post .post-body   { animation: postPageEnter 0.6s ease both 0.20s; }
}

/* --- Lightbox: click a photo to open it large --- */
.post-body figure img,
.post-body .fig-pair-imgs img { cursor: zoom-in; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(20, 20, 20, 0.85);
  cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 1.1rem;
  right: 1.25rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.28); }

/* --- Photo grid / collage (masonry columns, no cropping) --- */
.post-body .post-grid {
  column-count: 2;
  column-gap: 1rem;
  margin: 1.75rem 0;
}
.post-body .post-grid figure {
  break-inside: avoid;
  margin: 0 0 1rem;
}
.post-body .post-grid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}
@media (max-width: 560px) {
  .post-body .post-grid { column-count: 1; }
}

/* Small single figure — matches the width of the paired/grid photos */
.post-body .fig-small {
  max-width: 330px;
  margin-left: auto;
  margin-right: auto;
}
