.port-finding {
  border-left-color: #9b4b36;
  background: #f4eee2;
}

.port-explainer {
  margin: 3.2rem 0;
  border: 1px solid #d8ccba;
  border-radius: 22px;
  background: #f5f0e7;
  color: #1d292c;
  overflow: hidden;
  box-shadow: 0 18px 45px rgba(45, 39, 29, .1);
}

.port-explainer:focus-visible {
  outline: 3px solid #9b4b36;
  outline-offset: 4px;
}

.port-head {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.6rem 1.8rem 1.25rem;
  border-bottom: 1px solid #d8ccba;
}

.port-head span,
.port-document > span,
.port-decision > span,
.port-gate > span,
.port-status span {
  display: block;
  margin-bottom: .35rem;
  color: #805d47;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.port-head h3 {
  margin: 0;
  color: #172528;
  font-size: clamp(1.35rem, 3vw, 2.05rem);
  line-height: 1.08;
}

.port-head p {
  max-width: 16rem;
  margin: 0;
  color: #6f665c;
  font-size: .78rem;
  line-height: 1.45;
  text-align: right;
}

.port-figure {
  margin: 0;
}

.port-stage {
  padding: 1.7rem 1.8rem 1.35rem;
  background:
    radial-gradient(circle at 83% 18%, rgba(160, 111, 68, .12), transparent 27%),
    linear-gradient(180deg, #fbf8f1 0%, #eee5d6 100%);
}

.port-route {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .55rem;
  padding: 0;
  margin: 0 0 1.6rem;
  list-style: none;
}

.port-route::before {
  position: absolute;
  top: 1.1rem;
  right: 8%;
  left: 8%;
  height: 2px;
  content: "";
  background: #cabba6;
}

.port-route li {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: .14rem;
  color: #74695e;
  text-align: center;
}

.port-route i {
  display: grid;
  width: 2.2rem;
  height: 2.2rem;
  place-items: center;
  border: 2px solid #b8aa96;
  border-radius: 50%;
  background: #fbf8f1;
  color: #766b5f;
  font-size: .68rem;
  font-style: normal;
  font-weight: 700;
  transition: background .35s ease, border-color .35s ease, color .35s ease, transform .35s ease;
}

.port-route strong { font-size: .75rem; }
.port-route small { max-width: 8.5rem; font-size: .63rem; line-height: 1.25; }
.port-route li.is-past i { background: #dbe7df; border-color: #315f58; color: #244944; }
.port-route li.is-active i { background: #9b4b36; border-color: #9b4b36; color: #fff; transform: scale(1.12); }
.port-route li.is-active { color: #1d292c; }

.port-system {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) minmax(3rem, .45fr) minmax(9rem, 1fr) minmax(12rem, 1.3fr);
  align-items: stretch;
  gap: .7rem;
}

.port-terminal,
.port-file,
.port-status,
.port-document,
.port-decision,
.port-gate {
  border: 1px solid #cbbda9;
  border-radius: 13px;
  background: rgba(255, 253, 248, .82);
}

.port-terminal,
.port-file {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 8rem;
  padding: 1rem;
  text-align: center;
}

.port-terminal b,
.port-file b { margin-top: .45rem; font-size: .85rem; }
.port-terminal small,
.port-file small { color: #72675b; font-size: .63rem; }

.port-crane {
  position: relative;
  display: block;
  width: 4.4rem;
  height: 2.9rem;
  border-bottom: 5px solid #315f58;
  border-left: 5px solid #315f58;
}

.port-crane::before {
  position: absolute;
  top: .2rem;
  left: .15rem;
  width: 3.6rem;
  height: 4px;
  content: "";
  background: #315f58;
  transform: rotate(-20deg);
  transform-origin: left center;
}

.port-crane::after {
  position: absolute;
  top: -.25rem;
  right: .65rem;
  width: 1px;
  height: 1.85rem;
  content: "";
  background: #9b4b36;
}

.port-track { position: relative; align-self: center; height: 4px; background: #b9ab97; }
.port-track::after { position: absolute; top: -4px; right: -1px; content: ""; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 9px solid #9b4b36; }
.port-track i { position: absolute; top: -5px; left: 0; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: #9b4b36; box-shadow: 0 0 0 1px #9b4b36; transform: translateX(0); transition: transform .65s cubic-bezier(.2,.8,.2,1); }
.port-explainer[data-step="1"] .port-track i { transform: translateX(25%); }
.port-explainer[data-step="2"] .port-track i { transform: translateX(75%); }
.port-explainer[data-step="3"] .port-track i { transform: translateX(150%); }
.port-explainer[data-step="4"] .port-track i { transform: translateX(230%); }

.port-file span {
  position: relative;
  display: block;
  width: 3rem;
  height: 3.7rem;
  border: 2px solid #9b4b36;
  border-radius: 4px;
  background: repeating-linear-gradient(to bottom, transparent 0 8px, #dfd1bf 8px 9px);
}

.port-file span::after { position: absolute; right: -.1rem; bottom: -.1rem; padding: .1rem .25rem; content: "✓"; border-radius: 50%; background: #315f58; color: #fff; font-size: .7rem; opacity: 0; transform: scale(.7); transition: opacity .3s ease, transform .3s ease; }
.port-explainer[data-step="4"] .port-file span::after { opacity: 1; transform: scale(1); }

.port-status { display: grid; grid-template-columns: 1fr; }
.port-status div { padding: .62rem .8rem; border-bottom: 1px solid #ded3c3; }
.port-status div:last-child { border-bottom: 0; }
.port-status span { margin-bottom: .12rem; font-size: .58rem; }
.port-status b { display: block; font-size: .76rem; line-height: 1.25; transition: color .3s ease; }
.port-explainer[data-step="4"] .port-status b { color: #315f58; }

.port-document,
.port-decision,
.port-gate { margin-top: .7rem; padding: .75rem .9rem; }
.port-document { display: grid; grid-template-columns: 1fr 1.5fr 1fr; align-items: center; gap: .8rem; }
.port-document > span { margin: 0; }
.port-document b,
.port-decision b,
.port-gate b { font-size: .78rem; line-height: 1.3; }
.port-document small { color: #6c6257; font-size: .69rem; text-align: right; }
.port-decision,
.port-gate { display: inline-grid; width: calc(50% - .5rem); min-height: 5.3rem; vertical-align: top; }
.port-gate { margin-left: .65rem; }

.port-live { display: flex; gap: .75rem; align-items: baseline; padding: 1rem 1.8rem; border-top: 1px solid #d8ccba; border-bottom: 1px solid #d8ccba; background: #1d292c; color: #fff; }
.port-live strong { flex: 0 0 34%; color: #e8c7aa; font-size: .85rem; }
.port-live span { font-size: .8rem; line-height: 1.45; }

.port-controls { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; padding: 1rem 1.8rem .7rem; }
.port-controls button { min-height: 2.3rem; padding: .48rem .76rem; border: 1px solid #aa9984; border-radius: 999px; background: #fffdf8; color: #1d292c; font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.port-controls button:hover { border-color: #9b4b36; color: #823e2d; }
.port-controls button:focus-visible { outline: 3px solid rgba(155, 75, 54, .35); outline-offset: 2px; }
.port-counter { margin-left: auto; color: #6d6256; font-size: .72rem; font-variant-numeric: tabular-nums; }
.port-figure figcaption { padding: 0 1.8rem 1.25rem; color: #6d6256; font-size: .72rem; line-height: 1.45; }

.port-state-copy { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 0; margin: 0; border-top: 1px solid #d8ccba; list-style: none; }
.port-state-copy li { min-height: 8rem; padding: 1rem; border-right: 1px solid #d8ccba; background: #eee6d9; color: #645b51; transition: background .35s ease, color .35s ease; }
.port-state-copy li:last-child { border-right: 0; }
.port-state-copy strong,
.port-state-copy span { display: block; }
.port-state-copy strong { margin-bottom: .4rem; font-size: .75rem; line-height: 1.25; }
.port-state-copy span { font-size: .68rem; line-height: 1.45; }
.port-state-copy li.is-active { background: #fffaf1; color: #1d292c; box-shadow: inset 0 4px 0 #9b4b36; }

@media (max-width: 760px) {
  .port-head { display: block; padding: 1.3rem 1.1rem 1rem; }
  .port-head p { max-width: none; margin-top: .7rem; text-align: left; }
  .port-stage { padding: 1.25rem 1.05rem 1rem; }
  .port-route { overflow-x: auto; grid-template-columns: repeat(5, minmax(6.6rem, 1fr)); padding-bottom: .45rem; }
  .port-route::before { right: 3rem; left: 3rem; }
  .port-system { grid-template-columns: 1fr 2.5rem 1fr; }
  .port-status { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
  .port-status div { border-right: 1px solid #ded3c3; border-bottom: 0; }
  .port-status div:last-child { border-right: 0; }
  .port-document { grid-template-columns: 1fr; }
  .port-document small { text-align: left; }
  .port-decision,
  .port-gate { display: grid; width: 100%; min-height: auto; }
  .port-gate { margin-left: 0; }
  .port-live { display: block; padding: .9rem 1.1rem; }
  .port-live strong,
  .port-live span { display: block; }
  .port-live span { margin-top: .35rem; }
  .port-controls { padding: .9rem 1.1rem .65rem; }
  .port-counter { flex-basis: 100%; margin: .2rem 0 0; }
  .port-figure figcaption { padding: 0 1.1rem 1rem; }
  .port-state-copy { grid-template-columns: 1fr; }
  .port-state-copy li { min-height: auto; border-right: 0; border-bottom: 1px solid #d8ccba; }
  .port-state-copy li:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .port-explainer *,
  .port-explainer *::before,
  .port-explainer *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
