/*
Theme Name: Mon theme
Theme URI: https://www.through-history.com
Author: Through History
Author URI: https://www.through-history.com
Description: Thème officiel Through History — boutique médiévale authentique
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: mon-theme
Tags: woocommerce, custom, medieval, ecommerce
*/

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

/* ==========================================================================
   Design Tokens
   ========================================================================== */
:root {
  --ink:      #1A1510;
  --ink-mid:  #2C2318;
  --parch:    #F2ECD8;
  --parch-2:  #E8DFC4;
  --gold:     #C8973A;
  --gold-lt:  #E5B96A;
  --gold-dk:  #8B6520;
  --stone:    #8B7355;
  --stone-lt: #BFB09A;
  --rust:     #7A3B1E;
  --cream:    #F9F5EC;
  --r-sm: 2px;
  --r-md: 4px;
  --speed: 0.3s;
}

/* ==========================================================================
   Base
   ========================================================================== */
html { scroll-behavior: smooth; }

body {
  font-family: 'Lato', sans-serif;
  background: var(--cream);
  color: var(--ink);
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-lt); }
ul, ol { list-style: none; padding: 0; }

/* ==========================================================================
   NAV
   ========================================================================== */
#site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(26,21,16,0.97);
  border-bottom: 1px solid var(--gold-dk);
  backdrop-filter: blur(8px);
}
.admin-bar #site-nav { top: 32px; }

/* Offset pour le nav fixe — fiche produit (template WC default ou custom) */
body.single-product { padding-top: 80px; }

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-logo {
  font-family: 'Cinzel', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo span { color: var(--parch); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.15rem;
  align-items: center;
}

.nav-links a {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--stone-lt);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-sm);
  transition: color var(--speed), background var(--speed);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links .current-menu-item > a,
.nav-links a.active {
  color: var(--gold);
  background: rgba(200,151,58,0.08);
}

.nav-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-shrink: 0;
}

.btn-cart {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--gold);
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.5rem 1rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background var(--speed), transform var(--speed);
}
.btn-cart:hover { background: var(--gold-lt); transform: translateY(-1px); color: var(--ink); }

.nav-icon {
  color: var(--stone-lt);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
  font-size: 1.1rem;
  line-height: 1;
  transition: color var(--speed);
  text-decoration: none;
  display: inline-flex;
}
.nav-icon:hover { color: var(--gold); }

/* ── Dropdown menus ── */
.nav-links li { position: relative; }

/* Chevron sur les items parents */
.nav-links .menu-item-has-children > a::after {
  content: '▾';
  font-size: 0.55rem;
  margin-left: 0.3rem;
  vertical-align: middle;
  display: inline-block;
  transition: transform var(--speed);
  line-height: 1;
  opacity: 0.7;
}
.nav-links .menu-item-has-children.dropdown-open > a::after,
.nav-links .menu-item-has-children:hover > a::after {
  transform: rotate(180deg);
  opacity: 1;
}

/* Panneau dropdown */
.nav-links .sub-menu {
  position: absolute;
  top: calc(100% + 1px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 200px;
  list-style: none;
  padding: 0.5rem 0;
  background: rgba(18,14,10,0.98);
  border: 1px solid rgba(200,151,58,0.2);
  border-top: 2px solid var(--gold);
  border-radius: 0 0 var(--r-md) var(--r-md);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--speed), transform var(--speed),
              visibility 0s var(--speed);
  z-index: 200;
}

/* Ouverture au survol (desktop) ET via classe JS */
.nav-links li:hover > .sub-menu,
.nav-links li.dropdown-open > .sub-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity var(--speed), transform var(--speed), visibility 0s 0s;
}

/* Petit triangle */
.nav-links .sub-menu::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--gold);
}

/* Liens dans le dropdown */
.nav-links .sub-menu a {
  display: block;
  padding: 0.6rem 1.25rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--stone-lt);
  border-radius: 0;
  white-space: nowrap;
  border-left: 2px solid transparent;
  background: none;
}
.nav-links .sub-menu a:hover {
  color: var(--gold);
  background: rgba(200,151,58,0.07);
  border-left-color: var(--gold);
}

/* Bouton flèche injecté par JS (mobile uniquement) */
.dropdown-arrow {
  display: none;
  background: none;
  border: none;
  color: var(--stone-lt);
  font-size: 0.7rem;
  padding: 0.4rem 0.5rem;
  cursor: pointer;
  line-height: 1;
  transition: color var(--speed), transform var(--speed);
  vertical-align: middle;
}
.dropdown-arrow:hover { color: var(--gold); }

/* Mobile nav toggle */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: var(--r-sm);
  color: var(--stone-lt);
  padding: 0.4rem 0.75rem;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  cursor: pointer;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink);
  background: var(--gold);
  border: 1px solid var(--gold);
  padding: 0.9rem 2rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--speed);
  display: inline-block;
}
.btn-primary:hover {
  background: var(--gold-lt);
  border-color: var(--gold-lt);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,151,58,0.3);
  color: var(--ink);
}

.btn-secondary {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--parch);
  background: transparent;
  border: 1px solid rgba(242,236,216,0.35);
  padding: 0.9rem 2rem;
  border-radius: var(--r-sm);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--speed);
  display: inline-block;
}
.btn-secondary:hover {
  background: rgba(242,236,216,0.08);
  border-color: var(--parch);
  color: var(--parch);
}

/* ==========================================================================
   Page Header (breadcrumb bar — shared by boutique, contact, etc.)
   ========================================================================== */
.page-header {
  padding: 100px 2rem 3rem;
  background: var(--ink);
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cpath d='M30 5 L55 20 L55 40 L30 55 L5 40 L5 20 Z' fill='none' stroke='%23C8973A' stroke-width='.3' opacity='.07'/%3E%3C/svg%3E");
  background-size: 60px 60px;
}
.page-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
}
.breadcrumb {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--stone-lt);
  opacity: 0.6;
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.breadcrumb a { color: var(--stone-lt); text-decoration: none; transition: color var(--speed); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb-sep { color: var(--gold-dk); }

.page-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  font-weight: 700;
  color: var(--parch);
  letter-spacing: 0.06em;
}
.page-subtitle {
  font-size: 1rem;
  color: var(--stone-lt);
  line-height: 1.7;
  max-width: 540px;
}
.page-header-divider {
  width: 60px;
  height: 2px;
  background: var(--gold);
  margin: 1.5rem 0;
}

/* ==========================================================================
   Section Commons
   ========================================================================== */
section { position: relative; z-index: 1; }

.section-header { text-align: center; margin-bottom: 3rem; }

.section-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--gold);
  text-transform: uppercase;
  font-family: 'Lato', sans-serif;
  margin-bottom: 0.75rem;
  display: block;
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.section-desc {
  font-size: 0.95rem;
  line-height: 1.75;
  color: var(--stone);
  max-width: 520px;
  margin: 1rem auto 0;
}

/* ==========================================================================
   Divider
   ========================================================================== */
.divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  margin: 0.5rem 0;
}
.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dk), transparent);
}
.divider-ornament {
  padding: 0 1rem;
  color: var(--gold);
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ==========================================================================
   Product Cards (shared between homepage, boutique, related)
   ========================================================================== */
.prod-card {
  background: var(--cream);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid rgba(139,115,85,0.15);
  transition: transform var(--speed), box-shadow var(--speed);
  text-decoration: none;
  color: inherit;
  display: block;
}
.prod-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(26,21,16,0.12); }

.prod-img {
  aspect-ratio: 3/4;
  background: var(--parch-2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.prod-img img { width: 100%; height: 100%; object-fit: cover; }

/* Product image placeholder gradients */
.prod-img-1 { background: linear-gradient(160deg,#c8973a22,#8b735522,#1a151022); }
.prod-img-2 { background: linear-gradient(160deg,#7a3b1e22,#c8973a22,#2c231822); }
.prod-img-3 { background: linear-gradient(160deg,#1a1e2a22,#c8973a22,#8b655522); }
.prod-img-4 { background: linear-gradient(160deg,#2a1a1e22,#8b735522,#c8973a22); }
.prod-img-5 { background: linear-gradient(160deg,#1e2a1a22,#345228,#c8973a11); }
.prod-img-6 { background: linear-gradient(160deg,#2a1e1222,#c8973a22,#50372022); }
.prod-img-7 { background: linear-gradient(160deg,#1a2a2a22,#2a5050,#c8973a11); }
.prod-img-8 { background: linear-gradient(160deg,#2a1a2a22,#503050,#c8973a11); }

.prod-icon { font-size: 3rem; opacity: 0.18; line-height: 1; }
.prod-icon-sm { font-size: 2.5rem; opacity: 0.18; }

.prod-badge {
  position: absolute;
  top: 0.75rem; left: 0.75rem;
  background: var(--gold);
  color: var(--ink);
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-sm);
}
.prod-badge.new  { background: var(--rust); color: var(--parch); }
.prod-badge.sale { background: #5a7a1a; color: var(--parch); }

.prod-wishlist {
  position: absolute;
  top: 0.75rem; right: 0.75rem;
  width: 30px; height: 30px;
  background: rgba(242,236,216,0.9);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--speed);
  cursor: pointer;
  border: none;
  color: var(--stone);
}
.prod-card:hover .prod-wishlist { opacity: 1; transform: scale(1); }

.prod-info { padding: 1rem 1.1rem 1.25rem; }

.prod-origin {
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  font-family: 'Lato', sans-serif;
}

.prod-name {
  font-family: 'Cinzel', serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin-bottom: 0.75rem;
  letter-spacing: 0.03em;
}

.prod-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.prod-price {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
.prod-price-old {
  font-size: 0.82rem;
  color: var(--stone-lt);
  text-decoration: line-through;
  margin-right: 0.25rem;
}

.btn-add {
  font-family: 'Lato', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold);
  background: transparent;
  border: 1px solid var(--gold-dk);
  padding: 0.35rem 0.75rem;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--speed);
  text-transform: uppercase;
}
.btn-add:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
  background: #120E0A;
  border-top: 1px solid rgba(200,151,58,0.15);
  padding: 4rem 2rem 2rem;
  color: var(--stone-lt);
}

.footer-inner { max-width: 1280px; margin: 0 auto; }

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(139,115,85,0.15);
  margin-bottom: 2rem;
}

.footer-brand .nav-logo { font-size: 1.2rem; display: block; margin-bottom: 1rem; }

.footer-tagline {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--stone-lt);
  opacity: 0.8;
  margin-bottom: 1.25rem;
  max-width: 260px;
}

.footer-socials { display: flex; gap: 0.6rem; }

.social-btn {
  width: 34px; height: 34px;
  border: 1px solid rgba(139,115,85,0.3);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--stone-lt);
  text-decoration: none;
  font-size: 0.85rem;
  transition: all var(--speed);
}
.social-btn:hover { border-color: var(--gold); color: var(--gold); background: rgba(200,151,58,0.08); }

.footer-col-title {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--parch);
  margin-bottom: 1.25rem;
}

.footer-links { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.footer-links a { font-size: 0.82rem; color: var(--stone-lt); opacity: 0.75; text-decoration: none; transition: opacity var(--speed), color var(--speed); }
.footer-links a:hover { opacity: 1; color: var(--gold); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--stone-lt);
  opacity: 0.5;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Scroll Reveal
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   Responsive — shared
   ========================================================================== */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .menu-toggle { display: block; }
  .nav-links.nav-open {
    display: flex; flex-direction: column;
    position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(18,14,10,0.99);
    padding: 0.75rem 1.5rem 1.25rem;
    gap: 0; z-index: 99;
    border-bottom: 1px solid rgba(200,151,58,0.15);
  }
  .nav-links.nav-open > li > a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(139,115,85,0.1);
  }
  .nav-links.nav-open > li:last-child > a { border-bottom: none; }
  /* Flèche mobile visible */
  .nav-links.nav-open .dropdown-arrow { display: inline-flex; align-items: center; }
  .nav-links.nav-open li.dropdown-open > .dropdown-arrow { transform: rotate(180deg); color: var(--gold); }
  /* Sous-menu mobile : accordéon inline */
  .nav-links .sub-menu {
    position: static;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: rgba(0,0,0,0.25);
    border: none;
    border-left: 2px solid var(--gold-dk);
    border-top: none;
    border-radius: 0;
    padding: 0.25rem 0 0.5rem 0.75rem;
    margin: 0.25rem 0 0.25rem 0.75rem;
    box-shadow: none;
    backdrop-filter: none;
    display: none;
    transition: none;
  }
  .nav-links li.dropdown-open > .sub-menu { display: block; }
  .nav-links .sub-menu::before { display: none; }
  .nav-links .sub-menu a {
    padding: 0.5rem 0.75rem;
    border-left: none;
    font-size: 0.7rem;
    opacity: 0.85;
  }
  /* Désactiver le hover desktop en mobile */
  .nav-links li:hover > .sub-menu { opacity: 1; visibility: visible; }
  .footer-top { grid-template-columns: 1fr 1fr; gap: 2rem; }
}
@media (max-width: 480px) {
  .footer-top { grid-template-columns: 1fr; gap: 1.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
