/* Reset */
body, h2, p, ul {
  margin: 0;
  padding: 0;
}

h1, h2 {
  margin-bottom: 40px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  background: #f4f4f9; /* light gray background */
  color: #333;
  font-size: larger;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
} 

/* Odsazení odstavců */
main p {
  text-indent: 2em;      /* první řádek odsazený */
  margin-bottom: 1.2em;  /* mezera mezi odstavci */
  line-height: 1.6;      /* lepší čitelnost */
}

/* Seznam vsude*/
main ul {
  margin-left: 2em;   /* posun doprava */
  margin-bottom: 1.2em;
}

main li {
  margin-bottom: 0.5em; /* mezera mezi položkami seznamu */
}

/* Header navigation */
header {
  background: #ffffff;
  padding: 20px 40px; /* more space = higher header */
  display: flex;      /* place logo and nav in one row */
  justify-content: space-between; /* logo left, nav right */
  align-items: center; /* vertically center them */
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Logo styling */
header .logo img {
  height: 60px;   /* adjust logo height */
  width: auto;    /* keep aspect ratio */
}

/* Ensure the menu items are laid out horizontally on desktop */
.mobile-menu-container {
    display: flex;
    align-items: center;
    gap: 60px;
}

/* Navigation */
header .main-nav {
  display: flex;
  gap: 30px;
}

header .main-nav a {
  color: rgb(0, 0, 0);
  text-decoration: none;
  font-weight: lighter;
  font-family: Verdana, Tahoma, sans-serif;
  font-size: smaller; /* slightly smaller links */
}

header .main-nav a:hover {
  color: #3b82f6;
}

/* --- Language Menu Container --- */
/* Your existing lang-switch styling is slightly changed/moved to .lang-menu */
.lang-menu {
    display: flex;
    gap: 5px; /* Adjust spacing between EN | CZ */
    align-items: center;
}

.lang-menu .lang-link img {
    width: 22px;        /* Slightly larger for better visibility */
    aspect-ratio: 4 / 3; /* Forces a consistent "icon" shape */
    object-fit: cover;   /* Crops the edges instead of squishing the image */
    display: inline-block;
    border-radius: 2px;
    box-shadow: 0 0 1px rgba(0,0,0,0.2)
}

.lang-menu .separator {
    color: rgb(0, 0, 0);
    font-size: 18px; 
}

/* Ensure the links within the menu match your original styling */
.lang-menu .lang-link {
    display: flex;
    align-items: center;
    color: rgb(0, 0, 0);
    text-decoration: none;
    font-weight: lighter;
    font-family: Verdana, Tahoma, sans-serif;
    font-size: 18px;
}

.lang-menu .lang-link:hover {
    color: #3b82f6;
}

/* Hamburger Button Styling */
.hamburger {
    display: none; /* Hide the button by default on large screens */
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1010; /* Ensure it's above the menu */
}

.hamburger .bar {
    width: 100%;
    height: 3px;
    background: #000;
    border-radius: 10px;
    transition: all 0.3s linear;
}

/* FADE EFFECT */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.show {
  opacity: 1;
  transform: translateY(0);
}

a {
  color: inherit;
  text-decoration: none;
  transition: transform 0.3s ease; /* smooth animation */
  display: inline-block; /* required so transform works properly */
}

a:visited {
  color: inherit;      /* removes purple visited color */
}

a:hover {
  color: #3b82f6;      /* optional: change color on hover */ 
  transform: scale(1.01); /* 1.01 = 101% size */
}

/* HERO */

#hero-members {
  background: linear-gradient(170deg, #0e509b, #192b3d, #1d2b2b, #5a8f8b);
  height: 50vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#hero-members .content {
  max-width: 1200px;
  width: 100%; /* Important: Makes it span the full 1200px width */
  margin: 0 auto; /* Keeps the block centered within its parent */
  padding: 80px 20px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,3);
}

#coordination, .members {
    padding: 80px 20px;
    max-width: 1200px;
    margin: auto;
    background: #f4f4f9; /* solid light color */
    color: #333;
}

#coordination h1, #members h1 {
    text-align: left;
    width: 100%; /* Ensure H1 spans full width */
    margin-bottom: 50px;
    font-size: 2.25rem;
    border-bottom: 3px solid #93c5fd;
    padding-bottom: 10px;
}

  /* Styly pro kartu koordinátora */
  .coordinator-card {
      display: flex;
      flex-direction: row; /* Stack image and content vertically */
      max-width: 100%; /* Allow the card to take full width of its container */
      align-items: stretch; /* Aby obrázek i text měly stejnou výšku */
      margin: 0 auto 4rem auto; /* Center the card horizontally and add margin below */
      border: 1px solid #e5e7eb;
      background: #fff;
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
      border-radius: 12px;
      overflow: hidden; 
  }

  .coordinator-card img {
      width: 400px;       /* Pevná šířka obrázku (můžete upravit dle potřeby) */
      min-width: 400px;   /* Zabrání smrštění obrázku */
      height: auto;       /* Výška se přizpůsobí obsahu karty */
      object-fit: cover;
      display: block;
  }

  .coordinator-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  }

  .coordinator-content {
    padding: 2rem;      /* Klíčové: prostor kolem textu včetně Kontaktu */
    flex-grow: 1;       /* Vyplní zbytek karty */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Vycentruje text vertikálně vůči obrázku */
}

/* Styly pro text uvnitř */
.coordinator-content h2 {
    margin-top: 0;      /* Odstraní mezeru nad prvním nadpisem */
    margin-bottom: 0.5rem;
}

.coordinator-content p {
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* MEMBERS */

  .members {
      max-width: 1200px;
      margin: 0 auto;
      padding: 2rem;
  }

  .members-grid {
        display: flex;
        gap: 2rem;
        align-items: flex-start; /* columns don't stretch — each independent */
  }

  .members-col {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 2rem;
  }

  .member-card {
      display: flex;
      flex-direction: column;
      border: 1px solid #e5e7eb;
      background: #fff;
      box-shadow: 0 4px 12px rgba(0,0,0,0.08);
      transition: transform 0.3s ease, box-shadow 0.3s ease;
      border-radius: 12px;
  }

    /* Původně skryjeme kontaktní informace */
  .member-content h2:nth-of-type(2), 
  .member-content h2:nth-of-type(2) + * {
      /* Můžete použít display: none, ale pro případnou animaci je lepší opacity a výška */
      opacity: 0;
      max-height: 0;
      margin-top: 0;
      overflow: hidden;
      transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease;
  }

  /* Pravidlo, které zobrazuje kontakt POUZE po kliknutí (pro oba typy karet) */
  .member-card.is-expanded .member-content h2:nth-of-type(2),
  .member-card.is-expanded .member-content h2:nth-of-type(2) + p,
  /* PŘIDÁME I KOORDINÁTORA pro jistotu a specifičnost */
  .coordinator-card.is-expanded .member-content h2:nth-of-type(2),
  .coordinator-card.is-expanded .member-content h2:nth-of-type(2) + p {
      max-height: 200px; 
      opacity: 1;
      margin-top: 1rem; 
      margin-bottom: 1rem; 
  }

  .member-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 8px 16px rgba(0,0,0,0.1);
  }

  .member-card img {
      width: 100%;
      height: 200px; /* Pevná výška obrázku pro konzistentní horní část */
      object-fit: cover;
      display: block;
      border-radius: 12px 12px 0 0; 
  }

  .member-content {
      /* KLÍČOVÝ FIX: Flex-grow 1 zajistí, že tento blok zabere veškerý volný prostor, 
          a tím konzistentně odtlačí tlačítko "toggle-btn" na dno karty. */
      flex-grow: 1; 
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 1.5rem;
      text-align: center;
      justify-content: flex-start; /* Zarovnání obsahu nahoru */
  }

  .member-card h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    /* ZMĚNA 2: KLÍČOVÝ FIX pro výšku H2 (Role) */
    /* Zajišťuje, že H2 vždy zabere prostor pro dva řádky (přibližně 2.6em) */
    line-height: 1.3; 
    min-height: 2.6em; /* 2 řádky * 1.3 line-height */
    overflow: hidden; /* Skryje případný text, který se nevejde do 2 řádků */
    text-overflow: ellipsis; /* Přidá trojtečku, pokud se text nevejde (funguje jen pro single-line) */
  }

  .member-card h2 a {
      color: #333;
      text-decoration: none;
      transition: color 0.2s;
  }

  .member-card h2 a:hover {
      color: #3b82f6;
  }

  .member-card p {
      color: #4b5563;
      line-height: 1.6;
      text-indent: 0; /* Zde odstraňuji text-indent, který může způsobovat problémy s layoutem */
      overflow: hidden;
      transition: max-height 0.4s ease, opacity 0.4s ease;
  }

    .member-content p {
      /* Udrží plynulý přechod */
      transition: max-height 0.5s ease-in-out, opacity 0.3s ease;
      overflow: hidden; /* Skryje přetékající text při zkrácení */
      /* Zpočátku nastaveno na max-height pro plný text - bude přepsáno .shortened */
      max-height: 1000px;
      opacity: 1;
  }

  /* 2. Stav ZKRÁCENÍ: Aplikuje se při startu přes JS */
  .member-content p.shortened {
      max-height: 8em; /* roughly 5 lines */
      opacity: 1;
  }
  
  /* Styl pro skrytý/zobrazený obsah */
  .member-content .full-text {
      max-height: 1000px; /* Dostatečně velká hodnota pro zobrazení */
      opacity: 1;
  }

  .member-content .short-text {
      max-height: 5em; /* Omezení na 4-5 řádků pro "zkrácený" stav */
      overflow: hidden;
      opacity: 1;
  }

  .member-content .hidden-text {
      max-height: 0;
      opacity: 0;
      margin-bottom: 0;
  }

  .member-content h2.contact-heading {
      margin-top: 1rem;
      font-size: 1.25rem;
      color: #4b5563;
  }

  /* Styling for the toggle button */
  .toggle-btn {
      width: calc(100% - 3rem);
      margin: 0 1.5rem 1.5rem 1.5rem;
      padding: 12px 15px;
      background: linear-gradient(135deg, #0f2d6e, #1d838d);
      color: white;
      border: none;
      border-radius: 8px;
      font-size: 1rem;
      font-weight: 700;
      cursor: pointer;
      transition: opacity 0.3s, transform 0.1s, box-shadow 0.2s;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  }

  .toggle-btn:hover {
      opacity: 0.88;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  }

  .toggle-btn:active {
      transform: translateY(1px);
  }

  @media (max-width: 768px) {
      .members-grid {
          flex-direction: column;
      }
      .members-col {
          width: 100%;
      }
  }

/* RESPONSIVE - Hamburger menu (matches main styles.css) */
@media (max-width: 900px) {
    .hamburger {
        display: flex;
    }

    .mobile-menu-container {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 75%;
        max-width: 350px;
        background-color: #ffffff;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 100px;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1005;

        /* Scrollable menu, independent from page */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px;

        /* Readable font */
        font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    }

    .mobile-menu-container.open {
        transform: translateX(0);
    }

    .main-nav {
        flex-direction: column;
        width: 100%;
        gap: 0;
        margin-bottom: 20px;
    }

    .main-nav a {
        padding: 15px 20px;
        width: 100%;
        text-align: center;
        border-bottom: 1px solid #eee;
        font-size: 26px !important;
        font-weight: 400;
    }

    .lang-menu {
        flex-direction: row;
        padding: 10px 0;
        gap: 10px;
    }

    .lang-menu .separator {
        display: inline;
    }

    /* Hide the main nav on mobile (it lives inside the drawer) */
    header .main-nav {
        display: none;
    }

    /* Show nav when drawer is open */
    header .mobile-menu-container.open .main-nav {
        display: flex;
    }

    /* Mobile adjustments (keeping your existing logic) */
    header .lang-menu .lang-link,
    header .lang-menu .separator {
        font-size: 20px;
    }

    .hamburger.open .bar:nth-child(2) {
        opacity: 0;
    }

    .hamburger.open .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .hamburger.open .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* Hero fix for mobile */
    #hero-members {
        height: auto;
        min-height: 40vh;
        padding: 20px 0;
        align-items: stretch;
        overflow: hidden;
    }

    #hero-members .content {
        width: auto;
        max-width: 100%;
        padding: 30px 20px;
        text-align: left;
        box-sizing: border-box;
    }

    #hero-members .content h1,
    #hero-members .content p {
        text-indent: 0;
        white-space: normal;
        word-break: break-word;
    }

    /* Lock page scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
}

  @media (max-width: 850px) {
    .coordinator-card {
        flex-direction: column;
    }
    .coordinator-card img {
        width: 100%;
        min-width: 100%;
        height: 250px;
    }
    .coordinator-content {
        text-align: center;
        align-items: center;
    }
}

/* FOOTER */

footer {
  text-align: center;
  padding: 20px;
  background: #2c3e50;
  color: white;
  font-size: smaller;
}