/* ============================================================
   FLAG-CODE-SHARED.CSS — Tattered Flag Foundation
   Shared base styles for the Flag Code sub-pages (flag-display.html,
   half-staff-guide.html, etc.) — hero, sidebar nav, ordinal section
   pattern, and typography scale common across them.
   Link after tokens.css and reset.css, before nav.css/footer.css.
   Page-specific overrides/additions go in that page's own small CSS file.
   ============================================================ */

/* Local typography scale — same pattern as flag-code.css/history.css
   until a shared typography.css exists. Only the sizes this page
   actually uses are included. */
: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);

}
html {
    overflow-x: hidden; /* safety net against any remaining overflow culprits */
    overscroll-behavior-y: none;
}
* {
    width: 100%;
    max-width: 120rem; /* 1920px */
}
/* ===============================
   Hero Section
   Matches the striped-gradient hero pattern from history.css.
   =============================== */
#hero-section {
    width: 60vw;
    height: auto;
    padding: 0;
    /* padding: clamp(.1rem, .1vw, .125rem); */
    /* padding: clamp(.1rem, 4vw, 3.125rem); */
    background-image: repeating-linear-gradient(-10deg, blue, lightblue 12%, red 10%, skyblue);
    border-left: 1rem solid hsla(0, 26%, 92%, 0.1);
    border-right: 1rem solid hsla(0, 26%, 92%, 0.1);
    border-bottom: .6rem solid hsla(0, 26%, 92%, 0.1);
    margin: 6px auto 60px;
    outline: 1px solid blue;
    border-radius: 6px;
}

.hero-title {
    color: var(--clr-black-always);
    padding: 25px 30px;
    /* padding: 50px 70px; */
}

.hero-title h1 {
    text-align: center;
    padding-bottom: 1rem;
    font-size: var(--fs-700);
    font-weight: 600;
    color: black;
    text-shadow: 0 0 4px white;
}

.hero-title p {
    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;
    padding-bottom: 1rem;
}
@media (width < 1024px) {
    #hero-section {
    width: 90vw;
     border-left: .8rem solid hsla(0, 26%, 92%, 0.1);
    border-right: .8rem solid hsla(0, 26%, 92%, 0.1);
    border-bottom: .4rem solid hsla(0, 26%, 92%, 0.1);
    }
}
/* ===============================
   Page Split
   Whole-page two-column layout: fixed sidebar nav on the left,
   all page content (hero through footnote) on the right.
   =============================== */
.page-split {
    position: relative;
    display: grid;
    grid-template-columns: 250px auto;
    grid-template-areas:
        "nav  hero"
        "nav  content";
    width: auto;
    height: auto;
}

#hero-section {
    grid-area: hero;
}

.page-nav {
    grid-area: nav;
    width: auto;
    height: auto;
    background-color: var(--clr-blue-dark);
}

#nav-2-section {
    height: 100%;
}

.page-content {
    grid-area: content;
    width: auto;
    height: auto;
}

/* #second-section {
    width: auto;
    height: auto;
}
#second-section img {
    float: left;
} */

.second-nav {
    width: 210px;
    height: auto;
    position: sticky;
    top: 90px;
    margin-left: 10px;
    padding: .1rem;
     z-index: 2;   
}
.second-nav-container {
    width: auto;
    height: auto;
    border: 1px solid var(--clr-red-dark);
    border-radius: 6px;
    background-color: var(--clr-blue-darkest);
    padding: .2rem;
}
.second-nav-links ul {
    width: auto;
    height: auto;
}

.second-nav-links li {
    list-style-type: none;
    font-size: var(--fs-400);
    font-weight: 500;
    color: var(--clr-neutral-200);
    padding: 1rem;
    border: .1px solid var(--clr-red-dark);
}

.second-nav-links li a {
    display: flex;
    justify-content: space-between; /* pushes ::after to the right edge */
    align-items: center;            /* vertically centers text + arrow */
    color: inherit;
    text-decoration: none;
}

.second-nav-links li span {
    display: inline-block;
    min-width: 0;
    max-width: 100%;
}

@media (height < 900px) {
    .second-nav-links li span {
        max-height: 1lh;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition: max-height 0.4s ease;
    }
    .second-nav-links li span:hover {
        white-space: normal;
        max-height: 3lh;
    }
}

.second-nav-links li a::after {
    content: "  ➜";   
    color: var(--clr-neutral-200);
    /* color: var(--clr-yellow-gold); */
    border: 1px dashed var(--clr-red);
    /* color: var(--clr-red-dark);
    border: 1px solid var(--clr-yellow-gold); */
    border-radius: 38%;
    padding: 3px;
    margin-left: .4em;
    /* background-color: var(--clr-yellow-gold); */
    /* background-color: color-mix(in srgb, var(--clr-yellow-light) 50%, transparent); */
    /* background-color: (var(--clr-yellow-light); */
    flex-shrink: 0;
}
.second-nav-links li:hover:not(:active) a {
    color: var(--clr-yellow);
}
.second-nav-links li:hover:not(:active) a::after {
    color: var(--clr-yellow);
}
.second-nav-links li.active {
    font-weight: 700;
    cursor: default;
    text-underline-offset: 5px;
    text-decoration: underline;
    text-decoration-color: var(--clr-yellow-gold);
    display: flex;
    justify-content: right;
    /* justify-content: space-between; */
    align-items: center;
    letter-spacing: 3px;
}

.second-nav-links li.active::after {
    content: "";
    display: none;
}
@media (width < 1024px) {
    .page-split {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-areas:
            "hero"
            "nav"
            "content";
    }
    .page-nav {
        width: 100%;
        height: auto;
    }
    .page-content {
        width: 100%;
    }
    .second-nav {
        position: static;
        width: 100%;
         margin-left: 0;
    }
    #nav-2-section {
        width: 100%;
    }
    .second-nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        width: 100%;
        list-style: none;
    }
    .second-nav-links li {
        flex: 1 1 auto;
        width: auto;
        padding: 0.75rem 1rem;
    }
    .second-nav-links li a::after {
    content: none;   
    /* color: var(--clr-red-dark);
    border: 1px solid black;
    border-radius: 38%;
    padding: 3px;
    margin-left: .4em;
    background-color: var(--clr-yellow-light);
    flex-shrink: 0; */
}
}
/*===== Second Section ===*/

/* .second-section-right {
    position: relative;
    overflow: hidden;
    width: auto;
    height: auto;
    scroll-margin-top: 100px;
}
.second-image-container {
    max-width: 45vw;
    height: auto;
    padding: 20px;
}
.second-image {
    float: left;
    width: 40vw;
    margin: 1.75rem 2rem 2rem 1rem;
    height: auto;
} */
/* @media (width >= 1300px) {
.second-image {  
    width: 25vw;
    height: auto;
}
} */
/* .second-text-container {
    display: block;
    width: auto;
    height: auto;
    padding: 64px;
    text-align: left;
    justify-content: center;
    color: white; */
    /* border: 2px solid gray; */
/* }
.second-text-title {
    color: black;
    text-align: center;
    font-size: 2.2rem;
    padding-bottom: 1rem;
    text-shadow: 0 0 2px var(--clr-black-always);
}
.second-text {
    font-size: 1.2rem;
    text-indent: 3.5em;
    color: black;
} */

.second-text-title h2,
.third-text-title h2,
.fourth-text-title h2,
.fifth-text-title h2,
.sixth-text-title h2,
.seventh-text-title h2,
.eighth-text-title h2 {
    font: inherit;
    color: inherit;
    margin: 0;
}

/* ===============================
   Third – Seventh Sections
   12-column grid per section: image | text, image always on
   the left. Column split narrows as the viewport narrows, then
   stacks entirely (image full-width above text) under 1024px.
   Each section is its own independent grid — not one grid
   shared across all five.
   =============================== */
#second-section {
    display: grid;
    grid-template-columns: 4fr 8fr; /* laptop default: image = 2 of 12 */
    grid-template-areas: "image text";
    column-gap: 1.5rem;
    margin: auto;
    width: clamp(300px, 80vw, 1400px);
    padding: 2rem 3rem;
    scroll-margin-top: 100px;
    border-bottom: 1px solid var(--clr-neutral-200);
}

#third-section,
#fourth-section,
#fifth-section,
#sixth-section,
#seventh-section {
    display: grid;
    grid-template-columns: 9fr 3fr; /* laptop default: image = 2 of 12 */
    grid-template-areas: "text image";
    column-gap: 1.5rem;
    margin: auto;
    width: clamp(300px, 80vw, 1400px);
    padding: 2rem 3rem;
    scroll-margin-top: 100px;
    border-bottom: 1px solid var(--clr-neutral-200);
}

@media (width >= 1440px) {
    #third-section,
    #fourth-section,
    #fifth-section,
    #sixth-section,
    #seventh-section {
        grid-template-columns: 9fr 3fr; /* desktop: image = 3 of 12 */
    }
}
@media (width < 1024px) {
    #second-section,
    #third-section,
    #fourth-section,
    #fifth-section,
    #sixth-section,
    #seventh-section {
        grid-template-columns: 1fr;
        grid-template-areas:
            "image"
            "text";
        row-gap: 1rem;
        column-gap: 0;
        width: 98vw;
        padding: 1rem 0 .5rem;
    }
}
.second-image,
.third-image,
.fourth-image,
.fifth-image,
.sixth-image,
.seventh-image {
    grid-area: image;
    display: flex;
    padding: 1.2rem;
}
@media (width < 1024px) {
    .second-image,
    .third-image,
    .fourth-image,
    .fifth-image,
    .sixth-image,
    .seventh-image {
        padding: .3rem;
    }
}
.second-image img,
.third-image img,
.fourth-image img,
.fifth-image img,
.sixth-image img,
.seventh-image img {
    margin: auto; /* centers the image within its cell, any height */
    max-width: 100%;
    height: auto;
}
.second-text-container,
.third-text-container,
.fourth-text-container,
.fifth-text-container,
.sixth-text-container,
.seventh-text-container {
    grid-area: text;
    padding: 3rem;
    text-align: left;
    color: var(--clr-neutral-950);
    /* background-color: var(--clr-blue-dark); */
    /* border: 2px solid gray; */
}
@media (width < 1024px) {
    .second-text-container,
    .third-text-container,
    .fourth-text-container,
    .fifth-text-container,
    .sixth-text-container,
    .seventh-text-container {
        padding: 1rem;
    }
}
.second-text-title,
.third-text-title,
.fourth-text-title,
.fifth-text-title,
.sixth-text-title,
.seventh-text-title {
    color: var(--clr-yellow-gold);
    text-align: center;
    font-size: var(--fs-550);
    font-weight: 600;
    padding: 1rem;
    margin-bottom: 1rem;
    letter-spacing: .5ch;
    background-color: var(--clr-blue-dark);
    border: 2px solid gray;
    border-radius: 8px;
    box-shadow: 8px 8px 8px gray;
    /* box-shadow: 2px 2px 20px var(--clr-black-always);
    text-shadow: 2px 2px 20px var(--clr-black-always);
    border-radius: .5em; */
}

.second-text,
.third-text,
.fourth-text,
.fifth-text,
.sixth-text,
.seventh-text {
    font-size: var(--fs-400);
    padding: 1rem;
}

/* ===============================
   Eighth Section — Quick Reference
   =============================== */
#eighth-section {
    padding: 2rem 1.5rem 3rem;
}

.eighth-text-title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--clr-blue-darker);
    margin-bottom: 1.5rem;
}
.eighth-quick-ref-list {
    text-align: center;
}
.eighth-quick-ref-item {
    display: list-item;
    list-style-type: upper-roman;
    list-style-position: inside;
}
/* .eighth-quick-ref-list {
    list-style-type: disc;
    color: black;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 640px;
    margin: 0 auto;
} */
/* .eighth-quick-ref-list li span {
    list-style-type: upper-roman;
} */

/* .eighth-quick-ref-item {
    display: flex;
    align-items: center;
    gap: 1rem;
} */

/* .eighth-quick-ref-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 4px;
    background-color: var(--clr-neutral-200); /* visible placeholder box */

.eighth-quick-ref-item span {
    line-height: 1.5;
    color: var(--clr-gray-darker);
}

/* ===============================
   Photos, credits & lightbox
   Opt-in: any <figure class="photo-figure"> gets the credit
   styling and click-to-enlarge (js/photo-lightbox.js).
   =============================== */
.photo-figure {
    margin: 0;
}

.photo-figure img {
    display: block;
    cursor: zoom-in;
}

.photo-credit {
    margin-top: 0.5rem;
    font-size: var(--fs-300);
    line-height: var(--line-height);
    color: var(--clr-neutral-950);
}

.photo-credit summary {
    cursor: pointer;
}

.photo-credit summary:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.photo-credit p {
    margin: 0.5rem 0 0;
}

.photo-credit a {
    color: inherit;
    text-decoration: underline;
}

.photo-lightbox {
    width: auto;            /* beats the * { width: 100% } rule */
    max-width: 95vw;
    max-height: 95vh;
    margin: auto;           /* keeps it centered if reset.css zeroes margins */
    padding: 0.5rem;
    border: 0;
    border-radius: 8px;
    background: var(--clr-blue-darkest);
    color: var(--clr-neutral-200);
    text-align: center;
}

.photo-lightbox::backdrop {
    background: rgb(0 0 0 / 0.8);
}

.photo-lightbox img {
    display: block;
    width: auto;
    max-width: min(1000px, 90vw);
    max-height: 80vh;
    margin: auto;
    cursor: zoom-out;
}

.photo-lightbox p {
    margin: 0.5rem 0 0;
    font-size: var(--fs-300);
}

.photo-lightbox-close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    width: auto;
    font-size: 2rem;
    line-height: 1;
    color: inherit;
    background: none;
    border: 0;
    cursor: pointer;
}

html:has(.photo-lightbox[open]) {
    overflow: hidden;       /* stops the page scrolling behind the dialog */
}
/* works with zoomable class verses lightbox figure */
.zoomable {
    cursor: zoom-in;
}
