:root {
  --bg: #f4f5f8;
  --paper: #ffffff;
  --ink: #151922;
  --muted: #5c6570;
  --line: #dfe3ea;
  --accent: #3d6fd8;
  --max: 980px;
  --gallery-strip-height: 118px;
}

html {
  color-scheme: light;
}

body.view-post {
  --bg: #0f1115;
  --paper: #171a21;
  --ink: #f1f3f5;
  --muted: #9aa3ad;
  --line: #2a2f3a;
  --accent: #5c8dff;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}

.wrap {
  width: min(calc(100% - 32px), var(--max));
  margin: 0 auto;
}

header {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(
    in srgb,
    var(--bg) 90%,
    transparent
  );
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand {
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  gap: 18px;
  font-size: 0.95rem;
  color: var(--muted);
}

.nav-links a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

main {
  padding: 72px 0 96px;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 48px;
  align-items: start;
  margin-bottom: 72px;
}

h1 {
  font-size: clamp(2.7rem, 8vw, 5.8rem);
  line-height: 0.94;
  margin: 0 0 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.lead {
  font-size: 1.15rem;
  max-width: 40rem;
  color: var(--muted);
  margin: 0 0 28px;
}

.cta-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.button {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: inherit;
}

.button.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.note {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 24px;
  border-radius: 18px;
}

.note small {
  display: block;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 72px;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.section {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 28px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.section h3 {
  margin: 0;
  font-size: 1.1rem;
}

.section p {
  margin: 0;
  color: var(--muted);
}

footer {
  padding: 28px 0 44px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.post {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 28px;
  margin-bottom: 32px;
}

.post-date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-title {
  font-size: 1.4rem;
  margin: 0 0 16px;
  font-weight: 600;
}

.post-title a {
  text-decoration: none;
  color: inherit;
}

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

.post-content {
  line-height: 1.8;
  margin-bottom: 20px;
}

.post-content p {
  margin: 0 0 16px;
}

.post-images {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.post-images {
  align-items: stretch;
}

.post-preview-gallery-hit {
  display: block;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  border: 1px solid var(--line);
}

.post-preview-gallery-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.post-images img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.pagination {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pagination-prev,
.pagination-next {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.pagination-prev:hover,
.pagination-next:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination-numbers {
  display: flex;
  gap: 6px;
  align-items: center;
}

.pagination-link,
.pagination-current {
  display: inline-block;
  min-width: 36px;
  padding: 8px 12px;
  text-align: center;
  border-radius: 6px;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  transition: all 0.2s ease;
}

.pagination-link {
  cursor: pointer;
}

.pagination-link:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination-current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}

/* =========================
   GALLERY
========================= */

.gallery-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.gallery-item {
  cursor: pointer;
  overflow: hidden;
  background: #0a0c10;
  border: 1px solid var(--line);
}

.gallery-thumb {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
  transition:
    transform 0.25s ease,
    opacity 0.25s ease;
}

.gallery-thumb:hover {
  transform: scale(1.03);
  opacity: 0.96;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: #000;
  color: #f1f3f5;
}

.gallery-modal.hidden {
  display: none;
}

.gallery-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  cursor: pointer;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
}

.gallery-stage {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--gallery-strip-height);
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 20px);
  padding: 56px 12px 8px;
  pointer-events: none;
}

.gallery-stage > * {
  pointer-events: auto;
}

.gallery-image-wrap {
  flex: 1;
  min-width: 0;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-full {
  max-width: 100%;
  max-height: calc(
    100vh - var(--gallery-strip-height) - 72px
  );
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 0 48px rgba(0, 0, 0, 0.75);
}

.gallery-arrow {
  flex-shrink: 0;
  align-self: center;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 40px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  cursor: pointer;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.gallery-arrow:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.06);
}

.gallery-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.gallery-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gallery-strip {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 14px 16px 18px;
  min-height: var(--gallery-strip-height);
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.gallery-strip-inner {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 10px;
  width: max-content;
  margin-inline: auto;
}

.gallery-strip-thumb {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  object-fit: cover;
  cursor: pointer;
  opacity: 0.45;
  border: 2px solid transparent;
  transition:
    opacity 0.2s ease,
    border 0.2s ease,
    transform 0.2s ease;
}

.gallery-strip-thumb:hover {
  opacity: 0.85;
  transform: scale(1.03);
}

.gallery-strip-thumb.active {
  opacity: 1;
  border-color: #fff;
}

body.gallery-open {
  overflow: hidden;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 860px) {

  .hero,
  .grid,
  .section,
  .post-images {
    grid-template-columns: 1fr;
  }

  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  main {
    padding-top: 44px;
  }

  .gallery-thumb {
    height: 200px;
  }

  .gallery-full {
    max-height: calc(
      100vh - var(--gallery-strip-height) - 100px
    );
  }

  .gallery-arrow {
    width: 48px;
    height: 48px;
    font-size: 30px;
  }

  .gallery-stage {
    padding-top: 52px;
    gap: 6px;
  }

  .gallery-strip-thumb {
    width: 64px;
    height: 64px;
  }
}