:root                { color-scheme: light dark; }
[data-theme="light"] { color-scheme: light;      }
[data-theme="dark"]  { color-scheme: dark;        }

:root {

      /* ============================================================
       SECTION 1  TYPOGRAPHY
       ============================================================ */

    --font-family:   system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --line-height:   1.6;

    --content-max-width: 100%;

    /* Fluid type scale 400 min */
    --fs-300: clamp(0.94rem,  calc(0.92rem + 0.08vw), 0.98rem);
    --fs-400: clamp(1.13rem,  calc(1.06rem + 0.33vw), 1.31rem);
    --fs-450: clamp(1.24rem,  calc(1.135rem + 0.51vw), 1.53rem);
    --fs-500: clamp(1.35rem,  calc(1.21rem + 0.69vw), 1.75rem);
    --fs-550: clamp(1.485rem, calc(1.29rem + .965vw), 2.04rem);
    --fs-600: clamp(1.62rem,  calc(1.37rem + 1.24vw), 2.33rem);
    --fs-650: clamp(1.79rem,  calc(1.39rem + 2.03vw), 2.96rem);  /* fs-700, shifted down 0.15rem */
    --fs-700: clamp(1.94rem,  calc(1.54rem + 2.03vw), 3.11rem);
    --fs-750: clamp(2.23rem,  calc(1.60rem + 3.15vw), 4.04rem);  /* fs-800, shifted down 0.1rem */
    --fs-800: clamp(2.33rem,  calc(1.70rem + 3.15vw), 4.14rem);
    --fs-900: clamp(2.80rem,  calc(1.85rem + 4.74vw), 5.52rem);
}
#all-flags,
#page-layout-right {
    min-width: 0;
    margin-right: 0;
    margin-left: 0;
}
#page-layout {
    width: 100%;
    max-width: 120rem; /* 1920px */
    /*max-width: 100rem;  1600px */
    margin-inline: auto;
    padding-inline: clamp(1rem, 3vw, 4rem);
    display: grid;
    grid-template-columns: 10vw auto;
    /* grid-template-columns: auto 1fr; */
    gap: clamp(.2rem, 10vw, 10rem);
    /* gap: clamp(.1rem, 5vw, 2rem); */
    align-items: start;
}
/* #page-layout {
    width: clamp(19.375rem, calc(97vw - 8rem), 120rem); */
    /* width: clamp(19.375rem, calc(97vw - 8rem) 112.5rem); */
    /* margin-left: clamp(.1rem, 3vw, 2rem); */
    /* display: grid;
    grid-template-columns: auto 1fr;
    gap: clamp(.1rem, 5vw, 2rem);
    align-items: start;
    margin-inline: auto; }*/


/* ======= FLAGS ASIDE ======*/

#all-flags {
    width: clamp(100px, 20vw, 240px);
}
/* #all-flags {
    width: clamp(120px, 20vw, 220px); */

.all-flags-title {
    font-size: var(--fs-500);
    color: var(--clr-neutral-900);
    padding: .5rem;
    border: 1px solid black;
}
.all-flags-title span {
    font-size: var(--fs-400)
    /* font-size: .6em; */
}
.flag-container {
    display: flex;
    flex-direction: column;
    /* gap: 1.25rem; see line 187 */
    padding-top: 3rem;
    /* width: 800px; */
    width: 100%
}

.flag-wrapper {
    width: 100%;
}

.flag-img-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--clr-neutral-200);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    line-height: 0; /* removes inline-img gap */
}

.flag-img-btn:hover,
.flag-img-btn:focus-visible {
    border-color: var(--clr-neutral-400);
}

.flag-img {
    display: block;
    width: 100%;
    height: auto;
}

.flag-caption {
    font-size: var(--fs-300);
    color: var(--clr-neutral-700);
    margin: 0;
    line-height: var(--line-height);
}

.flag-attribution {
    font-size: calc(var(--fs-300) * 0.85);
    color: var(--clr-neutral-500);
    margin: 0;
    line-height: 1.4;
}

.flag-attribution p {
    margin: 0;
}

.flag-attribution a {
    color: var(--clr-neutral-600);
}
/* =============
 ASIDE-TRIVIA
 =============*/
.aside-trivia {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: .01rem;
    padding: .1rem .1rem;
    margin-top: 2rem;
    background-color: var(--clr-gray-lighter);
    border-radius: 8px;
    outline: 1px solid var(--clr-gray-darker);
    outline-offset: 5px;
}
@media (prefers-color-scheme: dark) {
    .aside-trivia {
        box-shadow: 14px -14px 1px var(--clr-gray-lighter),
         -14px -14px 2px var(--clr-gray-lighter),
         14px 14px 1px var(--clr-gray-lighter),
         -14px 14px 2px var(--clr-gray-lighter);
         outline: none;
    }
}
.aside-trivia .trivia-item {
    display: none;
}
.aside-trivia .trivia-item span {
    display: block;
    font-weight: 750;
    color: var(--clr-neutral-950);
    background-color: aliceblue;
    text-align: center;
    padding: .1rem;
    border-top: 1px solid var(--clr-gray-darker);
}
.aside-trivia .trivia-item p {
    text-indent: 1rem;
    text-align: left;
    padding-top: .1rem;
    margin-top: .1rem;
    font-size: var(--fs-300);
    color: var(--clr-neutral-950);
    line-height: var(--line-height);
}
/*===*/

@media (width > 1400px) {
    .aside-trivia { display: block; }
    .aside-trivia > .trivia-item { display: block;
   }
    /* .flag-container {
        gap: 2rem;
    } */
}

@media (width > 1525px) {
    .flag-container {
        gap: 1.45rem;
    }
    .aside-trivia > .trivia-item {
        margin-bottom: 80px;
    }
}
@media (width > 1950px) {
    .flag-container {
        gap: 2.5rem;
    }
}
@media (width <= 1525px) {
    .flag-container {
    gap: 1.45rem;
    }
     .aside-trivia > .trivia-item {
        margin-bottom: 80px;
    }
}
@media (width < 1450px) {
    .flag-container {
    gap: 1.45rem;
    }
     .aside-trivia > .trivia-item {
        margin-bottom: 90px;
    }
}
@media (width < 1400px) {
    .flag-container {
    gap: 1.45rem;
    }
}
@media (width <= 1320px) {
    .flag-container {
    gap: .5rem;
    }
    .aside-trivia { display: block; }
    .aside-trivia > .trivia-item:nth-child(1){ display: block;
     margin-bottom: 20px;
   }  
    .aside-trivia > .trivia-item:nth-child(2){ display: block;
     margin-bottom: 20px;
   }  
}
@media (width <= 1150px) {
  .aside-trivia > .trivia-item:nth-child(3){ display: block;
     margin-bottom: 20px;
   }    
   
}
@media (width <= 1060px) {
     .aside-trivia { display: block; }
    .aside-trivia > .trivia-item:nth-child(4){ display: block;
     margin-bottom: 20px;
   }   
}
 @media (width < 990px) {
    .aside-trivia { display: block; }
   .aside-trivia > .trivia-item:nth-child(3) 
   { display: none;
}
 }
 @media (width <= 868px) {
    .flag-container {
    gap: .5rem;
    }
    .aside-trivia { display: block; }
    .aside-trivia > .trivia-item:not(:nth-child(5)):not(:nth-child(4)){ display: block;
     margin-bottom: 20px;
   }
   .aside-trivia > .trivia-item:nth-child(4),
    .aside-trivia > .trivia-item:nth-child(5) {
    display: none;
}  
}


/*@media (width < 1485px) {
    .aside-trivia > .trivia-item:nth-child(3) { display: block; }
}
@media (width < 1400px) {
    .aside-trivia > .trivia-item:nth-child(4) { display: block; }
}
@media (width < 1305px) {
    .aside-trivia > .trivia-item:nth-child(5) { display: block; }
}
@media (width < 1250px) {
    .aside-trivia { display: none; }
} */
/*==*/
/* @media (width < 1185px) {
    .aside-trivia { display: block; }
    .aside-trivia > .trivia-item { display: none; }
    .aside-trivia > .trivia-item:nth-child(1) { display: block; }
}
@media (width < 1050px) {
    .aside-trivia > .trivia-item:nth-child(2) { display: block; }
}
@media (width < 950px) {
    .aside-trivia > .trivia-item:nth-child(3) { display: block; }
}
@media (width < 800px) {
    .aside-trivia > .trivia-item:nth-child(4) { display: block; }
}
@media (width < 768px) {
    .aside-trivia { display: none; }*/

/*== END OF TRIVIA ===*/

@media (width <= 768px) {
    .all-flags-title {
    font-size: var(--fs-700);
    font-weight: 600;
    text-align: center;
    }
    .all-flags-title span {
    font-size: var(--fs-500);
    }
    .flag-wrapper {
        border-bottom: 1px solid var(--clr-gray-light);
        padding-bottom: 1.25rem;
    }

    .flag-wrapper:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
     .flag-container {
    gap: 2rem;
    }
    .aside-trivia { display: block; }
    .aside-trivia > .trivia-item { display: block;
     margin-bottom: 20px;
   }
    .aside-trivia > .trivia-item:nth-child(4),
    .aside-trivia > .trivia-item:nth-child(5) {
    display: block;
}  
    
    #page-layout {
        display: flex;
        flex-direction: column;
         gap: 2rem;
    }
    #all-flags {
        order: 2;
        width: 100%;
    }
    #page-layout-right {
        order: 1;
        width: 100%;
    }
    /* #second-section {
        margin: 0;
        padding: 0;
    } */
}

/* ===============
 HERO SECTION 
 ============*/

#hero-section {
    width: auto;
    height: auto;
    /* margin-right: clamp(0, .5rem, 1rem); */
    padding: clamp(.1rem, 4vw, 3.125rem);
    /* padding: clamp(.5rem, 4vw, 3.125rem); */
    /* padding: 0 1.5rem 1rem; */
    /* position: relative; */
    background-image: repeating-linear-gradient(-10deg, blue, lightblue 12%, red 10%, skyblue);
    border: 10px solid hsla(0, 26%, 92%, 0.1);
    margin-bottom: 60px;
}

.hero-title {
    color: var(--clr-black-always);
    /* background-color: antiquewhite; */
    padding: 50px 70px;
    /* border-bottom: 1px solid var(--clr-gray);
    border-radius: 20px;
    box-shadow: 0 9px 9px var(--clr-gray); */
}
.hero-title  h1 {
    text-align: center;
    padding-bottom: 2rem;
    font-size: var(--fs-700);
    font-weight: 600;
    color: black;
    text-shadow: 0 0 4px white;
}
.hero-title h3 {
    font-size: var(--fs-500);
    font-weight: 100;
    text-align: left;
    max-width: 60rem;
    margin-inline: auto;
    text-wrap: pretty;
    color: white;
    text-shadow: 0 0 4px black;
}
.hero-title h3 span {
    color: black;
    text-shadow: none;
    font-weight: 600;
    letter-spacing: .3rem;
}

.hero-flags-link {
    color: var(--clr-black-always);
    /* background-color: antiquewhite; */
    display: none;
    text-align: center;
    padding: 1.5rem 1rem 0;
}

.hero-flags-link p {
    color: lightblue;
    font-size: var(--fs-500);
    margin-bottom: 0.75rem;
}

.hero-flags-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--clr-blue-dark);
    color: white;
    font-weight: 700;
    text-decoration: none;
    border:  2px solid var(--clr-red-dark);
    border-radius: 6px;
    transition: background-color 0.2s ease;
    margin-bottom: 20px;
}
.hero-flags-btn span {
    font-size: var(--fs-500);
    padding-top: 1.5rem;
    margin-left: 1.5rem;
    line-height: 1.5rem;
    color:  white;
}

.hero-flags-btn:hover,
.hero-flags-btn:focus-visible {
    background-color: var(--clr-yellow);
    color: var(--clr-neutral-950);
    border: 2px solid var(--clr-red-dark)
}
@media (768px < width < 1250px) {
    #hero-section {
    margin-left: 5px;
}}
    

@media (width < 900px) {
       .hero-title {
    padding: 30px;
}
}
   /* .hero-title {
    color: var(--clr-black-always);
    /* background-color: antiquewhite; 
    text-align: center;
    padding: 30px;
 */

@media (width <= 768px) {
    .hero-flags-link {
        display: block;
    }
    
     #page-layout {
        width: 97vw;   /* NEW — overrides the 310px rem floor at very small screens */
    }
}
@media (width < 600px) {
.hero-title {
    padding: 10px;
    }
   /* #page-layout {
        margin-inline: 0;
    } */
    #hero-section {
        padding: 0.5rem;
    }
}
@media (width < 350px) {
    #page-layout {
        width: 99vw;   /* NEW — overrides the 310px rem floor at very small screens */
    }
    #hero-section {
        padding: 0;
        box-shadow: none;
        text-align: left;
        border: none; 
       margin: 0 0 5px;
    }
    .hero-title {
    padding: 10px;
    }
    /* .hero-title {
        width: 97vw;
        box-shadow: none;
    } */
}

/*============
 NOTABLE FLAGS
 ========*/

#second-section {
 margin-top: 3px;  
 width: auto;
 height: auto;
 /* text-align: center; */
 /* margin: 50px 0;  */
 background-color: var(--clr-neutral-100);   
}


.notable-flags-title-container {
  display: flex;
  flex-direction: column;
  width: clamp(300px, 45vw, 500px);
  margin: auto;
  height: auto;
  text-align: center;
  justify-content: center;
  padding: 30px 60px;
  border-left: 10px solid var(--clr-yellow-gold);
  outline: 3px dotted red; 
  border-radius: 6px 20px 20px 6px;
  /* border-top: 50px solid var(--clr-neutral-100); */
  background-color: var(--clr-blue);
  /* box-shadow: 0 60px 8px var(--clr-blue-darker); */
  /* animation: flag-title 2s ease-in-out forwards;*/
   /* transform: translateY(5px);  */
}
.notable-flags-title {
    font-size: var(--fs-550);
    font-weight: 700;
    text-shadow: 0 0 2px black;

}
/* @keyframes flag-title {
    0% {transform: translateY(1px)} */
    /* 25% {transform: translateY(px);} */
    /* 50% {transform: translateY(-20px);} */
    /* 75% {transform: translateY(10px);} */
    /* 100% {transform: translateY(20px);} */

.notable-flags-title-text {
  font-size: var(--fs-500);
  color: white;    
}

.notable-flag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4rem;
    padding: 30px;
    /* padding: 20px; */
    align-items: center;
    justify-content: center;
    margin: 8.8rem 1.6rem;
    /* margin: 8.8rem 3.6rem; */
    /* margin: 2.8rem 1.6rem; */
    color: var(--clr-neutral-950);
    background-color: var(--clr-blue-dark);
    border: 2px solid var(--clr-gray-dark);
    border-radius: 8px;
    box-shadow: 8px 8px 8px var(--clr-gray);
    max-width: 1200px;
}


.notable-flag-text-wrapper {
    flex: 1 1 250px;
    order: 1;
    padding: clamp(0.625rem, 2vw, 3.125rem);
    background-color: var(--clr-blue-dark);
    border: 1px solid var(--clr-gray);
    border-radius: 6px;
    box-shadow: 6px 6px 6px var(--clr-gray-darker);
    max-width: 486px;
}
.notable-flag-text {
    color: var(--clr-white-always);
    text-shadow: 0 0 2px black;
    font-size: var(--fs-450);
    background-color: var(--clr-blue-dark);     
}
.notable-flag-text > span {
    font-weight: 600;
    font-size: var(--fs-600);
    color: var(--clr-yellow-gold);
    text-shadow: 0 0 2px black;
}
.notable-flag-image-wrapper {
    flex: 1 1 250px;
    order: 2;
    max-width: 500px;
    padding: clamp(0.058125rem, 0.15vw, 0.90625rem);
    /* padding: clamp(0.078125rem, 0.25vw, 0.390625rem); */
    background-color: var(--clr-neutral-950);
}
.notable-flag-image img {
    object-fit: contain;
    width: 100%;
    height: auto;
}

@media (width < 1700px) {
    .notable-flag-container {
        gap: 2rem;
    }
}
@media (width < 1500px) {
    .notable-flag-container {
        gap: 1rem;
    }
}
/* Float-wrap layout below 1250px */
@media (width < 1400px) {
    .notable-flag-container {
        display: block;
        border: 2px solid black;
        margin: 3.5rem 2rem 2rem;
    }
    .notable-flag-image-wrapper {
        float: right;
        width: clamp(250px, 30vw, 380px);
        margin: 0 0 1rem 1rem;
        /* padding: .01rem; */
        /* padding: 0; */

    }
    .notable-flag-text-wrapper {
        /* padding: .5rem; */
        background-color: var(--clr-blue-darker);
        max-width: none;
    }
    .notable-flag-text {
        background-color: var(--clr-blue-darker);
    }
}
@media (width < 1024px) {
    .notable-flag-container {
        background-color: var(--clr-blue-dark);
        /* border: none;
        box-shadow: none; */
        margin-bottom: 3rem;
    }
    .notable-flag-text-wrapper {
        border: none;
        box-shadow: none;
    }
}
@media (width < 990px) {
    .notable-flag-container {
    padding: 1rem;
    margin: 1.5rem;
    margin-bottom: 4rem;
    }
   
}
@media (width < 868px) {
    .notable-flag-container {
    padding: .5rem;
    margin: .25rem;
    margin-bottom: 4.5rem;
    }
    .notable-flags-title-container {
    transform: translateY(3px);
    width: 65vw;
    padding: .5rem;
    outline: none;
    margin-bottom: .4rem;     
    }   
}

@media (width < 500px) {
    .notable-flags-title-container {
    padding: .2rem;
}
    .notable-flag-container {
        display: flex;
        flex-wrap: wrap;
        background-color: white;
        border-bottom: .5px solid black;
        gap: .1rem;
        padding: .8rem;
        /* padding-top: .8rem; */
        margin: .25rem;
        box-shadow: none;
    }
    .notable-flag-container:last-child {
        border-bottom: none;
    }
    .notable-flag-image-wrapper {
        float: none;
        width: auto;
        flex: 1 1 250px;
        order: 1;
        max-width: 500px;
        margin: 0 0 20px;
    }
    .notable-flag-text-wrapper {
        order: 2;
        padding: clamp(0.625rem, 2vw, 3.125rem);
        background-color: var(--clr-blue-dark);
        box-shadow: none;
    }
    .flag-container {
    gap: 2.25rem;
    }
     .notable-flag-container {
        box-shadow: none;
    }
}

/* ============================================================
   SCROLL FADE-IN (Intersection Observer)
   ============================================================ */

/* Hero, second-section, and the flags aside — fast, plain fade */
#hero-section,
#second-section,
#all-flags {
    opacity: 0;
    transition: opacity 0.22s ease;
}

#hero-section.fade-in-fast,
#second-section.fade-in-fast,
#all-flags.fade-in-fast {
    opacity: 1;
}

/* Third through eleventh sections — fade in and rise up */
#third-section,
#fourth-section,
#fifth-section,
#sixth-section,
#seventh-section,
#eighth-section,
#ninth-section,
#tenth-section,
#eleventh-section {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.6s ease;
}

#third-section.fade-in,
#fourth-section.fade-in,
#fifth-section.fade-in,
#sixth-section.fade-in,
#seventh-section.fade-in,
#eighth-section.fade-in,
#ninth-section.fade-in,
#tenth-section.fade-in,
#eleventh-section.fade-in {
    opacity: 1;
    transform: translateY(0);
}


