/* IMECA3D — Material Selector page (loaded only on /material-selector) */

.msel { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.msel__results { grid-column: 1 / -1; outline: none; }

/* question card */
.msel__form { padding: 32px; border-radius: 20px; background: var(--frost-bg); border: 1px solid var(--frost-border);
  box-shadow: var(--frost-shadow); -webkit-backdrop-filter: blur(14px) saturate(150%); backdrop-filter: blur(14px) saturate(150%); }
.msel__progress { height: 6px; border-radius: 3px; background: var(--light-2); overflow: hidden; }
.msel__bar { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.35s ease; }
.msel__count { margin: 10px 0 18px; font-size: 0.8rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.msel__step { border: 0; padding: 0; margin: 0 0 28px; min-width: 0; }
.msel__step legend { display: flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 18px;
  font-family: var(--font-head); font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 600; color: var(--text); }
.msel__n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--dark); color: #fff; font-size: 0.95rem; }
.msel__hint { margin: -8px 0 16px; color: var(--text-3); font-size: 0.92rem; }
/* without JavaScript every question is visible; with it, one at a time */
.msel--ready .msel__step[hidden] { display: none; }

.msel__opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.msel-opt { position: relative; display: grid; grid-template-columns: 44px 1fr; column-gap: 14px; align-items: center;
  padding: 16px 18px; border-radius: 14px; background: #fff; border: 1.5px solid var(--border); cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s; }
.msel-opt:hover { border-color: rgba(194,65,12,0.5); transform: translateY(-1px); }
.msel-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.msel-opt__ic { grid-row: span 2; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--light); color: var(--accent); transition: background 0.2s, color 0.2s; }
.msel-opt__ic .icon { width: 22px; height: 22px; }
.msel-opt strong { font-size: 0.98rem; color: var(--text); line-height: 1.3; }
.msel-opt small { font-size: 0.84rem; color: var(--text-3); line-height: 1.35; }
.msel-opt--small { padding: 12px 14px; grid-template-columns: 36px 1fr; }
.msel-opt--small .msel-opt__ic { grid-row: auto; width: 36px; height: 36px; border-radius: 10px; }
.msel-opt--small .msel-opt__ic .icon { width: 18px; height: 18px; }
.msel-opt:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194,65,12,0.14); }
.msel-opt:has(input:checked) .msel-opt__ic { background: var(--accent); color: #fff; }
.msel-opt:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.msel-opt--small:has(input:checked)::after { content: ""; position: absolute; top: 10px; right: 12px; width: 8px; height: 14px;
  border: solid var(--accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

.msel__nav { display: flex; justify-content: space-between; gap: 12px; padding-top: 8px; border-top: 1px solid var(--border); padding-top: 20px; }
.msel__next { margin-left: auto; }
.msel__next:disabled { opacity: 0.45; cursor: not-allowed; }
.msel__back[hidden] { display: none; }

/* live shortlist */
.msel__live { position: sticky; top: calc(var(--nav-h) + 20px); padding: 24px; border-radius: 20px; color: var(--text-on-dark);
  background: linear-gradient(160deg, #12263D, #0B1B2E); box-shadow: 0 20px 50px rgba(11,27,46,0.28); }
.msel__live[hidden] { display: none; }
.msel__live-title { margin: 0 0 14px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-bright); }
.msel__live-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: live; }
.msel__live-list li { counter-increment: live; display: grid; gap: 6px; }
.msel__live-name { color: #fff; font-weight: 600; font-size: 0.98rem; }
.msel__live-name::before { content: counter(live) ". "; color: var(--accent-bright); }
.msel__live-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.1); overflow: hidden; }
.msel__live-bar i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #C2410C, #F07A2E); transition: width 0.4s ease; }
.msel__live-note { margin: 16px 0 0; font-size: 0.86rem; }

/* results */
.msel-res__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.msel-res__head .section-title { margin-bottom: 6px; }
.msel-res__intro { color: var(--text-3); margin: 0; }
.msel-res__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.msel-res__restart { color: var(--text-2); }
.msel-res__answers { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 26px; font-size: 0.88rem; color: var(--text-3); }
.msel-res__answers em { font-style: normal; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid var(--border); color: var(--text-2); }
.msel-res__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; align-items: start; }
.msel-card { display: flex; flex-direction: column; gap: 10px; padding: 26px; border-radius: 20px; background: var(--frost-bg);
  border: 1px solid var(--frost-border); box-shadow: var(--frost-shadow); }
.msel-card--top { background: #fff; border: 2px solid var(--accent); box-shadow: 0 18px 44px rgba(194,65,12,0.16); }
.msel-card__rank { align-self: flex-start; padding: 4px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; background: var(--light-2); color: var(--text-2); }
.msel-card--top .msel-card__rank { background: #C2410C; color: #fff; }
.msel-card h3 { margin: 4px 0 0; font-size: 1.4rem; }
.msel-card__fam { margin: 0; font-size: 0.86rem; color: var(--text-3); font-weight: 600; }
.msel-card__desc { margin: 0; color: var(--text-2); font-size: 0.95rem; }
.msel-card__ratings { list-style: none; margin: 4px 0; padding: 12px 0; display: grid; gap: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.msel-card__ratings li { display: flex; justify-content: space-between; align-items: center; font-size: 0.86rem; color: var(--text-2); }
.msel-meter { display: inline-flex; gap: 4px; }
.msel-meter i { width: 18px; height: 6px; border-radius: 3px; background: var(--light-2); }
.msel-meter i.on { background: var(--accent); }
.msel-card__h { margin: 6px 0 0; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.msel-card__why, .msel-card__watch { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 0.92rem; color: var(--text); }
.msel-card__why li, .msel-card__watch li { position: relative; padding-left: 22px; }
.msel-card__why li::before { content: ""; position: absolute; left: 3px; top: 4px; width: 6px; height: 11px; border: solid #15803D; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.msel-card__watch li::before { content: "!"; position: absolute; left: 0; top: 1px; width: 16px; height: 16px; border-radius: 50%; background: #B45309; color: #fff;
  font-size: 0.7rem; font-weight: 700; line-height: 16px; text-align: center; }
.msel-card__best { margin: 4px 0 0; font-size: 0.88rem; color: var(--text-2); }
.msel-card__links { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-top: 8px; }
.msel-card__links .btn { white-space: normal; text-align: left; }
.msel-res__note { max-width: 860px; margin: 22px 0 0; font-size: 0.88rem; color: var(--text-3); }
.msel-res__note + .msel-res__note { margin-top: 8px; }

/* how it works */
.msel-how { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 40px; align-items: start; }
.msel-how__list { margin: 0; padding-left: 22px; display: grid; gap: 16px; color: var(--text-2); }
.msel-how__list strong { color: var(--text); }
.msel-how__more { margin-top: 28px; color: var(--text-2); }

@media (max-width: 1000px) {
  .msel { grid-template-columns: 1fr; }
  .msel__live { position: static; padding: 18px 20px; }
  .msel__live-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .msel-res__grid { grid-template-columns: 1fr; max-width: 640px; }
  .msel-how { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 640px) {
  .msel__form { padding: 22px 18px; }
  .msel__opts { grid-template-columns: 1fr; }
  .msel__live-list { grid-template-columns: 1fr; }
  .msel-card { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .msel__bar, .msel__live-bar i, .msel-opt { transition: none; }
}

/* polish */
.msel__live .msel__live-note { color: var(--text-on-dark); }
.msel, .msel__results { scroll-margin-top: calc(var(--nav-h) + 24px); }
.msel-res__restart { background: none; border: 0; padding: 0 6px; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.msel-res__restart:hover { color: var(--accent-h); background: none; }

/* Service Finder (/service-finder): same step-by-step form, one column, service cards as results */
.msel--single { grid-template-columns: minmax(0, 1fr); max-width: 860px; margin: 0 auto; }
.msel--single.msel--done { max-width: none; }
.sfind-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.sfind-grid .msel-card--top { grid-column: 1 / -1; }
.sfind-card h3 { display: flex; align-items: center; gap: 12px; }
.sfind-card__ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: rgba(194,65,12,0.1); color: var(--accent); }
.msel-card--top .sfind-card__ic { background: var(--accent); color: #fff; }
.sfind-card__ic .icon { width: 22px; height: 22px; }
.msel-card--top .msel-card__links { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 18px; }
@media (max-width: 760px) { .sfind-grid { grid-template-columns: 1fr; } }
