/* Racó Digital · catálogo
   Cabecera fija con buscador · columna de categorías · rejilla de productos · ficha en dos columnas */
:root {
  --bg: #f5f4f2;
  --surface: #ffffff;
  --ink: #22201f;
  --muted: #6b6562;
  --line: #e0dcd9;
  --accent: rgb(249, 77, 28);
  --accent-text: #c4380f;
  --accent-ink: #ffffff;
  --accent-soft: #fee3d9;
  --ok: #1d7a3e; --ok-bg: #e2f3e7;
  --warn: #8a5a00; --warn-bg: #fbefd4;
  --info: #2a5a8a; --info-bg: #e2ecf6;
  --sale: #b3261e; --sale-bg: #fbe4e1;
  --photo: #ffffff;
  --shadow: 0 1px 2px rgba(40, 25, 20, .06), 0 6px 20px rgba(40, 25, 20, .06);
  --f-display: "Bahnschrift", "Segoe UI Variable Display", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Segoe UI", "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171413; --surface: #211c1a; --ink: #eeeae8; --muted: #aba3a0; --line: #3a3230;
    --accent: rgb(249, 77, 28); --accent-text: #ff7a52; --accent-ink: #ffffff; --accent-soft: #3d2016;
    --ok: #6fd58f; --ok-bg: #173323; --warn: #f0c060; --warn-bg: #3a2e12;
    --info: #8fbbe8; --info-bg: #182b3d; --sale: #ff8a80; --sale-bg: #3d1a18;
    --photo: #f4f6f5; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.5; }
img { max-width: 100%; }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1320px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

/* cabecera */
/* La cabecera es siempre clara para que el logo se vea bien también en modo oscuro */
.top { --surface: #ffffff; --bg: #f5f4f2; --ink: #22201f; --muted: #6b6562; --line: #e0dcd9; --accent-text: #c4380f; color-scheme: light; color: var(--ink); }
.top { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 20px; padding-block: 12px; }
.brand { display: flex; align-items: center; flex: none; line-height: 0; }
.brand img { height: 52px; width: auto; display: block; }
.tel-top { display: none; flex: none; align-items: center; gap: 7px; margin-left: auto; padding: 0 12px; height: 40px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.search { flex: 1; min-width: 0; position: relative; margin: 0; }
.search input { width: 100%; height: 44px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0 14px 0 40px; font-size: 16px; }
.search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.contact-top { flex: none; font-size: 13px; color: var(--muted); text-align: right; }
.contact-top a { font-weight: 700; text-decoration: none; color: var(--accent-text); }

/* listado */
.main { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; padding-block: 24px 48px; }
.side > summary { display: none; }
.side h2 { font-family: var(--f-display); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
.fams { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.fams a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 7px; font-size: 14px; color: var(--ink); text-decoration: none; }
.fams a:hover { background: var(--surface); }
.fams a.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.sec { border-top: 1px solid var(--line); }
.sec > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; border-radius: 7px; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
.sec[open] > summary::after { content: "−"; }
.sec > summary:hover { background: var(--surface); }
.sec .fams { padding: 0 0 8px 8px; }
.sec .fams a.todo span:first-child { color: var(--accent-text); font-weight: 700; }
.sec .fams a.todo.on span:first-child { color: inherit; }
.fams + .sec { margin-top: 6px; }
.chip .n { color: var(--muted); font-size: 12px; margin-left: 2px; }
.fams .n { color: inherit; opacity: .6; font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 2px; }

.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.head h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.01em; line-height: 1.1; margin: 0; text-wrap: balance; }
.head .count { color: var(--muted); font-size: 14px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; }
.controls select { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 10px; max-width: 220px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.subs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 13px; color: var(--ink); text-decoration: none; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }

.notice { background: var(--info-bg); color: var(--ink); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.ph { position: relative; aspect-ratio: 1; max-width: 100%; background: var(--photo); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.ph img { width: 82%; height: 82%; object-fit: contain; }
.noimg { font-family: var(--f-display); font-weight: 700; font-size: 20px; color: #aaa29e; text-align: center; padding: 12px; overflow-wrap: anywhere; }
.badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 5px; }
.badge { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 7px; border-radius: 5px; }
.badge.sale { background: var(--sale); color: #fff; }
.badge.new { background: var(--accent); color: var(--accent-ink); }
.card .body { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px 14px; flex: 1; }
.mk { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.card .tt { font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(1.35em * 3); }
.card .foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.price { font-family: var(--f-display); font-weight: 700; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1; }
.price s { font-family: var(--f-body); font-weight: 400; font-size: 13px; color: var(--muted); margin-left: 6px; }
.price.sale { color: var(--sale); }
.av { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; width: fit-content; }
.av::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.av.S { color: var(--ok); background: var(--ok-bg); }
.av.U, .av.P, .av.L { color: var(--warn); background: var(--warn-bg); }
.av.E, .av.C { color: var(--info); background: var(--info-bg); }
.av.X { color: var(--sale); background: var(--sale-bg); }

.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 28px; }
.pager a, .pager span { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; font-variant-numeric: tabular-nums; }
.pager .on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.pager .gap { border: 0; background: none; min-width: 20px; padding: 0; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 4px; }

/* portada */
.home { padding-block: 24px 56px; }
.home-title { font-family: var(--f-display); font-weight: 700; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.01em; line-height: 1.1; margin: 0 0 18px; text-wrap: balance; }
.see-all { margin: 24px 0 0; display: flex; justify-content: center; }
.see-all .chip { padding: 9px 18px; font-size: 14px; }
.chip.all { border-color: var(--accent); color: var(--accent-text); font-weight: 700; }
.tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; }
.tile { flex: 0 0 calc((100% - 3 * 16px) / 4); min-width: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-3px); }
.tile-img { aspect-ratio: 4 / 3; max-width: 100%; background: var(--photo); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); }
.tile-img img { width: 78%; height: 82%; object-fit: contain; }
.tile-txt { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px 16px; border-top: 4px solid var(--accent); margin-top: -1px; }
.tile-txt b { font-family: var(--f-display); font-size: 21px; font-weight: 700; line-height: 1.15; }
.tile-txt span { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile-txt span strong { color: var(--ink); }
.more-secs { margin-top: 40px; }
.more-secs h2 { font-family: var(--f-display); font-size: 19px; font-weight: 700; margin: 0 0 12px; }
.secs { display: flex; flex-wrap: wrap; gap: 8px; }
.secs .chip { padding: 8px 14px; font-size: 14px; }
.secs .chip.all { border-color: var(--accent); color: var(--accent-text); font-weight: 700; }

/* filtros */
.col-izq { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.filtros .grupo { border-top: 1px solid var(--line); }
.filtros .grupo > summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; font-weight: 700; font-size: 14px; cursor: pointer; list-style: none; border-radius: 7px; }
.filtros .grupo > summary::-webkit-details-marker { display: none; }
.filtros .grupo > summary::after { content: "+"; color: var(--muted); font-weight: 400; font-size: 18px; line-height: 1; }
.filtros .grupo[open] > summary::after { content: "−"; }
.filtros .grupo > summary .n { color: var(--accent-text); font-weight: 700; margin-right: auto; }
.opciones { list-style: none; margin: 0; padding: 0 4px 6px 6px; display: flex; flex-direction: column; gap: 1px; }
.opciones label { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.opciones label:hover { background: var(--surface); }
.opciones input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); flex: none; }
.opciones input:disabled + span { color: var(--muted); }
.opciones .n { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.opciones .extra { display: none; }
.grupo.todo .opciones .extra { display: block; }
.ver-mas { border: 0; background: none; color: var(--accent-text); font-weight: 700; font-size: 13px; padding: 0 12px 10px; cursor: pointer; }
.activos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 16px; }
.activos .chip span { margin-left: 4px; }
.activos .quitar { font-size: 13px; margin-left: 6px; }

/* ficha */
.prod { padding-block: 20px 48px; }
.det { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.big { aspect-ratio: 1; max-width: 100%; background: var(--photo); border: 1px solid var(--line); border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.big img { width: 88%; height: 88%; object-fit: contain; }
.big img { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(15, 12, 11, .88); padding: max(56px, env(safe-area-inset-top, 0px)) max(56px, env(safe-area-inset-right, 0px)) max(56px, env(safe-area-inset-bottom, 0px)) max(56px, env(safe-area-inset-left, 0px)); }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; border-radius: 10px; padding: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.lightbox button { position: absolute; width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: var(--accent); }
.lb-close { top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); }
.lb-prev { left: calc(10px + env(safe-area-inset-left, 0px)); top: 50%; transform: translateY(-50%); }
.lb-next { right: calc(10px + env(safe-area-inset-right, 0px)); top: 50%; transform: translateY(-50%); }
.lb-n { position: absolute; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); left: 0; right: 0; text-align: center; color: #fff; font-size: 14px; font-variant-numeric: tabular-nums; }
@media (max-width: 520px) {
  .lightbox { padding: 64px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); transform: none; }
}
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs button { width: 64px; height: 64px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--photo); cursor: pointer; }
.thumbs button.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.info h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.2; margin: 0; text-wrap: balance; }
.refs { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 13px; margin: 0; }
.refs dt { color: var(--muted); }
.refs dd { margin: 0; font-family: var(--f-mono); font-size: 12.5px; overflow-wrap: anywhere; }
.buy { display: flex; flex-direction: column; gap: 10px; padding: 18px; background: var(--bg); border-radius: 12px; }
.buy .price { font-size: 36px; }
.buy .iva { font-size: 12px; color: var(--muted); }
.gone { background: var(--sale-bg); border-radius: 12px; padding: 16px 18px; }
.gone b { display: block; font-size: 17px; color: var(--sale); margin-bottom: 2px; }
.spec { margin-top: 28px; }
.spec h2, .related h2 { font-family: var(--f-display); font-size: 21px; font-weight: 700; margin: 0 0 12px; }
.spec .tbl { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.spec table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec td, .spec th { padding: 9px 14px; vertical-align: top; border-bottom: 1px solid var(--line); text-align: left; }
.spec tr:last-child td { border-bottom: 0; }
.spec td:first-child { width: 28%; color: var(--muted); }
.spec td:first-child strong { color: var(--ink); }
.spec .free { padding: 16px; line-height: 1.6; }
.related { margin-top: 36px; }

.acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.share { position: relative; }
.share-panel { position: absolute; z-index: 6; top: calc(100% + 6px); left: 0; display: flex; flex-direction: column; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.share-panel a, .share-panel button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-decoration: none; font-weight: 600; cursor: pointer; }
.share-panel a:hover, .share-panel button:hover { background: var(--bg); color: var(--accent-text); }
.share-msg { font-size: 12px; color: var(--muted); padding: 0 12px; overflow-wrap: anywhere; }
.share-msg:empty { display: none; }
.btn-print { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.btn-print:hover { border-color: var(--accent); color: var(--accent-text); }
.print-only { display: none; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer .wrap { padding-block: 18px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

@media (max-width: 860px) {
  .main { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 14px; }
  .side { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  .side > summary { display: flex; justify-content: space-between; padding: 12px 14px; font-weight: 700; cursor: pointer; list-style: none; }
  .side > summary::-webkit-details-marker { display: none; }
  .side > summary::after { content: "▾"; color: var(--muted); }
  .side[open] > summary::after { content: "▴"; }
  .side h2 { display: none; }
  .side > .fams { padding: 0 8px 6px; }
  .side .sec { margin: 0 8px; }
  .side[open] { max-height: 75vh; overflow: auto; padding-bottom: 8px; }
  .col-izq { gap: 10px; }
  .filtros form { padding: 0 8px; }
  .contact-top { display: none; }
  .tel-top { display: inline-flex; }
  .det { grid-template-columns: minmax(0, 1fr); padding: 18px; gap: 20px; }
  .big { max-width: 440px; width: 100%; margin: 0 auto; }
}
@media (max-width: 900px) {
  .tile { flex-basis: calc((100% - 16px) / 2); }
}
@media (max-width: 520px) {
  .home { padding-top: 20px; }
  .tiles { gap: 10px; }
  .tile { flex-basis: calc((100% - 10px) / 2); }
  .tile-txt { padding: 10px 12px 12px; }
  .tile-txt b { font-size: 17px; }
  .tile-txt span { font-size: 12px; }
  .top .wrap { flex-wrap: wrap; gap: 10px; }
  .brand img { height: 42px; }
  .tel-top { order: 2; }
  .search { flex-basis: 100%; order: 3; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .body { padding: 10px; }
  .price { font-size: 19px; }
  .controls select { max-width: 46vw; }
  .spec td:first-child { width: 38%; }
}
@media (prefers-reduced-motion: reduce) { .card, .tile { transition: none; } .card:hover, .tile:hover { transform: none; } }

/* impresión de la ficha */
@media print {
  @page { margin: 14mm; }
  :root { color-scheme: light; --bg: #fff; --surface: #fff; --ink: #000; --muted: #555; --line: #ccc; --photo: #fff; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .top { position: static; border-bottom: 2px solid var(--accent); }
  .top .wrap { padding-block: 0 8px; }
  .search, .crumbs, .thumbs, .acciones, .related, .side, footer, .tel-top { display: none !important; }
  .contact-top { display: block !important; color: #000; margin-left: auto; }
  .wrap { max-width: none; padding: 0; }
  .prod { padding: 12px 0 0; }
  .det { grid-template-columns: 38% 1fr; gap: 24px; border: 0; padding: 0; border-radius: 0; }
  .big { border: 0; max-width: none; }
  .buy { background: none; border: 1px solid #ccc; }
  .av { border: 1px solid currentColor; }
  .spec { margin-top: 16px; }
  .spec .tbl { overflow: visible; border-color: #ccc; }
  .spec tr { break-inside: avoid; }
  .spec td, .spec th { padding: 5px 8px; }
  .print-only { display: block; }
  .print-url { font-size: 9pt; color: #555; margin: 0; overflow-wrap: anywhere; }
  .card:hover { transform: none; }
}
