/*
Theme Name: Za Gorizontom
Theme URI: https://my-russian-journey.lovable.app
Author: LeoWorks
Author URI: https://github.com/rQC2Qm7p7U
Description: Личный блог об эмиграции из России — тёплый редакционный дизайн с типографикой Merriweather + Inter.
Version: 1.0.1
Requires at least: 6.9
Tested up to: 6.9
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: za-gorizontom
Tags: blog, one-column, two-columns, custom-menu, featured-images, translation-ready
*/

/* ── CSS Variables (Design Tokens) ── */
:root {
  --bg: hsl(40, 33%, 96%);
  --fg: hsl(20, 10%, 15%);
  --card: hsl(40, 30%, 98%);
  --primary: hsl(152, 32%, 28%);
  --primary-fg: hsl(40, 33%, 96%);
  --secondary: hsl(32, 45%, 90%);
  --muted: hsl(35, 20%, 91%);
  --muted-fg: hsl(20, 8%, 45%);
  --accent: hsl(28, 70%, 55%);
  --accent-fg: hsl(40, 33%, 96%);
  --border: hsl(35, 20%, 85%);
  --radius: 0.5rem;
  --font-serif: 'Merriweather', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
}

/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 767px) {
  body {
    line-height: 1.7;
    /* Increased for better readability on mobile */
  }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  line-height: 1.2;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ── Layout ── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media (max-width: 479px) {
  .container {
    padding: 0 1.25rem;
    /* Slightly larger padding on small screens to prevent edge hugging */
  }
}

/* ── Header ── */
.site-header {
  border-bottom: 1px solid var(--border);
  background: hsla(40, 30%, 98%, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.site-brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.site-brand:hover {
  color: var(--primary);
}

/* Nav */
.main-nav ul {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.main-nav a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-fg);
  transition: color 0.2s;
}

.main-nav a:hover {
  color: var(--fg);
}

.main-nav .nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: opacity 0.2s;
}

.main-nav .nav-cta:hover {
  opacity: 0.9;
}

/* ── Hero ── */
.hero {
  position: relative;
  height: 70vh;
  min-height: 500px;
  overflow: hidden;
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, hsla(20, 10%, 15%, 0.7), hsla(20, 10%, 15%, 0.3), transparent);
}

.hero-content {
  position: relative;
  z-index: 10;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: 4rem;
}

.hero-tag {
  color: var(--secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  font-weight: 700;
  color: var(--primary-fg);
  max-width: 42rem;
  line-height: 1.1;
  /* Tighter line height for large headings */
}

.hero p.hero-desc {
  color: hsla(32, 45%, 90%, 0.8);
  font-size: 1.125rem;
  max-width: 32rem;
  margin-top: 1rem;
}

/* ── About ── */
.about-section {
  padding: 4rem 0;
  max-width: 48rem;
  margin: 0 auto;
  text-align: center;
}

.about-section p {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-style: italic;
  line-height: 1.8;
  color: var(--fg);
}

/* ── Articles Grid ── */
.articles-section {
  padding-bottom: 5rem;
}

.articles-section h2 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 2.5rem;
}

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem 2rem;
}

@media (min-width: 768px) {
  .articles-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Article Card */
.article-card {
  display: block;
}

.article-card:hover .article-card__img {
  transform: scale(1.05);
}

.article-card__thumb {
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.article-card__img {
  width: 100%;
  height: 14rem;
  object-fit: cover;
  transition: transform 0.5s;
}

.article-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.article-card__tag {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.article-card__date {
  font-size: 0.75rem;
  color: var(--muted-fg);
}

.article-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.5rem;
  transition: color 0.2s;
}

.article-card:hover .article-card__title {
  color: var(--primary);
}

.article-card__excerpt {
  font-size: 0.875rem;
  color: var(--muted-fg);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Single Article ── */
.single-article {
  padding: 2rem 0 5rem;
}

.single-article .back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted-fg);
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.single-article .back-link:hover {
  color: var(--fg);
}

.single-hero-img {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto 2rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.single-hero-img img {
  width: 100%;
  height: 40vh;
  min-height: 300px;
  object-fit: cover;
}

.single-content {
  max-width: 42rem;
  margin: 0 auto;
}

.single-content .entry-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.single-content .entry-tag {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.single-content .entry-date {
  font-size: 0.75rem;
  color: var(--muted-fg);
}

.single-content h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  /* Adjusted for better mobile scaling */
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 2rem;
  line-height: 1.2;
}

.single-content .entry-content p {
  font-size: 1.0625rem;
  color: hsla(20, 10%, 15%, 0.85);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

/* Post Nav */
.post-navigation {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding-top: 2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.post-navigation a {
  display: block;
}

.post-navigation .nav-label {
  font-size: 0.75rem;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-navigation .nav-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
  margin-top: 0.25rem;
  transition: color 0.2s;
}

.post-navigation a:hover .nav-title {
  color: var(--primary);
}

.post-navigation .nav-next {
  text-align: right;
}

/* ── Contact Section ── */
.contact-section {
  background: var(--primary);
  color: var(--primary-fg);
  padding: 5rem 0;
}

.contact-inner {
  max-width: 42rem;
  margin: 0 auto;
  text-align: center;
}

.contact-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1rem;
  opacity: 0.8;
}

.contact-section h2 {
  font-size: clamp(1.875rem, 3.5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.contact-section p {
  color: hsla(40, 33%, 96%, 0.75);
  font-size: 1.125rem;
  margin-bottom: 2.5rem;
}

.contact-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9375rem;
  transition: opacity 0.2s, background 0.2s;
}

.contact-btn--primary {
  background: var(--primary-fg);
  color: var(--primary);
}

.contact-btn--primary:hover {
  opacity: 0.9;
}

.contact-btn--outline {
  border: 1px solid hsla(40, 33%, 96%, 0.3);
  color: var(--primary-fg);
}

.contact-btn--outline:hover {
  background: hsla(40, 33%, 96%, 0.1);
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--muted-fg);
}

.site-footer .footer-brand {
  font-family: var(--font-serif);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--fg);
}

/* ── Skip Link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0.5rem;
  z-index: 100;
  background: var(--primary);
  color: var(--primary-fg);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0.5rem;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  word-wrap: normal !important;
}

.screen-reader-text:focus {
  clip: auto !important;
  clip-path: none;
  display: block;
  height: auto;
  width: auto;
  margin: 0;
  overflow: visible;
  padding: 0.5rem 1rem;
  position: absolute;
  z-index: 100;
}

/* ── Burger Menu Toggle ── */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 60;
}

.hamburger-line {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--fg);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.is-active .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Container variant ── */
.container--narrow {
  max-width: 56rem;
}

/* ── Archive / Search ── */
.articles-section--archive {
  padding-top: 3rem;
}

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

.archive-header h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--fg);
}

.archive-description {
  font-size: 1rem;
  color: var(--muted-fg);
  margin-top: 0.5rem;
}

/* ── Pagination ── */
.pagination-wrap {
  margin-top: 2.5rem;
}

.pagination-wrap .nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-wrap .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted-fg);
  transition: background 0.2s, color 0.2s;
}

.pagination-wrap .page-numbers:hover {
  background: var(--muted);
  color: var(--fg);
}

.pagination-wrap .page-numbers.current {
  background: var(--primary);
  color: var(--primary-fg);
}

/* ── 404 Page ── */
.error-404 {
  padding: 6rem 0;
  text-align: center;
}

.error-404__title {
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
  font-family: var(--font-serif);
}

.error-404__subtitle {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--fg);
  margin-top: 1rem;
}

.error-404__desc {
  font-size: 1.125rem;
  color: var(--muted-fg);
  max-width: 32rem;
  margin: 1rem auto 0;
  line-height: 1.6;
}

/* ── Line-clamp fix ── */
.article-card__excerpt {
  line-clamp: 3;
}

/* ── Entry content block styles ── */
.entry-content h2 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin: 2.5rem 0 1rem;
}

.entry-content h3 {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  margin: 2rem 0 0.75rem;
}

.entry-content ul,
.entry-content ol {
  margin: 0 0 1.5rem 1.5rem;
}

.entry-content li {
  margin-bottom: 0.5rem;
  line-height: 1.8;
}

.entry-content blockquote {
  border-left: 4px solid var(--accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--muted-fg);
  background: var(--card);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.entry-content img {
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

.entry-content a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  transition: color 0.2s;
}

.entry-content a:hover {
  color: var(--accent);
}

.entry-content pre {
  background: var(--fg);
  color: var(--bg);
  padding: 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.6;
}

.entry-content code {
  background: var(--muted);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.entry-content pre code {
  background: none;
  padding: 0;
}

/* ── WP Block alignments ── */
.alignwide {
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
}

.alignfull {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.aligncenter {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.alignleft {
  float: left;
  margin-right: 1.5rem;
  margin-bottom: 1rem;
}

.alignright {
  float: right;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

/* ── Responsive ── */

/* — Tablet landscape and smaller (< 1024px) — */
@media (max-width: 1023px) {
  .hero {
    height: 60vh;
  }

  .hero h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
  }

  .contact-section {
    padding: 4rem 0;
  }
}

/* — Tablet portrait and smaller (< 768px) — */
@media (max-width: 767px) {

  /* Burger menu visible */
  .menu-toggle {
    display: flex;
  }

  .main-nav {
    position: fixed;
    top: 0;
    right: 0;
    width: 80%;
    max-width: 320px;
    height: 100vh;
    height: 100dvh;
    background: var(--card);
    box-shadow: -4px 0 24px hsla(0, 0%, 0%, 0.15);
    padding: 5rem 2rem 2rem;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 55;
    overflow-y: auto;
  }

  .main-nav.is-open {
    transform: translateX(0);
  }

  .main-nav ul {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .main-nav a {
    font-size: 1.125rem;
  }

  .main-nav .nav-cta {
    margin-top: 0.5rem;
  }

  /* Body scroll lock */
  body.menu-open {
    overflow: hidden;
  }

  body.menu-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: hsla(0, 0%, 0%, 0.4);
    z-index: 52;
  }

  /* Hero */
  .hero {
    height: 55vh;
    min-height: 360px;
  }

  .hero-content {
    padding-bottom: 2.5rem;
  }

  .hero h1 {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
  }

  .hero p.hero-desc {
    font-size: 1rem;
  }

  /* About */
  .about-section {
    padding: 2.5rem 0;
  }

  .about-section p {
    font-size: 1rem;
  }

  /* Articles */
  .articles-section h2 {
    margin-bottom: 1.5rem;
  }

  .articles-grid {
    gap: 2rem;
  }

  /* Single */
  .single-hero-img img {
    height: 30vh;
    min-height: 220px;
  }

  .single-content h1 {
    font-size: clamp(1.5rem, 5vw, 2.25rem);
  }

  /* Post navigation */
  .post-navigation {
    grid-template-columns: 1fr;
  }

  .post-navigation .nav-next {
    text-align: left;
  }

  /* Contact */
  .contact-section {
    padding: 3.5rem 0;
  }

  .contact-section h2 {
    font-size: clamp(1.5rem, 5vw, 2rem);
  }

  /* Footer */
  .site-footer .container {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  /* Block alignments */
  .alignleft,
  .alignright {
    float: none;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }
}

/* — Small phones (< 480px) — */
@media (max-width: 479px) {
  .container {
    padding: 0 1rem;
  }

  .hero {
    height: 50vh;
    min-height: 300px;
  }

  .hero-content {
    padding-bottom: 2rem;
  }

  .hero h1 {
    font-size: 2rem;
    /* Adjusted down from 1.75rem for better scaling */
  }

  .hero p.hero-desc {
    font-size: 0.9375rem;
  }

  .hero-tag {
    font-size: 0.75rem;
  }

  .article-card__img {
    height: 10rem;
  }

  .site-header .container {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .site-brand {
    font-size: 1.1rem;
  }

  .contact-btn {
    width: 100%;
    justify-content: center;
  }

  .error-404 {
    padding: 4rem 0;
  }
}