/* --------------------

TABLE OF CONTENTS 

# GLOBALS
    # DEFINE GLOBAL VARIABLES (CUSTOM PROPERTIES)
    # SET GLOBAL COLORS
    # SET GLOBAL TYPOGRAPHY
    # GLOBAL MEDIA (images, video, svg)
    # GLOBAL HELPERS
    # GLOBAL RESETS
        # ENABLE SMOOTH SCROLLING

# LAYOUT
    # CONTAINER
    # GRID SYSTEM (12 column)

# SITE STRUCTURE
    # HEADER
        # LOGO
        # SITE NAV
    # MAIN
        # SECTIONS
    # FOOTER

# UI COMPONENTS
    # BUTTONS
    # CARDS
    # HR (HORIZONTAL RULE)
    # CODE BLOCKS

    (WE WILL ADD MORE HERE)

# CUSTOM SITE STYLING (OPINIONATED)
    # BODY GRID LAYOUT SYSTEM (header, main, and footer)
    # CUSTOM HERO STYLING
    # CUSTOM PAGE LAYOUT - 2 COLUMNS: ASIDE + MAIN CONTENT
    # STICKYBOX

----------------------- */

/* ------------------
        GLOBALS 
--------------------- */

/* DEFINE GLOBAL VARIABLES */
:root {

    /* DEFINE BASE COLORS */
    --color-white: #fff;
    --color-black: #000;
    --color-black-80: rgb(0 0 0 / .8);

    --color-grey-200: rgb(0 0 0 / .2);

    --color-blue-100: #dbeafe;
    --color-blue-400: #3b82f6;
    --color-blue-900: #1e40af;

    --color-green-100: #d1fae5;
    --color-green-200: #a0f2be;
    --color-green-400: #22c55e;
    --color-green-600: #0E9B42;
    --color-green-800: #166534;
    --color-green-900: #004419;

    /* DEFINE SEMANTIC COLORS */
    --color-body-background: var(--color-white);
    --color-body-text: var(--color-black-80);
    --color-body-text-dark: var(--color-black);

    --color-primary: var(--color-blue-400);
    --color-primary-dark: var(--color-blue-900);
    --color-secondary: var(--color-green-400);

    /* ACTION COLORS */
    --color-links: var(--color-green-600);
    --color-links-hover: var(--color-green-800);
    --color-links-light: var(--color-green-200);

    --color-siteheader-background: transparent;
    --color-sitefooter-background: transparent;
    --color-hero-background: var(--color-blue-100);

    /* BORDERS */
    --color-border: var(--color-grey-200);
    --border-radius: 5px;
    --border-thickness: .5px;

    /* SIZING UNITS */
    --unit-2xs: 0.25rem;
    --unit-xs: 0.5rem;
    --unit-s: 1rem;
    --unit-m: 1.5rem;
    --unit-l: 2rem;
    --unit-xl: 3rem;
    --unit-2xl: 4rem;
    --unit-3xl: 6rem;
    --container-width: 1100px;

    /* GLOBAL FONTS */
    --font-body: system-ui, Helvetica, arial, sans-serif;
    --font-headings: Georgia, Times, "Times New Roman", serif;

}

/* SET GLOBAL COLORS */
body {
    background-color: var(--color-body-background);
    color: var(--color-body-text);
}

/* HEADINGS */
h1, h2, h3 {
    color: var(--color-body-text-dark);

    /* ADD SUPPORT FOR TEXTWRAP BALANCE */
    text-wrap: balance;
}

/* LIMIT THE NUMBER OF CHARACTERS PER LINE FOR ALL PARAGRAPHS */
p {
    max-inline-size: 66ch;
}

/* REMOVE WIDOWS FOR ALL PARAGRAPHS AND LIST ITEMS*/
p, li { 
    text-wrap: pretty;
}

/* LINKS */
a {
    color: var(--color-links);

    /* STYLE THE UNDERLINE */
    text-decoration-color: var(--color-links-light);
    text-underline-offset: .135em;
    text-decoration-thickness: .1em;
}

a:hover {
    color: var(--color-links-hover);
}

/* GLOBAL TYPOHRAPHY */
body {
    font-family: var(--font-body);
    font-size: 100%;
    line-height: 1.4;
}

h1, h2, h3, h4 {
    font-family: var(--font-headings);
}

/* GLOBAL MEDIA */

/* IMAGES (Responsive)
   Responsive on small screens
   Do not stretch too large (beyond the orignal)
   on large screens */
img {
    max-width: 100%;
    height: auto;
}

/* GLOBAL HELPERS */

.text-centered {
    text-align: center;
}

/* CENTER PARAGRAPHS INSIDE CENTERED PARENTS */
.text-centered p {
    margin-inline: auto;
}

/* HIDE CONTENT VISUALLY (BUT KEEP FOR SEO AND ACCESSIBILITY) */
.hide-visually,
.visually-hidden,
.screen-reader-only {
    position: absolute;
    top: -9999px;
    left: -9999px;
}

/* GLOBAL RESETS */

/* Remove the default 8pm margin on body */
body {  margin: 0; }

/* Set all elements to box sizing border box */
* { box-sizing: border-box; }

/* SMOOTH SCROLLING */
html {
    scroll-behavior: smooth;
}

/* ADD OFFSET TO ALL INLINE ANCHOR LINKS */
:target {
    scroll-margin-top: var(--unit-m);
}


/* ------------------
        LAYOUT 
--------------------- */

/* CONTAINER */

.container {
    max-width: var(--container-width);
    margin-inline: auto;
    padding-inline: var(--unit-s);
}


/* GRID SYSTEM (12 column) */

.row {
    --grid-gap: var(--unit-s);
}

.row > * {
    margin-block-end: var(--grid-gap);
}

/* NEW width SYNTAX (updated from min-width: 768px)  */
@media ( width >= 768px ) {
   
    .row {
        display: grid;
        grid-template-columns: repeat(12, 1fr);
        gap: var(--grid-gap);
    }

    /* COMMONLY USED SEMANTIC COLUMNS */
    .one-whole { grid-column: auto / span 12; }
    .one-half { grid-column: auto / span 6; }
    .one-third { grid-column: auto / span 4; }
    .two-thirds { grid-column: auto / span 8; }
    .one-fourth { grid-column: auto / span 3; }
    .three-fourths { grid-column: auto / span 9; }

    /* SWAP (REVERSE COLUMNS) - WORKS ONLY w/ 2 COLUMNS */
    .row.swapped > *:first-child { order: 2; }
    .row.swapped > *:last-child { order: 1; }

    /* CENTERED COLUMNS */
    .one-half.centered { grid-column-start: 4;}
    .two-thirds.centered { grid-column-start: 3;}

    /* 12 COLUMN CLASS-BASED GRID SYSTEM */
    .col-1 { grid-column: auto / span 1; }
    .col-2 { grid-column: auto / span 2; }
    .col-3 { grid-column: auto / span 3; }
    .col-4 { grid-column: auto / span 4; }
    .col-5 { grid-column: auto / span 5; }
    .col-6 { grid-column: auto / span 6; }
    .col-7 { grid-column: auto / span 7; }
    .col-8 { grid-column: auto / span 8; }
    .col-9 { grid-column: auto / span 9; }
    .col-10 { grid-column: auto / span 10; }    
    .col-11 { grid-column: auto / span 11; }   
    .col-12 { grid-column: auto / span 12; } 
    
    /* PUSHES */
    .push-1 { grid-column-start: 2; }
    .push-2 { grid-column-start: 3; }
    .push-3 { grid-column-start: 4; }
    .push-4 { grid-column-start: 5; }
    .push-5 { grid-column-start: 6; }
    .push-6 { grid-column-start: 7; }
    .push-7 { grid-column-start: 8; }
    .push-8 { grid-column-start: 9; }
    .push-9 { grid-column-start: 10; }
    .push-10 { grid-column-start: 11; } 
    .push-11 { grid-column-start: 12; }           
}


/* FOR DEMO PURPOSES ONLY */
.row.demo > * {
    background-color: #eee;
    text-align: center;
    padding: var(--unit-s);
}

/* ------------------
    SITE STRUCTURE 
--------------------- */

/* SITE HEADER */
.site-header {
    background-color: var(--color-siteheader-background);
    padding-block: var(--unit-s);
    padding-inline: var(--unit-s);

    /* DISPLAY LOGO ON LEFT AND NAV ON RIGHT */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--unit-s);
    flex-wrap: wrap;
}

/* REMOVE HEADER PADDING IF IT HAS A CONTAINER */
.site-header:has(.container) {
    padding-inline: 0;
}

/* LOGO STYLING */
.site-header .logo {
    display: flex;
    align-items: center;
    gap: var(--unit-s);
}

.site-header .logo svg {
    max-height: 50px;
    min-width: 50px;
}

/* CHRS COYIER'S FIX FOR GAP UNDR INLINE IMAGES AND SVG*/
.site-header .logo img,
.site-header .logo svg {
    vertical-align: middle;
}

.site-header .logo h1 {
    font-size: 1.3125rem;
    margin: 0;
}

.site-header .logo a {
    text-decoration: none;
}

/* MAIN SITE NAV */
.site-header .site-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    gap: var(--unit-s);
    flex-wrap: wrap;
}

.site-header .site-nav a {
    text-decoration: none;
    font-weight: bold;
    display: block;
    padding: var(--unit-xs);
    padding-block-start: calc(var(--unit-xs) + .1em);
}

/* SITE MAIN */
.site-main {
    background-color: transparent;
}

/* STYLING FOR ALL SECTIONS */
section {
    padding-block: var(--unit-2xl);
}

.hero {
    background-color: var(--color-hero-background);
    padding-block: var(--unit-3xl);
    padding-inline: var(--unit-s);
}

.hero:has(.container) {
    padding-inline: 0;
}


/* SITE FOOTER */
.site-footer {
    background-color: var(--color-sitefooter-background);
    padding-block: var(--unit-2xl);
    padding-inline: var(--unit-s);
}

/* REMOVE FOOTER PADDING IF IT HAS A CONTAINER */
.site-footer:has(.container) {
    padding-inline: 0;
}

/* ------------------
    UI COMPONENTS 
--------------------- */

/* BUTTONS */
.button {
    background-color: var(--color-links);
    color: var(--color-white);
    padding: var(--unit-s) var(--unit-m);
    margin-block: var(--unit-2xs);
    display: inline-block;
    text-decoration: none;
    border-radius: var(--border-radius);
    line-height: 1;
}
.button:hover {
    background-color: var(--color-links-hover);  
    color: var(--color-white);  
}

/* CARDS */
.card {
    border: var(--border-thickness) solid var(--color-border);
    display: inline-block;
    padding: var(--unit-s);
    border-radius: var(--border-radius);
}

.color-swatch {
    --_swatch-color: grey;
    background-color: var(--_swatch-color);
    width: 150px;
    height: 150px;
}

/* HR */
hr {
    border: none;
    border-bottom: var(--border-thickness) solid var(--color-border);
    margin: var(--unit-xl) 0;
}

/* Code Blocks */
pre:has(code) {
    background-color: var(--color-black);
    color: var(--color-white);
    padding-inline: var(--unit-m);
    border-radius: var(--border-radius);
    white-space: pre-wrap;
}


/* ------------------
    CUSTOM SITE STYLING 
--------------------- */

/* PUSH THE FOOTER TO THE BOTTOM BY DEFAULT */
body {
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100svh;
}

/* TO FIX OVERFLOW WORD BREAK */
body > * {
     min-width: 0;  
}

/* NUDGE THE NAV ITEMS DOWN TO ALIGN WITH IMAGE LOGO TEXT */
.site-header .site-nav a {
    padding-block-start: calc(var(--unit-xs) + .35em);
}

/* CUSTOM HERO STYLING */
.hero h1 {
    font-size: clamp(2.5em, 4vw, 4em);
    margin-block: 0;
    overflow-wrap: break-word;
}
.hero p {
    text-wrap: balance;
}

/* CUSTOM PAGE LAYOUT - 2 COLUMNS: ASIDE + MAIN CONTENT */


@media ( width >= 768px ) {

    .pagelayout-wrapper-twocolumn {
        display: flex;
        gap: var(--unit-l);
    }

    .pagesection-aside {
        width: 25%;
    }

    .pagesection-maincontent {
        width: 75%;
    }

}

/* STICKYBOX */
.stickybox {
    position: sticky;
    top: var(--unit-m);
}