/* =====================================================================
   TECNID — Catálogo ecommerce
   Identidad: ficha técnica de catálogo industrial.
   Tipografía: Space Grotesk (display) + Inter (texto) + IBM Plex Mono (datos)
   ===================================================================== */

:root {
  --bg:        #F4F5F3;
  --panel:     #FFFFFF;
  --ink:       #14181C;
  --ink-soft:  #565F66;
  --ink-faint: #8B9298;
  --line:      #DBDFDF;
  --line-soft: #EAECEA;
  --accent:    #FF5A1F;
  --accent-ink:#B23E12;
  --steel:     #2C4A63;
  --ok:        #2F8F5B;
  --warn:      #C9821E;
  --bad:       #C13B3B;

  --radius: 3px;
  --nav-h: 68px;

  --font-display: 'Space Grotesk', 'Archivo', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

button {
  font-family: inherit;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------------------------------------------------------------
   NAV
   --------------------------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 21px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent);
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); }

.nav-search {
  flex: 1;
  display: flex;
  max-width: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.nav-search input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
}
.nav-search input:focus { outline: none; }
.nav-search input::placeholder { color: var(--ink-faint); }

.nav-search button {
  border: none;
  background: transparent;
  padding: 0 12px;
  display: flex;
  align-items: center;
  color: var(--ink-soft);
}
.nav-search button:hover { color: var(--accent); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
}
.icon-btn:hover { border-color: var(--line); }

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
}

.btn-login {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
}
.btn-login:hover { background: var(--ink); color: var(--panel); }

/* ---------------------------------------------------------------------
   FILTER STRIP (categorías)
   --------------------------------------------------------------------- */

.filter-strip {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.filter-scroll {
  display: flex;
  gap: 8px;
  padding: 14px 24px;
  overflow-x: auto;
  max-width: 1240px;
  margin: 0 auto;
  scrollbar-width: thin;
}
.filter-scroll::-webkit-scrollbar { height: 4px; }
.filter-scroll::-webkit-scrollbar-thumb { background: var(--line); }

.chip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border: 1px solid var(--ink-faint);
  background: transparent;
}

.chip:hover { border-color: var(--ink-soft); color: var(--ink); }

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--panel);
}
.chip.active::before {
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------------------------------------------------------------------
   CATALOG HEADER
   --------------------------------------------------------------------- */

.catalog-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 32px 0 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.catalog-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0;
}

.catalog-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------
   PRODUCT GRID / CARDS
   --------------------------------------------------------------------- */

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 20px;
  padding-bottom: 64px;
}

.product-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.product-card:hover {
  border-color: var(--ink-soft);
  transform: translateY(-2px);
}

.product-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spec-tag {
  position: absolute;
  top: 10px;
  left: 0;
  background: var(--ink);
  color: var(--panel);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  padding: 3px 8px 3px 10px;
  clip-path: polygon(0 0, 100% 0, 92% 100%, 0% 100%);
}

.stock-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--panel);
}
.stock-dot.in    { background: var(--ok); }
.stock-dot.low   { background: var(--warn); }
.stock-dot.out   { background: var(--bad); }

.product-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-category {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

.product-name {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  flex: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.product-price {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.btn-add {
  border: 1px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius);
}
.btn-add:hover { background: var(--ink); color: var(--panel); }
.btn-add:disabled {
  border-color: var(--line);
  color: var(--ink-faint);
  cursor: not-allowed;
}
.btn-add:disabled:hover { background: var(--panel); color: var(--ink-faint); }

/* ---------------------------------------------------------------------
   STATES: loading / empty
   --------------------------------------------------------------------- */

.skeleton {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.skeleton .product-media {
  background: linear-gradient(90deg, var(--line-soft) 25%, var(--bg) 37%, var(--line-soft) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton .line {
  height: 10px;
  margin: 12px 14px;
  background: var(--line-soft);
  border-radius: 2px;
}
.skeleton .line.short { width: 40%; }

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 72px 20px;
  color: var(--ink-soft);
}
.empty-state .mono-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 10px;
}
.empty-state h2 {
  font-family: var(--font-display);
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------------
   FOOTER
   --------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------
   CARRITO (drawer)
   --------------------------------------------------------------------- */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 28, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 90;
}
.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(400px, 100%);
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 91;
}
.cart-drawer.open { transform: translateX(0); }

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.cart-drawer-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0;
}
.cart-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-soft);
  padding: 4px 6px;
}
.cart-close:hover { color: var(--ink); }

.cart-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px;
}

.cart-empty {
  text-align: center;
  padding: 60px 10px;
  color: var(--ink-faint);
}
.cart-empty .mono-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.cart-item-info { flex: 1; min-width: 0; }

.cart-item-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-price {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}

.cart-item-qty {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.cart-item-qty button {
  border: none;
  background: transparent;
  width: 26px;
  height: 26px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--ink);
}
.cart-item-qty button:hover { color: var(--accent); }
.cart-item-qty span {
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-width: 16px;
  text-align: center;
}

.cart-item-remove {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 18px;
  line-height: 1;
  padding: 4px;
}
.cart-item-remove:hover { color: var(--bad); }

.cart-drawer-footer {
  border-top: 1px solid var(--line);
  padding: 16px 20px 20px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.cart-total {
  font-family: var(--font-mono);
  font-size: 19px;
}

.btn-checkout {
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--panel);
  font-size: 14px;
  font-weight: 600;
}
.btn-checkout:hover { background: var(--accent); }
.btn-checkout:disabled {
  background: var(--line);
  color: var(--ink-faint);
  cursor: not-allowed;
}

/* ---------------------------------------------------------------------
   RESPONSIVE
   --------------------------------------------------------------------- */

@media (max-width: 760px) {
  .nav-inner {
    height: auto;
    flex-wrap: wrap;
    padding: 12px 20px;
    gap: 10px;
  }
  .nav-search { order: 3; max-width: none; width: 100%; }
  .nav-actions { margin-left: auto; }
  .container { padding: 0 20px; }
  .filter-scroll { padding: 12px 20px; }
  .catalog-header { padding-top: 22px; }
}