:root {
  color-scheme: light dark;
  --bg: #faf8f4;
  --fg: #201d18;
  --muted: #6b6459;
  --card-bg: #fff;
  --border: #e2ddd3;
  --accent: #8a4b2e;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1916;
    --fg: #ece8e1;
    --muted: #a39a8b;
    --card-bg: #24211d;
    --border: #3a352d;
    --accent: #d99a6c;
  }
}

* { box-sizing: border-box; }

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

header.site-header {
  padding: 2.5rem 1.5rem 1.5rem;
  max-width: 760px;
  margin: 0 auto;
}

.site-logo {
  width: 200px;
  height: 132px;
  margin: 0 0 0.5rem -6px;
  background-color: var(--fg);
  -webkit-mask: url('assets/vizija-logo.png') no-repeat center / contain;
  mask: url('assets/vizija-logo.png') no-repeat center / contain;
}

header.site-header .about {
  color: var(--muted);
  font-size: 1rem;
}

.site-nav {
  margin-top: 0.75rem;
}

.site-nav a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.section-heading {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 2rem 0 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.4rem;
}

.section-heading:first-child {
  margin-top: 0;
}

.issue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.5rem;
}

.issue-card .issue-description {
  padding: 0 0.7rem 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.issue-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.issue-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.issue-card img {
  width: 100%;
  display: block;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  background: var(--border);
}

.issue-card .issue-title {
  padding: 0.6rem 0.7rem;
  font-size: 0.95rem;
}

.issue-card .issue-pages {
  padding: 0 0.7rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

/* viewer */

.viewer-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0.5rem;
}

.viewer-header a.back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.viewer-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.viewer-title-block {
  min-width: 0;
}

.viewer-title-block .issue-description {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.viewer-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 2rem;
}

.page-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.page-stage button {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 50%;
  width: 2.4rem;
  height: 2.4rem;
  font-size: 1.1rem;
  cursor: pointer;
  flex: none;
}

.page-stage button:disabled {
  opacity: 0.3;
  cursor: default;
}

.page-image-wrap {
  flex: 1;
  text-align: center;
  min-height: 0;
  max-width: 100%;
  overflow: auto;
}

.page-image-wrap img {
  max-width: 100%;
  max-height: 80vh;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: zoom-in;
  background: var(--card-bg);
}

.page-image-wrap img.zoomed {
  max-width: none;
  max-height: none;
  width: auto;
  cursor: grab;
}

.page-image-wrap img.zoomed:active {
  cursor: grabbing;
}

.page-counter {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.thumb-strip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}

.thumb-strip img {
  height: 90px;
  border: 2px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  flex: none;
}

.thumb-strip img.active {
  border-color: var(--accent);
}

/* about page */

.about-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
}

.about-main p {
  margin: 0 0 1rem;
}

.about-main a {
  color: var(--accent);
}
