/* ==========================================================================
   Base layout
   ========================================================================== */

html, body {
    height: 100%;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
}

#container{
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#main-content {
    box-sizing: border-box;
    flex: 1;
    max-width: 1500px;
    width: 100%;
    margin: auto;
    padding: 0 50px;
}

.logo{
    margin: 1%;
}

/* ==========================================================================
   Navbar
   ========================================================================== */

.navbar { width: 100%; }

.navbar-row1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background-color: #5f6d39;
    color: white;
}

.logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.logo-image {
    height: 100px;
    width: auto;
}

.logo-text {
    margin-left: 10px;
    font-size: 24px;
    font-weight: bold;
}

.navbar-row2 {
    background-color: #7b8a54;
    position: relative;
}

.burger-menu {
    display: none;
    flex-direction: column;
    cursor: pointer;
    margin: 0 10px;
    align-items: flex-end;
}

.line {
    height: 3px;
    width: 30px;
    background-color: white;
    margin: 4px 0;
}

.nav-links {
    list-style: none;
    display: flex;
    justify-content: center;
    padding: 7px 0;
    margin: auto;
    max-width: 1500px;
}

.nav-links li {
    margin: 0 15px;
    font-size: 20px;
}

.nav-links a {
    text-decoration: none;
    color: white;
    padding: 5px 10px;
}

.nav-links a:hover {
    padding-top: 12px;
    background-color: #586435;
    border-bottom: 2px solid rgb(36, 34, 34);
    text-decoration: none;
}
.nav-links a:active { text-decoration: none; }

/* ==========================================================================
   Search bar
   ========================================================================== */

.future-content {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 20px;
}

form {
    display: flex;
    border: 2px solid #3e472b;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

input[type="search"] {
    border: none;
    padding: 10px;
    font-size: 16px;
    outline: none;
    flex: 1;
}

input[type="search"]::placeholder { color: #888; }

button {
    background-color: #7b8a54;
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover { background-color: #4f5a37; }

/* ==========================================================================
   Breadcrumb
   ========================================================================== */

#breadcrumb {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
}

#breadcrumb a {
    text-decoration: none;
    color: black;
    margin: 5px;
}

#breadcrumb span { margin: 5px; }

/* ==========================================================================
   Footer
   ========================================================================== */

footer {
    background-color: hsla(207, 31%, 48%, 0.199);
    color: #5a5a5a;
    padding: 40px 0;
    font-family: Arial, sans-serif;
}

.footer-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-link-container{ display: flex; }

.footer-portal-link-text{
    margin-left: 1vw;
    translate: 0 -1vh;
}

.row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.col-4 { width: 30%; }

h2 {
    font-size: 1.3rem;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 10px;
    position: relative;
}

ul { list-style: none; padding: 0; }

a {
    color: inherit;
    text-decoration: none;
    font-size: 1rem;
}
a:hover { text-decoration: underline; }

.contact-info p {
    margin: 5px 0;
    font-size: 1rem;
}
.contact-info p strong {
    display: block;
    font-weight: bold;
}

.contact-info .icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.contact-info .icon img {
    width: 16px;
    height: 16px;
}

.portal {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.portal img {
    width: 30px;
    height: auto;
}

.footer-bottom {
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
}

.footer-img{
    width: 3vw;
    height: auto;
}

@media (max-width: 900px) {
    .row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .col-4 {
        width: 100%;
        margin-bottom: 20px;
    }
}

/* ==========================================================================
   List page
   ========================================================================== */

.page-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
}

.page-list.home { margin-top: 0; }

.page-list h1{
    font-size: 50px;
    text-align: center;
}

.page-item {
    display: none;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
    justify-content: center;
    width: 100%;
    max-width: 800px;
}

.page-item-home {
    display: flex;
    margin-bottom: 20px;
    text-decoration: none;
    color: inherit;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    font-size: 1.2em;
}

.page-item-home:hover .page-title{ text-decoration: underline; }

.styled-hr {
    border: none;
    height: 2px;
    background-color: rgba(128, 128, 128, 0.3);
    margin: 20px 0;
}

.page-image {
    flex: 0 0 200px;
    margin-right: 20px;
}

.page-image img {
    width: 100%;
    height: auto;
}

.page-content { flex: 1; }

.page-title {
    font-size: 1.5em;
    margin: 0;
}

.page-item:hover .page-title { text-decoration: underline; }

.page-description { margin: 5px 0; }

.page-date {
    color: gray;
    font-size: 0.9em;
}

.button-container {
    display: flex;
    justify-content: center;
    margin: 20px auto;
}

#load-more {
    background-color: #7b8a54;
    color: white;
    border: none;
    display: none;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

#load-more:hover { background-color: #4f5a37; }
#load-more:focus { outline: none; }

/* ==========================================================================
   Single page
   ========================================================================== */

.post{
    font-size: 1.2em;
    width: 60%;
    margin: 0 auto;
}

.post-title {
    font-size: 2em;
    margin-bottom: 0.5em;
}

.post-date {
    color: grey;
    margin-bottom: 1em;
    font-size: 1em;
}

.post-image img {
    max-width: 100%;
    height: auto;
}

.post-image .image-alt {
    margin-top: 0;
    color: #888;
    font-size: 0.9em;
    margin-bottom: 1em;
}

.post-description {
    font-weight: bold;
    margin-bottom: 1em;
}

.post-content{ margin-bottom: 5em; }

/* ==========================================================================
   Home page
   ========================================================================== */

.image-container {
    position: relative;
    width: 60%;
    overflow: hidden;
    margin: 0 auto;
    margin-bottom: 1em;
}

.image-container a{ text-decoration: none; }

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    transition: filter 0.5s ease-in-out;
}

.image-title {
    position: absolute;
    top: 70%;
    left: 5%;
    width: 60%;
    background-color: rgba(31, 77, 121, 0.7);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 5px;
    transition: background-color 0.5s ease-in-out, color 0.5s ease-in-out;
}

.image-container:hover img { filter: brightness(0.5); }
.image-container:hover .image-title {
    background-color: rgba(31, 78, 121, 0.911);
    color: white;
}

/* ==========================================================================
   Loading spinner
   ========================================================================== */

.search-loading {
    border: 16px solid #f3f3f3;
    border-radius: 50%;
    border-top: 16px solid #3498db;
    width: 120px;
    height: 120px;
    -webkit-animation: spin 2s linear infinite;
    animation: spin 2s linear infinite;
}

@-webkit-keyframes spin {
    0% { -webkit-transform: rotate(0deg); }
    100% { -webkit-transform: rotate(360deg); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Global responsive rules
   ========================================================================== */

@media (max-width: 1250px) {
    .image-container{
        border-radius: 15px;
        width: 80%;
    }

    .image-title {
        position: static;
        top: auto;
        left: auto;
        width: 100%;
        background-color: black;
    }
}

@media screen and (max-width: 1100px) {
    .navbar-row1 {
        flex-direction: column;
        align-items: center;
    }

    .future-content {
        margin-top: 10px;
        width: 100%;
    }

    #search-query {
        width: 100%;
        padding: 10px;
        font-size: 16px;
    }

    button {
        padding: 10px;
        font-size: 16px;
    }

    .nav-links {
        flex-direction: column;
        align-items: center;
        display: none;
        width: 100%;
    }

    .nav-links li { margin: 10px 0; }

    .nav-links.active { display: flex; }

    .burger-menu { display: flex; }

    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .footer-links, .footer-social {
        margin-bottom: 20px;
        width: 100%;
    }

    .footer-links ul, .footer-social ul { justify-content: center; }

    /* Card-like layout on smaller screens */
    .page-item,
    .page-item-home {
        flex-direction: column;
        align-items: center;
        border: 1px solid #ccc;
        padding: 10px;
        margin: 10px 0;
        border-radius: 5px;
    }

    /* Keep .page-item hidden by default */
    .page-item { border: none; }

    .page-image {
        margin-right: 0;
        margin-bottom: 5px;
    }

    .post{ width: 90%; }

    #breadcrumb {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    #breadcrumb span { margin: 5px 0; }

    .image-container{ width: 100%; }

    #training{ margin-bottom: 0; }
}

/* ==========================================================================
   Under-nav helpers
   ========================================================================== */

.text-with-icon {
    display: flex;
    justify-content: left;
    align-items: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

#under-nav{
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

#under-nav-link{
    display: inline-flex;
    align-items: center;
    transform: none;
}

.image-alt{ display: none; }

/* ==========================================================================
   Articles grid
   ========================================================================== */

.articles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    width: 100%;
    margin-top: 0;
    max-height: none;
}

@media screen and (max-width: 1100px){
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.article-main {
    grid-column: 1 / span 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: white;
}

.article-other {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: white;
}

.article-main h2, .article-other h4 {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.article-text {
    color: white;
    position: absolute;
    bottom: 10%;
    left: 5%;
    width: 80%;
    padding: 1%;
    border-radius: 1%;
    word-wrap: break-word;
    text-align: left;
    z-index: 2;
}

.article-date{ text-decoration: none; }

.article-title:hover{ text-decoration: underline; }
.article-date:hover{ text-decoration: none; }

.article-text a:hover .article-title,
.article-text:hover .article-title {
    text-decoration: underline;
}

.article-text a:hover .article-date,
.article-text:hover .article-date {
    text-decoration: none;
}

a:hover .article-title { text-decoration: underline; }
a:hover .article-date { text-decoration: none; }

.image-wrapper {
    position: relative;
    width: 100%;
    height: auto;
    overflow: hidden;
}

.article-image {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,0,0,0) 0%, rgba(0,0,0,0.9) 100%);
    z-index: 1;
}

.content {
    position: absolute;
    opacity: 1;
    left: 5%;
    bottom: 5%;
    z-index: 2;
}

/* ==========================================================================
   Carousel
   ========================================================================== */

.training-img{
    width: 100%;
    min-height: 16em;
    max-height: 16em;
    object-fit: cover;
}

.hugo-carousel{
    --gap: 30px;
    --perView: 4;
    --arrow-offset: 14px; /* arrow offset outside the images */
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.hc-viewport{
    width: 100%;
    overflow: hidden;
    /* reserve space so arrows sit outside the image area */
    padding-left: calc(var(--arrow-offset) + 26px);
    padding-right: calc(var(--arrow-offset) + 26px);
    box-sizing: border-box;
}

.hc-track{
    display: flex;
    gap: var(--gap);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    padding: 4px 0;
    scrollbar-width: none;
}
.hc-track::-webkit-scrollbar{ display: none; }

.hc-slide{
    flex: 0 0 calc((100% - (var(--perView) - 1) * var(--gap)) / var(--perView));
    scroll-snap-align: start;
    text-decoration: none;
}

/* Center the title text below each image */
.hc-slide .training-title,
.hc-slide .training-title p{
    text-align: center;
}

/* Breakpoints for slides per view */
@media (max-width: 1200px){ .hugo-carousel{ --perView: 3; } }
@media (max-width: 900px){  .hugo-carousel{ --perView: 2; } }
@media (max-width: 600px){  .hugo-carousel{ --perView: 1; } }

/* Nav buttons */
.hc-btn{
    position: absolute;
    top: 35%;
    transform: translateY(-50%);
    z-index: 10;

    border: 0;
    background: transparent !important;
    padding: 0;
    margin: 0;

    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    user-select: none;

    color: #0b3d2e;
    opacity: 1;
}

/* Place arrows outside the image area */
.hc-prev{ left: var(--arrow-offset); }
.hc-next{ right: var(--arrow-offset); }

/* Increase clickable area without adding a background */
.hc-btn::before{
    content: "";
    position: absolute;
    inset: -10px;
}

.hc-btn:hover{ opacity: 0.85; }
.hc-btn:active{ transform: translateY(-50%) scale(0.98); }
.hc-btn:focus-visible{
    outline: 2px solid #0b3d2e;
    outline-offset: 4px;
}

/* ==========================================================================
   Command grid
   ========================================================================== */

.command-grid{
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 100%;
    height: auto;
}

.command-portrait{
    margin-top: 20px;
    background-color: #f1f1f1;
    overflow: hidden;
}

/* The <a> has classes: page-item + command-inner-grid */
.command-inner-grid{
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-content: stretch;
    gap: 12px;
    padding: 12px;
    box-sizing: border-box;
}

.command-portrait > a.command-inner-grid{
    width: 100%;
    max-width: none;
}

.command-text{
    margin: 0;
    padding: 0 8px;
    text-align: center;
    min-width: 0;
    overflow-wrap: anywhere;
    translate: none;
}

.command-text h5{ margin: 0.25em 0; }

.command-img{
    width: clamp(6.5rem, 14vw, 8rem);
    height: auto;
    max-height: 11rem;
    object-fit: contain;
    object-position: center bottom;
    translate: none;
    display: block;
}

@media (max-width: 1100px){
    .command-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px){
    .command-grid{ grid-template-columns: 1fr; }

    .command-inner-grid{
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }
}
