@font-face {
  font-family: "Horrible Histories font"; /* revert to original name to match prior visuals */
  src:
    url("fonts/Horrible Histories Font Extended 4.woff2") format("woff2"),
    url("fonts/Horrible Histories Font Extended 4.woff") format("woff"),
    url("fonts/Horrible Histories Font Extended 4.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Non-visual compatibility: also expose the font under the 'Font' name
   that header h1 references, so both map to the same file. */
@font-face {
  font-family: "Horrible Histories Font";
  src:
    url("fonts/Horrible Histories Font Extended 4.woff2") format("woff2"),
    url("fonts/Horrible Histories Font Extended 4.woff") format("woff"),
    url("fonts/Horrible Histories Font Extended 4.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

html, body {
  margin: 0;
  display: flex;
  flex-direction: column; 
}

html { -webkit-text-size-adjust: 100%; }

/* Adjustable title offsets (tweak these to move the header title up/down) */
:root {
  --title-shift-desktop: -280px; /* restore previous position */
  /* Logo offsets (negative X = left, negative Y = up) */
  --logo-shift-x: 0px;
  --logo-shift-y: 0px;
  /* Small vertical nudge for the image title: negative moves up, positive moves down. Tweak this to align with the hamburger */
  --site-title-nudge-y: 6px;
}

main {
  flex: 1;  /*push footer down */
}

body {
  margin: 0;
  font-family: Arial, sans-serif; /* revert to original body font */
  display: flex;
  flex-direction: column; 
  min-height: 100vh;
  max-width: 100%;
}

header {
  background: #002147;
  color: white;
  padding: 0.5rem 1rem;
  grid-column: 1 / -1;
  min-height: 100px;   /* ✅ minimum height */
  height: auto;
  position: relative;    
}

header h1.site-title {
  transform: none !important;     
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  line-height: 1;
  flex: 1 1 auto;                 /*centering between logo and menu */
  position: relative;
  top: var(--site-title-nudge-y, 0px);
}

header h1.site-title img {
  display: block;
  width: auto;                    /* keep intrinsic width */
  height: auto;
  max-width: min(100vw, 1000px);    /* never exceed viewport */
  max-height: 100px;             
  object-fit: contain;
}

@media (max-width: 768px) {
  .top-bar h1.site-title {
    transform: none !important;
  }
  .top-bar h1.site-title img {
    max-width: 70vw;
    max-height: 56px;
  }

  /* Replace desktop header image with a mobile-optimised one */
  .top-bar h1.site-title img.desktop-header {
    display: none !important;
  }

  .top-bar h1.site-title {
    background-image: url('images/ICHistSocHeaderMobile.png?v=20250929');
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
    width: 100%;
    height: 56px; /* reserve space for the background image */
    display: block;
  }

  /* visually hide the inline img but keep DOM for accessibility if needed */
  .top-bar h1.site-title img:not(.desktop-header) { display: none; }
}

/* HOMEPAGE */

.content {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
  flex-grow: 1; /* take available space */
  padding: 2rem;
  max-width: 100%;
  margin: 0 5%;
  box-sizing: border-box; 
  width: 90%;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-bar h1 {
  font-size: 3.2rem;
  margin: 0;
  text-align: center;
}

/* #logo {
  height: 150px;
  width: auto;
} */

#logo {
  max-width: 120px;
  height: auto;
  margin-right: 10px;
  transform: translate(var(--logo-shift-x, 0px), var(--logo-shift-y, 0px));
}

/* IMPERIAL COLLEGE HISTORY SOCIETY  */

header h1 {
    flex-grow: 1;
    text-align: center;
    margin: 0;
    font-family: "Horrible Histories Font", Arial, sans-serif;
    font-size: 3.2rem; 
    line-height: 1.2; /* tighter line height */
    padding: 0;
  transform: translateY(var(--title-shift-desktop, 0px)); /* revert to original behavior */
}

nav a {
    color: white;
    margin: 0 10px;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s;
}

body {
  background-image: url('images/Imperial_Institute.jpg?v=20250929');
  background-size: cover;    
  background-position: top center; 
  background-repeat: no-repeat;
  background-attachment: fixed; 
}

.main-nav {
  display: flex;
  justify-content: center;
  gap: 100px;
  margin-top: -2.5rem; /* restore original spacing */
}

.main-nav a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

.main-nav a:hover {
  text-decoration: underline;
}

.menu-container {
  position: relative;
  display: inline-block;  /* makes button inline and allows dropdown positioning */
}

.hamburger {
  background: none;
  border: none;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  z-index: 1000;
  position: relative;          /* ensure z-index takes effect */
  width: 44px; height: 44px;   /* consistent tap target */
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  flex: 0 0 auto;
  align-self: center; /* keep the hamburger centered vertically */
}

.dropdown {
  display: none;       
  position: absolute;
  right: 0;
  top: 100%;             
  background: white;
  color: black;
  min-width: 220px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Allow JS toggle via .show on all screen sizes */
.dropdown.show {
  display: block;
}

/* Removed hover-based dropdown display; rely on JS toggle for better usability */

.dropdown a {
  display: block;
  padding: 12px 18px;
  text-decoration: none;
  color: #002147;
}

.dropdown a:hover {
  background: #eee;
}

.btn {
  display: inline-block;      
  background-color: #002147;   
  color: white;
  text-decoration: none;       /* remove underline */
  padding: 14px 32px;          /* bigger button */
  font-size: 1.2rem;          
  font-weight: bold;
  border-radius: 8px;          /* rounded corners */
  transition: all 0.3s ease;   /* smooth hover effect */
  text-align: center;
}

.btn:hover {
  background-color: #003366;   /* darker on hover */
  transform: scale(1.05);      /*  zoom */
}

/* main content  */

#intro {
  position: relative; 
  text-align: center;
  padding: 0rem 2rem;
  color: #002147;
}

.intro-text h2 { /* Welcome! */
  margin-bottom: 0rem;
}

.intro-text p {
  font-weight: 600;   /* semi-bold */
  font-size: 1.1rem; 
  margin-bottom: 1.5rem;
}

/* Side bar elements  */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Connect with us  */

aside {
  background: #f9f9f9;            
  padding: 0.3rem 1rem;
  border-radius: 10px;              /* rounded corners */
  box-shadow: 0 4px 12px rgba(0,0,0,0.1); 
  font-family: Arial, sans-serif;
  align-self: flex-start; 
  width: 100%;
  margin-left: auto;   
}

aside h3 {
  color: #002147;      
  font-size: 1.4rem;
  margin-bottom: 1rem;
  text-align: center;
  border-bottom: 2px solid #003366;
  padding-bottom: 0.5rem;
}

aside ul {
  list-style: none;     /* remove bullets */
  padding: 0;
  margin: 0;
}

aside li {
  margin: 12px 0;
}

aside a {
  display: block;        /* make the whole line clickable */
  text-decoration: none;
  color: #002147;
  font-weight: bold;
  background: #e6ecf5;  
  padding: 10px 15px;
  border-radius: 6px;
  transition: all 0.3s ease;
}

aside a:hover {
  background: #002147;
  color: white;
  transform: translateX(5px); /*slide effect */
}

/* Announcements  */

aside.announcements {
  background: #f9f9f9;
  padding: 0.3rem 1rem;
}

.announcement-content {
  margin-top: -2rem;
}

.announcement-item {
  padding: 8px 0;
  margin-bottom: -0.5rem;
}

.announcement-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.announcement-item h4 { /* heading for each announcement */
  color: #002147;
  margin-bottom: -1px; /* space below heading*/
}

.announcement-item p { /* paragraph for each announcement */
  margin-bottom: 3px;
  font-size: 0.95rem;
  line-height: 1.3;
}

/* In Announcements, links should be inline text (not block buttons) */
aside.announcements .announcement-item a {
  display: inline;
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-weight: normal;
  text-decoration: underline;
  color: #002147;
  transform: none;
}

aside.announcements .announcement-item a:hover {
  background: transparent;
  color: #003366;
  transform: none;
  text-decoration: underline;
}

.date {
  font-size: 0.8rem;
  color: #78909c;
  font-style: italic;
}

/* history fact */

aside.history-fact {
  background: #f9f9f9;
  padding: 0.3rem 1rem;
}

.fact-content {
  font-size: 1rem;
  line-height: 1.5;
}

.fact-source {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #78909c;
  font-style: italic;
  text-align: right;
}

footer {
  grid-column: 1 / -1;
  background: #002147;
  color: white;
  text-align: center;
  padding: 1.5rem;
  margin-top: 20px;
  border-top: 1px solid #ddd;
  font-size: 1rem;
}

/* ================================================= */

/* ABOUT US PAGE  */
.about-text {
  background-color: rgba(255, 255, 255, 0.5); /* semi-transparent dark */
  color: #002147; /*TEXT*/
  padding: 2rem 3rem;
  border-radius: 12px;
  text-shadow: 1px 1px 3px rgba(223, 223, 223, 0.8);
  max-width: 800px;     /* optional: limit width */
  margin: 2rem auto;    /* center on page */
  line-height: 1.6;     /* easier to read */
}

/* ================================================= */
/* upcoming events */
#events {
  max-width: 1000px;
  margin: 2rem auto;
  padding: 0 1rem;
}

#events h2 {
  text-align: center;
  margin-bottom: 2rem;
  color: #002147;
}

.event-card {
  display: flex;
  gap: 20px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 2rem;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.event-card:hover {
  transform: scale(1.02);
}

.event-card img {
  width: 200px;
  height: auto;
  object-fit: cover;
}

.event-details {
  flex: 1;
  padding: 1rem 1.5rem;
}

.event-details h3 {
  margin-top: 0;
  color: #002147;
}

.event-date, .event-location {
  font-weight: bold;
  color: #444;
  margin: 0.5rem 0;
}

.event-description {
  margin: 1rem 0;
  line-height: 1.5;
}

.event-details .btn {
  background-color: #002147;
  color: white;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.event-details .btn:hover {
  background-color: #003366;
}


/* ================================================= */
/* Meet the committee */
#committee {
  /* padding: 1rem ; */
  text-align: center;
}

#committee h2 {
  font-size: 2.2rem;
  color: #002147;
}

.committee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  justify-content: center;
  max-width: 1200px; 
  margin: 0 auto;    
  padding: 0 2rem;
}

.profile-card {
  background: rgba(255, 255, 255, 0.9);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  margin: 0 auto;
  width: 80%;
  height: 600px;      
  display: flex;
  flex-direction: column;
}

.profile-card img {
  width: 90%;
  height: 350px;    
  object-fit: cover;
  align-self: center;
  border-radius: 8px;
  margin-bottom: 1rem;
}

.profile-card h3,
.profile-card h4 {
  margin: 0.3rem 0;   
  line-height: 1.2;  
  color: #002147;
}

.profile-card .role {
  font-style: italic;
  color: #002147ae;
  font-size: 1.1rem;
}

.profile-card p {
  margin: 0.4rem 0;
  font-size: 1rem;
  color: #002147;
}

.profile-card .bio {
  font-size: 0.95rem;
  color: #002147b9;
  line-height: 1.2;
  margin-top: auto; 
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Put the label on its own line, answer on the next line */
.profile-card .bio strong {
  display: block;
}


/* ================================================= */
/* Contact page */
#contact {
  text-align: center;
  padding: 3rem 1rem;
}

#contact h2 {
  font-size: 2.2rem;
  color: #002147;
  margin-bottom: 2rem;
}

.contact-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.contact-card {
  background: rgba(255, 255, 255, 0.9);
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
}

.contact-card:hover {
  transform: translateY(-5px);
}

.contact-card i {
  font-size: 2.5rem;
  color: #002147;
  margin-bottom: 1rem;
}

.contact-card a {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: bold;
  text-decoration: none;
  color: #002147;
}

.contact-card a:hover {
  text-decoration: underline;
}

/* ================================================= */
/* Previous Events timeline */

    .timeline {
      position: relative;
      margin: 0 auto;
      padding: 20px 0;
      max-width: 800px;
    }

    /* vertical line */
    .timeline::before {
      content: '';
      position: absolute;
      top: 0;
      left: 120px;
      width: 4px;
      height: 100%;
      background: #bbb;
      border-radius: 2px;
    }

    .timeline-item {
      position: relative;
      margin: 20px 0;
      display: flex;
    }

    .timeline-date {
      width: 100px;
      text-align: right;
      padding-right: 20px;
      font-weight: bold;
      color: #000000;
    }

    .timeline-content {
      background: #fff;
      padding: 15px 20px;
      border-radius: 8px;
      box-shadow: 0 2px 6px rgba(0,0,0,0.1);
      margin-left: 20px;
      position: relative;
    }

    .timeline-content img {
      max-width: 150px;
      height: auto;
      display: block;
      margin-top: 10px;
      border-radius: 6px;
    }

    /* circle dot on line */
    .timeline-content::before {
      content: '';
      position: absolute;
      left: -34px;
      top: 20px;
      width: 16px;
      height: 16px;
      background: #fff;
      border: 4px solid #444;
      border-radius: 50%;
    }

    .timeline-content h3 {
      margin: 0 0 5px;
      font-size: 1.1em;
      color: #222;
    }

    .timeline-content p {
      margin: 5px 0;
      line-height: 1.4;
    }

  /* Removed duplicate rule to ensure correct max-width is applied above */
/* ================================================= */

/* for different screen sizes */

/* phones */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
    margin: 0;
    padding: 0;
  }

  .top-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  /* Mobile: set a small default shift further up and left; tweak as needed */
  :root {
    --logo-shift-x: -8px;  /* left */
    --logo-shift-y: -10px; /* up */
  }

  #logo {
    width: 40px;
    height: auto;
    margin: 0; /* avoid pushing the title down */
  }

  /* Mobile-specific adjustable offset (keep modest to avoid moving off-screen) */
  :root { --title-shift-mobile: -12px; }

  .top-bar h1 {
    font-size: clamp(0.9rem, 4.5vw, 1.1rem);
    text-align: center;
    margin: 0 0.5rem;
    flex: 1 1 0;
  /* Clamp the shift so it can't push the title outside the header */
  transform: translateY(clamp(-24px, var(--title-shift-mobile, 0px), 24px));
    line-height: 1.05;
    letter-spacing: -0.2px;  /* tighten to reduce wrapping */
    min-width: 0;            /* allow flex child to shrink */
    overflow: visible;       /* ensure it doesn't get clipped out */
    display: block;
    color: #ffffff;
    position: relative;
    z-index: 1;
    overflow-wrap: anywhere;
  }

  .menu-container {
    position: relative;
    z-index: 1001;
    flex: 0 0 auto; /* don't let it shrink */
  }

  .hamburger {
    font-size: 1.8rem; /* slightly smaller to reduce overlap */
    color: #ffffff;
    margin-left: 0.5rem;
    z-index: 1002;  /* above title */
  }

  .dropdown {
    position: absolute;
    right: 0;
    top: 100%; /* attach directly under the hamburger */
    background: #fff;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-radius: 6px;
    min-width: 180px;
    display: none;
    flex-direction: column;
    z-index: 1000;
  }

  .dropdown.show {
    display: flex;
  }

  .dropdown a {
    padding: 12px 16px;
    color: #002147;
    text-decoration: none;
    border-bottom: 1px solid #eee;
    font-size: 1rem;
  }
  .dropdown a:last-child {
    border-bottom: none;
  }
  .dropdown a:hover {
    background: #f5f5f5;
  }

  .main-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #002147;
    padding: 0.5rem 1rem;
    margin-top: 0; /* override desktop negative margin to prevent overlap */
  }
  .main-nav a {
    padding: 10px 0;
    color: #fff;
    text-align: left;
    border-bottom: 1px solid #223366;
    font-size: 1rem;
  }
  .main-nav a:last-child {
    border-bottom: none;
  }

  .content {
    flex-direction: column;
    display: flex;
    padding: 0.5rem;
  }

  main {
    width: 100%;
    padding: 0;
  }

  .sidebar {
    width: 100%;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  aside {
    padding: 0.5rem;
    font-size: 1rem;
  }

  iframe {
    width: 100% !important;
    height: 350px !important;
  }
}

/* Make sure top-bar uses flex for layout */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: #002147;
  gap: 1rem;
}

/* Mobile override (placed at end to win against base .top-bar) */
@media (max-width: 768px) {
  :root { --title-shift-mobile: 0px; }

  .top-bar {
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem !important;
    gap: 0.5rem;
    min-height: 56px; /* matches 44px tap target with padding */
  }

  .top-bar h1 {
    margin: 0 0.5rem;
    line-height: 1.05;
    transform: translateY(var(--title-shift-mobile, 0px));
    display: block;
  }
}
