/**
 * Hose Coupling Trace — track page (Capillary Mat / CityTribe Nursery)
 * Coupling connectors for lookup + curved linked progress joints.
 * NOT Dispatch Path, Cork Dispatch Board, Germination Trace, Grower Passport,
 * Guide Trellis, Plugflat Market, Halftone, Sail Rack, Drift, Folio, Contour.
 */

.page-a105-coupling {
  --hz-ease: cubic-bezier(0.34, 1.35, 0.64, 1);
}

.hz-stage {
  padding-block: var(--a105-space-6) var(--a105-space-9);
  position: relative;
}

.hz-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 30% at 80% 10%, rgba(255, 75, 42, 0.08), transparent),
    radial-gradient(ellipse 40% 28% at 10% 60%, rgba(14, 124, 116, 0.1), transparent);
  pointer-events: none;
}

.hz-mast,
.hz-body {
  position: relative;
  z-index: 1;
}

.hz-mast {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a105-space-4);
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--a105-space-6);
}

.hz-kicker {
  margin: 0 0 var(--a105-space-2);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a105-mat-deep);
}

.hz-mast .a105-display {
  margin: 0 0 var(--a105-space-3);
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--a105-loam);
}

.hz-mast-copy p:last-child {
  margin: 0;
  color: var(--a105-mute);
  max-width: 32rem;
}

.hz-chip {
  min-width: 7rem;
  padding: var(--a105-space-3) var(--a105-space-4);
  background: var(--a105-surface);
  border: 2px solid var(--a105-border);
  border-radius: 18px 8px 18px 8px;
  text-align: center;
}

.hz-chip strong {
  display: block;
  font-family: var(--a105-font-display);
  font-size: 1.6rem;
  color: var(--a105-mat);
}

.hz-chip span {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--a105-mute);
}

.hz-chip.is-found {
  border-color: var(--a105-sprout);
  background: rgba(152, 216, 50, 0.15);
}

.hz-chip.is-miss {
  border-color: var(--a105-plug);
  background: rgba(255, 75, 42, 0.08);
}

.hz-body {
  display: grid;
  gap: var(--a105-space-5);
  max-width: 44rem;
}

/* Coupling form */
.hz-couple {
  padding: var(--a105-space-5);
  background:
    linear-gradient(160deg, rgba(214, 244, 238, 0.85), var(--a105-surface)),
    var(--a105-surface);
  border: 2px solid var(--a105-mat);
  border-radius: 28px 12px 28px 12px;
  box-shadow: 0 16px 0 -10px rgba(14, 124, 116, 0.2);
}

.hz-couple-mark {
  margin: 0 0 var(--a105-space-4);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a105-mat);
}

.hz-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: var(--a105-space-2);
  align-items: stretch;
}

.hz-collar {
  position: relative;
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  padding: var(--a105-space-4) var(--a105-space-4) var(--a105-space-4) 2.6rem;
  background: var(--a105-paper);
  border: 2px solid var(--a105-border);
  border-radius: 999px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.25s var(--hz-ease);
}

.hz-collar-ring {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  border: 5px solid var(--a105-mat);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, var(--a105-mist));
  box-shadow: inset 0 0 0 2px var(--a105-loam);
}

.hz-collar-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--a105-mat-deep);
}

.hz-collar input {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--a105-ink);
  padding: 0;
}

.hz-collar input:focus {
  outline: none;
}

.hz-collar.is-focused {
  border-color: var(--a105-mat);
  box-shadow: 0 0 0 3px rgba(14, 124, 116, 0.18);
  transform: scale(1.01);
}

.hz-collar.is-filled .hz-collar-ring {
  border-color: var(--a105-sprout);
  animation: hz-ring-pulse 0.5s var(--hz-ease);
}

.hz-link {
  width: 28px;
  align-self: center;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--a105-mat), var(--a105-plug));
  position: relative;
}

.hz-link::before,
.hz-link::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 10px;
  height: 22px;
  border-radius: 4px;
  background: var(--a105-loam);
}

.hz-link::before { left: -4px; }
.hz-link::after { right: -4px; }

.hz-couple-act {
  margin-top: var(--a105-space-4);
}

.hz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.35rem;
  border: none;
  border-radius: var(--a105-radius);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--hz-ease), background 0.2s ease;
}

.hz-btn--mat {
  background: var(--a105-mat);
  color: var(--a105-on-mat);
  width: 100%;
}

.hz-btn--mat:hover {
  background: var(--a105-mat-deep);
}

.hz-btn--mat.is-pressing {
  transform: scale(0.98);
}

.hz-btn--plug {
  background: var(--a105-plug);
  color: var(--a105-on-plug);
}

.hz-btn--plug:hover {
  background: var(--a105-plug-deep);
}

.hz-another {
  margin: var(--a105-space-3) 0 0;
  text-align: center;
}

.hz-another a {
  color: var(--a105-mat-deep);
  font-weight: 600;
}

/* Curved coupling path — visible by default; dim/settle is motion enhancement */
.hz-path {
  padding: var(--a105-space-5);
  background: var(--a105-surface);
  border: 2px solid var(--a105-border);
  border-radius: var(--a105-radius-lg);
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hz-path {
    opacity: 0.55;
    transform: translateY(8px);
    transition: opacity 0.5s ease, transform 0.5s var(--hz-ease);
  }
  .hz-path.is-settled {
    opacity: 1;
    transform: none;
  }
}

.hz-path.is-found {
  border-color: var(--a105-mat);
}

.hz-path.is-miss {
  border-color: rgba(255, 75, 42, 0.35);
}

.hz-path-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--a105-space-3);
  margin-bottom: var(--a105-space-4);
}

.hz-path-head h2 {
  margin: 0;
  font-family: var(--a105-font-display);
  font-size: 1.35rem;
  color: var(--a105-loam);
}

.hz-path-head span {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--a105-mute);
}

.hz-couplings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  position: relative;
}

.hz-couplings::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 12px;
  bottom: 12px;
  width: 6px;
  border-radius: 999px;
  background: rgba(14, 124, 116, 0.15);
  transform: rotate(-2deg);
}

.hz-joint {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--a105-space-3);
  align-items: center;
  padding: var(--a105-space-3) 0;
  position: relative;
  margin-left: calc(var(--hz-i, 0) * 1.1rem);
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hz-joint {
    animation: hz-joint-in 0.55s var(--hz-ease) both;
    animation-delay: calc(var(--hz-i, 0) * 0.1s);
  }
}

.hz-joint-cap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 5px solid var(--a105-border);
  background: var(--a105-paper);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  transition: border-color 0.3s ease, transform 0.3s var(--hz-ease);
}

.hz-joint-wet {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: transparent;
  transform: scale(0);
  transition: transform 0.4s var(--hz-ease), background 0.3s ease;
}

.hz-joint--mat.is-done .hz-joint-cap,
.hz-joint--mat.is-live .hz-joint-cap { border-color: var(--a105-mat); }
.hz-joint--sprout.is-done .hz-joint-cap,
.hz-joint--sprout.is-live .hz-joint-cap { border-color: var(--a105-sprout); }
.hz-joint--sun.is-done .hz-joint-cap,
.hz-joint--sun.is-live .hz-joint-cap { border-color: var(--a105-sun); }
.hz-joint--plug.is-done .hz-joint-cap,
.hz-joint--plug.is-live .hz-joint-cap { border-color: var(--a105-plug); }

.hz-joint.is-done .hz-joint-wet,
.hz-joint.is-live .hz-joint-wet {
  transform: scale(1);
}

.hz-joint--mat.is-done .hz-joint-wet,
.hz-joint--mat.is-live .hz-joint-wet { background: var(--a105-mat); }
.hz-joint--sprout.is-done .hz-joint-wet,
.hz-joint--sprout.is-live .hz-joint-wet { background: var(--a105-sprout); }
.hz-joint--sun.is-done .hz-joint-wet,
.hz-joint--sun.is-live .hz-joint-wet { background: var(--a105-sun); }
.hz-joint--plug.is-done .hz-joint-wet,
.hz-joint--plug.is-live .hz-joint-wet { background: var(--a105-plug); }

.hz-joint.is-live .hz-joint-cap {
  transform: scale(1.08);
  animation: hz-live-pulse 1.6s ease-in-out infinite;
}

.hz-joint.is-muted {
  opacity: 0.45;
}

.hz-joint-meta {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}

.hz-joint-meta em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--a105-mat);
}

.hz-joint-meta strong {
  font-family: var(--a105-font-display);
  font-size: 1.05rem;
  color: var(--a105-loam);
}

.hz-joint-meta small {
  color: var(--a105-mute);
  font-size: 0.85rem;
}

/* Result plate — always visible; optional entrance when JS adds .is-live */
.hz-plate {
  padding: var(--a105-space-5);
  background: linear-gradient(135deg, var(--a105-mat), var(--a105-mat-deep));
  color: var(--a105-on-mat);
  border-radius: 12px 28px 12px 28px;
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hz-plate.is-live {
    animation: hz-plate-in 0.45s var(--hz-ease, ease) both;
  }
}

@keyframes hz-plate-in {
  from { opacity: 0; transform: translateY(12px) rotate(-0.5deg); }
  to { opacity: 1; transform: none; }
}

.hz-plate-head {
  display: flex;
  justify-content: space-between;
  gap: var(--a105-space-3);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.9;
}

.hz-plate-status {
  background: rgba(255, 255, 255, 0.18);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.hz-plate-id {
  margin: var(--a105-space-3) 0;
  font-family: var(--a105-font-display);
  font-size: clamp(1.4rem, 4vw, 1.9rem);
}

.hz-plate-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--a105-space-3);
  margin: 0 0 var(--a105-space-4);
}

.hz-plate-meta div {
  background: rgba(255, 255, 255, 0.12);
  padding: var(--a105-space-3);
  border-radius: var(--a105-radius-sm);
}

.hz-plate-meta dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.hz-plate-meta dd {
  margin: 0.2rem 0 0;
  font-weight: 700;
  font-size: 1.05rem;
}

.hz-plate-acts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a105-space-3);
  align-items: center;
}

.hz-text-exit {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hz-miss,
.hz-idle {
  padding: var(--a105-space-5);
  background: var(--a105-surface);
  border: 2px dashed var(--a105-border);
  border-radius: var(--a105-radius-lg);
}

.hz-miss strong,
.hz-idle strong {
  display: block;
  font-family: var(--a105-font-display);
  font-size: 1.25rem;
  color: var(--a105-loam);
  margin-bottom: 0.35rem;
}

.hz-miss p,
.hz-idle p {
  margin: 0 0 var(--a105-space-3);
  color: var(--a105-mute);
}

.hz-miss .hz-text-exit,
.hz-idle .hz-text-exit {
  color: var(--a105-mat-deep);
}

.hz-trail {
  display: flex;
  flex-wrap: wrap;
  gap: var(--a105-space-3) var(--a105-space-4);
}

.hz-trail a {
  color: var(--a105-mat-deep);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes hz-ring-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes hz-joint-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: none; }
}

@keyframes hz-live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 124, 116, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(14, 124, 116, 0); }
}

@media (max-width: 700px) {
  .hz-fields {
    grid-template-columns: 1fr;
  }
  .hz-link {
    width: 10px;
    height: 28px;
    justify-self: center;
    background: linear-gradient(180deg, var(--a105-mat), var(--a105-plug));
  }
  .hz-link::before,
  .hz-link::after {
    left: -6px;
    width: 22px;
    height: 10px;
  }
  .hz-link::before { top: -4px; }
  .hz-link::after { top: auto; bottom: -4px; }
  .hz-joint {
    margin-left: calc(var(--hz-i, 0) * 0.45rem);
  }
  .hz-plate-meta {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hz-path,
  .hz-plate,
  .hz-joint,
  .hz-joint.is-live .hz-joint-cap,
  .hz-collar.is-filled .hz-collar-ring,
  .hz-collar.is-focused {
    animation: none !important;
    transition: none !important;
  }
  .hz-path,
  .hz-plate,
  .hz-joint,
  .hz-joint-wet {
    opacity: 1;
    transform: none;
  }
  .hz-joint.is-done .hz-joint-wet,
  .hz-joint.is-live .hz-joint-wet {
    transform: scale(1);
  }
}
