/*
Theme Name: Culs
Theme URI: https://culs.kz/
Author: Culs Team
Author URI: https://culs.kz/
Description: Современная, быстрая, mobile-first блочная (FSE) тема для сайта открыток, поздравлений, стихов и праздничных пожеланий. Рассчитана на максимальное удобство со смартфонов: прямое копирование картинок и текстов в буфер, отправка в WhatsApp/Telegram/VK в один клик, нативный Web Share API, нижняя панель действий и совместимость с Yoast SEO.
Version: 1.1.0
Requires at least: 6.2
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: culs
Tags: block-theme, full-site-editing, custom-post-types, grid-layout, mobile-first, custom-colors, custom-menu, featured-images, seo-friendly
*/

/* ==========================================================================
   Culs Theme Core & Mobile-First Design Tokens
   ========================================================================== */

:root {
  --culs-primary: #e11d48;
  --culs-primary-hover: #be123c;
  --culs-primary-soft: #ffe4e6;
  --culs-secondary: #8b5cf6;
  --culs-secondary-hover: #7c3aed;
  --culs-secondary-soft: #ede9fe;
  --culs-accent: #f59e0b;
  --culs-accent-soft: #fef3c7;
  --culs-success: #10b981;
  --culs-bg-page: #f8fafc;
  --culs-bg-card: #ffffff;
  --culs-text-main: #0f172a;
  --culs-text-muted: #64748b;
  --culs-border: #e2e8f0;
  --culs-radius-sm: 8px;
  --culs-radius-md: 14px;
  --culs-radius-lg: 20px;
  --culs-radius-pill: 9999px;
  --culs-shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --culs-shadow-md: 0 4px 14px -2px rgba(0,0,0,0.08), 0 2px 6px -1px rgba(0,0,0,0.04);
  --culs-shadow-lg: 0 12px 28px -4px rgba(0,0,0,0.12), 0 4px 10px -2px rgba(0,0,0,0.05);
  --culs-shadow-hover: 0 16px 32px -6px rgba(225, 29, 72, 0.16);
  --culs-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --culs-touch-highlight: rgba(225, 29, 72, 0.12);
}

/* Base Mobile-First Resets */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--culs-bg-page);
  color: var(--culs-text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-bottom: 0;
}

/* Add bottom padding on single cards for the mobile sticky bar */
body.single-cards {
  padding-bottom: 80px;
}

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

a:hover, a:focus-visible {
  color: var(--culs-primary-hover);
  text-decoration: underline;
}

button {
  font-family: inherit;
}

/* --------------------------------------------------------------------------
   Mobile-First Touch Category & Occasion Pills (Swipeable Track)
   -------------------------------------------------------------------------- */
.culs-pills-scroll-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  padding: 4px 0 12px;
  margin: 12px 0 20px;
}

.culs-pills-scroll-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

.culs-category-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  padding: 2px 4px;
}

.culs-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid var(--culs-border);
  border-radius: var(--culs-radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--culs-text-main);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: var(--culs-shadow-sm);
  transition: var(--culs-transition);
  touch-action: manipulation;
}

.culs-category-pill:active {
  transform: scale(0.96);
}

.culs-category-pill:hover,
.culs-category-pill.is-active {
  background: var(--culs-primary);
  color: #ffffff;
  border-color: var(--culs-primary);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.28);
}

/* --------------------------------------------------------------------------
   Responsive Mobile Card Grid & Items (CPT 'cards')
   -------------------------------------------------------------------------- */
.culs-card-item {
  position: relative;
  background: var(--culs-bg-card);
  border-radius: var(--culs-radius-md);
  border: 1px solid var(--culs-border);
  box-shadow: var(--culs-shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--culs-transition);
}

.culs-card-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--culs-shadow-md);
  border-color: rgba(225, 29, 72, 0.3);
}

.culs-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f1f5f9;
  overflow: hidden;
}

.culs-card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.culs-card-item:hover .culs-card-thumb-wrap img {
  transform: scale(1.03);
}

.culs-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
}

.culs-card-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  margin: 0 0 10px 0;
  color: var(--culs-text-main);
}

.culs-card-title a {
  color: inherit;
  text-decoration: none;
}

.culs-card-title a:hover {
  color: var(--culs-primary);
}

/* Card Actions inside Grid / Single */
.culs-card-actions-wrapper {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 16px 0;
}

.culs-primary-actions-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.culs-btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--culs-radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--culs-transition);
  touch-action: manipulation;
}

.culs-btn-pill:active {
  transform: scale(0.96);
}

.culs-btn-download-primary {
  background: var(--culs-primary);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.25);
}

.culs-btn-download-primary:hover {
  background: var(--culs-primary-hover);
  color: #ffffff;
  text-decoration: none;
}

.culs-btn-copy-image {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
}

.culs-btn-copy-image:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.culs-btn-native-share {
  background: #0f172a;
  color: #ffffff;
}

.culs-btn-native-share:hover {
  background: #1e293b;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   Messengers & Social Share Buttons
   -------------------------------------------------------------------------- */
.culs-share-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.culs-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--culs-radius-pill);
  font-size: 13.5px;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: var(--culs-transition);
  touch-action: manipulation;
}

.culs-share-btn:active {
  transform: scale(0.95);
}

.culs-share-btn:hover {
  color: #ffffff;
  text-decoration: none;
  filter: brightness(1.08);
}

.culs-share-whatsapp { background-color: #25d366; }
.culs-share-telegram { background-color: #229ed9; }
.culs-share-vk { background-color: #0077ff; }
.culs-share-copy { background-color: #475569; }

/* --------------------------------------------------------------------------
   Single Card Page Styling
   -------------------------------------------------------------------------- */
.culs-single-card-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.culs-single-card-media {
  background: var(--culs-bg-card);
  border-radius: var(--culs-radius-lg);
  box-shadow: var(--culs-shadow-md);
  border: 1px solid var(--culs-border);
  padding: 12px;
  text-align: center;
  margin: 16px 0 20px;
}

.culs-single-card-media img {
  max-width: 100%;
  height: auto;
  max-height: 75vh;
  border-radius: var(--culs-radius-md);
  display: inline-block;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* --------------------------------------------------------------------------
   Mobile Sticky Bottom Action Bar (Fixed on Mobile Screens)
   -------------------------------------------------------------------------- */
.culs-mobile-sticky-bar {
  display: none;
}

@media (max-width: 768px) {
  .culs-mobile-sticky-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(226, 232, 240, 0.9);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    z-index: 9999;
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.08);
    justify-content: space-around;
    align-items: center;
  }

  .culs-sticky-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: var(--culs-text-main);
    text-decoration: none;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
    min-width: 58px;
    transition: var(--culs-transition);
  }

  .culs-sticky-btn:active {
    transform: scale(0.92);
    background: rgba(0, 0, 0, 0.05);
  }

  .culs-sticky-download { color: var(--culs-primary); }
  .culs-sticky-wa { color: #25d366; }
  .culs-sticky-tg { color: #229ed9; }
}

/* --------------------------------------------------------------------------
   Wishes & Congratulations Blocks (Текстовые поздравления)
   -------------------------------------------------------------------------- */
.culs-wish-card {
  background: var(--culs-bg-card);
  border-radius: var(--culs-radius-md);
  border: 1px solid var(--culs-border);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--culs-shadow-sm);
  position: relative;
  transition: var(--culs-transition);
}

.culs-wish-card:hover {
  border-color: rgba(225, 29, 72, 0.3);
  box-shadow: var(--culs-shadow-md);
}

.culs-wish-title {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--culs-primary);
}

.culs-wish-text {
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--culs-text-main);
  white-space: pre-line;
  margin-bottom: 16px;
  user-select: all; /* Allows easy double-tap selection on mobile */
}

.culs-wish-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--culs-border);
  flex-wrap: wrap;
}

.culs-wish-meta {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: var(--culs-text-muted);
}

.culs-wish-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.culs-btn-copy-wish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--culs-primary-soft);
  color: var(--culs-primary);
  padding: 8px 16px;
  border-radius: var(--culs-radius-pill);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--culs-transition);
  touch-action: manipulation;
}

.culs-btn-copy-wish:active {
  transform: scale(0.95);
}

.culs-btn-copy-wish:hover {
  background: var(--culs-primary);
  color: #ffffff;
}

.culs-btn-copy-wish.copied {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}

.culs-btn-mini-share {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--culs-radius-pill);
  background: #f1f5f9;
  border: 1px solid var(--culs-border);
  color: var(--culs-text-main);
  text-decoration: none;
  transition: var(--culs-transition);
  touch-action: manipulation;
}

.culs-btn-mini-share:active {
  transform: scale(0.92);
}

.culs-mini-wa:hover { background: #dcfce7; color: #15803d; }
.culs-mini-tg:hover { background: #e0f2fe; color: #0284c7; }

/* --------------------------------------------------------------------------
   Toast Notification (Mobile-Friendly & Accessible)
   -------------------------------------------------------------------------- */
.culs-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 80px);
  background: #0f172a;
  color: #ffffff;
  padding: 12px 22px;
  border-radius: var(--culs-radius-pill);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  z-index: 999999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  max-width: 90vw;
}

.culs-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .culs-toast {
    bottom: calc(75px + env(safe-area-inset-bottom));
  }
}

/* --------------------------------------------------------------------------
   Mobile Grid Adjustments for Block Queries
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* 2-column compact grid for cards on mobile phones */
  .wp-block-query .wp-block-post-template.is-layout-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .culs-card-body {
    padding: 8px 10px;
  }

  .culs-card-title {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .culs-btn-pill {
    padding: 9px 16px;
    font-size: 13px;
    width: 100%;
  }

  .culs-share-group {
    width: 100%;
  }

  .culs-share-btn {
    flex: 1 1 calc(50% - 6px);
    height: 38px;
    font-size: 13px;
  }
}

/* --------------------------------------------------------------------------
   Yoast SEO Breadcrumbs Support Styling
   -------------------------------------------------------------------------- */
.culs-breadcrumbs,
#breadcrumbs,
.yoast-breadcrumbs {
  font-size: 13px;
  color: var(--culs-text-muted);
  margin-bottom: 16px;
  padding: 6px 0;
  line-height: 1.4;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

.culs-breadcrumbs::-webkit-scrollbar {
  display: none;
}

.culs-breadcrumbs a,
#breadcrumbs a,
.yoast-breadcrumbs a {
  color: var(--culs-text-muted);
  text-decoration: none;
}

.culs-breadcrumbs a:hover,
#breadcrumbs a:hover,
.yoast-breadcrumbs a:hover {
  color: var(--culs-primary);
  text-decoration: underline;
}

.culs-breadcrumbs .breadcrumb_last,
#breadcrumbs .breadcrumb_last {
  color: var(--culs-text-main);
  font-weight: 600;
}
