/* FeriaNav theme: "Warm artisan market" */
[hidden] { display: none !important; }
:root {
  --c-primary: #9c3d24;
  --c-bg: #f6efe4;
  --c-accent: #2f5d3a;
  --c-border: #e6d6c2;
  --c-border-strong: #c9a27e;
  --c-text-soft: #6b4a32;
  --c-surface: #fff;
  --c-text: #2b1d14;
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--c-bg); color: var(--c-text); font-family: var(--font-body); line-height: 1.5; }
img { max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--font-head); color: var(--c-text); line-height: 1.2; }
a { color: var(--c-primary); }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px dashed var(--c-border-strong); color: var(--c-text-soft); }
.logo { font-family: var(--font-head); font-weight: 700; font-size: 22px; color: var(--c-primary); text-decoration: none; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; font-size: 14px; }
.site-nav a { color: var(--c-text-soft); text-decoration: none; }
.site-nav a:hover { color: var(--c-primary); }
.site-search { flex: 1 1 100%; order: 3; margin: 0; }
.site-search input { width: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--c-border-strong); border-radius: 999px; background: #fff; font: inherit; }
@media (min-width: 720px) { .site-search { flex: 0 1 280px; order: 0; } }
.site-nav .nav-cta { color: var(--c-primary); font-weight: 600; }
.site-footer { text-align: center; padding: 16px; font-size: 13px; color: var(--c-text-soft); }
.divider { border: 0; border-top: 1px dashed var(--c-border-strong); margin: 16px 0; }

/* Buttons */
.btn { display: inline-block; padding: 10px 16px; border-radius: 8px; border: 1px solid var(--c-primary); background: var(--c-primary); color: #fff; font: 600 14px var(--font-body); text-align: center; text-decoration: none; cursor: pointer; }
.btn-wa { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn-email { background: var(--c-bg); border-color: var(--c-primary); color: var(--c-primary); }

/* Chips */
.chip { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-text-soft); font-size: 13px; text-decoration: none; }
.chip.is-active { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }

/* Card + product grid */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px; }
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

/* Forms */
.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form-row label { font-weight: 600; font-size: 14px; color: var(--c-text-soft); }
.form-row input, .form-row select, .form-row textarea { width: 100%; padding: 10px; border: 1px solid var(--c-border-strong); border-radius: 8px; background: var(--c-surface); font: 16px var(--font-body); }
.form-row .errorlist, .form-row .help { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.form-row .errorlist { color: var(--c-primary); }

/* Notices */
.notice { padding: 10px 14px; margin: 12px 0; border-radius: 8px; border: 1px solid; font-size: 14px; }
.notice--info { background: #eaf1f7; border-color: #b8cfe3; color: #254a6b; }
.notice--warn { background: #fbefd9; border-color: #e3c28a; color: #7a4b0c; }
.notice--ok { background: #e6f0e8; border-color: #a9c9b0; color: var(--c-accent); }

/* Hero with dot pattern */
.hero { background: var(--c-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Ccircle cx='18' cy='18' r='1.6' fill='%23f6efe4' opacity='.3'/%3E%3C/svg%3E"); color: var(--c-bg); padding: 32px 16px; }
.hero h1, .hero h2, .hero h3 { color: var(--c-bg); margin-top: 0; }

.logout-form { display: inline; margin: 0; }
.nav-link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }

/* Dashboard */
.dash-nav { display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0; font-size: 14px; }
.form-row input[type="checkbox"], .form-row input[type="radio"] { width: auto; }
.form-row ul { list-style: none; margin: 0; padding: 0; }

/* Storefront */
.btn-light { background: var(--c-bg); border-color: var(--c-bg); color: var(--c-primary); }
.coming-soon { text-align: center; padding: 56px 16px; }
.coming-soon__date { font: 700 24px var(--font-head, inherit); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0; -webkit-overflow-scrolling: touch; }
.chip-row .chip { white-space: nowrap; flex: 0 0 auto; }
.filter-panel { margin: 4px 0 16px; }
.filter-panel summary { cursor: pointer; font-weight: 600; color: var(--c-text-soft); padding: 8px 0; }
.filter-form { display: grid; gap: 0 12px; grid-template-columns: 1fr; padding-top: 8px; }
@media (min-width: 640px) { .filter-form { grid-template-columns: repeat(2, 1fr); } }
.filter-form .btn { justify-self: start; }
.filter-clear { margin: 10px 0 0 12px; font-size: 14px; }
.product-card { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.product-card__link { color: inherit; text-decoration: none; }
.product-card__img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; background: var(--c-border); }
.product-card__name { margin: 8px 0 2px; font-size: 15px; }
.product-card__brand, .product-card__place { margin: 0; font-size: 12px; color: var(--c-text-soft); }
.product-card__price { margin: 4px 0 0; font-weight: 600; color: var(--c-primary); }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 20px 0; font-size: 14px; }
.empty-state { text-align: center; padding: 32px 0; color: var(--c-text-soft); }

/* Slider */
.slider { position: relative; overflow: hidden; background: var(--c-border); }
.slider__slide { display: none; position: relative; }
.slider__slide.is-active { display: block; }
.slider__slide img { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: 420px; object-fit: cover; }
.slider__slide a { color: inherit; text-decoration: none; display: block; }
.slider__caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 24px 16px 28px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); display: flex; flex-direction: column; gap: 2px; }
.slider__caption strong { font: 700 20px var(--font-head, inherit); }
.slider__dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; }
.slider__dot { width: 24px; height: 24px; border: 0; background: none; cursor: pointer; position: relative; padding: 0; }
.slider__dot::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgba(255,255,255,.55); }
.slider__dot.is-active::after { background: #fff; }

/* Product / brand pages */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #fbefd9; border: 1px solid #e3c28a; color: #7a4b0c; font: 600 12px var(--font-body); vertical-align: middle; }
.breadcrumb { margin: 12px 0; font-size: 14px; }
.product-detail { display: grid; gap: 20px; grid-template-columns: 1fr; margin-bottom: 32px; }
@media (min-width: 768px) { .product-detail { grid-template-columns: 1fr 1fr; align-items: start; } }
.gallery__main { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius); background: var(--c-border); touch-action: pan-y; }
.gallery__thumbs { display: flex; gap: 8px; margin-top: 8px; overflow-x: auto; }
.gallery__thumb { flex: 0 0 64px; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 6px; background: none; cursor: pointer; overflow: hidden; }
.gallery__thumb.is-active { border-color: var(--c-primary); }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.product-detail__category { color: var(--c-text-soft); margin: 0; }
.product-detail__price { font: 700 22px var(--font-head, inherit); color: var(--c-primary); margin: 4px 0 12px; }
.contact__buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.contact__text { list-style: none; padding: 0; margin: 10px 0; font-size: 14px; color: var(--c-text-soft); }
.brand-terms { margin-top: 20px; }
.brand-terms h2 { margin-top: 0; font-size: 18px; }
.brand-terms dt { font-weight: 600; margin-top: 6px; }
.brand-terms dd { margin: 0; }
.brand-header { display: flex; gap: 20px; align-items: center; margin: 20px 0; }
.brand-header__logo { flex: 0 0 auto; width: 136px; height: 136px; object-fit: cover; border-radius: 50%; border: 1px solid var(--c-border); background: var(--c-surface); }
@media (min-width: 720px) { .brand-header { gap: 32px; } .brand-header__logo { width: 200px; height: 200px; } }
.brand-header h1 { margin: 0; }
.brand-header__place { margin: 4px 0 0; color: var(--c-text-soft); }
.brand-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .brand-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .brand-grid { grid-template-columns: repeat(4, 1fr); } }
.brand-card { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: inherit; text-decoration: none; }
.brand-card__logo { width: 96px; height: 96px; object-fit: cover; border-radius: 50%; background: var(--c-border); }
.brand-card__place { font-size: 12px; color: var(--c-text-soft); }

/* ---------------------------------------------------------------
   Motion & interaction
   One memorable moment: hovering a product reveals its second photo.
   Everything else is short, quiet feedback. Reduced motion = none.
   --------------------------------------------------------------- */
:root {
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --shadow-warm: 0 14px 28px -16px rgba(107, 74, 50, .55);
}

/* Keyboard focus that matches the theme */
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.product-card__link:focus-visible { outline-offset: 4px; border-radius: 6px; }

/* Header: sticky; on phones it slides away while scrolling down and returns on scroll up */
.site-header {
  position: sticky; top: 0; z-index: 30; background: var(--c-bg);
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.site-header.is-scrolled { box-shadow: 0 6px 18px -14px rgba(107, 74, 50, .6); }
.site-header.is-tucked { transform: translateY(-100%); }
.site-header:focus-within { transform: none; }

/* Buttons and chips: smooth fills, small lift, press on tap */
.btn, .chip { transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s var(--ease-out), box-shadow .18s ease; }
.btn:active, .chip:active { transform: scale(.97); }
@media (hover: hover) {
  .btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-warm); }
  .btn:not(.btn-email):not(.btn-light):not(.btn-wa):hover { background: #84321d; border-color: #84321d; }
  .btn-wa:hover { background: #244a2d; border-color: #244a2d; }
  .btn-email:hover { background: var(--c-primary); color: #fff; }
  .chip:not(.is-active):hover { border-color: var(--c-primary); color: var(--c-primary); }
  .site-nav a { transition: color .15s ease; }
}

/* Product cards: lift, gentle zoom, crossfade to the second photo */
.product-card { transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out), border-color .35s ease; }
.product-card__media { position: relative; overflow: hidden; border-radius: 6px; }
.product-card__media .product-card__img { transition: transform .6s var(--ease-out), opacity .45s ease; }
.product-card__img--alt { position: absolute; inset: 0; height: 100%; opacity: 0; }
.product-card:active { transform: scale(.985); }
@media (hover: hover) {
  .product-card:hover, .product-card:focus-within { transform: translateY(-4px); box-shadow: var(--shadow-warm); border-color: var(--c-border-strong); }
  .product-card:hover .product-card__img, .product-card:focus-within .product-card__img { transform: scale(1.04); }
  .product-card:hover .product-card__img--alt, .product-card:focus-within .product-card__img--alt { opacity: 1; }
}

/* Scroll reveal for product grids only (class added by JS, so no-JS shows everything) */
.js-reveal .product-grid > .product-card:not(.is-in) { opacity: 0; transform: translateY(16px); }
.js-reveal .product-grid > .product-card { transition: opacity .5s ease var(--reveal-delay, 0s), transform .6s var(--ease-out) var(--reveal-delay, 0s), box-shadow .35s var(--ease-out), border-color .35s ease; }

/* Brand directory: the logo leans in */
.brand-card__logo { transition: transform .35s var(--ease-out), box-shadow .35s ease; }
@media (hover: hover) {
  .brand-card:hover .brand-card__logo, .brand-card:focus-visible .brand-card__logo { transform: scale(1.06) rotate(-3deg); box-shadow: var(--shadow-warm); }
}

/* Slider: crossfade between slides, slow zoom on the active image, caption rises */
.slider__track { display: grid; }
.slider__slide, .slider__slide.is-active { display: block; grid-area: 1 / 1; }
.slider__slide { opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s linear .8s; }
.slider__slide.is-active { opacity: 1; visibility: visible; transition: opacity .8s ease; }
.slider__slide img { transform-origin: 70% 40%; }
.slider__slide.is-active img { animation: slow-zoom 7s var(--ease-out) forwards; }
.slider__caption > * { transition: transform .6s var(--ease-out) .25s, opacity .6s ease .25s; }
.slider__slide:not(.is-active) .slider__caption > * { transform: translateY(12px); opacity: 0; }
.slider__dot::after { transition: background-color .2s ease, transform .2s var(--ease-out); }
.slider__dot.is-active::after { transform: scale(1.25); }
@keyframes slow-zoom { from { transform: scale(1); } to { transform: scale(1.06); } }

/* Product gallery: crossfade when switching photos */
.gallery__main { transition: opacity .2s ease; }
.gallery__main.is-fading { opacity: 0; }
.gallery__thumb { transition: border-color .2s ease, transform .2s var(--ease-out); }
@media (hover: hover) { .gallery__thumb:hover { transform: translateY(-2px); } }

/* Respect "reduce motion" everywhere */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; transition-delay: 0s !important; scroll-behavior: auto !important; }
  .site-header.is-tucked { transform: none; }
}

/* Brand web and social links: platform icons */
.icon { width: 1em; height: 1em; display: block; }
.social-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.social-links__item {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--c-border-strong); background: var(--c-surface); color: var(--c-primary); font-size: 18px;
  transition: background-color .18s ease, color .18s ease, border-color .18s ease, transform .18s var(--ease-out);
}
.social-links__item:active { transform: scale(.94); }
@media (hover: hover) {
  .social-links__item:hover { background: var(--c-primary); border-color: var(--c-primary); color: #fff; transform: translateY(-2px); }
}

/* Public inscription form */
.inscription-form fieldset { border: 1px solid var(--c-border-strong); border-radius: 12px; padding: 16px; margin: 0 0 20px; }
.inscription-form legend { font-weight: 700; padding: 0 8px; }
.inscription-form .contact-row { border-top: 1px dashed var(--c-border-strong); padding-top: 12px; margin-top: 12px; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------
   Brand page, layout B: cover hero, featured video, "Detrás de la marca"
   --------------------------------------------------------------- */
.brand-hero {
  position: relative; display: flex; align-items: flex-end; margin: 20px 0 0;
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--c-border); isolation: isolate;
}
@media (min-width: 720px) { .brand-hero { aspect-ratio: 3 / 1; min-height: 300px; } }
.brand-hero__img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; animation: hero-settle 1.6s var(--ease-out) both; }
.brand-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to top, rgba(43, 29, 20, .78) 0%, rgba(43, 29, 20, .35) 38%, transparent 70%); }
.brand-hero__title { display: flex; align-items: center; gap: 14px; padding: 20px; min-width: 0; }
@media (min-width: 720px) { .brand-hero__title { gap: 22px; padding: 28px 32px; } }
.brand-hero__logo { flex: 0 0 auto; width: 72px; height: 72px; object-fit: cover; border-radius: 50%; border: 3px solid var(--c-bg); background: var(--c-surface); box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .6); }
@media (min-width: 720px) { .brand-hero__logo { width: 112px; height: 112px; } }
.brand-hero h1 { margin: 0; color: #fff; font-size: clamp(28px, 5vw, 48px); text-shadow: 0 2px 14px rgba(0, 0, 0, .45); overflow-wrap: anywhere; }
.brand-hero__meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding: 12px 0 4px; border-bottom: 1px dashed var(--c-border-strong); }
.brand-hero__meta .brand-header__place { margin: 12px 0 0; }
@keyframes hero-settle { from { transform: scale(1.05); opacity: .6; } to { transform: scale(1); opacity: 1; } }

.brand-description { max-width: 68ch; font-size: 17px; }

.video-embed { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--c-text); }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.featured-video { margin: 24px 0; }

.story { margin: 32px 0 8px; }
.story__title { margin: 0 0 12px; }
.story__title::after { content: ""; display: block; width: 56px; margin-top: 8px; border-top: 2px dashed var(--c-border-strong); }
.story-strip {
  display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  margin: 0 -16px; padding: 4px 16px 16px; scroll-padding: 0 16px; list-style: none; align-items: flex-start;
  scrollbar-width: thin; scrollbar-color: var(--c-border-strong) transparent;
}
.story-strip__item { flex: 0 0 auto; width: min(70vw, 260px); scroll-snap-align: start; }
.story-strip__item--video { width: min(86vw, 440px); }
.story-card { margin: 0; }
.story-card__link { display: block; border-radius: var(--radius); overflow: hidden; background: var(--c-border); cursor: zoom-in; }
.story-card__link:focus-visible { outline-offset: 3px; }
.story-card__img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .6s var(--ease-out); }
@media (hover: hover) { .story-card__link:hover .story-card__img { transform: scale(1.04); } }
.story-card__caption { margin: 8px 2px 0; font: italic 400 15px/1.35 var(--font-head); color: var(--c-text-soft); }

/* Lightbox (built by feria.js on first use) */
.lightbox { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(28, 19, 13, .94); color: var(--c-bg); }
.lightbox::backdrop { background: rgba(28, 19, 13, .6); }
.lightbox[open] { display: grid; place-items: center; animation: lightbox-in .25s ease both; }
.lightbox__figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: calc(100vw - 32px); touch-action: pan-y; }
.lightbox__img { display: block; max-width: 100%; max-height: calc(100dvh - 140px); object-fit: contain; border-radius: 6px; }
.lightbox__caption { font: italic 400 16px/1.4 var(--font-head); text-align: center; max-width: 60ch; }
.lightbox__count { position: absolute; top: 16px; left: 16px; margin: 0; font-size: 13px; opacity: .8; }
.lightbox__btn { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid rgba(246, 239, 228, .4); border-radius: 50%; background: rgba(28, 19, 13, .5); color: var(--c-bg); font: 400 26px/1 var(--font-body); cursor: pointer; transition: background-color .18s ease, border-color .18s ease; }
.lightbox__btn:focus-visible { outline-color: var(--c-bg); }
@media (hover: hover) { .lightbox__btn:hover { background: var(--c-primary); border-color: var(--c-primary); } }
.lightbox__close { top: 12px; right: 12px; }
.lightbox__prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 12px; top: 50%; transform: translateY(-50%); }
@media (max-width: 719px) { .lightbox__prev, .lightbox__next { top: auto; bottom: 16px; transform: none; } }
html.has-lightbox { overflow: hidden; }
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .brand-hero__img, .lightbox[open] { animation: none; }
  .story-strip { scroll-behavior: auto; }
}

/* Visually hidden but still read by screen readers. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
