/* =============================================================
   ITI Design System — Header (utility bar, masthead, nav, search)
   Loaded site-wide; replaces css/header.css entirely.

   The masthead stays light because both logo files are transparent PNGs
   with DARK ink (avg lightness 95/255) — on a navy bar the mark would
   disappear. The futuristic weight is carried instead by the near-black
   utility bar, the dark dropdown panels, the dark search overlay and the
   cyan scroll-progress rail along the header's bottom edge.
   ============================================================= */

/* ---- Carried over from the old header.css, which this file replaces.
        Other (not yet redesigned) pages rely on these three. ---- */
/* `clip`, not `hidden`. Both stop sideways scrolling, but `hidden` makes
   the element a scroll container, and that silently disables every
   `position: sticky` on the page — the sidebar rails stopped following the
   scroll because of this rule. `clip` clips without becoming a scroller,
   and leaves overflow-y as `visible` rather than forcing it to `auto`. */
html, body { overflow-x: clip; }
ul li { list-style: none; }
input { overflow: visible; }

/* ---------------- Preloader ----------------
   Shown between page loads. The old one was a pulsing blue dot on white —
   and in the legacy theme its image path was missing the /iti prefix, so it
   404'd and you only ever saw a white flash. This is a short "boot" panel
   on the theme's own ground: a chamfered frame with corner ticks, a cyan
   scan line, and an indeterminate sweep bar (indeterminate because there is
   no real progress to report). */

body #load {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 9901;
  display: grid;
  place-items: center;
  background-color: #04121f;
  opacity: 1;
  visibility: visible;
  transition: opacity .35s ease-out, visibility 0s linear .35s;
}
body #load.loader-removed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
/* The no-JavaScript failsafe now lives in css/iti-no-js.css, loaded from a
   <noscript> in the head. It used to be an animation on #load above, which
   Firefox treats as in effect during its delay — and an animation outranks a
   normal declaration, so this rule never applied there and the cover never
   faded. */
/* circuit grid, same texture as the page sections */
body #load::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(to right, rgba(var(--iti-electric-rgb), .07) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(to bottom, rgba(var(--iti-electric-rgb), .07) 0 1px, transparent 1px 72px);
  mask-image: radial-gradient(60% 60% at 50% 50%, #000 0%, transparent 100%);
}

.spinner-loader .load-wrap {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 22px;
  width: auto;
  height: auto;
}

/* --- chamfered frame --- */
.iti-boot__frame {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(var(--iti-electric-rgb), .45);
  clip-path: var(--iti-clip-sm);
  overflow: hidden;
}
.iti-boot__frame::before,
.iti-boot__frame::after {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid var(--iti-electric);
}
.iti-boot__frame::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.iti-boot__frame::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* The mark reads ΙΠΤΗΛ in Greek and ITI in English. IBM Plex Mono has no
   Greek glyphs, and CSS font fallback is per-glyph: listing Plex Sans
   straight after it means the Latin mark renders in mono while the Greek
   one falls through to Plex Sans, instead of landing on whatever monospace
   font the OS happens to supply. */
.iti-boot__mark {
  font-family: "IBM Plex Mono", "IBM Plex Sans", "Roboto", sans-serif;
  font-size: 1.32rem;
  font-weight: 500;
  letter-spacing: .22em;
  text-indent: .22em;
  color: var(--iti-electric);
  text-shadow: 0 0 18px rgba(var(--iti-electric-rgb), .55);
}

/* scan line sweeping down the frame */
.iti-boot__scan {
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--iti-electric), transparent);
  box-shadow: 0 0 12px rgba(var(--iti-electric-rgb), .9);
  animation: iti-boot-scan 1.5s cubic-bezier(.4, 0, .6, 1) infinite;
}
@keyframes iti-boot-scan {
  0%   { top: -2px;  opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { top: 100%;  opacity: 0; }
}

/* indeterminate sweep bar */
.iti-boot__bar {
  position: relative;
  width: 150px;
  height: 2px;
  background: rgba(255, 255, 255, .12);
  overflow: hidden;
}
.iti-boot__bar span {
  position: absolute;
  top: 0; bottom: 0;
  width: 42%;
  background: var(--iti-electric);
  box-shadow: 0 0 10px rgba(var(--iti-electric-rgb), .8);
  animation: iti-boot-sweep 1.15s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes iti-boot-sweep {
  0%   { left: -45%; }
  100% { left: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .iti-boot__scan { animation: none; top: 50%; }
  .iti-boot__bar span { animation: none; left: 0; width: 100%; }
}

/* ---------------- Utility bar ---------------- */

/* The bar keeps id="top" as the scroll-to-top anchor target, which also
   drags in the legacy style.css rules for #top:
     - `padding: 10px 0`
     - `#top::before/::after`, two 22x112px white bars rotated 30deg that
       cut decorative diagonals out of the old bar's corners.
   Both are cancelled here; these selectors win on specificity (1,1,0). */
.iti-util,
.iti-util#top { padding: 0; }
.iti-util#top::before,
.iti-util#top::after { content: none; display: none; }

.iti-util {
  background: var(--iti-ink-900);
  color: var(--iti-on-dark-muted);
  font-size: var(--iti-fs-xs);
  position: relative;
  z-index: 60;
}
.iti-util__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--iti-s-4);
  min-height: 38px;
  flex-wrap: wrap;
}
.iti-util__group {
  display: flex;
  align-items: center;
  gap: var(--iti-s-4);
}
.iti-util a {
  display: inline-flex;
  align-items: center;
  gap: var(--iti-s-2);
  color: var(--iti-on-dark-muted);
  letter-spacing: .04em;
  text-decoration: none;
  transition: color var(--iti-dur) var(--iti-ease);
}
.iti-util a:hover { color: var(--iti-electric); }
.iti-util__sep { width: 1px; height: 13px; background: var(--iti-line-dark); }

/* `.iti-util a` (0,1,1) out-specifies a bare `.iti-util__social` (0,1,0),
   so its inline-flex + gap won and the icon sat off-centre. Match the
   element too. */
.iti-util a.iti-util__social {
  display: grid;
  place-items: center;
  gap: 0;
  padding: 0;
  width: 26px; height: 26px;
  border: 1px solid var(--iti-line-dark);
  transition: border-color var(--iti-dur) var(--iti-ease),
              background var(--iti-dur) var(--iti-ease),
              color var(--iti-dur) var(--iti-ease);
}
.iti-util a.iti-util__social:hover {
  border-color: var(--iti-electric);
  background: rgba(var(--iti-electric-rgb), .12);
}

/* Language switcher — flags kept, with the code alongside */
.iti-lang { display: flex; align-items: center; gap: var(--iti-s-1); }
.iti-lang a {
  gap: 6px;
  padding: 3px 7px;
  border: 1px solid transparent;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.iti-lang img { width: 18px; height: auto; display: block; }
.iti-lang a:hover { border-color: var(--iti-line-dark); }
.iti-lang a[aria-current="true"] {
  border-color: var(--iti-electric);
  color: var(--iti-electric);
}

/* ---------------- Masthead ---------------- */

.iti-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--iti-surface);
  border-bottom: 1px solid var(--iti-line);
  transition: box-shadow var(--iti-dur) var(--iti-ease);
}
.iti-head[data-stuck="true"] { box-shadow: 0 6px 24px rgba(6, 25, 44, .10); }

/* Cyan scroll-progress rail along the bottom edge */
.iti-head::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  height: 2px;
  width: var(--iti-scroll-progress, 0%);
  background: var(--iti-electric);
  box-shadow: 0 0 10px rgba(var(--iti-electric-rgb), .8);
  transition: width .1s linear;
}

.iti-head__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--iti-s-5);
  min-height: 78px;
}
.iti-head__logo { display: block; flex: none; }
.iti-head__logo img {
  width: auto;
  height: clamp(34px, 2.6vw, 46px);
  display: block;
}

/* ---------------- Primary nav ---------------- */

.iti-nav { display: flex; align-items: center; gap: var(--iti-s-2); }

.iti-nav .main-nav {
  display: flex;
  align-items: center;
  gap: clamp(.15rem, .1rem + .5vw, .9rem);
  margin: 0;
  padding: 0;
}
.iti-nav .main-nav > li { position: relative; }

.iti-nav .main-nav > li > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .55rem .55rem;
  font-size: clamp(.78rem, .62rem + .34vw, .9rem);
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--iti-text);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--iti-dur) var(--iti-ease);
}
.iti-nav .main-nav > li > a::after {
  content: "";
  position: absolute;
  left: .6rem; right: .6rem; bottom: .1rem;
  height: 2px;
  background: var(--iti-electric);
  box-shadow: var(--iti-electric-glow);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--iti-dur) var(--iti-ease);
}
/* On an item with a submenu the chevron is a flex item after the text, so
   an underline drawn across the whole link ran under it too. Stop it where
   the word stops: the furniture to the right of the text — the 5px gap, the
   5px chevron and the right padding — measures a constant 23px on every one
   of those items, against 8px on the ones without. */
.iti-nav .main-nav > li.menu-item-has-children > a::after { right: 23px; }

.iti-nav .main-nav > li:hover > a,
.iti-nav .main-nav > li:focus-within > a { color: var(--iti-blue); }
.iti-nav .main-nav > li:hover > a::after,
.iti-nav .main-nav > li:focus-within > a::after,
.iti-nav .main-nav > li.current-menu-item > a::after,
.iti-nav .main-nav > li.active > a::after { transform: scaleX(1); }
.iti-nav .main-nav > li.current-menu-item > a,
.iti-nav .main-nav > li.active > a { color: var(--iti-blue); }

/* Chevron marker on items that have a submenu */
.iti-nav .main-nav > li.menu-item-has-children > a::before {
  content: "";
  width: 5px; height: 5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  order: 2;
  opacity: .55;
  transition: transform var(--iti-dur) var(--iti-ease), opacity var(--iti-dur) var(--iti-ease);
}
.iti-nav .main-nav > li.menu-item-has-children:hover > a::before {
  opacity: 1;
  transform: rotate(225deg) translateY(-3px) translateX(-3px);
}

/* ---- Dropdown panel: dark, chamfered, cyan-edged ---- */
.iti-nav .main-nav ul.sub-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: -.4rem;
  z-index: 40;
  min-width: 288px;
  margin: 0;
  padding: var(--iti-s-2) 0;
  list-style: none;

  background: var(--iti-ink-850);
  border: 1px solid rgba(var(--iti-electric-rgb), .35);
  box-shadow: 0 18px 44px rgba(4, 18, 31, .38);
  /* Deliberately NOT chamfered with clip-path: a clip on the panel also
     clips every descendant, and the third-level flyout sits at left:100%,
     entirely outside the panel — so it was being clipped away completely
     and never appeared. The corner accent below gives the same language
     without clipping anything. */

  /* Closing keeps a short grace period so crossing the gap between a row
     and its flyout does not snap the panel shut, but it is brief: .18s
     before the fade starts, .18s to fade, gone at .36s (was .65s).
     Opening has no delay — see the hover/focus rule below. */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s var(--iti-ease) .18s,
              transform .18s var(--iti-ease) .18s,
              visibility 0s linear .36s;
}
/* Corner accent standing in for the chamfer the panels can't use. */
.iti-nav .main-nav ul.sub-menu::after {
  content: "";
  position: absolute;
  right: 7px; bottom: 7px;
  width: 9px; height: 9px;
  border-right: 1px solid var(--iti-electric);
  border-bottom: 1px solid var(--iti-electric);
  opacity: .8;
  pointer-events: none;
}

/* Open on hover/focus at ANY level, not just the top one. The menu really
   is three deep: ΦΟΡΕΑΣ > Ερευνητικές Μονάδες » > the nine labs. */
.iti-nav .main-nav li:hover > ul.sub-menu,
.iti-nav .main-nav li:focus-within > ul.sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .2s var(--iti-ease) 0s,
              transform .2s var(--iti-ease) 0s,
              visibility 0s linear 0s;
}

/* Third level flies out to the right of its parent row instead of
   dropping below the bar. Every li is a positioning context so the
   flyout anchors to its own row. */
.iti-nav .main-nav li { position: relative; }
.iti-nav .main-nav ul.sub-menu ul.sub-menu {
  top: calc(-1 * var(--iti-s-2));
  left: 100%;
  transform: translateX(-6px);
}
.iti-nav .main-nav ul.sub-menu li:hover > ul.sub-menu,
.iti-nav .main-nav ul.sub-menu li:focus-within > ul.sub-menu { transform: translateX(0); }

/* Parent rows inside a panel get a right-pointing marker and keep the
   same colour as their siblings. */
.iti-nav .main-nav ul.sub-menu > li.menu-item-has-children > a {
  display: flex;
  align-items: center;
  gap: var(--iti-s-3);
}
.iti-nav .main-nav ul.sub-menu > li.menu-item-has-children > a::after {
  content: "";
  margin-left: auto;
  flex: none;
  width: 5px; height: 5px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
  opacity: .6;
  transition: transform var(--iti-dur) var(--iti-ease), opacity var(--iti-dur) var(--iti-ease);
}
.iti-nav .main-nav ul.sub-menu > li.menu-item-has-children:hover > a::after {
  opacity: 1;
  transform: rotate(45deg) translate(2px, -2px);
}
.iti-nav .main-nav ul.sub-menu a {
  display: block;
  padding: .58rem 1.1rem;
  font-size: .88rem;
  font-weight: 400;
  letter-spacing: .01em;
  line-height: 1.4;
  color: var(--iti-on-dark);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color var(--iti-dur) var(--iti-ease),
              border-color var(--iti-dur) var(--iti-ease),
              background var(--iti-dur) var(--iti-ease);
}
/* The legacy style.css hard-codes
     .menu-item-23860 a, .menu-item-23962 a { color: #54595f !important }
   a leftover from the old Elementor nav that singles out the
   "Ερευνητικές Μονάδες »" row (EL and EN) and paints it Elementor grey on
   the dark panel. Matching !important here is the only way to undo it;
   scoped to this nav so nothing else is affected, and written against the
   submenu rather than those two ids so it survives a menu rebuild. */
.iti-nav .main-nav ul.sub-menu > li > a,
.iti-drawer .main-nav ul.sub-menu > li > a { color: var(--iti-on-dark) !important; }
.iti-nav .main-nav ul.sub-menu > li > a:hover,
.iti-nav .main-nav ul.sub-menu > li > a:focus-visible,
.iti-drawer .main-nav ul.sub-menu > li > a:hover { color: var(--iti-electric) !important; }

.iti-nav .main-nav ul.sub-menu a:hover,
.iti-nav .main-nav ul.sub-menu a:focus-visible {
  color: var(--iti-electric);
  background: rgba(var(--iti-electric-rgb), .08);
  border-left-color: var(--iti-electric);
}

/* ---------------- Search ---------------- */

.iti-search-toggle,
.iti-burger {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  flex: none;
  padding: 0;
  background: transparent;
  border: 1px solid var(--iti-line);
  color: var(--iti-text-muted);
  cursor: pointer;
  clip-path: var(--iti-clip-sm);
  transition: background var(--iti-dur) var(--iti-ease),
              border-color var(--iti-dur) var(--iti-ease),
              color var(--iti-dur) var(--iti-ease);
}
.iti-search-toggle:hover,
.iti-burger:hover {
  border-color: var(--iti-electric);
  color: var(--iti-blue);
  background: rgba(var(--iti-electric-rgb), .08);
}

.iti-search {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: start center;
  padding-top: 18vh;
  background: rgba(4, 18, 31, .93);
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s var(--iti-ease), visibility 0s linear .25s;
}
.iti-search[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transition: opacity .25s var(--iti-ease), visibility 0s;
}
.iti-search__form {
  width: min(720px, 90vw);
  display: grid;
  gap: var(--iti-s-3);
}
.iti-search__label {
  font-size: var(--iti-fs-xs);
  font-weight: 600;
  letter-spacing: var(--iti-track-label);
  text-transform: uppercase;
  color: var(--iti-electric);
}
.iti-search__field {
  display: flex;
  align-items: center;
  gap: var(--iti-s-3);
  border-bottom: 1px solid rgba(var(--iti-electric-rgb), .45);
  padding-bottom: var(--iti-s-3);
}
.iti-search__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--iti-on-dark);
  font-family: var(--iti-font-sans);
  font-size: clamp(1.3rem, 1rem + 1.6vw, 2.1rem);
  font-weight: 300;
  letter-spacing: -.01em;
  padding: 0;
}
.iti-search__input::placeholder { color: rgba(255, 255, 255, .35); }
.iti-search__submit {
  flex: none;
  background: transparent;
  border: 0;
  color: var(--iti-electric);
  cursor: pointer;
  padding: 0;
}
.iti-search__close {
  position: absolute;
  top: clamp(16px, 4vw, 40px);
  right: clamp(16px, 4vw, 40px);
  width: 44px; height: 44px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .28);
  color: var(--iti-on-dark);
  cursor: pointer;
  clip-path: var(--iti-clip-sm);
  transition: background var(--iti-dur) var(--iti-ease), border-color var(--iti-dur) var(--iti-ease);
}
.iti-search__close:hover { background: rgba(255, 255, 255, .1); border-color: var(--iti-electric); }

/* ---------------- Mobile drawer ---------------- */

.iti-burger { display: none; }
.iti-burger span {
  display: block;
  width: 17px; height: 1.5px;
  background: currentColor;
  transition: transform .28s var(--iti-ease), opacity .2s var(--iti-ease);
}
.iti-burger span + span { margin-top: 4px; }
.iti-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.iti-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.iti-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

.iti-drawer {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: flex;
  flex-direction: column;
  padding: calc(78px + 38px) var(--iti-gutter) var(--iti-s-7);
  background: var(--iti-ink-900);
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .28s var(--iti-ease), transform .28s var(--iti-ease), visibility 0s linear .28s;
}
.iti-drawer[data-open="true"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .28s var(--iti-ease), transform .28s var(--iti-ease), visibility 0s;
}
.iti-drawer .main-nav { display: block; margin: 0; padding: 0; }
.iti-drawer .main-nav > li { border-bottom: 1px solid var(--iti-line-dark); }
.iti-drawer .main-nav > li > a {
  display: block;
  padding: var(--iti-s-4) 0;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--iti-on-dark);
  text-decoration: none;
}
.iti-drawer .main-nav > li.menu-item-has-children > a { padding-right: 46px; }

/* Toggle button injected next to parents with children */
.iti-drawer .iti-sub-toggle {
  position: absolute;
  top: 6px; right: 0;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--iti-line-dark);
  color: var(--iti-electric);
  cursor: pointer;
  transition: transform var(--iti-dur) var(--iti-ease), border-color var(--iti-dur) var(--iti-ease);
}
.iti-drawer .main-nav > li { position: relative; }
.iti-drawer .iti-sub-toggle[aria-expanded="true"] {
  transform: rotate(180deg);
  border-color: var(--iti-electric);
}
.iti-drawer .main-nav ul.sub-menu {
  display: none;
  margin: 0 0 var(--iti-s-4);
  padding: 0 0 0 var(--iti-s-4);
  border-left: 1px solid rgba(var(--iti-electric-rgb), .35);
}
.iti-drawer .main-nav li[data-open="true"] > ul.sub-menu { display: block; }
.iti-drawer .main-nav ul.sub-menu li { position: relative; }
.iti-drawer .main-nav ul.sub-menu > li.menu-item-has-children > a { padding-right: 42px; }
.iti-drawer .main-nav ul.sub-menu .iti-sub-toggle {
  top: 0;
  width: 34px; height: 34px;
}
.iti-drawer .main-nav ul.sub-menu a {
  display: block;
  padding: .5rem 0;
  font-size: .86rem;
  color: var(--iti-on-dark);
  text-decoration: none;
}
.iti-drawer .main-nav ul.sub-menu a:hover { color: var(--iti-electric); }

@media (max-width: 1140px) {
  .iti-nav .main-nav { display: none; }
  .iti-burger { display: grid; }
}
@media (min-width: 1141px) {
  .iti-drawer { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .iti-head::after,
  .iti-nav .main-nav ul.sub-menu,
  .iti-search,
  .iti-drawer,
  .iti-burger span { transition: none; }
  .spinner-loader .load-wrap { animation: none; }
}
