/* ============ ДИЗАЙН-ТОКЕНЫ ============ */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #0a0a0a;
  --text-muted: #6b7280;
  --accent: #ff4a00;
  --accent-contrast: #ffffff;
  --border: rgba(10, 10, 10, 0.1);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.14);
  --radius: 14px;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #141414;
  --text: #f5f5f5;
  --text-muted: #9ca3af;
  --accent: #ff5a1f;
  --accent-contrast: #ffffff;
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* ============ БАЗА ============ */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s var(--ease), color 0.3s var(--ease);
}

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

button { font: inherit; color: inherit; cursor: pointer; }

a { color: inherit; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding: 88px 0; }

.section-title {
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.section-lead {
  font-size: 1.1rem;
  margin: 0 0 14px;
}

.section-body { color: var(--text-muted); margin: 0 0 14px; }

.accent { color: var(--accent); }

.skip-link,
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

.skip-link:focus {
  position: fixed;
  z-index: 100;
  top: 12px; left: 12px;
  width: auto; height: auto;
  clip: auto;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: 8px;
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ============ КНОПКИ ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease), color 0.2s;
  will-change: transform;
}

.btn:hover { transform: scale(1.02); }
.btn:active { transform: scale(0.99); }

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover { border-color: var(--text-muted); }

/* ============ HERO ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.55)),
    url("159-1200x630.jpg") center / cover no-repeat;
  filter: saturate(0.85);
}

.hero-inner { position: relative; z-index: 1; color: #fff; }

.hero-kicker {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 18px;
}

.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 20px;
  max-width: 16ch;
  margin-inline: auto;
}

.hero-title .accent { color: var(--accent); }

.hero-subtitle {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.2rem);
  max-width: 46ch;
  margin: 0 auto 34px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-actions .btn-ghost {
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  z-index: 1;
}

.hero-scroll-hint span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  animation: scroll-dot 1.8s infinite var(--ease);
}

@keyframes scroll-dot {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { opacity: 0; }
}

/* ============ ABOUT ============ */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: center;
}

.about-visual {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 5;
}

.about-visual img { width: 100%; height: 100%; object-fit: cover; }

/* ============ FILTER BAR ============ */
.filterbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px;
  scrollbar-width: none;
  max-width: 100%;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 500;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s;
}

.tab:hover { border-color: var(--text-muted); }

.tab[aria-selected="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.sort select {
  appearance: none;
  -webkit-appearance: none;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 36px 9px 18px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.25s;
}

.sort select:hover { border-color: var(--text-muted); }

.grid-count { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 18px; }

/* ============ GALLERY (MASONRY) ============ */
.masonry {
  column-count: 1;
  column-gap: 16px;
}

@media (min-width: 640px) { .masonry { column-count: 2; column-gap: 20px; } }
@media (min-width: 1024px) { .masonry { column-count: 3; column-gap: 24px; } }
@media (min-width: 1440px) { .masonry { column-count: 4; } }

.card {
  break-inside: avoid;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

@media (min-width: 640px) { .card { margin-bottom: 20px; } }
@media (min-width: 1024px) { .card { margin-bottom: 24px; } }

.card:hover, .card:focus-visible { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.card-media { position: relative; overflow: hidden; }

.card-media img {
  width: 100%;
  height: auto;
  transition: transform 0.6s var(--ease);
}

.card:hover .card-media img { transform: scale(1.05); }

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.card:hover .card-overlay, .card:focus-visible .card-overlay { opacity: 1; }

.card-cat {
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

.card-info { padding: 12px 14px 14px; }

.card-title {
  margin: 0 0 2px;
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
}

.card-author { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.card-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 200px;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 20px;
  text-align: center;
  background: var(--surface);
}

.card-fallback button {
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
}

/* Появление при скролле */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero-scroll-hint span { animation: none; }
  .card:hover .card-media img { transform: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ============ EMPTY STATE ============ */
.empty {
  text-align: center;
  padding: 72px 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.hidden { display: none !important; }

.empty-title {
  font-family: var(--font-head);
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.empty-text { color: var(--text-muted); margin: 0 0 20px; }

/* ============ AUTHOR ============ */
.author { background: var(--surface); border-block: 1px solid var(--border); }

.author-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 44px;
  align-items: center;
}

.author-photo {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
  box-shadow: var(--shadow);
}

.author-photo img { width: 100%; height: 100%; object-fit: cover; }

.author-name {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0 0 10px;
}

.author-meta { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 20px; }

.author-socials { display: flex; gap: 10px; }

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 50%;
  text-decoration: none;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s;
}

.social-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ============ NEWSLETTER ============ */
.newsletter-box {
  max-width: 620px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 6px);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 44px 36px;
  text-align: center;
}

.newsletter-box .section-body { margin-bottom: 24px; }

.newsletter-form {
  display: flex;
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.newsletter-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 12px 18px;
  transition: border-color 0.25s;
}

.newsletter-form input::placeholder { color: var(--text-muted); }

.newsletter-form input:hover,
.newsletter-form input:focus { border-color: var(--text-muted); }

.newsletter-msg { min-height: 1.4em; margin: 14px 0 0; font-size: 0.92rem; }

.newsletter-msg.ok { color: #15803d; }
.newsletter-msg.err { color: #dc2626; }

[data-theme="dark"] .newsletter-msg.ok { color: #4ade80; }
[data-theme="dark"] .newsletter-msg.err { color: #f87171; }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--border); padding: 34px 0; }

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

.footer-logo {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 4px;
}

.footer-note { margin: 0; color: var(--text-muted); font-size: 0.85rem; }

.footer-nav { display: flex; gap: 20px; }

.footer-nav a, .footer-contact a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s;
}

.footer-nav a:hover, .footer-contact a:hover { color: var(--accent); }

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
}

.lightbox.hidden { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
}

.lb-figure {
  position: relative;
  z-index: 1;
  max-width: min(1100px, 92vw);
  margin: 0;
  text-align: center;
}

.lb-figure img {
  max-width: 100%;
  max-height: 78vh;
  margin: 0 auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  background: #1c1c1c;
  object-fit: contain;
}

.lb-skeleton {
  width: min(70vw, 700px);
  height: min(70vh, 500px);
  margin: 0 auto 16px;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #222 30%, #333 50%, #222 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}

.lb-skeleton.hidden { display: none; }

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.lb-caption {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 8px 0;
  color: #fff;
}

.lb-title { font-family: var(--font-head); font-size: 1.25rem; font-weight: 600; }

.lb-meta { color: rgba(255, 255, 255, 0.65); font-size: 0.9rem; }

.lb-desc { color: rgba(255, 255, 255, 0.85); font-size: 0.95rem; max-width: 56ch; margin: 8px auto 0; }

.lb-btn {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  transition: background 0.25s var(--ease), transform 0.2s;
}

.lb-btn:hover { background: var(--accent); border-color: var(--accent); transform: scale(1.05); }

.lb-close { top: 20px; right: 20px; }
.lb-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 20px; top: 50%; transform: translateY(-50%); }

.lb-prev:hover { transform: translateY(-50%) scale(1.05); }
.lb-next:hover { transform: translateY(-50%) scale(1.05); }

@media (max-width: 640px) {
  .lb-prev, .lb-next { width: 44px; height: 44px; bottom: 20px; top: auto; transform: none; }
  .lb-prev { left: calc(50% - 56px); }
  .lb-next { right: calc(50% - 56px); }
  .lb-fig, .lb-figure { max-width: 96vw; }
  .lb-figure img { max-height: 60vh; }
}

/* ============ АДАПТИВ ============ */
@media (max-width: 768px) {
  .section { padding: 60px 0; }
  .about-grid { grid-template-columns: 1fr; gap: 28px; }
  .about-visual { order: -1; aspect-ratio: 16 / 10; }
  .author-grid { grid-template-columns: 1fr; gap: 28px; }
  .author-photo { max-width: 280px; }
  .newsletter-box { padding: 34px 22px; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }
  .filterbar { flex-direction: column; align-items: stretch; }
  .tabs { width: 100%; }
  .sort { display: flex; }
  .sort select { width: 100%; }
}

/* Иконки темы: светлая → луна, тёмная → солнце */
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
