:root {
  color-scheme: light;
  --azul: #0083c5;
  --azul-deep: #005b8e;
  --azul-wash: #e4f1f9;
  --tinta: #0f2740;
  --gris: #5e6b78;
  --faint: #8492a1;
  --linea: #e2e8f0;
  --fondo: #eef2f6;
  --card: #fff;
  --inset: #f5f8fb;
  --danger: #b3261e;
  --ui: 'Figtree', system-ui, -apple-system, sans-serif;
  --display: 'Amiri', Georgia, serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  color: var(--tinta);
  background: var(--fondo);
  font: 400 16px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.top {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 66px;
  align-items: center;
  gap: 18px;
  padding: 10px max(20px, calc((100vw - 1280px) / 2));
  border-bottom: 1px solid var(--linea);
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: auto; height: 32px; }
.brand strong { display: block; color: var(--azul-deep); font: 700 1.08rem/1.1 var(--display); }
.brand small { display: block; margin-top: 3px; color: var(--faint); font-size: .67rem; font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-link {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--linea);
  border-radius: 9px;
  color: var(--azul-deep);
  background: #fff;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { border-color: var(--azul); background: var(--azul-wash); }
.catalog-main { width: min(1280px, 100%); margin: 0 auto; padding: 26px 20px 48px; }
.intro { margin: 0 0 22px; }
.eyebrow { margin: 0 0 4px; color: var(--azul-deep); font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.intro h1 { margin: 0; font: 400 clamp(1.7rem, 4vw, 2.25rem)/1.1 var(--display); }
.intro > p:last-child { margin: 7px 0 0; color: var(--gris); font-size: .9rem; }
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(125px, 1fr));
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--linea);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 3px 12px rgba(15,39,64,.04);
}
.search-field,.filter-field { display: grid; min-width: 0; gap: 4px; }
.search-field { grid-column: span 2; }
.search-field span,.filter-field span,.filter-field>label { color: var(--gris); font-size: .68rem; font-weight: 600; }
.filter-specific { display: grid; gap: 4px; padding-left: 8px; border-left: 2px solid var(--linea); }
.filter-specific[hidden] { display: none; }
.filter-specific label { color: var(--gris); font-size: .68rem; }
.search-field input,.filter-field input,.filter-field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--linea);
  border-radius: 8px;
  color: var(--tinta);
  background: var(--inset);
  font: 500 .82rem var(--ui);
}
.search-field input:focus,.filter-field input:focus,.filter-field select:focus,.clear-button:focus-visible {
  outline: 3px solid rgba(0,131,197,.2);
  border-color: var(--azul);
}
.clear-button,.retry-button {
  align-self: end;
  min-height: 40px;
  padding: 7px 11px;
  border: 1px solid var(--linea);
  border-radius: 8px;
  color: var(--azul-deep);
  background: #fff;
  font: 600 .78rem var(--ui);
  cursor: pointer;
}
.clear-button:hover,.retry-button:hover { border-color: var(--azul); background: var(--azul-wash); }
.results-bar { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 10px; }
.results-bar p { margin: 0; color: var(--gris); font-size: .77rem; }
.retry-button[hidden] { display: none; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 15px; }
.product-card {
  display: block;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 13px;
  color: inherit;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: #c4dbe9; box-shadow: 0 8px 22px rgba(15,39,64,.1); }
.product-card:focus-visible { outline: 3px solid var(--azul-deep); outline-offset: 2px; }
.card-image { position: relative; display: grid; aspect-ratio: 4/5; place-items: center; overflow: hidden; border-bottom: 1px solid var(--linea); background: var(--inset); }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.no-image { color: var(--faint); font-size: .76rem; }
.id-badge { position: absolute; top: 9px; left: 9px; max-width: calc(100% - 18px); padding: 4px 7px; overflow: hidden; border: 1px solid rgba(255,255,255,.25); border-radius: 7px; color: #fff; background: rgba(15,39,64,.88); font-size: .66rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.card-body { padding: 10px 11px 12px; }
.card-brand { overflow: hidden; color: var(--azul-deep); font-size: .67rem; font-weight: 700; letter-spacing: .03em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.card-name { display: -webkit-box; min-height: 2.35em; margin: 3px 0 7px; overflow: hidden; font: 400 1rem/1.18 var(--display); -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.record-status { display: inline-flex; width: fit-content; align-items: center; min-height: 22px; margin: 0 0 7px; padding: 3px 7px; border-radius: 6px; font-size: .64rem; font-weight: 700; line-height: 1.1; }
.record-status.is-digital { border: 1px solid #e8d39e; color: #79520c; background: #fff8e8; }
.record-status.is-purchased { border: 1px solid #cfe8dd; color: #27654e; background: #eff9f4; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--gris); font-size: .72rem; }
.stars { color: #d99a16; letter-spacing: .02em; white-space: nowrap; }
.empty-state { grid-column: 1/-1; padding: 40px 18px; border: 1px dashed var(--linea); border-radius: 12px; color: var(--gris); background: #fff; text-align: center; }
.product-dialog,.comment-dialog {
  min-width: 0;
  width: min(850px, calc(100vw - 28px));
  max-width: none;
  max-height: min(92dvh, 880px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--linea);
  border-radius: 18px;
  color: var(--tinta);
  background: #fff;
  box-shadow: 0 20px 60px rgba(15,39,64,.24);
}
.product-dialog::backdrop,.comment-dialog::backdrop { background: rgba(7,22,36,.52); backdrop-filter: blur(2px); }
.product-dialog { grid-template-rows: auto minmax(0,1fr) auto; }
.product-dialog[open] { display: grid; }
.dialog-head { display: flex; min-height: 52px; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--linea); color: var(--gris); background: #fff; font-size: .78rem; font-weight: 600; }
.icon-close { display: grid; width: 38px; height: 38px; flex: 0 0 38px; place-items: center; border: 0; border-radius: 50%; color: var(--gris); background: var(--inset); font: 400 1.5rem/1 var(--ui); cursor: pointer; }
.icon-close:hover { color: var(--tinta); background: var(--linea); }
.detail-scroll { min-width: 0; max-width: 100%; min-height: 0; padding: 18px; overflow: auto; overscroll-behavior: contain; }
.detail-layout { display: grid; min-width: 0; max-width: 100%; grid-template-columns: minmax(190px, 280px) minmax(0,1fr); gap: 22px; }
.detail-media { position: sticky; top: 0; min-width: 0; align-self: start; }
.detail-photo { position: relative; display: grid; aspect-ratio: 4/5; max-height: 430px; place-items: center; overflow: hidden; border: 1px solid var(--linea); border-radius: 12px; background: var(--inset); }
.detail-photo img { width: 100%; height: 100%; object-fit: contain; }
.detail-gallery { display: flex; gap: 7px; margin-top: 8px; overflow-x: auto; }
.detail-thumb { display: grid; width: 56px; height: 56px; flex: 0 0 56px; place-items: center; padding: 3px; overflow: hidden; border: 1px solid var(--linea); border-radius: 8px; background: #fff; cursor: pointer; }
.detail-thumb img { width: 100%; height: 100%; object-fit: contain; }
.detail-thumb.is-primary,.detail-thumb.is-selected { border-color: var(--azul); box-shadow: 0 0 0 1px var(--azul); }
.detail-copy { min-width: 0; }
.detail-brand { margin: 0 0 3px; color: var(--azul-deep); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.detail-title { min-width: 0; margin: 0 0 10px; font: 400 1.55rem/1.15 var(--display); overflow-wrap: anywhere; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
.meta-chip { max-width: 100%; padding: 5px 8px; overflow-wrap: anywhere; border: 1px solid var(--linea); border-radius: 8px; color: var(--ink-soft, #42546a); background: var(--inset); font-size: .72rem; }
.detail-lede { margin: 0 0 13px; color: var(--ink-soft, #42546a); font-size: .88rem; line-height: 1.55; }
.spec-grid { display: grid; min-width: 0; max-width: 100%; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--linea); border-radius: 10px; background: var(--linea); }
.spec-cell { min-width: 0; padding: 9px 10px; background: var(--inset); }
.spec-cell span { display: block; color: var(--faint); font-size: .64rem; }
.spec-cell strong { display: block; margin-top: 2px; overflow-wrap: anywhere; font-size: .78rem; font-weight: 600; }
.detail-block { margin-top: 12px; }
.detail-block h3 { margin: 0 0 3px; color: var(--faint); font-size: .68rem; font-weight: 600; }
.detail-block p { margin: 0; font-size: .82rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-link { display: inline-block; margin-top: 12px; color: var(--azul-deep); font-size: .79rem; font-weight: 600; }
.feedback-dock { position: relative; z-index: 2; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); background: rgba(255,255,255,.98); box-shadow: 0 -5px 18px rgba(15,39,64,.05); }
.feedback-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.feedback-button { display: flex; min-width: 0; min-height: 48px; align-items: center; justify-content: center; gap: 7px; padding: 7px 9px; border: 1px solid var(--linea); border-radius: 11px; color: var(--tinta); background: var(--inset); font: 600 .79rem var(--ui); cursor: pointer; }
.feedback-button span:first-child { font-size: 1.05rem; }
.feedback-button.like { color: #167a55; }
.feedback-button.dislike { color: var(--danger); }
.feedback-button.comment { color: var(--azul-deep); }
.feedback-button[aria-pressed="true"] { border-color: #98cdb1; background: #e8f5ed; }
.feedback-button.dislike[aria-pressed="true"] { border-color: #efaaa6; background: #fff0ef; }
.feedback-button:disabled { opacity: .55; cursor: wait; }
.feedback-status { min-height: 0; margin: 0; color: var(--gris); font-size: .72rem; text-align: center; }
.feedback-status:empty { display: none; }
.comment-dialog { width: min(480px, calc(100vw - 28px)); padding: 20px; }
.comment-dialog[open] { display: block; }
.comment-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.comment-head > div { flex: 1; }
.comment-head h2 { margin: 0; font: 400 1.35rem/1.15 var(--display); }
.comment-head p { margin: 6px 0 0; color: var(--gris); font-size: .76rem; line-height: 1.45; }
.comment-dialog label { display: block; margin-bottom: 5px; font-size: .78rem; font-weight: 600; }
.comment-dialog textarea { width: 100%; min-height: 125px; padding: 10px; border: 1px solid var(--linea); border-radius: 9px; color: var(--tinta); background: #fff; font: 400 .88rem/1.45 var(--ui); resize: vertical; }
.comment-dialog textarea:focus-visible { outline: 3px solid rgba(0,131,197,.2); border-color: var(--azul); }
.comment-status { min-height: 1.2em; margin: 8px 0 0; color: var(--gris); font-size: .74rem; line-height: 1.4; }
.comment-status:empty { display: none; }
.submit-comment { width: 100%; min-height: 45px; margin-top: 10px; border: 0; border-radius: 9px; color: #fff; background: var(--azul); font: 700 .85rem var(--ui); cursor: pointer; }
.submit-comment:hover { background: var(--azul-deep); }
.submit-comment:disabled { opacity: .6; cursor: wait; }
@media (max-width: 900px) {
  .filters { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .search-field { grid-column: span 2; }
}
@media (max-width: 620px) {
  html,body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .top { flex-wrap: wrap; gap: 8px; padding: 9px 12px; }
  .brand { min-width: 0; }
  .brand img { height: 28px; }
  .brand strong { font-size: 1rem; }
  .top-actions { gap: 6px; }
  .nav-link { min-height: 35px; padding: 6px 9px; font-size: .7rem; }
  .catalog-main { padding: 19px 12px 30px; }
  .intro { margin-bottom: 16px; }
  .intro > p:last-child { font-size: .82rem; }
  .filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 10px; }
  .search-field { grid-column: 1/-1; }
  .filter-field input,.filter-field select,.search-field input { min-height: 42px; font-size: .78rem; }
  .clear-button { grid-column: 1/-1; }
  .product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .card-body { padding: 8px 9px 10px; }
  .card-name { font-size: .94rem; }
  .product-dialog { position: fixed; inset: max(8px, env(safe-area-inset-top)) 0 0; width: 100%; max-width: none; max-height: none; min-width: 0; margin: 0; border-radius: 16px 16px 0 0; }
  .dialog-head { position: relative; }
  .detail-scroll { width: 100%; padding: 12px; overflow-x: hidden; }
  .detail-layout { width: 100%; grid-template-columns: minmax(0,1fr); gap: 12px; }
  .detail-media { position: relative; width: min(100%,200px); margin: 0 auto; }
  .detail-photo { width: 100%; max-height: 245px; margin: 0 auto; }
  .detail-title { font-size: 1.28rem; }
  .detail-meta,.detail-copy,.spec-cell { min-width: 0; }
  .spec-cell strong { overflow-wrap: anywhere; word-break: break-word; }
  .comment-dialog { width: calc(100vw - 20px); max-height: calc(100dvh - env(safe-area-inset-top) - 12px); overflow-y: auto; }
  .feedback-dock { padding-right: 10px; padding-left: 10px; }
  .feedback-button { flex-direction: column; gap: 1px; min-height: 54px; padding: 5px; font-size: .68rem; }
}
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
