/* Prevent padding from causing overflow */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    min-height: 100svh;            /* modern viewport unit, safe on mobile */
    display: flex;
    flex-direction: column;
    color: #000;
    background: #fff;
}

/* Header & menu (desktop aligned left, mobile uses dropdown) */
header {
    display: center;
    justify-content: flex-start;   /* aligned (not centered) */
    padding: 1rem;
    position: relative;
    background: transparent;
    margin-bottom: 1rem;
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.2em; /* 40px/16=2.5em */
    font-weight: normal;
    letter-spacing: 8px;
    text-align: center;
}

header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 0.8em; /* 40px/16=2.5em */
    font-weight: normal;
    letter-spacing: 2px;
}

header button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #0077cc;
    color: black;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

h1 {
    margin: 0 0 0.5rem 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1.2rem; /* 40px/16=2.5em */
    font-weight: normal;
    letter-spacing: 8px;
    text-align: center;
}

h2 {
    margin: 0 0 0.5rem 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1.0rem; /* 40px/16=2.5em */
    font-weight: normal;
    letter-spacing: 2px;
    text-align: left;
}

.top-bar a:hover, .top-bar button:hover {
    background: #ccc;
}

section {
    background: #fff;
    padding: 3rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

section img {
    max-width: 100%;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.menu-toggle {
    display:none; /* hidden on desktop */
    background: none;
    border: none;
    font-size: 2rem;
    color:black;
    cursor: pointer;
    
    
    position: absolute;
    left: 2rem;
    top: 1rem;
}

.menu-bar {
    display:block;
    justify-content:left; /* center on desktop */
    align-items:left;
    position:relative;
    margin-top:0.5rem;
    margin-bottom:0rem;
}

#navMenu ul {
    list-style: none;
    margin: 0;
    padding: 0rem;
    display: flex;                  /* desktop row */
    
}

#navMenu a {
    padding: 0.5rem 2rem;
    color: black;
    text-decoration: none;
    font-weight: 500;
}

#navMenu a:hover {
    background:#eee;
    border-radius:4px;
}

/* Main area: vertically centered when there's extra height, but scrolls when taller */
.page-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
}

/* This block is what gets centered vertically when there is extra space */
.center-when-room {
    margin-block: auto;             /* pushes block to vertical center if there's room */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;            /* keep inner content centered horizontally wrapper-wise */
    gap: 1rem;
}

main {
    width: 100%;
    max-width: 800px;               /* desktop reading width */
    margin: 0 auto;                 /* horizontal centering */
    text-align: left;
}

main img {
    display: block;
    max-width: 100%;                /* never exceed container */
    height: auto;
    margin-bottom: 1rem;
    border-radius: 6px;
}

main p {
    font-size: 1.1rem;
    line-height: 1.6;
    overflow-wrap: anywhere;        /* prevent long words/URLs from causing overflow */
    margin: 0;
}

main a {
    display: inline-block;
    margin-top: 1rem;
    color: blue;
    text-decoration: none;
}

#langBtn {
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    align-self: center;             /* centered under content */
}

/* Mobile: hamburger + dropdown below, no overflow */
@media (max-width: 768px) {
    
    header {
        
        justify-content: flex-start;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .menu-bar {
        justify-content:flex-start;
    }
    
    
    #navMenu ul {
        display: none;                       /* hidden until toggle */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        background: #f9f9f9;
        width: 180px);             /* fit within viewport */
        border-radius: 4px;
        padding: 0.5rem 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.12);
        
    }
    
    #navMenu.active ul {
        
        display: flex;
    }
    
    #navMenu a {
        padding: 0.5rem 1rem;
        display: block;
        text-decoration:none;
        font-weight:500;
    }
    
    /* Title fits small screens nicely */
    h1 { font-size: 1.5rem; }
    
}

.media-item {
      flex: 1 1 220px;
      max-width: auto;
      text-align: center;
}

.media-item img {
      width: 100%;
      height: auto;
      cursor: pointer;
}

.media-item video {
    width: 100%;           /* image/video fills container */
    height: auto;
/*border: 2px solid #ccc;*/
    display: block;
    cursor: pointer;
}

.caption {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #666;
    background: #fff;
  /*border: 1px solid #ccc;*/
    border-top: none;
    padding: 6px;
  
}

@media (min-width: 600px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 900px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Templates hidden */
template {
    
    display: none;
}

.back-btn {
    display: inline-block;
    z-index: 10000;
    color: white;
    padding: 0.5em 1em;
    background: rgba(0,0,0,0.7);
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9em;
}

/* Slightly smaller paragraph for tiny widths */
@media (max-width: 400px) {
  main p { font-size: 1rem; line-height: 1.5; }
}
