/* ============================================
   ШАХНЕМАТ.РФ — Chess Club & News Portal
   Aesthetic: Classic editorial, chess magazine
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400&family=PT+Sans:wght@400;700&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-dark: #0f0f0f;
  --bg-section: #1a1917;
  --bg-card: #242220;
  --bg-warm: #f8f4ec;
  --bg-warm-alt: #f0ebe0;

  --gold: #c9a84c;
  --gold-dim: #a08535;
  --gold-bright: #e4c76b;
  --green-board: #5a7d5a;
  --green-dark: #2d4a2d;
  --red-accent: #8b3a3a;

  --text-light: #e8e0d0;
  --text-muted: #9a9080;
  --text-dark: #2c2c2c;
  --text-dark-muted: #6b6560;

  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-heading: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'PT Sans', 'Segoe UI', sans-serif;

  --max-width: 1200px;
  --radius: 4px;
  --transition: 0.3s ease;
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.7;
  overflow-x: hidden;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--gold-bright);
}

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

/* --- Utility --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1.5rem;
}

.divider {
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin-bottom: 2rem;
}

.divider--center {
  margin-left: auto;
  margin-right: auto;
}

/* --- Chessboard texture (CSS only) --- */
.chess-texture {
  background-image:
    linear-gradient(45deg, rgba(201,168,76,0.03) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(201,168,76,0.03) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(201,168,76,0.03) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(201,168,76,0.03) 75%);
  background-size: 40px 40px;
  background-position: 0 0, 0 20px, 20px -20px, -20px 0;
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 15, 15, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,168,76,0.15);
  transition: background var(--transition);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header__logo-icon {
  font-size: 1.8rem;
  color: var(--gold);
  line-height: 1;
}

.header__logo-text {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.02em;
}

.header__logo-text span {
  color: var(--gold);
}

.header__nav {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.header__nav a {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}

.header__nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--gold);
  transition: width var(--transition);
}

.header__nav a:hover,
.header__nav a.active {
  color: var(--gold);
}

.header__nav a:hover::after,
.header__nav a.active::after {
  width: 100%;
}

/* Mobile menu */
.header__burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
}

.header__burger span {
  width: 24px;
  height: 2px;
  background: var(--text-light);
  transition: var(--transition);
}

/* ============================================
   HERO
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--bg-dark);
}

.hero__bg {
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,168,76,0.3), transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(90,125,90,0.2), transparent 60%);
}

/* Animated chess pieces floating */
.hero__pieces {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero__piece {
  position: absolute;
  font-size: 3rem;
  opacity: 0.04;
  color: var(--gold);
  animation: float 20s infinite ease-in-out;
}

.hero__piece:nth-child(1) { left: 10%; top: 20%; animation-delay: 0s; font-size: 4rem; }
.hero__piece:nth-child(2) { left: 80%; top: 15%; animation-delay: -4s; font-size: 2.5rem; }
.hero__piece:nth-child(3) { left: 25%; top: 70%; animation-delay: -8s; font-size: 3.5rem; }
.hero__piece:nth-child(4) { left: 70%; top: 65%; animation-delay: -12s; font-size: 2rem; }
.hero__piece:nth-child(5) { left: 50%; top: 40%; animation-delay: -16s; font-size: 5rem; }
.hero__piece:nth-child(6) { left: 90%; top: 80%; animation-delay: -6s; font-size: 2.5rem; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-30px) rotate(5deg); }
  50% { transform: translateY(-15px) rotate(-3deg); }
  75% { transform: translateY(-40px) rotate(3deg); }
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 0 2rem;
}

.hero__emblem {
  font-size: 4rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
  text-shadow: 0 0 40px rgba(201,168,76,0.3);
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

.hero__title span {
  color: var(--gold);
}

.hero__subtitle {
  font-family: var(--font-heading);
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--gold);
  padding: 1rem 2.5rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
}

.hero__cta:hover {
  background: var(--gold-bright);
  color: var(--bg-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(201,168,76,0.3);
}

.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  animation: bounce 2s infinite;
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--gold), transparent);
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ============================================
   NEWS SECTION
   ============================================ */
.news {
  padding: 6rem 0;
  background: var(--bg-section);
}

.news__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3rem;
}

.news__more {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.news__grid {
  columns: 2;
  column-gap: 2rem;
}

.news__side {
  display: contents;
}

/* Featured (large) card */
.news-card {
  background: var(--bg-card);
  border: 1px solid rgba(201,168,76,0.08);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  break-inside: avoid;
  margin-bottom: 2rem;
}

.news-card:hover {
  border-color: rgba(201,168,76,0.2);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.news-card--featured {
  /* no special grid spanning needed in masonry */
}

.news-card__image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--bg-dark);
}

.news-card--featured .news-card__image {
  aspect-ratio: 16/10;
}

/* CSS-only chess pattern placeholder for images */
.news-card__image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  opacity: 0.15;
  color: var(--gold);
}

.news-card--featured .news-card__image-placeholder {
  font-size: 6rem;
}

.news-card__image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(45,74,45,0.4),
    rgba(15,15,15,0.6));
}

.news-card__tag {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--bg-dark);
  background: var(--gold);
  padding: 0.3rem 0.8rem;
}

.news-card__body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-card--featured .news-card__body {
  padding: 2rem;
}

.news-card__date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  letter-spacing: 0.05em;
}

.news-card__title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text-light);
  transition: color var(--transition);
}

.news-card:hover .news-card__title {
  color: var(--gold);
}

.news-card--featured .news-card__title {
  font-size: 1.8rem;
}

.news-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.news-card__read {
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold-dim);
  transition: color var(--transition);
}

.news-card:hover .news-card__read {
  color: var(--gold);
}

/* Side cards (smaller) */
.news__side {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ============================================
   SCHEDULE SECTION
   ============================================ */
.schedule {
  padding: 6rem 0;
  background: var(--bg-dark);
}

.schedule__table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

.schedule__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.schedule__table thead th {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: left;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid rgba(201,168,76,0.2);
}

.schedule__table tbody td {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: top;
}

.schedule__table tbody tr {
  transition: background var(--transition);
}

.schedule__table tbody tr:hover {
  background: rgba(201,168,76,0.04);
}

.schedule__day {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-light);
  min-width: 120px;
}

.schedule__time {
  color: var(--gold);
  font-weight: 700;
  white-space: nowrap;
}

.schedule__event {
  color: var(--text-light);
}

.schedule__level {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border: 1px solid;
  white-space: nowrap;
}

.schedule__level--all {
  color: var(--green-board);
  border-color: var(--green-board);
}

.schedule__level--beginner {
  color: #6a9fd8;
  border-color: #6a9fd8;
}

.schedule__level--advanced {
  color: var(--gold);
  border-color: var(--gold);
}

/* ============================================
   TOURNAMENTS SECTION
   ============================================ */
.tournaments {
  padding: 6rem 0;
  background: var(--bg-section);
}

.tournaments__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 1rem;
}

.tournament-card {
  background: var(--bg-card);
  border: 1px solid rgba(201,168,76,0.08);
  padding: 2rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.tournament-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--green-board));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.tournament-card:hover::before {
  transform: scaleX(1);
}

.tournament-card:hover {
  border-color: rgba(201,168,76,0.15);
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.tournament-card__date {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tournament-card__day {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.tournament-card__month {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: lowercase;
}

.tournament-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text-light);
}

.tournament-card__details {
  list-style: none;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tournament-card__details li {
  padding: 0.3rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tournament-card__details li::before {
  content: '·';
  color: var(--gold);
  font-weight: 700;
}

.tournament-card__status {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.35rem 0.75rem;
}

.tournament-card__status--open {
  color: var(--green-board);
  border: 1px solid var(--green-board);
}

.tournament-card__status--soon {
  color: var(--gold);
  border: 1px solid var(--gold);
}

.tournament-card__status--closed {
  color: var(--red-accent);
  border: 1px solid var(--red-accent);
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
  padding: 6rem 0;
  background: var(--bg-dark);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about__text p {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 1rem;
}

.about__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.about__stat-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--gold);
  line-height: 1;
}

.about__stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Chess board visual (CSS-only) */
.about__board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1;
  border: 3px solid rgba(201,168,76,0.3);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.about__board-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 2.5vw, 2rem);
  transition: all 0.5s ease;
}

.about__board-cell--light {
  background: #d4b896;
}

.about__board-cell--dark {
  background: #7a5c3a;
}

.about__board-cell:hover {
  transform: scale(1.05);
  z-index: 1;
}

/* ============================================
   PUZZLE SECTION
   ============================================ */
.puzzle {
  padding: 5rem 0;
  background: var(--bg-section);
  text-align: center;
}

.puzzle__inner {
  max-width: 600px;
  margin: 0 auto;
}

.puzzle__board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  max-width: 400px;
  margin: 2rem auto;
  border: 2px solid rgba(201,168,76,0.3);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}

.puzzle__cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  line-height: 1;
}

.puzzle__cell--light { background: #e8d5b5; }
.puzzle__cell--dark { background: #6d8a55; }

.puzzle__hint {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 1.5rem;
}

.puzzle__answer {
  margin-top: 1rem;
}

.puzzle__answer-btn {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold);
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
}

.puzzle__answer-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

.puzzle__answer-text {
  display: none;
  margin-top: 1rem;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

.puzzle__answer-text.visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  padding: 4rem 0 2rem;
  background: var(--bg-dark);
  border-top: 1px solid rgba(201,168,76,0.1);
}

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

.footer__brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.footer__brand span {
  color: var(--gold);
}

.footer__desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 360px;
}

.footer__heading {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.footer__links {
  list-style: none;
}

.footer__links li {
  margin-bottom: 0.5rem;
}

.footer__links a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer__links a:hover {
  color: var(--gold);
}

.footer__bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   ANIMATIONS (on scroll)
   ============================================ */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-delay-1 { transition-delay: 0.1s; }
.fade-in-delay-2 { transition-delay: 0.2s; }
.fade-in-delay-3 { transition-delay: 0.3s; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 968px) {
  .news__grid {
    columns: 1;
  }

  .tournaments__grid {
    grid-template-columns: 1fr 1fr;
  }

  .about__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .about__board {
    max-width: 400px;
    margin: 0 auto;
  }

  .footer__grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 640px) {
  .header__nav {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(15, 15, 15, 0.98);
    flex-direction: column;
    padding: 1.5rem 2rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(201,168,76,0.15);
  }

  .header__nav.open {
    display: flex;
  }

  .header__burger {
    display: flex;
  }

  .hero__title {
    font-size: 2.2rem;
  }

  .section-title {
    font-size: 1.8rem;
  }

  .tournaments__grid {
    grid-template-columns: 1fr;
  }

  .about__stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .schedule__table {
    font-size: 0.85rem;
  }

  .news__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
}
