/*
Theme Name: The Regent's Recipes Theme
Theme URI: https://verovid.com/
Author: @DenisFreeLanc
Author URI: https://verovid.com/
Description: A custom theme designed for The Regent's Recipes website, based on our unique design.
Version: 1.0
License: GNU General Public License v2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: regents-recipes
*/

/* --- Basic Setup & Variables --- */
:root {
  --color-accent1: #01110d;
  --color-accent2: #a4c639;
  --color-accent3: #ffebcd;
  --color-card-bg: #f8fff6;
  --color-main-bg: #fdfdf2;
  --color-text: #595959;
  --font-heading: 'Lora', serif;
  --font-body: 'Roboto', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--color-main-bg);
  color: var(--color-text);
  line-height: 1.6;
}

.container {
  max-width: calc(100vw - 120px);
  margin: 0 auto;
  padding: 0px 20px;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-heading);
  color: var(--color-accent1);
  line-height: 1.2;
}

a {
  color: var(--color-accent1);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-accent2);
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  margin-bottom: 40px;
}

/* --- Header --- */
.main-header {
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.swiper {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.main-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-accent1);
}

.main-nav ul {
  list-style: none;
  display: flex;
  gap: 30px;
}

.main-nav a {
  color: var(--color-text);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.search-bar input {
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 15px;
  font-family: var(--font-body);
}

.search-bar button {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--color-text);
}

.mobile-menu-toggle {
  display: none; /* Hidden on desktop */
  font-size: 1.8rem;
  background: none;
  border: none;
  cursor: pointer;
}

/* --- Hero Section --- */
.hero-section {
  position: relative;
  height: 60vh;
  background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url('https://placehold.co/1920x1080/DEC388/FFFDEB?text=Beautiful+Food+Image');
  background-size: cover;
  background-position: center;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #fff;
  padding: 20px;
}

.hero-content {
  position: relative;
  display: flex;
  z-index: 1;
  flex-direction: column;
  align-items: center;
}
.swiper.swiper-hero:after {
  width: 100%;
  height: 100%;
  display: block;
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  background-image: linear-gradient(112deg, black, transparent);
}
.hero-content h1 {
  color: #fff;
  font-size: 3.5rem;
  margin-bottom: 15px;
}

.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 30px;
  max-width: 600px;
}

.btn {
  padding: 12px 25px;
  border-radius: 5px;
  font-weight: 700;
  text-transform: uppercase;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background-color: var(--color-accent2);
  color: var(--color-main-bg);
  border: 2px solid var(--color-accent2);
}

.btn-secondary {
  background-color: var(--color-accent1);
  color: #fff;
  border: 2px solid var(--color-accent1);
}

/* --- Featured Categories --- */
.featured-categories {
  padding: 60px 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px;
}

.category-card {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}
.swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.category-card img {
  width: 100%;
  display: block;
  transition: transform 0.4s ease;
}

.category-card:hover img {
  transform: scale(1.1);
}

.category-card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-family: var(--font-heading);
  font-size: 1.8rem;
  text-align: center;
}

/* --- Recipe Section (Latest & Popular) --- */
.recipe-section {
  padding: 60px 0px;
}

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 30px;
}

.recipe-card {
  background: var(--color-card-bg);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
}

.recipe-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.recipe-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-height: 375px;
}

.recipe-card-content {
  color: #fff;
  padding: 20px;
  position: absolute;
  bottom: 0;
  background-image: linear-gradient(0deg, #000000bf, transparent);
  width: 100%;
  font-weight: 500;
}

.recipe-card-content h3 {
  font-size: 1.3rem;
  margin-bottom: 10px;
}

.recipe-card-content h3 a {
  color: var(--color-accent1);
}

.recipe-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #888;
}

/* --- Newsletter Section --- */
.newsletter-section {
  background-color: var(--color-accent3);
  padding: 60px 0;
  text-align: center;
}

.newsletter-section h2 {
  color: var(--color-accent1);
}

.newsletter-form {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.newsletter-form input {
  width: 300px;
  padding: 12px;
  border: 1px solid var(--color-accent1);
  border-radius: 5px;
}

/* --- Footer --- */
.main-footer {
  background-color: var(--color-accent1);
  color: #fff;
  padding: 50px 0 20px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 40px;
}

.footer-content h4 {
  color: var(--color-accent1);
  margin-bottom: 15px;
}

.footer-content p,
.footer-content a {
  color: #ccc;
}

.footer-links ul {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-social a {
  display: block;
  margin-bottom: 8px;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid #3a506b;
  padding-top: 20px;
  font-size: 0.9rem;
  color: #aaa;
}

/* --- Animations & Responsive --- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .main-nav {
    display: none;
  }
  .mobile-menu-toggle {
    display: block;
  }

  .main-nav.is-active {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  }
  .main-nav.is-active ul {
    flex-direction: column;
    align-items: center;
  }

  .hero-content h1 {
    font-size: 2.5rem;
  }
  .category-grid {
    grid-template-columns: 1fr;
  }
  .footer-content {
    grid-template-columns: 1fr;
  }
  .newsletter-form {
    flex-direction: column;
    align-items: center;
  }
  .featured-categories {
    padding: 60px 20px;
  }
  .recipe-section {
    padding: 60px 20px;
  }
}

/* --- Mega Menu with Tabs Styles (ВЕРСИЯ 3.0 - ИСПРАВЛЕННАЯ) --- */

/* Контейнер для пункта меню "Recipes" */
.main-nav .menu-item-has-children {
  position: relative;
}

/* Сама выпадающая панель мега-меню (скрыта по умолчанию) */
.main-nav > ul > .menu-item-has-children > .sub-menu {
  position: absolute;
  top: 100%;
  left: 50%; /* Центрируем относительно родителя */
  transform: translate(-50%, 0px); /* Точная центровка */

  background-color: #fff;
  padding: 20px 30px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);

  width: 1200px; /* Ширина мега-меню, можно настроить */
  max-width: 90vw; /* Ограничение по ширине экрана */

  visibility: hidden;
  opacity: 0;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  pointer-events: none;
}

/* Показываем панель при наведении */
.main-nav > ul > .menu-item-has-children:hover > .sub-menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Контейнер, который строит JS */
.megamenu-container {
  display: flex;
  flex-direction: column;
}

/* Стилизация списка вкладок (Main Dishes, Appetizers, etc.) */
.megamenu-tabs {
  display: flex;
  list-style: none;
  margin: 0 0 20px 0;
  padding: 0 0 15px 0; /* Убираем отступ слева */
  border-bottom: 2px solid #eee;
  flex-wrap: wrap; /* Позволяем переноситься на мобильных */
}

.megamenu-tabs .tab-trigger {
  padding: 8px 15px;
  cursor: pointer;
  font-family: var(--font-heading);
  color: var(--color-text);
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 5px;
  transition: background-color 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.megamenu-tabs .tab-trigger:hover {
  background-color: var(--color-card-bg);
}

.megamenu-tabs .tab-trigger.active {
  background-color: var(--color-accent1);
  color: #fff;
}

/* Панель с контентом для одной вкладки (список 3-го уровня) */
.megamenu-content {
  display: none; /* Все панели контента скрыты */
  padding: 0;
  margin: 0;
  list-style: none;

  /* Создаем 4 колонки */
  column-count: 4;
  column-gap: 30px;
}

.main-nav .sub-menu .sub-menu.megamenu-content.active {
  display: block;
}

.megamenu-content li {
  margin-bottom: 12px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.megamenu-content a {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: normal;
  text-transform: none; /* Убираем uppercase у дочерних */
}

.megamenu-content a:hover {
  color: var(--color-accent2);
}

/* Убираем стили по умолчанию для вложенных .sub-menu, так как мы управляем ими через JS */
.main-nav .sub-menu .sub-menu {
  position: static;
  visibility: visible;
  opacity: 1;
  display: block;
  width: auto;
  background: none;
  box-shadow: none;
  transform: none;
  border: none;
  display: none;
}
