/*
Theme Name: Predki
Theme URI: https://predki.org
Author: predki.org
Description: Газетная тема для генеалогического блога Предки
Version: 1.0.0
License: GNU General Public License v2 or later
Text Domain: predki
*/

/* ==========================================
   RESET & BASE
   ========================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg:      #f5f0e8;
  --color-surface: #f5f0e8;
  --color-text:    #111111;
  --color-muted:   #555555;
  --color-border:  #111111;
  --color-border-light: #ccc5b5;
  --color-accent:  #111111;

  --font-serif: 'Playfair Display', 'Times New Roman', Georgia, serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  --measure: 680px;
  --gap: clamp(1.5rem, 4vw, 2.5rem);
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  filter: grayscale(20%);
}

a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration: none;
}

/* ==========================================
   LAYOUT
   ========================================== */

.site-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container--narrow {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================
   HEADER
   ========================================== */

.site-header {
  background: var(--color-bg);
  border-bottom: 3px double var(--color-border);
  text-align: center;
  padding: 1.25rem 1.5rem .75rem;
}

.site-header__meta {
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: .5rem;
}

.site-branding {
  text-decoration: none;
  display: block;
  margin-bottom: .5rem;
}

.site-title {
  font-family: var(--font-serif);
  font-size: clamp(2.8rem, 8vw, 5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--color-text);
  display: block;
}

.site-tagline {
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--color-muted);
  display: block;
  margin-top: .4rem;
}

/* Nav */

.site-nav {
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: .4rem 0;
  margin-top: .75rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0;
}

.site-nav a {
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-text);
  text-decoration: none;
  padding: .2rem 1.25rem;
  border-right: 1px solid var(--color-border);
}

.site-nav a:last-child {
  border-right: none;
}

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

/* Burger (mobile) */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  color: var(--color-text);
}

@media (max-width: 560px) {
  .nav-toggle { display: flex; position: absolute; right: 1rem; top: 1rem; }

  .site-nav {
    display: none;
    flex-direction: column;
    align-items: center;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { border-right: none; border-bottom: 1px solid var(--color-border-light); width: 100%; text-align: center; }
  .site-nav a:last-child { border-bottom: none; }
}

/* ==========================================
   HERO / FEATURED (homepage)
   ========================================== */

.featured-story {
  border-bottom: 2px solid var(--color-border);
  padding: 2rem 0 1.75rem;
}

.featured-story__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.featured-story__img {
  border: 1px solid var(--color-border);
  aspect-ratio: 4/3;
  overflow: hidden;
}

.featured-story__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-story__img--placeholder {
  background: #ddd6c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
}

.featured-story__cat {
  font-size: .65rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--color-text);
  display: inline-block;
  padding-bottom: .1rem;
  margin-bottom: .75rem;
  text-decoration: none;
  color: var(--color-text);
}

.featured-story__title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: .75rem;
}

.featured-story__title a {
  text-decoration: none;
  color: var(--color-text);
}

.featured-story__title a:hover {
  text-decoration: underline;
}

.featured-story__meta {
  font-size: .72rem;
  color: var(--color-muted);
  margin-bottom: .85rem;
  letter-spacing: .03em;
}

.featured-story__excerpt {
  font-size: .9rem;
  line-height: 1.75;
  color: #333;
}

@media (max-width: 680px) {
  .featured-story__inner { grid-template-columns: 1fr; }
}

/* ==========================================
   POST GRID — NEWSPAPER COLUMNS
   ========================================== */

.posts-section {
  padding: 1.75rem 0;
}

.posts-section__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--color-border);
}

.posts-section__title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.posts-section__link {
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-muted);
}

/* Newspaper column grid */

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-top: 1px solid var(--color-border);
}

@media (max-width: 720px) {
  .post-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .post-grid { grid-template-columns: 1fr; }
}

/* ==========================================
   POST CARD — NEWSPAPER STYLE
   ========================================== */

.post-card {
  padding: 1.25rem;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.post-card:nth-child(3n) {
  border-right: none;
}

.post-card__thumb {
  border: 1px solid var(--color-border);
  aspect-ratio: 3/2;
  overflow: hidden;
  margin-bottom: .85rem;
}

.post-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.post-card__meta {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}

.post-card__cat {
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid var(--color-text);
  padding-bottom: .05rem;
}

.post-card__date {
  font-size: .68rem;
  color: var(--color-muted);
}

.post-card__title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: .5rem;
}

.post-card__title a {
  color: var(--color-text);
  text-decoration: none;
}

.post-card__title a:hover {
  text-decoration: underline;
}

.post-card__excerpt {
  font-size: .82rem;
  color: #444;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================
   SINGLE POST
   ========================================== */

.entry-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 2rem;
  text-align: center;
}

.entry-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.entry-meta__cat {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-text);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 1.5px solid var(--color-text);
  padding-bottom: .1rem;
}

.entry-meta__sep {
  color: var(--color-border-light);
}

.entry-meta__date,
.entry-meta__read {
  font-size: .75rem;
  color: var(--color-muted);
}

.entry-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  max-width: 820px;
  margin: 0 auto .85rem;
}

.entry-subtitle {
  font-size: 1rem;
  color: var(--color-muted);
  max-width: 600px;
  margin: 0 auto;
  font-style: italic;
}

/* Featured image */

.entry-cover {
  margin-bottom: 2.5rem;
  border: 1px solid var(--color-border);
}

.entry-cover img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
}

/* Content typography */

.entry-content {
  font-size: 1rem;
  line-height: 1.8;
}

.entry-content p {
  margin-bottom: 1.4rem;
}

.entry-content h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.5rem 0 .85rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--color-border);
}

.entry-content h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 2rem 0 .6rem;
}

.entry-content blockquote {
  border-left: 3px solid var(--color-text);
  padding: .5rem 0 .5rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  color: var(--color-muted);
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.entry-content figure {
  margin: 2rem 0;
  border: 1px solid var(--color-border);
}

.entry-content figcaption {
  font-size: .75rem;
  color: var(--color-muted);
  text-align: center;
  padding: .4rem;
  border-top: 1px solid var(--color-border-light);
  letter-spacing: .04em;
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0;
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1.4rem;
}

.entry-content li {
  margin-bottom: .35rem;
}

/* ==========================================
   TAGS
   ========================================== */

.entry-tags {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
}

.entry-tags__label {
  font-size: .68rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-right: .25rem;
}

.entry-tags a {
  font-size: .72rem;
  letter-spacing: .05em;
  padding: .2rem .6rem;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-muted);
  transition: background .15s, color .15s;
}

.entry-tags a:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* ==========================================
   AUTHOR BOX
   ========================================== */

.post-author {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid var(--color-border);
  margin-top: 2.5rem;
}

.post-author__avatar {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  object-fit: cover;
  filter: grayscale(100%);
  border: 1px solid var(--color-border);
}

.post-author__name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: .2rem;
}

.post-author__bio {
  font-size: .82rem;
  color: var(--color-muted);
  line-height: 1.55;
}

/* ==========================================
   PREV / NEXT NAVIGATION
   ========================================== */

.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: 2.5rem;
  border: 1px solid var(--color-border);
}

.post-nav__item {
  padding: 1rem 1.25rem;
  text-decoration: none;
  display: block;
  transition: background .15s;
}

.post-nav__item:first-child {
  border-right: 1px solid var(--color-border);
}

.post-nav__item:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.post-nav__item:hover .post-nav__label,
.post-nav__item:hover .post-nav__title {
  color: var(--color-bg);
}

.post-nav__label {
  font-size: .65rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: .3rem;
}

.post-nav__title {
  font-family: var(--font-serif);
  font-size: .95rem;
  color: var(--color-text);
  line-height: 1.3;
}

.post-nav__item--next {
  text-align: right;
}

@media (max-width: 560px) {
  .post-nav { grid-template-columns: 1fr; }
  .post-nav__item:first-child { border-right: none; border-bottom: 1px solid var(--color-border); }
}

/* ==========================================
   ARCHIVE LAYOUT
   ========================================== */

.archive-layout {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 3rem;
  align-items: start;
  padding: 2rem 0;
}

@media (max-width: 860px) {
  .archive-layout { grid-template-columns: 1fr; }
}

/* ==========================================
   WIDGETS / SIDEBAR
   ========================================== */

.widget {
  margin-bottom: 2rem;
  border: 1px solid var(--color-border);
  padding: 1rem 1.1rem;
}

.widget__title {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--color-text);
  margin-bottom: .85rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--color-border);
  font-weight: 700;
}

.widget ul {
  list-style: none;
}

.widget ul li {
  padding: .35rem 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: .85rem;
}

.widget ul li:last-child {
  border-bottom: none;
}

/* Tag cloud */

.widget_tag_cloud .tagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.widget_tag_cloud .tagcloud a {
  font-size: .72rem !important;
  padding: .2rem .55rem;
  border: 1px solid var(--color-border);
  text-decoration: none;
  color: var(--color-muted);
  letter-spacing: .04em;
  transition: background .15s, color .15s;
}

.widget_tag_cloud .tagcloud a:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* ==========================================
   PAGINATION
   ========================================== */

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  margin-top: 2rem;
  border: 1px solid var(--color-border);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 38px;
  padding: 0 .75rem;
  font-size: .82rem;
  text-decoration: none;
  border-right: 1px solid var(--color-border);
  color: var(--color-muted);
  transition: background .15s, color .15s;
}

.pagination a:last-child,
.pagination span:last-child {
  border-right: none;
}

.pagination a:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.pagination .current {
  background: var(--color-text);
  color: var(--color-bg);
}

/* ==========================================
   SEARCH FORM
   ========================================== */

.search-form {
  display: flex;
  border: 1px solid var(--color-border);
}

.search-form input[type="search"] {
  flex: 1;
  border: none;
  outline: none;
  padding: .55rem .85rem;
  font-size: .85rem;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-sans);
}

.search-form button {
  border: none;
  border-left: 1px solid var(--color-border);
  background: var(--color-text);
  color: var(--color-bg);
  padding: 0 1rem;
  cursor: pointer;
  font-size: .8rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: var(--font-sans);
  transition: opacity .15s;
}

.search-form button:hover {
  opacity: .8;
}

/* ==========================================
   FOOTER
   ========================================== */

.site-footer {
  border-top: 3px double var(--color-border);
  padding: 1.25rem 1.5rem;
  text-align: center;
  background: var(--color-bg);
  margin-top: auto;
}

.site-footer__copy {
  font-size: .72rem;
  color: var(--color-muted);
  letter-spacing: .06em;
}

.site-footer__copy a {
  color: var(--color-text);
}

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: .4rem;
}

.site-footer__links a {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-decoration: none;
}

.site-footer__links a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* ==========================================
   UTILITIES
   ========================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
