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

/* ═══════════════════════════════════════════════════════════════════
   GOOGLE FONTS  (system fallback if offline)
═══════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ═══════════════════════════════════════════════════════════════════
   LIGHT THEME  (default)
═══════════════════════════════════════════════════════════════════ */
:root,
[data-theme="light"] {
  /* page — clean off-white */
  --page-bg:      #f7f7f5;
  --page-mesh:    radial-gradient(ellipse 120% 50% at 20% -10%, rgba(99,102,241,.06) 0%, transparent 55%),
                  radial-gradient(ellipse 70% 45% at 85% 110%,  rgba(16,185,129,.05) 0%, transparent 50%);

  /* surfaces — pure whites with slight warmth */
  --surface:      #ffffff;
  --surface-2:    #f7f7f5;
  --surface-3:    #f0f0ee;

  /* borders — neutral grey */
  --line:         rgba(0,0,0,.08);
  --line-soft:    rgba(0,0,0,.04);

  /* text — near-black neutral */
  --ink:          #111110;
  --ink-2:        #3c3c3a;
  --ink-3:        #6e6e6a;
  --ink-4:        #a8a8a3;

  /* accent — indigo */
  --accent:       #6366f1;
  --accent-2:     #818cf8;
  --accent-bg:    rgba(99,102,241,.07);
  --accent-glow:  rgba(99,102,241,.18);

  /* semantic */
  --red:          #ef4444;
  --red-soft:     rgba(239,68,68,.10);
  --green:        #10b981;

  /* shadows — clean neutral */
  --sh-card:
    0 1px 2px rgba(0,0,0,.04),
    0 4px 12px rgba(0,0,0,.06),
    0 16px 40px rgba(0,0,0,.06);
  --sh-side:
    0 1px 2px rgba(0,0,0,.04),
    0 4px 16px rgba(0,0,0,.06);
  --sh-glow:  0 0 0 3px var(--accent-glow);

  /* ad SVG colors */
  --ad-rect:   rgba(99,102,241,.08);
  --ad-stroke: rgba(99,102,241,.30);
  --ad-circle: rgba(99,102,241,.15);

  /* theme toggle */
  --toggle-bg:    #f0f0ee;
  --toggle-color: #6366f1;
}

/* ═══════════════════════════════════════════════════════════════════
   DARK THEME
═══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* page — true dark, near-black */
  --page-bg:    #0a0a0a;
  --page-mesh:  radial-gradient(ellipse 120% 55% at 20% -10%, rgba(99,102,241,.10) 0%, transparent 55%),
                radial-gradient(ellipse 80% 50% at 85% 110%,  rgba(16,185,129,.06) 0%, transparent 50%);

  /* surfaces — dark grey scale */
  --surface:    #141414;
  --surface-2:  #1c1c1c;
  --surface-3:  #242424;

  /* borders — subtle white */
  --line:       rgba(255,255,255,.07);
  --line-soft:  rgba(255,255,255,.03);

  /* text — high contrast neutral */
  --ink:        #ededed;
  --ink-2:      #b4b4b4;
  --ink-3:      #787878;
  --ink-4:      #4a4a4a;

  /* accent — indigo (same family as light) */
  --accent:     #818cf8;
  --accent-2:   #a5b4fc;
  --accent-bg:  rgba(129,140,248,.10);
  --accent-glow:rgba(129,140,248,.18);

  /* semantic */
  --red:        #f87171;
  --red-soft:   rgba(248,113,113,.10);
  --green:      #34d399;

  /* shadows */
  --sh-card: 0 1px 2px rgba(0,0,0,.5), 0 8px 32px rgba(0,0,0,.4);
  --sh-side: 0 1px 2px rgba(0,0,0,.4), 0 4px 20px rgba(0,0,0,.35);
  --sh-glow: 0 0 0 3px var(--accent-glow);

  /* ad SVG colors */
  --ad-rect:   rgba(129,140,248,.07);
  --ad-stroke: rgba(129,140,248,.28);
  --ad-circle: rgba(129,140,248,.16);

  /* theme toggle */
  --toggle-bg:    #1c1c1c;
  --toggle-color: #818cf8;
}

/* ═══════════════════════════════════════════════════════════════════
   GLOBAL
═══════════════════════════════════════════════════════════════════ */
html, body { min-height: 100%; }

body {
  background: var(--page-bg);
  background-image: var(--page-mesh);
  background-attachment: fixed;
  font-family: "DM Sans", "Trebuchet MS", Optima, Candara, sans-serif;
  color: var(--ink);
  padding: 32px 16px 64px;
  transition: background-color .3s, color .3s;
}

/* ═══════════════════════════════════════════════════════════════════
   THEME TOGGLE BUTTON
═══════════════════════════════════════════════════════════════════ */
.theme-toggle {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 100;
  all: unset;
  cursor: pointer;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--toggle-bg);
  color: var(--toggle-color);
  border-radius: 50%;
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  transition: background .2s, color .2s, transform .15s, box-shadow .2s;
  box-shadow: var(--sh-side);
}
.theme-toggle:hover {
  transform: scale(1.1) rotate(15deg);
  box-shadow: var(--sh-glow), var(--sh-side);
}
.theme-toggle:active { transform: scale(.93); }

.theme-toggle svg { width: 18px; height: 18px; }

/* show/hide icons based on theme */
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="dark"]  .theme-icon-light { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   LAYOUT — 3 columns
═══════════════════════════════════════════════════════════════════ */
.layout {
  display: grid;
  /* TEMPORARILY: single centered column (left/right cols hidden) */
  grid-template-columns: 1fr;
  grid-template-areas: "center";
  gap: 20px;
  max-width: 620px;
  margin: 0 auto;
  align-items: start;
}
.col-left  { grid-area: left; }
.day-card  { grid-area: center; }
.col-right { grid-area: right; }

.col {
  position: sticky;
  top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ═══════════════════════════════════════════════════════════════════
   WIDGET BASE
═══════════════════════════════════════════════════════════════════ */
.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--sh-side);
  transition: background .3s, border-color .3s, box-shadow .3s;
}

/* ═══════════════════════════════════════════════════════════════════
   MINI-CALENDAR
═══════════════════════════════════════════════════════════════════ */
.mini-cal {
  padding: 16px 14px 17px;
  animation: rise .4s .05s cubic-bezier(.22,.68,0,1.2) both;
}

.mc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.mc-arrow {
  all: unset;
  cursor: pointer;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  font-size: .8rem;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: all .15s;
}
.mc-arrow:hover  {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
  transform: scale(1.1);
}
.mc-arrow:active { transform: scale(.9); }

.mc-title {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.mc-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.mc-weekdays {
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.mc-weekdays span {
  font-size: .60rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 2px 0;
}
.mc-weekdays .wknd { color: var(--red); }

.mc-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.mc-day {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border-radius: 8px;
  font-size: .75rem;
  font-weight: 400;
  color: var(--ink-2);
  position: relative;
  transition: background .12s, color .12s, transform .09s;
}
.mc-day:hover:not(.selected):not(.other-month) {
  background: var(--accent-bg);
  color: var(--accent);
  transform: scale(1.08);
}
.mc-day.other-month {
  color: var(--ink-4);
  opacity: .4;
  pointer-events: none;
}
.mc-day.wknd { color: var(--red); }

.mc-day.has-holiday::after {
  content: '';
  position: absolute;
  bottom: 3px; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--red);
}

.mc-day.is-today {
  color: var(--accent);
  font-weight: 700;
  box-shadow: 0 0 0 1.5px var(--accent);
  border-radius: 8px;
}

.mc-day.selected {
  background: var(--accent) !important;
  color: #fff !important;
  font-weight: 700;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--accent-glow) !important;
}
.mc-day.selected::after { background: rgba(255,255,255,.9); }
.mc-day.is-today.selected { box-shadow: 0 2px 8px var(--accent-glow) !important; }

/* ── Legend ──────────────────────────────────────────────────────── */
.legend {
  padding: 11px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: rise .4s .1s cubic-bezier(.22,.68,0,1.2) both;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .70rem;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: .02em;
}
.pip {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.pip-holiday { background: var(--red); }
.pip-today   { background: transparent; box-shadow: 0 0 0 1.5px var(--accent); }
.pip-sel     { background: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════
   DAY CARD (center)
═══════════════════════════════════════════════════════════════════ */
.day-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--sh-card);
  animation: rise .38s cubic-bezier(.22,.68,0,1.2) both;
  transition: background .3s, border-color .3s, box-shadow .3s;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ── Nav bar ─────────────────────────────────────────────────────── */
.nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
}

.arrow {
  all: unset;
  cursor: pointer;
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: .95rem;
  color: var(--ink-3);
  background: var(--surface-2);
  transition: all .15s;
  user-select: none;
}
.arrow:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
  transform: scale(1.1);
  box-shadow: 0 2px 8px var(--accent-glow);
}
.arrow:active { transform: scale(.92); }

.today-btn {
  all: unset;
  cursor: pointer;
  font-family: inherit;
  font-size: .62rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
  transition: all .15s;
}
.today-btn:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: transparent;
  box-shadow: 0 2px 8px var(--accent-glow);
}

/* ── Date hero ───────────────────────────────────────────────────── */
.date-hero {
  text-align: center;
  padding: 22px 28px 28px;
  position: relative;
  border-bottom: 1px solid var(--line-soft);
}

/* glass radial glow behind the number */
.date-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 50% 20%, var(--accent-bg) 0%, transparent 70%);
  pointer-events: none;
}

.day-num {
  font-family: "DM Serif Display", "Palatino Linotype", Georgia, serif;
  font-size: clamp(4rem, 12vw, 7rem);
  line-height: .88;
  color: var(--accent);
  letter-spacing: -.02em;
  position: relative;
  transition: opacity .18s, transform .18s, color .3s;
  /* subtle text glow in dark mode */
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.month-yr {
  margin-top: 10px;
  font-size: .82rem;
  font-weight: 500;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--ink-2);
  position: relative;
  transition: opacity .18s, transform .18s, color .3s;
}

.weekday {
  margin-top: 5px;
  font-size: .62rem;
  font-weight: 400;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-3);
  position: relative;
  transition: opacity .18s, transform .18s, color .3s;
}

.day-of-year {
  margin: 14px 28px 0;
  font-size: .78rem;
  font-weight: 400;
  color: var(--ink-2);
  font-style: italic;
  line-height: 1.6;
  padding: 11px 18px;
  background: var(--accent-bg);
  border: 1px solid rgba(99,102,241,.13);
  border-radius: 14px;
  box-shadow: 0 2px 8px var(--accent-glow);
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  transition: opacity .18s, color .3s, background .3s;
}

.day-of-year span:last-child {
  color: var(--ink-3);
  font-size: .73rem;
}



/* ── Holidays section ────────────────────────────────────────────── */
.holidays { transition: opacity .18s; }

.no-holidays {
  text-align: center;
  padding: 22px 26px 28px;
  font-size: .8rem;
  font-weight: 300;
  font-style: italic;
  color: var(--ink-3);
  line-height: 1.65;
}

/* ── Category accordion ──────────────────────────────────────────── */
.cat-section {
  border-top: 1px solid var(--line-soft);
}
.cat-section:first-child { border-top: none; }

.cat-header {
  all: unset;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 20px 11px 18px;
  gap: 10px;
  box-sizing: border-box;
  transition: background .15s;
  user-select: none;
}
.cat-header:hover { background: var(--surface-2); }

.cat-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
  margin-right: 0.5em;
  vertical-align: middle;
}

.cat-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cat-label {
  font-family: "DM Sans", sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--ink-2);
  transition: color .3s;
}

.cat-count {
  font-size: .58rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 20px;
  background: var(--accent-bg);
  color: var(--accent);
  min-width: 18px;
  text-align: center;
}

.cat-arrow {
  flex-shrink: 0;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  transition: transform .25s cubic-bezier(.22,.68,0,1.2), color .15s;
}
.cat-arrow svg { width: 12px; height: 12px; }

.cat-section.is-open .cat-arrow { transform: rotate(180deg); }
.cat-section.is-open .cat-label { color: var(--accent); }

/* ── Category body animation ─────────────────────────────────────── */
.cat-body { overflow: hidden; }

@keyframes catReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cat-body-anim { animation: catReveal .32s ease both; }

.cat-empty {
  padding: 12px 20px 14px;
  font-size: .68rem;
  font-style: italic;
  font-weight: 300;
  color: var(--ink-4);
  line-height: 1.5;
}

/* ── Event card (левое фото | текст | правое фото) ──────────────── */
.event-card {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  min-height: 64px;
  border-top: 1px solid var(--line-soft);
  overflow: hidden;
  transition: background .15s;
}
.event-card:hover { background: var(--surface-2); }
.event-card:first-child { border-top: none; }

.ev-img {
  position: relative;
  background: var(--surface-3);
  overflow: hidden;
  flex-shrink: 0;
}
.ev-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity .55s ease;
}
.ev-img img.loaded { opacity: 1; }
.ev-img-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--ink-4);
  opacity: .25;
  pointer-events: none;
}

.ev-body {
  padding: 9px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  justify-content: center;
}
.ev-name {
  font-family: "DM Serif Display", Georgia, serif;
  font-size: .85rem;
  line-height: 1.25;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color .3s;
}
.ev-fact {
  font-size: .75rem;
  font-weight: 300;
  line-height: 1.5;
  color: var(--ink-3);
  transition: color .3s;
  display: -webkit-box;
  /* -webkit-line-clamp: 5;
  line-clamp: 5; */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════
   AD COLUMN (right)
═══════════════════════════════════════════════════════════════════ */
.ad-widget {
  overflow: hidden;
  animation: rise .4s .12s cubic-bezier(.22,.68,0,1.2) both;
}

.ad-tag {
  font-size: .55rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-4);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
  padding: 6px 14px;
  text-align: center;
}

/* primary — tall */
.ad-primary .ad-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px 18px 28px;
  min-height: 240px;
  background:
    repeating-linear-gradient(
      -50deg,
      transparent 0px, transparent 18px,
      var(--line-soft) 18px, var(--line-soft) 19px
    );
}

.ad-icon svg {
  width: 64px;
  height: 64px;
  text-align: center;
}

.ad-slide .ad-icon {
  display: flex;
  justify-content: center;
}

.ad-text {
  font-size: .75rem;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.6;
}

.ad-link {
  display: inline-block;
  text-decoration: none;
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  border: 1.5px solid var(--accent-bg);
  border-radius: 20px;
  padding: 7px 18px;
  transition: all .15s;
  background: var(--accent-bg);
}
.ad-link:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
  transform: translateY(-1px);
}

/* secondary — small square */
.ad-secondary .ad-body-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface-3) 100%);
}

.ad-text-sm {
  font-size: .70rem;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}

/* tertiary — text */
.ad-text-block .ad-body-text {
  display: flex;
  flex-direction: column;
  padding: 14px 16px;
  gap: 8px;
}

  .ad-widget {
    position: relative;
    overflow: hidden;
  }

  .ad-slide {
    display: none;
    animation: fadeInAd 0.5s ease;
  }

  .ad-slide.active {
    display: block;
  }

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

  .ad-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 8px;
  }

  .ad-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ad-stroke, #aaa);
    opacity: 0.3;
    transition: opacity 0.3s;
    cursor: pointer;
  }

  .ad-dot.active {
    opacity: 1;
  }


/* ═══════════════════════════════════════════════════════════════════
   FADE TRANSITION (day change)
═══════════════════════════════════════════════════════════════════ */
.fade-out .day-num,
.fade-out .month-yr,
.fade-out .weekday  { opacity: 0; transform: translateY(-5px); }
.fade-out .day-of-year { opacity: 0; }
.fade-out .holidays { opacity: 0; }

/* ═══════════════════════════════════════════════════════════════════
   SCROLLBAR  (subtle in both themes)
═══════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .event-card {
    grid-template-columns: 64px 1fr;
  }
  
  .event-card .ev-img:last-of-type {
    display: none;
  }
  }

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas: "left" "center" "right";
  }
  .col {
    position: static;
  }
  
  .theme-toggle {
    top: 12px;
    right: 12px;
  }

  .event-card {
    grid-template-columns: 64px 1fr;
  }
  .event-card .ev-img:last-of-type {
    display: none;
  }
  }

/* ═══════════════════════════════════════════════════════════════════
   FOOTER
═══════════════════════════════════════════════════════════════════ */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
   flex-direction: column;
  text-align: center;
  gap: 12px;
  max-width: 620px; /* TEMPORARILY: matches single-column layout */
  margin: 36px auto 0;
  padding: 16px 20px;
  border-top: 1px solid var(--line-soft);
  font-size: .80rem;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--ink-4);
  transition: color .3s, border-color .3s;
}

.footer-contacts {
  display: flex;
  align-items: center;
  gap: 16px;
}

.contact-icon {
  display: flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity 0.2s, transform 0.2s;
}

.contact-icon:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.site-footer {
  flex-direction: column;
  text-align: center;
  gap: 12px;
}

.footer-sep {
  color: var(--line);
}

.footer-author {
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.footer-copy {
  font-variant-numeric: tabular-nums;
}