:root {
  --bg: #080808;
  --surface: #111111;
  --surface-2: #171717;
  --line: rgba(255, 255, 255, .12);
  --line-strong: rgba(255, 255, 255, .24);
  --text: #f5f4ef;
  --muted: #a7a7a2;
  --soft: #d8d7d1;
  --danger: #ff6b6b;
  --success: #85d9a4;
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .025;
  z-index: 20;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.65'/%3E%3C/svg%3E");
}

.site-header,
.admin-header {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  position: relative;
  z-index: 5;
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  letter-spacing: .12em;
}

.brand-copy b {
  font-size: 13px;
}

.brand-copy small {
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}

.header-actions,
.admin-header-actions,
.editor-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .2s ease;
  font-weight: 600;
  font-size: 13px;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled {
  opacity: .55;
  cursor: wait;
  transform: none;
}

.button-solid {
  background: var(--text);
  color: #080808;
}

.button-solid:hover {
  background: white;
}

.button-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line-strong);
}

.button-ghost:hover {
  border-color: rgba(255, 255, 255, .5);
}

.button-danger {
  background: rgba(255, 107, 107, .08);
  border-color: rgba(255, 107, 107, .35);
  color: #ff9b9b;
}

.button-wide {
  width: 100%;
}

/* Portada principal */

.hero {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(40px, 5vw, 80px) 0 64px;
  border-bottom: 1px solid var(--line);
}

.hero-brand {
  font-family: 'Playfair Display', serif;
  font-size: clamp(72px, 9vw, 128px);
  font-weight: 600;
  font-style: italic;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--text);
  margin: 0 0 17px;
}

.hero-kicker,
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(56px, 9vw, 145px);
  line-height: .88;
  letter-spacing: -.065em;
  margin: 20px 0 27px;
  max-width: 1160px;
  font-weight: 600;
}

.hero h1 em {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
}

.hero > p {
  color: var(--soft);
  max-width: 750px;
  font-family: 'Playfair Display', serif;
  font-size: clamp(24px, 2.8vw, 40px);
  font-weight: 600;
  font-style: italic;
  line-height: 1.25;
  letter-spacing: -.015em;
  margin: 0;
}

.hero-meta {
  display: flex;
  gap: 34px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 40px;
}

/* Catálogo */

.catalog-section {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  padding: 70px 0 110px;
}

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
}

.catalog-toolbar h2,
.panel-heading h2 {
  margin: 8px 0 0;
  font-size: clamp(28px, 3vw, 45px);
  letter-spacing: -.04em;
}

.search-field {
  width: min(430px, 100%);
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px 0;
  color: var(--muted);
}

.search-field input {
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  width: 100%;
}

.search-field input::placeholder {
  color: #777;
}

.category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 36px 0;
}

.filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: .2s ease;
}

.filter-chip:hover,
.filter-chip.is-active {
  background: var(--text);
  color: #080808;
  border-color: var(--text);
}

.status-message,
.empty-state {
  color: var(--muted);
  padding: 60px 0;
}

/* Productos */

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  animation: rise .5s both;
  animation-delay: var(--delay);
  outline: 0;
  transition: transform .25s ease, border-color .25s ease;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--line-strong);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
}

.product-image-wrap {
  aspect-ratio: .82;
  position: relative;
  background: #151515;
  overflow: hidden;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s ease;
}

.product-card:hover .product-image {
  transform: scale(1.025);
}

.product-placeholder {
  width: 100%;
  height: 100%;
  min-height: 300px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, #2a2a2a, #0d0d0d 62%);
  color: #686868;
  letter-spacing: .18em;
  font-size: 11px;
}

.product-placeholder.large {
  min-height: 560px;
}

.product-badge,
.product-code {
  position: absolute;
  top: 14px;
  font-size: 9px;
  letter-spacing: .12em;
  border-radius: 999px;
  padding: 8px 10px;
  backdrop-filter: blur(8px);
}

.product-badge {
  left: 14px;
  background: rgba(245, 244, 239, .9);
  color: #080808;
}

.product-code {
  right: 14px;
  background: rgba(0, 0, 0, .58);
  color: var(--text);
}

.product-card-body {
  padding: 19px;
}

.product-card-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.product-card-top p {
  color: var(--muted);
  margin: 0 0 6px;
  font-size: 11px;
}

.product-card-top h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.product-card-top strong {
  white-space: nowrap;
  font-size: 14px;
}

.product-availability {
  margin-top: 18px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.product-availability span {
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  padding: 6px 8px;
  border-radius: 7px;
}

/* Estado vacío */

.empty-state {
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state h3 {
  color: var(--text);
  font-size: 28px;
}

/* Pie de página */

.site-footer {
  width: min(1420px, calc(100% - 40px));
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 32px 0 45px;
  display: flex;
  justify-content: space-between;
  align-items: end;
  color: var(--muted);
  font-size: 12px;
}

.site-footer strong {
  color: var(--text);
  letter-spacing: .12em;
}

/* Ventana del producto */

.product-dialog {
  width: min(1180px, calc(100% - 30px));
  max-height: calc(100vh - 30px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  background: var(--surface);
  color: var(--text);
}

.product-dialog::backdrop {
  background: rgba(0, 0, 0, .8);
  backdrop-filter: blur(8px);
}

.dialog-close {
  position: fixed;
  z-index: 5;
  top: 25px;
  right: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(10, 10, 10, .72);
  font-size: 25px;
  cursor: pointer;
}

.dialog-layout {
  display: grid;
  grid-template-columns: 1.25fr .75fr;
  min-height: 660px;
}

.dialog-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  background: #050505;
  align-content: start;
}

.dialog-gallery img {
  width: 100%;
  aspect-ratio: .84;
  object-fit: cover;
  display: block;
}

.dialog-info {
  padding: clamp(35px, 5vw, 70px);
  position: sticky;
  top: 0;
  align-self: start;
}

.dialog-info h2 {
  font-size: clamp(39px, 5vw, 68px);
  line-height: .95;
  letter-spacing: -.05em;
  margin: 18px 0 10px;
}

.dialog-brand {
  color: var(--muted);
}

.dialog-price {
  display: block;
  font-size: 23px;
  margin: 30px 0;
}

.dialog-description {
  color: var(--soft);
  line-height: 1.7;
}

.variant-groups {
  display: grid;
  gap: 16px;
  margin: 34px 0;
}

.variant-group b {
  font-size: 12px;
}

.variant-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.variant-group span {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--muted);
}

/* Panel administrativo */

.admin-body {
  background: #090909;
}

.admin-shell {
  min-height: 100vh;
}

.login-card {
  width: min(520px, calc(100% - 30px));
  margin: 0 auto;
  padding: 8vh 0;
}

.brand-centered {
  justify-content: center;
  display: flex;
  margin-bottom: 70px;
}

.login-copy {
  margin-bottom: 35px;
}

.login-copy h1 {
  font-size: clamp(45px, 7vw, 75px);
  line-height: .95;
  letter-spacing: -.055em;
  margin: 15px 0 20px;
}

.login-copy p {
  color: var(--muted);
  line-height: 1.6;
}

.stack-form {
  display: grid;
  gap: 18px;
}

.stack-form label,
.product-form label,
.inline-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .04em;
}

.stack-form input,
.product-form input,
.product-form textarea,
.product-form select,
.inline-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 14px;
  outline: 0;
}

.stack-form input:focus,
.product-form input:focus,
.product-form textarea:focus,
.product-form select:focus,
.inline-form input:focus {
  border-color: rgba(255, 255, 255, .5);
}

.form-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 12px;
}

.form-message[data-type="error"] {
  color: #ff9797;
}

.form-message[data-type="success"] {
  color: var(--success);
}

.back-link {
  display: block;
  text-align: center;
  color: var(--muted);
  margin-top: 30px;
  font-size: 12px;
}

.dashboard {
  width: min(1680px, calc(100% - 28px));
  margin: 0 auto;
}

.admin-header {
  width: 100%;
  border-bottom: 1px solid var(--line);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 14px;
  padding: 14px 0 30px;
  min-height: calc(100vh - 88px);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.product-sidebar {
  padding: 20px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.panel-heading h2 {
  font-size: 28px;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 24px;
  cursor: pointer;
}

.search-field-compact {
  width: 100%;
  margin: 18px 0;
}

.admin-product-list {
  display: grid;
  gap: 7px;
  max-height: calc(100vh - 230px);
  overflow: auto;
  padding-right: 4px;
}

.admin-product-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 9px;
  border-radius: 13px;
  display: grid;
  grid-template-columns: 44px 1fr 8px;
  gap: 11px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.admin-product-item:hover,
.admin-product-item.is-active {
  background: var(--surface-2);
  border-color: var(--line);
}

.admin-product-item img,
.mini-placeholder {
  width: 44px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
}

.mini-placeholder {
  display: grid;
  place-items: center;
  background: #262626;
  color: #888;
  font-size: 10px;
}

.admin-product-item span:nth-child(2) {
  display: grid;
  min-width: 0;
}

.admin-product-item b {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}

.admin-product-item small {
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #555;
}

.status-dot.online {
  background: var(--success);
}

.editor-panel {
  padding: clamp(20px, 3vw, 42px);
  overflow: hidden;
}

.editor-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 25px;
}

.product-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 32px 0;
}

.form-span-2 {
  grid-column: span 2;
}

.toggle-label {
  display: flex !important;
  align-items: center;
  gap: 9px !important;
  cursor: pointer;
}

.toggle-label input {
  width: 17px;
  height: 17px;
  accent-color: #fff;
}

.admin-section {
  border-top: 1px solid var(--line);
  padding: 32px 0 10px;
}

.section-heading h3 {
  margin: 8px 0 20px;
  font-size: 25px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr .8fr auto auto;
  gap: 10px;
  align-items: end;
}

.compact-toggle {
  min-height: 43px;
}

.variant-list {
  display: grid;
  gap: 7px;
  margin-top: 20px;
}

.variant-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr auto auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 11px;
}

.variant-row div {
  display: flex;
  gap: 10px;
}

.variant-row span {
  color: var(--muted);
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
}

.pill-active {
  color: var(--success) !important;
  border-color: rgba(133, 217, 164, .28);
}

.text-button {
  background: transparent;
  color: var(--soft);
  border: 0;
  padding: 0;
  cursor: pointer;
  font-size: 11px;
}

.danger-text {
  color: #ff9292;
}

.upload-box {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  display: grid;
  gap: 6px;
  place-items: center;
  padding: 26px;
  margin-bottom: 12px;
  cursor: pointer;
}

.upload-box input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-box small {
  color: var(--muted);
}

.photo-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.photo-item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
}

.photo-item img {
  width: 100%;
  aspect-ratio: .82;
  object-fit: cover;
  display: block;
}

.photo-item figcaption {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  gap: 8px;
}

.muted-block {
  color: var(--muted);
  font-size: 12px;
  padding: 20px 0;
}

/* Tabletas */

@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dialog-layout {
    grid-template-columns: 1fr;
  }

  .dialog-info {
    position: static;
  }

  .dashboard-grid {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .inline-form {
    grid-template-columns: repeat(2, 1fr);
  }

  .photo-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Celulares */

@media (max-width: 780px) {
  .site-header,
  .hero,
  .catalog-section,
  .site-footer {
    width: min(100% - 24px, 1420px);
  }

  .header-actions .button-ghost {
    display: none;
  }

  .hero {
    padding-top: 68px;
    padding-bottom: 52px;
  }

  .hero-brand {
    font-size: clamp(27px, 9vw, 38px);
    margin-bottom: 13px;
  }

  .hero h1 {
    margin-top: 17px;
  }

  .hero-meta {
    flex-direction: column;
    gap: 8px;
  }

  .catalog-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }

  .product-card-body {
    padding: 13px;
  }

  .product-card-top {
    display: grid;
    gap: 10px;
  }

  .dialog-gallery {
    grid-template-columns: 1fr;
  }

  .dialog-gallery img:nth-child(n+4) {
    display: none;
  }

  .dialog-info {
    padding: 30px 20px 35px;
  }

  .dashboard {
    width: calc(100% - 16px);
  }

  .admin-header .brand-copy {
    display: none;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .product-sidebar {
    max-height: 430px;
  }

  .admin-product-list {
    max-height: 300px;
  }

  .product-form {
    grid-template-columns: 1fr;
  }

  .form-span-2 {
    grid-column: auto;
  }

  .editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .editor-actions {
    width: 100%;
  }

  .editor-actions .button {
    flex: 1;
  }

  .variant-row {
    grid-template-columns: 1fr 1fr;
  }

  .photo-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .site-header {
    padding: 15px 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .header-actions .button {
    min-height: 38px;
    padding: 0 13px;
  }

  .hero {
    padding-top: 58px;
  }

  .hero-brand {
    font-size: 31px;
  }

  .hero h1 {
    font-size: 54px;
  }

  .hero > p {
    font-size: 24px;
  }

  .product-grid {
    grid-template-columns: 1fr 1fr;
  }

  .product-image-wrap {
    aspect-ratio: .75;
  }

  .product-card-top h3 {
    font-size: 14px;
  }

  .product-card-top strong {
    font-size: 12px;
  }

  .product-availability {
    display: none;
  }

  .product-code {
    top: 8px;
    right: 8px;
  }

  .product-badge {
    top: 8px;
    left: 8px;
  }

  .site-footer {
    align-items: flex-start;
    gap: 20px;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }
}
