/* Match owns its feed layout. Colors and control metrics come from the shared UI base. */
.imd-match {
  --match-red: #e70019;
  --match-action: #e70019;
  --match-action-hover: #bf0015;
  --match-bg: var(--imd-ui-surface, #fff);
  --match-text: var(--imd-ui-ink, #172126);
  --match-muted: var(--imd-ui-muted, #53636d);
  --match-line: var(--imd-ui-line, #cdd6da);
  --match-soft: var(--imd-ui-soft, #edf0f1);
  --match-tint: var(--imd-ui-tint, #fff0f2);
  --match-link: var(--imd-ui-link, #b80019);
  --match-focus: var(--imd-ui-focus, #b91f20);
  --match-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%2353636d' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --match-positive: #1c6c3d;
  /* Blocksy reads these on native controls, including typed submit buttons. */
  --theme-button-background-initial-color: var(--match-bg);
  --theme-button-background-hover-color: var(--match-tint);
  --theme-button-text-initial-color: var(--match-text);
  --theme-button-text-hover-color: var(--match-text);
  --theme-form-field-border-focus-color: var(--match-focus);
  max-width: 1180px;
  margin: 8px auto 24px;
  padding: 12px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  color: var(--match-text);
  font-family: var(--imd-font-body, Aileron, Arial, sans-serif);
  overflow-wrap: anywhere;
  color-scheme: light;
}
.imd-match, .imd-match * { box-sizing: border-box; }
.imd-match [hidden] { display: none !important; }
.imd-match :is(button, input, select, a) { font: inherit; }
.imd-match button, .imd-match__primary {
  appearance: none;
  -webkit-appearance: none;
  min-height: var(--imd-ui-control-height, 46px);
  padding: 10px 18px;
  border: 1px solid var(--match-line);
  border-radius: var(--imd-ui-radius, 16px);
  background: var(--match-bg);
  color: inherit;
  box-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
  text-decoration: none;
}
.imd-match button:not(:disabled):hover { background: var(--match-tint); border-color: var(--match-link); color: var(--match-text); }
.imd-match :is(button, a, input, select, summary):focus-visible { outline: 3px solid var(--imd-ui-focus, #b91f20); outline-offset: 3px; }
.imd-match button:disabled { opacity: .6; cursor: wait; }
.imd-match .imd-match__primary {
  --theme-button-background-initial-color: var(--match-action);
  --theme-button-background-hover-color: var(--match-action-hover);
  --theme-button-text-initial-color: #fff;
  --theme-button-text-hover-color: #fff;
  display: inline-flex; align-items: center; justify-content: center; border-color: transparent; background: var(--match-action); color: #fff; font-weight: 700;
}
.imd-match .imd-match__primary:not(:disabled):is(:hover, :focus-visible) { background: var(--match-action-hover); border-color: transparent; color: #fff; }
.imd-match a:not(.imd-match__primary) { color: var(--match-link); text-underline-offset: 3px; }
.imd-match :is(summary, a) { min-height: 44px; align-content: center; }
.imd-match :is(h1, h2, h3) { color: var(--match-text); font-family: var(--imd-font-heading, Oduda, Aileron, Arial, sans-serif); }
.imd-match h1 { margin: 5px 0; font-size: clamp(25px, 3vw, 36px); line-height: 1.1; }
.imd-match__header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 10px; }
.imd-match__header > div, .imd-match__details { min-width: 0; }
.imd-match__header p { margin:0; color: var(--match-red); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.imd-match__header span { font-size:14px; line-height:1.4; }
.imd-match__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.imd-match__tabs [aria-pressed=true] { border-color: var(--match-red); background: var(--match-tint); color: var(--match-text); }
.imd-match__profile, .imd-match__welcome { margin-bottom: 24px; padding: 28px; border: 1px solid var(--match-line); border-radius: 24px; background: var(--match-bg); }
.imd-match__welcome > a { display: inline-flex; align-items: center; margin: 6px 8px 6px 0; }
.imd-match__profile [data-match-fields] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 24px 0; }
.imd-match__profile > button { margin: 4px 8px 4px 0; }
.imd-match__field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.imd-match__field label { margin: 0; color: var(--match-text); font-weight: 700; line-height: 1.4; }
.imd-match .imd-match__field :is(input, select) {
  min-width: 0; width: 100%; min-height: 48px; margin: 0; padding: 11px 12px;
  border: 1px solid var(--match-line); border-radius: var(--imd-ui-control-radius, 14px);
  background-color: var(--match-bg); color: var(--match-text); box-shadow: none;
  font: 400 16px/1.4 var(--imd-font-body, Aileron, Arial, sans-serif);
}
.imd-match .imd-match__field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: var(--match-select-chevron); background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
.imd-match .imd-match__field :is(input, select):focus { border-color: var(--match-focus); box-shadow: none; }
.imd-match .imd-match__field :is(input, select):focus-visible { outline: 2px solid var(--match-focus); outline-offset: 2px; }
.imd-match .imd-match__field select[name$="_required"] { min-height: 44px; background-color: var(--match-soft); font-size: 13px; font-weight: 600; }
.imd-match .imd-match__field :is(input[type="checkbox"], input[type="radio"]) { width: 20px; min-height: 20px; padding: 0; accent-color: var(--match-action); }
.imd-match__field input::placeholder { color: var(--match-muted); opacity: .85; }
.imd-match__field small { font-size: 12px; line-height: 1.4; }
.imd-match__field small, .imd-match__specs, .imd-match__empty-photo { color: var(--match-muted); }
.imd-match__optional { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--match-line); }
.imd-match__optional > summary { padding: 10px 0; color: var(--match-text); font-weight: 700; cursor: pointer; }
.imd-match summary::marker { color: var(--match-link); }
.imd-match__optional-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.imd-match [data-match-status] { min-height:20px; margin:7px 0; font-size:14px; line-height:1.4; }
.imd-match [data-match-status]:empty { min-height:0; margin:0; }
.imd-match__deck-nav { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:6px 0 10px; }
.imd-match__deck-nav > span { color:var(--match-muted); font-size:14px; font-variant-numeric:tabular-nums; }
.imd-match__deck-nav > button { padding:8px 12px; font-size:14px; }
.imd-match__deck-nav > button:disabled { cursor:default; }
.imd-match__feed { display:block; overflow:hidden; padding:4px; margin:-4px; }
.imd-match__card { display: grid; height:var(--match-deck-height,520px); grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); overflow: hidden; border: 1px solid var(--match-line); border-radius: 26px; background: var(--match-bg); touch-action:pan-y pinch-zoom; transform-origin:50% 85%; }
.imd-match__card.is-dragging { user-select:none; cursor:grabbing; }
.imd-match__card.is-leaving-left { transform:translateX(-110%) rotate(-5deg); opacity:0; }
.imd-match__card.is-leaving-right { transform:translateX(110%) rotate(5deg); opacity:0; }
.imd-match__card:not(.is-dragging) { transition:transform .18s ease-out,opacity .18s ease-out; }
.imd-match__card .imd-match__photo { -webkit-user-drag:none; user-select:none; }
.imd-match__gallery { position: relative; min-height:0; overflow:hidden; background: var(--match-soft); touch-action: pan-y pinch-zoom; }
.imd-match__photo { display: block; width: 100%; height: 100%; object-fit: cover; }
.imd-match__empty-photo { display: flex; min-height:140px; height:100%; align-items: center; justify-content: center; }
.imd-match__score { position: absolute; top: 16px; left: 16px; padding: 9px 15px; border-radius: 99px; background: #f3fff5; color: #176132; font-weight: 800; }
.imd-match__gallery-controls { position: absolute; bottom: 16px; right: 16px; left: 16px; display: flex; justify-content: space-between; align-items: center; }
.imd-match__gallery-controls button { min-width: 46px; }
.imd-match__gallery-controls span { padding: 5px 10px; border-radius: 20px; background: #fff; color: #172126; }
.imd-match__details { display:grid; min-height:0; grid-template-rows:auto minmax(0,1fr) auto; gap:10px; padding:20px; }
.imd-match__identity { display:flex; flex-direction:column; gap:6px; min-width:0; }
.imd-match__identity > p { font-size:14px; line-height:1.35; }
.imd-match__identity > strong { line-height:1.2; }
.imd-match__summary { display:flex; min-height:0; overflow-y:auto; overscroll-behavior:contain; flex-direction:column; gap:12px; padding:2px 5px 5px 2px; scrollbar-width:thin; }
.imd-match__summary > * { flex-shrink:0; }
.imd-match__summary:focus-visible { outline:2px solid var(--match-focus); outline-offset:-2px; }
.imd-match__details h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.imd-match__details p { margin: 0; }
.imd-match__price { font-size: 26px; font-weight: 800; }
.imd-match__specs { font-size: 14px; }
.imd-match__actions { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; margin-top:auto; }
.imd-match__actions button { min-width:0; padding:8px 9px; overflow-wrap:normal; white-space:normal; font-size:14px; line-height:1.3; }
.imd-match__actions .imd-match__primary { grid-column:1/-1; width:100%; }
.imd-match__actions .imd-match__contact { grid-column:1/-1; border-color:var(--match-link); color:var(--match-link); font-weight:700; }
.imd-match__actions .imd-match__like { border-color:var(--match-action); background:var(--match-action); color:#fff; font-weight:700; }
.imd-match__actions .imd-match__like:not(:disabled):is(:hover,:focus-visible) { background:var(--match-action-hover); color:#fff; border-color:var(--match-action-hover); }
.imd-match__actions > a { display:flex; min-width:0; justify-content:center; align-items:center; padding:8px 7px; font-size:14px; line-height:1.3; text-align:center; white-space:normal; }
.imd-match__reasons { padding-left: 0; list-style: none; font-size: 14px; line-height: 1.8; }
.imd-match__reasons [data-state=matched] { color: var(--match-positive); }
.imd-match__validation { padding: 10px; border: 1px solid #b8dfc5; border-radius: 12px; color: var(--match-positive); font-size: 13px; }
.imd-match__availability { padding:10px 12px; border:1px solid var(--match-line); border-radius:12px; background:var(--match-soft); color:var(--match-muted); font-size:13px; }
:is(html[data-theme="dark"], html[data-imd-color-scheme="dark"], html.inmudescuentos-site-dark, html.imh-site-dark, body.dark-mode, body.imd-dark-mode) .imd-match { --match-red: #ff4057; --match-positive: #a7e9b9; --match-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%23bcc7ce' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); color-scheme: dark; }
@media (min-width: 701px) and (max-width: 950px) {
  .imd-match { padding-inline: 18px; }
  .imd-match__card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .imd-match__details { padding: 20px; }
}
@media (max-width: 700px) {
  .imd-match { margin-top:8px; padding:8px 12px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .imd-match__header { display:block; margin-bottom:6px; }
  .imd-match__header > button { max-width:105px; padding:9px 10px; font-size:13px; line-height:1.3; }
  .imd-match__tabs { flex-wrap:nowrap; gap:6px; max-width:100%; overflow-x:auto; padding:4px 3px 8px; scrollbar-width:thin; }
  .imd-match__tabs button { flex:0 0 auto; padding:9px 12px; font-size:14px; white-space:nowrap; }
  .imd-match__profile { padding: 20px; }
  .imd-match__profile [data-match-fields], .imd-match__optional-grid { grid-template-columns: 1fr; }
  .imd-match .imd-match__field :is(input, select), .imd-match .imd-match__field select[name$="_required"] { font-size: 16px; }
  .imd-match__card { display:grid; grid-template-columns:minmax(0,1fr); grid-template-rows:150px minmax(0,1fr); }
  .imd-match__gallery { min-height:0; height:auto; max-height:none; }
  .imd-match__details { gap:8px; padding:12px; }
  .imd-match__summary { gap:8px; }
  .imd-match__details h2, .imd-match__price { font-size: 23px; }
  .imd-match__reasons { margin: 0; }
  .imd-match__actions button { flex: 1 0 auto; }
  .imd-match__actions .imd-match__primary { flex-basis: 100%; min-width: 0; white-space: normal; }
}
@media (max-width: 420px) {
  .imd-match { padding-inline: 8px; }
  .imd-match__tabs button { flex:0 0 auto; padding:9px 10px; }
  .imd-match__details { padding:10px; }
  .imd-match__profile, .imd-match__welcome { padding: 18px; }
  .imd-match__header > button { align-self:center; }
}
@media (prefers-reduced-motion: no-preference) {
  .imd-match__card { animation: imd-match-in .18s ease-out; }
  @keyframes imd-match-in { from { opacity: .6; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .imd-match__card { transition:none; } }
