/* Diacenter : onglets Vente / Location et liste des diagnostics (micro-animations propres à chacun). */

.tabs {
  display: flex;
  gap: clamp(20px, 4vw, 40px);
  margin-bottom: 40px;
  border-bottom: 1px solid var(--line);
}

.tabs[hidden] {
  display: none;
}

.tabs__tab {
  position: relative;
  min-height: 44px;
  padding: 8px 0 14px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--ink-soft);
  font-size: clamp(1.0625rem, .95rem + .5vw, 1.375rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}

.tabs__tab::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 250ms var(--ease), background-color var(--dur) var(--ease);
}

.tabs__tab:hover {
  color: var(--ink);
}

.tabs__tab:hover::after {
  transform: scaleX(.3);
  background: var(--line);
}

.tabs__tab[aria-selected="true"] {
  color: var(--ink);
}

.tabs__tab[aria-selected="true"]::after {
  transform: none;
  background: var(--ink);
}

.panel {
  display: grid;
  grid-template-columns: minmax(0, .75fr) minmax(0, 2fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: start;
  border-radius: var(--r-xs);
}

/* Sans JavaScript, les deux listes s'affichent l'une sous l'autre. */
.panel + .panel {
  margin-top: 64px;
}

.js .panel + .panel {
  margin-top: 0;
}

.panel[hidden] {
  display: none;
}

.panel.is-entering {
  animation: panel-in 250ms var(--ease);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
}

.panel__aside {
  position: sticky;
  top: 120px;
}

.panel__title {
  font-size: 1.5rem;
  font-weight: 800;
}

.panel__aside p {
  margin: 12px 0 24px;
  color: var(--ink-soft);
}

.diags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 40px;
  border-top: 2px solid var(--ink);
}

.diag {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  column-gap: 16px;
  height: 100%;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.diag__icon {
  width: 40px;
  height: 40px;
  overflow: visible;
  color: var(--ink);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diag__icon * {
  transform-box: fill-box;
  transform-origin: center;
}

.diag__icon [transform] {
  transform-box: view-box;
  transform-origin: 0 0;
}

.diag__icon .ic-accent {
  stroke: var(--sea);
}

.diag__name {
  font-size: var(--fs-h3);
  font-weight: 800;
  transition: color var(--dur) var(--ease);
}

.diag__desc {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.diag__valid {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.diag__valid::before {
  content: "";
  flex: none;
  width: 8px;
  height: 2px;
  background: var(--sea);
  transform: translateY(-4px);
}

.diag__cta {
  position: absolute;
  top: 24px;
  right: 0;
  color: var(--sea);
  font-size: var(--fs-sm);
  font-weight: 700;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.diag:hover .diag__name,
.diag:focus-visible .diag__name {
  color: var(--sea);
}

.diag:hover .diag__cta,
.diag:focus-visible .diag__cta {
  opacity: 1;
  transform: none;
}

/* ---------- Micro-animations, au survol ou au focus de la ligne ---------- */
.diag__icon--dpe .ic-bar {
  stroke-width: 3.5;
  stroke-dasharray: 22;
  stroke-dashoffset: 0;
}

.diag:is(:hover, :focus-visible) .ic-bar {
  animation: bar-fill 450ms var(--ease) var(--d) both;
}

@keyframes bar-fill {
  from { stroke-dashoffset: 22; }
}

.diag:is(:hover, :focus-visible) .ic-fiber {
  animation: fiber-out 600ms ease-out;
}

@keyframes fiber-out {
  55% { transform: translate(var(--fx), var(--fy)) rotate(25deg); opacity: 0; }
  56% { transform: none; opacity: 0; }
}

.diag:is(:hover, :focus-visible) .ic-drop {
  animation: drop-fall 600ms ease-in;
}

@keyframes drop-fall {
  60% { transform: translateY(6px) scale(.85); opacity: 0; }
  61% { transform: translateY(-3px) scale(.6); opacity: 0; }
}

.diag:is(:hover, :focus-visible) .ic-pin {
  animation: pin-hop 500ms var(--ease);
}

.diag:is(:hover, :focus-visible) .ic-ring {
  animation: ring-pulse 500ms ease-out;
}

@keyframes pin-hop {
  40% { transform: translateY(-3px); }
}

@keyframes ring-pulse {
  from { transform: scale(.5); opacity: 0; }
}

.diag__icon--mesure .ic-tape {
  transform-origin: left center;
}

.diag:is(:hover, :focus-visible) .ic-tape {
  animation: tape-out 500ms var(--ease);
}

@keyframes tape-out {
  from { transform: scaleX(.15); }
}

.diag:is(:hover, :focus-visible) .ic-bug {
  animation: bug-walk 600ms ease-in-out;
}

.diag:is(:hover, :focus-visible) .ic-legs {
  animation: legs 150ms linear 4;
}

@keyframes bug-walk {
  50% { transform: translateX(4px); }
}

@keyframes legs {
  50% { transform: scaleY(.85); }
}

.diag:is(:hover, :focus-visible) .ic-bolt {
  animation: bolt-flash 450ms steps(1);
}

@keyframes bolt-flash {
  0%, 50% { fill: var(--sea); stroke: var(--sea); }
  25%, 75% { fill: none; }
}

.diag__icon--gaz .ic-flame {
  transform-origin: center bottom;
}

.diag:is(:hover, :focus-visible) .ic-flame {
  animation: flame 600ms ease-in-out;
}

@keyframes flame {
  25% { transform: scale(.95, 1.06) skewX(-4deg); }
  50% { transform: scale(1.03, .96) skewX(3deg); }
  75% { transform: scale(.97, 1.04) skewX(-2deg); }
}

@media (min-width: 1000px) {
  .diags li:nth-last-child(-n + 2):nth-child(odd) .diag,
  .diags li:last-child .diag {
    border-bottom: 0;
  }
}

@media (max-width: 999px) {
  .panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel__aside {
    position: static;
  }

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

  .diags li:last-child .diag {
    border-bottom: 0;
  }
}

@media (max-width: 479px) {
  .tabs {
    gap: 18px;
  }

  .tabs__tab {
    font-size: .9375rem;
    white-space: nowrap;
  }
}

/* Sur écran tactile, l'indication répétée sur chaque ligne alourdit la liste. */
@media (hover: none) {
  .diag__cta {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel.is-entering,
  .diag:is(:hover, :focus-visible) .diag__icon * {
    animation: none;
  }
}
