/* Section: factory_plan — EXALCO-Egkatastaseis "Factory plan hotspots" + department modal (spec 12.2) */

/* Head → plan: 26px in the mockup (the shared head is 30px). */
.ex-factory-plan { --ex-head-gap: 26px; }
.ex-factory-plan__hint { flex: none; max-width: 100%; margin: 0; font-size: 12px; line-height: normal; color: var(--ex-text-muted); }
.ex-factory-plan__body { display: flex; flex-direction: column; gap: clamp(18px, 2vw, 28px); }

/* ---- Plan -------------------------------------------------------------- */
.ex-factory-plan__scroller { min-width: 0; }
.ex-factory-plan__frame {
  position: relative;
  aspect-ratio: var(--ratio, 1919 / 882); /* the image's own ratio: hotspot percentages never drift */
  border: 1.5px solid var(--ex-ink);
  background: #EDEEEE;
  overflow: hidden;
}
.ex-factory-plan__image { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
/* light wash over the photo, as in the mockup */
.ex-factory-plan__frame::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .12); pointer-events: none; }
.ex-factory-plan__badge {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 3;
  margin: 0;
  padding: 6px 10px;
  background: rgba(255, 255, 255, .85);
  color: var(--ex-ink);
  font-size: 10px;
  font-weight: 700;
  line-height: normal; /* rendered mockup: badge 23px high */
  letter-spacing: .14em;
}

/* Hotspot: the 34px square is centred exactly on (--x, --y); the label hangs beside it. */
.ex-factory-plan__hotspot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 4;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ex-white);
  font-family: inherit;
  cursor: pointer;
}
.ex-factory-plan__hotspot-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border: 2px solid var(--ex-white);
  background: var(--ex-red);
  box-shadow: 0 6px 18px -6px rgba(35, 31, 32, .45);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transition: transform .38s cubic-bezier(.22, .9, .24, 1), background-color .38s ease, box-shadow .38s ease;
  animation: ex-factory-plan-pulse 2.8s ease infinite;
}
.ex-factory-plan__hotspot-label {
  position: absolute;
  top: 50%;
  left: calc(100% + 8px); /* mockup: 8px between marker and label */
  padding: 8px 12px;
  background: var(--ex-ink);
  box-shadow: 0 10px 24px -8px rgba(35, 31, 32, .5);
  color: var(--ex-white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .06em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-8px, -50%) scale(.96);
  transition: opacity .38s ease, transform .38s cubic-bezier(.22, .9, .24, 1);
}
/* The label hangs to the right, as in the mockup; it flips to the left only where it would leave the frame:
   always past 75%, and past 62% while the frame is narrow (the longest label is about 260px). */
.ex-factory-plan__hotspot--flip .ex-factory-plan__hotspot-label { right: calc(100% + 8px); left: auto; transform: translate(8px, -50%) scale(.96); }
@media (max-width: 1199px) {
  .ex-factory-plan__hotspot--flip-narrow .ex-factory-plan__hotspot-label { right: calc(100% + 8px); left: auto; transform: translate(8px, -50%) scale(.96); }
}

.ex-factory-plan__hotspot:hover,
.ex-factory-plan__hotspot:focus-visible,
.ex-factory-plan__hotspot.is-active { z-index: 5; }
.ex-factory-plan__hotspot:hover .ex-factory-plan__hotspot-num,
.ex-factory-plan__hotspot:focus-visible .ex-factory-plan__hotspot-num,
.ex-factory-plan__hotspot.is-active .ex-factory-plan__hotspot-num {
  background: var(--ex-ink);
  box-shadow: 0 10px 26px -8px rgba(35, 31, 32, .6);
  transform: scale(1.22);
  animation: none;
}
.ex-factory-plan__hotspot:hover .ex-factory-plan__hotspot-label,
.ex-factory-plan__hotspot:focus-visible .ex-factory-plan__hotspot-label,
.ex-factory-plan__hotspot.is-active .ex-factory-plan__hotspot-label { opacity: 1; transform: translate(0, -50%) scale(1); }
.ex-factory-plan__hotspot:focus-visible { outline-color: var(--ex-white); outline-offset: 5px; }

@keyframes ex-factory-plan-pulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 18, 41, .5); }
  70% { box-shadow: 0 0 0 14px rgba(201, 18, 41, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 18, 41, 0); }
}

/* ---- Department list --------------------------------------------------- */
.ex-factory-plan__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ex-factory-plan__item { display: flex; min-width: 0; }
.ex-factory-plan__row {
  display: flex;
  flex: 1;
  align-items: stretch;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 0;
  border: .5px solid rgba(35, 31, 32, .14);
  border-left: 3px solid transparent;
  border-radius: 0;
  background: var(--ex-white);
  color: var(--ex-text-muted);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .34s ease, border-color .34s ease, color .28s ease, transform .34s cubic-bezier(.22, .9, .24, 1);
}
.ex-factory-plan__row-num {
  flex: none;
  align-self: center;
  padding: 12px 0 12px 14px;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  color: rgba(35, 31, 32, .4);
  transition: color .28s ease;
}
.ex-factory-plan__row-text { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 2px; min-width: 0; padding: 12px 10px 12px 13px; }
.ex-factory-plan__row-name { font-size: 13px; font-weight: 700; line-height: normal; /* rendered mockup: 15px line → row 72.8px */ letter-spacing: .02em; color: inherit; }
.ex-factory-plan__row-sub { font-size: 11px; line-height: 1.35; color: var(--ex-text-muted); }
.ex-factory-plan__row-arrow {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  border-left: .5px solid rgba(35, 31, 32, .14);
  color: var(--ex-red);
  font-size: 15px;
  font-weight: 700;
  transition: background-color .28s ease, color .28s ease;
}
.ex-factory-plan__row:hover,
.ex-factory-plan__row:focus-visible,
.ex-factory-plan__row.is-active {
  border-color: rgba(223, 25, 43, .35);
  border-left-color: var(--ex-red);
  background: var(--ex-red-tint);
  color: var(--ex-ink);
  transform: translateY(-2px);
}
.ex-factory-plan__row:hover .ex-factory-plan__row-num,
.ex-factory-plan__row:focus-visible .ex-factory-plan__row-num,
.ex-factory-plan__row.is-active .ex-factory-plan__row-num { color: var(--ex-red); }
.ex-factory-plan__row:hover .ex-factory-plan__row-arrow,
.ex-factory-plan__row:focus-visible .ex-factory-plan__row-arrow { background: var(--ex-red); color: var(--ex-white); }

/* ---- Modal ------------------------------------------------------------- */
.ex-factory-plan__modal {
  position: fixed;
  inset: 0;
  z-index: var(--ex-z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(12px, 3vw, 40px);
  animation: ex-factory-plan-fade .2s ease both;
}
.ex-factory-plan__modal[hidden] { display: none; }
.ex-factory-plan__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(35, 31, 32, .6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
.ex-factory-plan__dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  background: var(--ex-white);
  box-shadow: 0 40px 80px -30px rgba(35, 31, 32, .6);
  color: var(--ex-ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ex-factory-plan__dialog-body { padding: clamp(26px, 3vw, 40px); }
.ex-factory-plan__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1.5px solid rgba(35, 31, 32, .25);
  border-radius: 0;
  background: var(--ex-white);
  color: var(--ex-ink);
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--ex-t-fast), color var(--ex-t-fast);
}
.ex-factory-plan__close:hover,
.ex-factory-plan__close:focus-visible { border-color: var(--ex-red); color: var(--ex-red); }

@keyframes ex-factory-plan-fade { from { opacity: 0; } to { opacity: 1; } }

.ex-factory-plan__dept-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding-right: 48px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .2em;
  color: var(--ex-text-muted);
}
.ex-factory-plan__dept-num { font-size: 22px; font-weight: 900; line-height: 1; letter-spacing: 0; color: var(--ex-red); }
.ex-factory-plan__dept-title {
  margin: 0 0 6px;
  font-size: clamp(22px, 2.2vw, 32px);
  font-weight: var(--ex-fw-title);
  line-height: 1.05;
  letter-spacing: var(--ex-ls-title);
  color: var(--ex-ink);
}
.ex-factory-plan__dept-sub { margin: 0; font-size: 13px; line-height: normal; color: var(--ex-text-muted); } /* rendered mockup: 15px line (photo starts 3px higher) */

/* Photo slider: native scroll-snap track, one photo per view (works without JS by swiping / scrolling). */
.ex-factory-plan__gallery { margin-top: 20px; }
.ex-factory-plan__viewport { position: relative; aspect-ratio: 16 / 10; background: #EDEEEE; overflow: hidden; }
.ex-factory-plan__slides {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.ex-factory-plan__slides::-webkit-scrollbar { display: none; }
.ex-factory-plan__slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; }
.ex-factory-plan__slide > img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.ex-factory-plan__slide-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(35, 31, 32, .78);
  color: var(--ex-white);
  font-family: inherit;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transform: translateY(-50%);
  transition: background-color var(--ex-t-base);
}
.ex-factory-plan__slide-nav--prev { left: 0; }
.ex-factory-plan__slide-nav--next { right: 0; }
.ex-factory-plan__slide-nav:hover,
.ex-factory-plan__slide-nav:focus-visible { background: var(--ex-red); }
.ex-factory-plan__slide-nav:focus-visible { outline-color: var(--ex-white); outline-offset: -5px; }
.ex-factory-plan__gallery-bar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ex-factory-plan__dot {
  position: relative;
  flex: none;
  width: 10px;
  height: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(35, 31, 32, .25);
  cursor: pointer;
  transition: width var(--ex-t-slow), background-color var(--ex-t-slow);
}
.ex-factory-plan__dot::after { content: ""; position: absolute; inset: -12px -4px; } /* larger hit area */
.ex-factory-plan__dot.is-active,
.ex-factory-plan__dot[aria-current="true"] { width: 26px; background: var(--ex-red); }
.ex-factory-plan__counter { margin: 0 0 0 auto; font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--ex-text-muted); }

.ex-factory-plan__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}
.ex-factory-plan__kpi { display: flex; flex-direction: column; padding: 16px 18px; background: var(--ex-blue); }
.ex-factory-plan__kpi-value { font-size: clamp(22px, 2vw, 30px); font-weight: 900; line-height: 1; letter-spacing: -.02em; color: var(--ex-ink); }
.ex-factory-plan__kpi-label { margin-top: 7px; font-size: 11px; font-weight: 700; line-height: 1.4; letter-spacing: .12em; color: var(--ex-text-muted); }

.ex-factory-plan__desc { margin: 22px 0 0; font-size: 14.5px; line-height: 1.7; color: var(--ex-ink); }
.ex-factory-plan__desc--extra { margin-top: 14px; font-size: 14px; color: var(--ex-text-muted); }

.ex-factory-plan__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: .5px solid rgba(35, 31, 32, .16);
}
.ex-factory-plan__fact { min-width: 0; }
.ex-factory-plan__fact > dt { margin: 0 0 5px; font-size: 10.5px; font-weight: 700; line-height: normal; letter-spacing: .16em; color: var(--ex-text-muted); }
.ex-factory-plan__fact > dd { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ex-ink); }

/* Previous / next department (proposal: required by spec 12.2.2, not designed in the mockup). */
.ex-factory-plan__dept-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 22px 0 0;
  padding: 18px 0 0;
  border-top: .5px solid rgba(35, 31, 32, .16);
}
.ex-factory-plan__dept-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 52px;
  margin: 0;
  padding: 10px 14px;
  border: 1.5px solid var(--ex-line);
  border-radius: 0;
  background: var(--ex-white);
  color: var(--ex-ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ex-t-base), background-color var(--ex-t-base);
}
.ex-factory-plan__dept-link--next { justify-content: flex-end; text-align: right; }
.ex-factory-plan__dept-link:hover,
.ex-factory-plan__dept-link:focus-visible { border-color: var(--ex-red); background: var(--ex-red-tint); }
.ex-factory-plan__dept-link-arrow { flex: none; font-size: 15px; font-weight: 700; color: var(--ex-red); }
.ex-factory-plan__dept-link-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ex-factory-plan__dept-link-kicker { font-size: 9.5px; font-weight: 700; line-height: 1.2; letter-spacing: .16em; color: var(--ex-text-muted); }
.ex-factory-plan__dept-link-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Responsive (proposal; the mockup's 820px rule let the plan ratio break) ---- */
@media (max-width: 899px) {
  .ex-factory-plan__hint { flex-basis: 100%; }
  /* The department list is the primary navigation: it comes first; the plan keeps its ratio and scrolls sideways. */
  .ex-factory-plan__scroller { order: 2; margin-inline: calc(var(--ex-gutter) * -1); padding-inline: var(--ex-gutter); overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
  .ex-factory-plan__frame { min-width: 760px; }
  .ex-factory-plan__hotspot::before { content: ""; position: absolute; inset: -5px; } /* 44px touch target */
  .ex-factory-plan__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-factory-plan__row { min-height: 56px; }
  .ex-factory-plan__row-name { font-size: clamp(13px, 2vw, 14px); }
  .ex-factory-plan__row-sub { font-size: 12px; }

  /* Bottom sheet, as in the mockup. */
  .ex-factory-plan__modal { align-items: flex-end; padding: 0; }
  .ex-factory-plan__dialog { width: 100%; max-height: 92vh; }
  .ex-factory-plan__close { width: var(--ex-touch); height: var(--ex-touch); top: 10px; right: 10px; }
  .ex-factory-plan__slide-nav { width: var(--ex-touch); height: var(--ex-touch); }
  .ex-factory-plan__kpis { grid-template-columns: 1fr 1fr; }
  .ex-factory-plan__dot { height: 6px; }
}
@media (max-width: 599px) {
  .ex-factory-plan__list { grid-template-columns: 1fr; }
  .ex-factory-plan__frame { min-width: 640px; }
  .ex-factory-plan__dialog-body { padding: 24px var(--ex-gutter) 28px; }
  .ex-factory-plan__dept-nav { grid-template-columns: 1fr; }
  .ex-factory-plan__dept-link--next { justify-content: space-between; }
  .ex-factory-plan__facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .ex-factory-plan__hotspot-num { animation: none; transition: none; }
  .ex-factory-plan__hotspot-label,
  .ex-factory-plan__row,
  .ex-factory-plan__row-num,
  .ex-factory-plan__row-arrow,
  .ex-factory-plan__close,
  .ex-factory-plan__slide-nav,
  .ex-factory-plan__dot,
  .ex-factory-plan__dept-link { transition: none; }
  .ex-factory-plan__row:hover,
  .ex-factory-plan__row:focus-visible,
  .ex-factory-plan__row.is-active { transform: none; }
  .ex-factory-plan__modal { animation: none; }
  .ex-factory-plan__slides { scroll-behavior: auto; }
}
