/* Armería Gil · base y componentes de la tienda pública.
   Cabecera y pie: layout.css. Cada página tiene su propio CSS (home.css, catalogo.css, compra.css). */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
address { font-style: normal; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--laton-300); color: var(--encina-900); }

/* Barra de desplazamiento con la paleta: verde monte sobre piedra, latón al pasar el ratón.
   Chrome/Edge/Safari usan los pseudoelementos (forma redondeada); Firefox solo admite colores (scrollbar-color),
   que se limita a él porque en Chrome anularía los pseudoelementos. En móvil la barra es del sistema. */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--piedra-200); }
::-webkit-scrollbar-thumb {
  background: var(--monte-500); border-radius: 999px;
  border: 3px solid var(--piedra-200); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--laton-600); }
::-webkit-scrollbar-thumb:active { background-color: var(--laton-700); }
::-webkit-scrollbar-corner { background: var(--piedra-200); }
@supports (-moz-appearance: none) {
  html { scrollbar-color: var(--monte-500) var(--piedra-200); }
}

.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;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--encina-900); color: var(--hueso); padding: 10px 14px; border-radius: var(--r-sm);
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

/* Tipografía --------------------------------------------------------------- */
.display, .h-display {
  font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display);
  letter-spacing: -0.01em;
  line-height: 1.02;
}
.h1 { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-3xl); line-height: 1.05; letter-spacing: -0.01em; }
.h2 { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-2xl); line-height: 1.1; }
.h3 { font-size: var(--fs-lg); font-weight: 600; }
.lead { font-size: var(--fs-md); color: var(--text-muted); max-width: 62ch; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.prose { max-width: 70ch; }
.prose p + p, .prose p + ul, .prose ul + p { margin-top: 0.9em; }
.prose ul { padding-left: 1.2em; }
.prose h2 { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-xl); margin: 1.6em 0 0.5em; }
.prose h3 { font-size: var(--fs-md); margin: 1.4em 0 0.4em; }

/* Botones -------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--btn-bd); border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-fg);
  font-weight: 600; font-size: var(--fs-sm); letter-spacing: 0.01em; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s;
}
.btn:hover { --btn-bd: var(--pizarra-400); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { --btn-bg: var(--laton-500); --btn-fg: var(--encina-900); --btn-bd: var(--laton-500); }
.btn-primary:hover { --btn-bg: var(--laton-600); --btn-bd: var(--laton-600); }
.btn-dark { --btn-bg: var(--encina-800); --btn-fg: var(--hueso); --btn-bd: var(--encina-800); }
.btn-dark:hover { --btn-bg: var(--encina-700); --btn-bd: var(--encina-700); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); --btn-bd: transparent; }
.btn-light { --btn-bg: transparent; --btn-fg: var(--hueso); --btn-bd: rgba(251, 251, 248, .45); }
.btn-light:hover { --btn-bg: rgba(251, 251, 248, .1); --btn-bd: var(--hueso); }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: var(--fs-base); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; cursor: pointer;
}
.icon-btn:hover { background: rgba(127, 127, 127, .12); }
.link { color: var(--accent-strong); font-weight: 600; text-decoration: underline; text-decoration-color: var(--laton-300); }
.link:hover { text-decoration-color: currentColor; }

/* Formularios ----------------------------------------------------------------- */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; }
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field .error { font-size: var(--fs-xs); color: var(--danger); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--laton-500); box-shadow: 0 0 0 3px var(--laton-100); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--monte-600); }

/* Insignias y precios ------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; line-height: 1.3;
  background: var(--surface-2); color: var(--text);
}
.badge-sale { background: var(--sale); color: #fff; }
.badge-license { background: var(--encina-800); color: var(--laton-300); }
.badge-new { background: var(--laton-100); color: var(--laton-700); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.price { font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.price-sale { color: #a33a12; }  /* rebajado: el naranja de la marca, oscurecido para leerse bien (5:1) */
.price-old { color: #59645c; font-size: .875em; font-weight: 400; font-variant-numeric: tabular-nums; }

/* Tarjeta de producto ---------------------------------------------------------- */
.product-grid {
  display: grid; gap: clamp(12px, 2vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
}
@media (max-width: 560px) { .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Tarjeta de producto: superficie blanca sobre el gris de la tienda, se levanta al pasar el ratón */
.pcard { position: relative; display: flex; flex-direction: column; background: #ffffff; border-radius: 8px; overflow: hidden;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease); }
.pcard:hover { box-shadow: 0 10px 28px rgba(20, 29, 23, .14); transform: translateY(-2px); }
.pcard-media { position: relative; display: block; aspect-ratio: 1 / 1; background: #eceeea; overflow: hidden; text-decoration: none; }
.pcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.pcard:hover .pcard-media img { transform: scale(1.035); }
/* Sin foto: sello de la casa sobre verde monte, con el nombre de la marca. Nunca un hueco. */
.pcard-noimg {
  display: grid; place-items: center; align-content: center; gap: 12px; height: 100%;
  background: #eceeea; color: var(--monte-500);
}
.pcard-noimg-seal {
  display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: #e9eae3;
}
.pcard-noimg-brand { font-family: var(--font-display); font-weight: var(--fw-display); font-variation-settings: "wdth" var(--wdth-display); letter-spacing: var(--ls-display); font-size: var(--fs-md); color: var(--monte-600); line-height: 1; }
.pcard-flags { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.pcard-body { display: flex; flex-direction: column; gap: 4px; flex: 1; padding: 14px 16px 16px; }
.pcard-brand { font-size: 13px; color: #4c5850; font-weight: 600; }
.pcard-title {
  font-size: 16px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.pcard-title a { text-decoration: none; }
.pcard-title a::after { content: ""; position: absolute; inset: 0; }
.pcard-title a:focus-visible { outline: none; }
.pcard:has(.pcard-title a:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.pcard-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
/* Precio y botón en una fila pegada al pie: en todas las tarjetas a la misma altura */
.pcard-buy { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-height: 40px; }
.pcard-buy .pcard-price { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
.pcard-buy .price-old { font-size: 13px; }
.pcard-add-form { margin: 0; position: relative; z-index: 2; flex: none; }
.pcard-add {
  position: relative; z-index: 2; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 0; border-radius: 6px; background: var(--encina-800); color: #ffffff; font: 600 14px/1 var(--font-sans);
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .2s var(--ease);
}
.pcard-add:hover { background: var(--laton-500); color: var(--encina-900); }
.pcard-add:focus-visible { outline: 3px solid var(--laton-500); outline-offset: 2px; }
.pcard-price { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; font-size: 18px; }
.pcard-stock { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pcard-stock::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pcard-stock.is-in { color: var(--ok); }
.pcard-stock.is-out { color: var(--warn); }
.pcard-stock.is-last { color: #a33a12; }
/* Rejilla a dos columnas en móvil: el texto de la tarjeta va centrado. */
@media (max-width: 560px) {
  .pcard-body { text-align: left; padding: 10px 10px 12px; }
  .pcard-buy { flex-direction: column; align-items: stretch; }
  .pcard-add { width: 100%; justify-content: center; }
  .pcard-add-form { width: 100%; }
  .pcard-price { justify-content: flex-start; }
}

/* Migas --------------------------------------------------------------------- */
.breadcrumbs { font-size: var(--fs-xs); color: var(--text-muted); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--text-soft); }
.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current] { color: var(--text); }

/* Avisos ------------------------------------------------------------------------- */
.notice {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); font-size: var(--fs-sm);
}
.notice svg { flex: none; margin-top: 2px; }
.notice-license { background: var(--encina-800); color: var(--piedra-100); border-color: var(--encina-800); }
.notice-license strong { color: var(--laton-300); }
.notice-warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.flash-stack { display: grid; gap: 8px; padding-top: 16px; }
.flash { padding: 12px 16px; border-radius: var(--r-md); background: var(--ok-bg); color: var(--ok); font-size: var(--fs-sm); font-weight: 600; }
.flash-error { background: var(--danger-bg); color: var(--danger); }
.flash-warning { background: var(--warn-bg); color: var(--warn); }

/* Toast ----------------------------------------------------------------------------- */
.toast-region { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; border-radius: var(--r-md);
  background: var(--encina-800); color: var(--hueso); box-shadow: var(--shadow-3); font-size: var(--fs-sm);
  animation: toast-in .25s var(--ease);
}
.toast a { color: var(--laton-300); font-weight: 600; margin-left: auto; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warn); }
.toast-close {
  margin-left: auto; flex: none; width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: transparent; color: inherit; opacity: .7; font-size: 18px; line-height: 1; cursor: pointer;
}
.toast-close:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.toast a + .toast-close { margin-left: 4px; }

/* Secciones --------------------------------------------------------------------------- */
.section { padding-block: clamp(48px, 8vw, 96px); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: clamp(20px, 3vw, 32px); flex-wrap: wrap; }
.page-head { padding-block: clamp(24px, 4vw, 40px) clamp(16px, 3vw, 24px); display: grid; gap: 12px; }

.empty {
  display: grid; justify-items: center; gap: 12px; text-align: center;
  padding: clamp(40px, 8vw, 80px) 16px; color: var(--text-muted);
}
.empty .mark { color: var(--monte-300); }

/* «Avísame cuando llegue» (partials/stock_request.html) --------------------------- */
.stock-req { display: grid; gap: 10px; padding: 16px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); }
.stock-req-title { font-weight: 600; }
.stock-req-fields { display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.stock-req-fields input[name=phone] { grid-column: 1 / -1; }
.stock-req-more summary { cursor: pointer; font-size: var(--fs-sm); color: var(--text-muted); }
.stock-req-more textarea { margin-top: 8px; min-height: 64px; }
.stock-req-trap { position: absolute; left: -9999px; }
.stock-req-done { color: var(--ok); font-weight: 600; font-size: var(--fs-sm); }
.stock-req.is-done > :not(.stock-req-done) { display: none; }
@media (max-width: 480px) { .stock-req-fields { grid-template-columns: 1fr; } }

/* Primera capa RGPD (partials/rgpd_capa.html) ------------------------------------- */
.rgpd { font-size: var(--fs-xs); line-height: 1.5; color: var(--text-muted); justify-self: start; max-width: 100%; }
.rgpd-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; cursor: pointer; list-style: none;
  color: var(--text-muted); font-weight: 500; text-decoration: underline; text-decoration-color: var(--border);
  text-underline-offset: 3px; border-radius: var(--r-sm);
}
.rgpd-btn::-webkit-details-marker { display: none; }
.rgpd-btn svg { flex: none; color: var(--monte-500); }
.rgpd-btn:hover, .rgpd[open] .rgpd-btn { color: var(--text); text-decoration-color: currentColor; }
.rgpd-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rgpd-panel {
  margin-top: 8px; padding: 12px 14px; max-width: 460px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.rgpd-list { display: grid; gap: 6px; margin: 0; }
.rgpd-list > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.rgpd-list dt { font-weight: 600; color: var(--text); }
.rgpd-list dd { margin: 0; overflow-wrap: anywhere; }
.rgpd-list a, .rgpd-more { color: var(--accent-strong); font-weight: 600; text-underline-offset: 2px; }
.rgpd-more { display: inline-block; margin-top: 10px; }
@media (max-width: 480px) {
  .rgpd-list > div { grid-template-columns: 1fr; gap: 0; }
}
.price-from { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; margin-right: 2px; }
.pcard-options { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--text-muted); }
