/*
Theme Name: Höritröpfli
Theme URI: https://hoeritroepfli-dev.ch
Author: Dominique Dümmler
Description: Custom theme for Höritröpfli Fine Spirits & Whisky
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 8.0
License: GPL v2 or later
Text Domain: hoeritroepfli
*/

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */

:root {
  --color-primary:    #4f1b30;
  --color-footer:     #772948;
  --color-white:      #ffffff;
  --color-hover-bg:   rgba(255, 255, 255, 0.65);
  --color-overlay:    rgba(0, 0, 0, 0.26);
  --color-black:      #000000;
  --font-heading:     'Rufina', serif;
  --font-body:        system-ui, -apple-system, sans-serif;
  --hero-height:      600px;
  --container:        1100px;
  --gap:              24px;
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  background: #fff;
}

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

a { color: var(--color-primary); }
a:hover { color: var(--color-black); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.3;
  margin-top: 0;
}

p { margin-top: 0; }

/* ==========================================================================
   LAYOUT
   ========================================================================== */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap);
}

.site-main {
  min-height: 60vh;
}

/* Two-column layout used on content pages */
.two-col {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.two-col > * {
  flex: 1 1 calc(50% - var(--gap));
  min-width: 280px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-primary);
  padding: 0 var(--gap);
}

.site-header .header-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* Logo */
.site-header .custom-logo-link img {
  height: 44px;
  width: auto;
}

/* Nav */
.site-header .main-navigation ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
}

.site-header .main-navigation ul li { position: relative; }

.site-header .main-navigation ul li a {
  display: block;
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--color-white);
  text-decoration: none;
  letter-spacing: 0.8px;
  padding: 10px 12px;
  transition: background 0.15s, color 0.15s;
}

.site-header .main-navigation ul li a:hover,
.site-header .main-navigation ul li.current-menu-item > a {
  background: var(--color-hover-bg);
  color: var(--color-primary);
}

/* Dropdown */
.site-header .main-navigation ul li ul {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-primary);
  min-width: 200px;
  flex-direction: column;
  z-index: 100;
}
.site-header .main-navigation ul li:hover > ul { display: flex; }
.site-header .main-navigation ul li ul li a { font-size: 15px; }

/* Cart icon in header */
.header-cart {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-white);
  text-decoration: none;
  font-size: 15px;
  padding: 10px 8px;
  position: relative;
}
.header-cart:hover { color: var(--color-white); }
.header-cart svg { width: 22px; height: 22px; fill: currentColor; }
.cart-count {
  background: var(--color-hover-bg);
  color: var(--color-primary);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 6px;
  right: 2px;
}

/* ==========================================================================
   HERO
   ========================================================================== */

.hero-section {
  position: relative;
  height: var(--hero-height);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
}

.hero-section.hero-bottom {
  align-items: flex-end;
  justify-content: flex-start;
}

.hero-text {
  position: relative;
  z-index: 1;
  font-family: var(--font-heading);
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.5;
  color: var(--color-primary);
  background: var(--color-hover-bg);
  padding: 20px 32px;
}

/* ==========================================================================
   CONTENT SECTIONS
   ========================================================================== */

.content-section {
  padding: 48px var(--gap);
  max-width: var(--container);
  margin: 0 auto;
}

.content-section h2 {
  color: var(--color-primary);
  font-size: 28px;
  margin-bottom: 16px;
}

/* Oxygen class equivalents */
.heading2-black { font-family: var(--font-heading); color: var(--color-primary); font-size: 28px; }
.heading-rot    { font-family: var(--font-heading); color: var(--color-primary); font-size: 24px; }
.slogan         { font-family: var(--font-heading); font-size: clamp(20px,3vw,30px); color: var(--color-primary); background: var(--color-hover-bg); padding: 20px 32px; }
.slogan-rot     { font-family: var(--font-heading); font-size: clamp(20px,3vw,30px); color: var(--color-white); }
.slogan-rot-links { text-align: left; }
.text           { font-size: 16px; color: #333; }
.footer-text    { font-size: 14px; color: rgba(255,255,255,0.85); line-height: 1.8; }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.site-footer {
  background: var(--color-footer);
  color: var(--color-white);
  padding: 48px var(--gap);
}

.footer-grid {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

.footer-col h4 {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  opacity: 0.7;
  color: var(--color-white);
}

.footer-col p,
.footer-col a {
  font-size: 14px;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  display: block;
  margin: 0;
}

.footer-col a:hover { color: var(--color-white); }

/* ==========================================================================
   KONTAKT PAGE
   ========================================================================== */

.kontakt-section {
  padding: 48px var(--gap);
  max-width: var(--container);
  margin: 0 auto;
}

.kontakt-info h2 {
  color: var(--color-primary);
  font-family: var(--font-heading);
  margin-bottom: 16px;
}

.kontakt-info p {
  line-height: 1.9;
  color: #333;
}

.map-section {
  margin-top: 0;
}

.map-section iframe {
  display: block;
  width: 100%;
  border: 1px solid #ccc;
}

/* ==========================================================================
   WOOCOMMERCE — MINI CART BAR
   ========================================================================== */

.shop-mini-cart-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 16px var(--gap);
  max-width: var(--container);
  margin: 0 auto;
  gap: 8px;
}

.shop-mini-cart-bar a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-primary);
  font-size: 14px;
  text-decoration: none;
  font-weight: 500;
}

.shop-mini-cart-bar a:hover { color: var(--color-black); }

.shop-mini-cart-bar .cart-count-badge {
  background: var(--color-primary);
  color: var(--color-white);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   WOOCOMMERCE — CATEGORY GRID (archive-product.php)
   ========================================================================== */

.woo-categories-grid {
  padding: 24px var(--gap) 48px;
  max-width: var(--container);
  margin: 0 auto;
}

/* Override WooCommerce product categories output */
.woo-categories-grid .woocommerce ul.products {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 20px !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

.woo-categories-grid .woocommerce ul.products li.product-category {
  margin: 0 !important;
  text-align: center;
}

.woo-categories-grid .woocommerce ul.products li.product-category a h2,
.woo-categories-grid .woocommerce ul.products li.product-category a .woocommerce-loop-category__title {
  font-family: var(--font-heading) !important;
  font-size: 16px !important;
  color: var(--color-primary) !important;
  font-weight: 400;
  text-align: center;
}

.woo-categories-grid .woocommerce ul.products li.product-category a:hover h2,
.woo-categories-grid .woocommerce ul.products li.product-category a:hover .woocommerce-loop-category__title {
  color: var(--color-black) !important;
}

/* ==========================================================================
   WOOCOMMERCE — PRODUCT LOOP (taxonomy-product_cat.php)
   ========================================================================== */

.woo-products-wrap {
  padding: 24px var(--gap) 48px;
  max-width: var(--container);
  margin: 0 auto;
}

.woo-products-wrap .woocommerce-products-header h1 {
  font-family: var(--font-heading);
  font-size: 46px;
  font-weight: 400;
  color: var(--color-primary);
  margin-bottom: 8px;
}

.woo-products-wrap .term-description {
  font-size: 20px;
  color: var(--color-black);
  margin-bottom: 24px;
}

.woo-products-wrap .woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-primary);
}

.woo-products-wrap .woocommerce ul.products li.product a:hover .woocommerce-loop-product__title {
  color: var(--color-black);
}

/* ==========================================================================
   WOOCOMMERCE — SINGLE PRODUCT
   ========================================================================== */

.single-product-layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
  padding: 48px var(--gap);
  max-width: var(--container);
  margin: 0 auto;
}

.single-product-image { flex: 1; }
.single-product-details { flex: 1; }

.single-product-details .product_title {
  font-family: var(--font-heading) !important;
  font-size: 25px !important;
  color: var(--color-primary) !important;
  font-weight: 400 !important;
  margin-bottom: 16px;
}

.single-product-details .woocommerce-product-details__short-description {
  margin-bottom: 16px;
  color: #444;
}

/* Add to cart button */
.single-product-details .single_add_to_cart_button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
  background: var(--color-primary) !important;
  color: var(--color-white) !important;
  border: none !important;
  padding: 10px 24px !important;
  font-size: 15px !important;
  border-radius: 3px !important;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
}

.single-product-details .single_add_to_cart_button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover {
  background: var(--color-black) !important;
  color: var(--color-white) !important;
}

/* Product tabs below fold */
.single-product-tabs {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gap) 48px;
}

/* Price */
.woocommerce .price, .woocommerce p.price {
  color: var(--color-primary) !important;
  font-size: 22px !important;
  font-weight: 700;
}

/* ==========================================================================
   WOOCOMMERCE — CART / CHECKOUT / ACCOUNT
   ========================================================================== */

/* Inherit button style from above; override WooCommerce's default blue */
.woocommerce #payment #place_order,
.woocommerce-page #payment #place_order {
  background: var(--color-primary) !important;
}

.woocommerce a.button.alt,
.woocommerce button.button.alt {
  background: var(--color-primary) !important;
}

/* Age gate above the place-order button */
.hoeri-age-gate {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid #e2d6dc;
  border-radius: 3px;
  background: #faf6f8;
}
.hoeri-age-gate__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
}
.hoeri-age-gate__check input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.hoeri-age-gate__legal {
  margin: 8px 0 0 28px;
  font-size: 14px;
}
.hoeri-age-gate__legal a { text-decoration: underline; }

/* Disabled state for the place-order button until age is confirmed */
.woocommerce #payment #place_order.hoeri-disabled,
.woocommerce-page #payment #place_order.hoeri-disabled,
#place_order.hoeri-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ==========================================================================
   LEGAL MODAL (Impressum / AGB / Datenschutz popups)
   ========================================================================== */

body.hoeri-modal-open { overflow: hidden; }

.hoeri-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.hoeri-modal[hidden] { display: none; }

.hoeri-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.hoeri-modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--color-white);
  border-radius: 4px;
  padding: 32px 36px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.hoeri-modal__close {
  position: absolute;
  top: 10px;
  right: 14px;
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: var(--color-primary);
  cursor: pointer;
}
.hoeri-modal__close:hover { color: var(--color-black); }

.hoeri-modal__title {
  margin: 0 0 16px;
  padding-right: 30px;
  color: var(--color-primary);
}
.hoeri-modal__body { font-size: 15px; line-height: 1.6; }
.hoeri-modal__body img { max-width: 100%; height: auto; }
.hoeri-modal__status { color: #777; font-style: italic; }

@media (max-width: 600px) {
  .hoeri-modal__dialog { padding: 26px 20px; max-height: 90vh; }
}

/* ==========================================================================
   MOBILE NAV — HAMBURGER + DRAWER (activated ≤768px)
   ========================================================================== */

/* Hamburger button — hidden on desktop, revealed in the ≤768px media query */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  margin-left: 4px;
  /* Reset native control chrome — iOS Safari otherwise paints a light button
     background, hiding the white bars (looked like a blank white box). */
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.nav-toggle__bar {
  display: block;
  width: 26px;
  height: 2px;
  margin: 0 auto;
  background: var(--color-white);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
/* Morph the three bars into an ✕ when the drawer is open */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Dimmed backdrop behind the drawer */
.mobile-drawer__backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mobile-drawer__backdrop.is-open { opacity: 1; }
.mobile-drawer__backdrop[hidden] { display: none; }

/* Slide-in drawer panel */
.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1600;
  width: min(80vw, 320px);
  padding: 64px 24px 32px;
  background: var(--color-primary);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.mobile-drawer.is-open { transform: translateX(0); }
.mobile-drawer[hidden] { display: none; }

.mobile-drawer__close {
  position: absolute;
  top: 12px;
  right: 16px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--color-white);
  font-size: 32px;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* Drawer nav links */
.mobile-drawer__nav ul { list-style: none; margin: 0; padding: 0; }
.mobile-drawer__nav li { margin: 0; }
.mobile-drawer__nav a {
  display: block;
  font-family: var(--font-heading);
  font-size: 20px;
  color: var(--color-white);
  text-decoration: none;
  letter-spacing: 0.8px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.mobile-drawer__nav a:hover { color: var(--color-hover-bg); }
.mobile-drawer__nav ul ul a { font-size: 16px; padding-left: 20px; }

/* Drawer cart link */
.mobile-drawer__cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--color-white);
  text-decoration: none;
}
.mobile-drawer__cart .cart-count-badge {
  background: var(--color-hover-bg);
  color: var(--color-primary);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Drawer legal links */
.mobile-drawer__legal {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.mobile-drawer__legal a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}
.mobile-drawer__legal a:hover { color: var(--color-white); }

/* Lock background scroll while the drawer is open */
body.hoeri-drawer-open { overflow: hidden; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .single-product-layout { flex-direction: column; }
  .woo-categories-grid .woocommerce ul.products { grid-template-columns: repeat(3, 1fr) !important; }
}

/* Swap the inline nav for the hamburger + drawer */
@media (max-width: 768px) {
  .site-header .main-navigation { display: none; }
  .nav-toggle { display: flex; }
}

@media (max-width: 600px) {
  .footer-grid { grid-template-columns: 1fr; }
  .hero-text { font-size: 18px; padding: 12px 20px; }
  .woo-categories-grid .woocommerce ul.products { grid-template-columns: repeat(2, 1fr) !important; }
}
