/* Color scheme */

:root {
    --overall-width: 1200px;
    --content-width: 800px;
    --text-color:                     hsl(221,  41%,  23%);
    --article-link-color:             hsl(  0,  60%,  50%);
    --link-hover-color:               hsl(  0, 100%,  63%);
    --button-hover-color:             hsl(  0,  13%,  70%);
    --input-error-border-color:       hsl(  0,  80%,  50%);
    --header-text-color:              hsl(  0,   0%, 100%);
    --footer-text-color:              hsl(  0,   2%,  67%);
    --header-footer-background-color: hsl(  0,   3%,  12%);
    --light-background-color:         hsl(  0,  13%,  97%);
    --sidebar-background-color:       hsl(  0,  13%,  88%);
    --shadow-color:                   hsl(  0,  13%,  94%);

    --column-background-color:   var(--light-background-color);
    --table-row-alternate-color: var(--light-background-color);
}

/* Fonts */
@font-face {
  font-family:'FontAwesomeBrands';
  src: url('../fonts/fa-brands-400.woff2') format('woff2');
}
@font-face {
  font-family:'FontAwesomeRegular';
  src: url('../fonts/fa-regular-400.woff2') format('woff2');
}
@font-face {
  font-family:'FontAwesomeSolid';
  src: url('../fonts/fa-solid-900.woff2') format('woff2');
}

.fa-brands {
    font-style:normal;
    line-height: 1;
    font-family: FontAwesomeBrands;
}
.fa-regular {
    font-style:normal;
    line-height: 1;
    font-family: FontAwesomeRegular;
}
.fa-solid {
    font-style:normal;
    line-height: 1;
    font-family: FontAwesomeSolid;
}

.fa-facebook:before     { content: "\f09a"; }
.fa-instagram:before    { content: "\f16d"; }
.fa-youtube:before      { content: "\f167"; }
.fa-file-o:before       { content: "\f15b"; }
.fa-child:before        { content: "\f1ae"; }
.fa-envelope:before     { content: "\f0e0"; }
.fa-bullhorn:before     { content: "\f0a1"; }
.fa-comment-dots:before { content: "\f4ad"; }

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
    font-size: 15px;
    color: var(--text-color);
    line-height: 1.68;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 3.1rem;
    max-width: 100%;
    word-break: break-word;  /* prevent overflow on long titles */
}

h2 {
    font-size: 2rem;
    margin: 2.8rem 0 1rem 0;
    font-weight: 600;
    line-height: 2.2rem;
}

h3 {
    font-size: 1.2rem;
    margin: 2rem 0 1rem 0;
    font-weight: 600;
    line-height: 1.4rem;
}

p {
    margin-bottom: 1.5rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.15s, color 0.15s ease;
}

a:hover {
    color: var(--link-hover-color);
}

ul {
    list-style-position: inside;
    margin: .8rem .4rem;
}

li {
    list-style: outside;
    margin-left: 1.2rem;
}

/* Header */
.site-header {
    background-color: var(--header-footer-background-color);
    color: var(--header-text-color);
}

.header-container {
    max-width: var(--overall-width);
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo img {
    height: 100px;
    width: auto;
    margin-left: 1rem;
}

/* Hamburger menu button */
.hamburger {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--header-text-color);
    margin: 3px 0;
    transition: 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-6px, -6px);
}

/* Navigation menu */
.main-nav {
    display: flex;
    align-items: center;
}

.menu {
    list-style: none;
    display: flex;
    gap: 2rem;
}

.menu li {
    list-style: none;
}

.menu li a {
    color: var(--header-text-color);
    text-decoration: none;
    font-size: 1.05rem;
    transition: color 0.15s ease;
}

.menu li a:hover {
    color: var(--link-hover-color);
}

/* Main content area */
main {
    display: flex;
}

main:not(.with-hero-image) {
    min-height: calc(100vh - 199px); /* Ensure footer is at bottom */
}

main > article, .recent-posts {
    flex-grow: 1;
    padding: 0 1rem 2rem 1rem;
}

article, .recent-posts > h1 {
    max-width: calc(var(--content-width) - 2rem);
    margin: 2rem auto 1rem auto;
}

article a {
    color: var(--article-link-color);
}
article h2 a {
    /* do not change h2 link color for posts page */
    text-decoration: inherit;
    color: inherit;
}

img.visualize-transparency {
    background-color: #f0f0f0;
}

/* Navigation sidebar */
aside {
    width: calc(15% + 4rem);
    min-width: 200px;
    background-color: var(--sidebar-background-color);
    padding: 1.5rem 1.2rem;
}

aside ul {
    list-style: none;
    margin: 0;
}

aside li {
    margin: .8rem 0;
    white-space: nowrap;
    list-style: none;
    font-size: 1.05rem;
}

aside a {
    text-decoration: none;
    color: inherit;
}

aside i {
    display: inline-block;
    width: 1.25rem;
    margin-right: 0.2rem;
    text-align: center;
}

/* Tables */
table {
    min-width: 80%;
    border-collapse: collapse;
    margin: .8rem 0;
    line-height: 1.5;
}

table td, table th {
    padding: 0.5rem 0.4rem;
    text-align: left;
    vertical-align: top;
}

table thead {
    display: none;  /* Markdown tables must have a header, but we hide it for styling */
}

table td:first-child {
    text-align: right;
    width: 3rem;
}

table tr:nth-child(odd) {
    background-color: var(--table-row-alternate-color);
}

/* Column layout */
.columns {
    display: flex;
    flex-wrap: wrap;
    gap: 3em;
}

.columns > div {
    background-color: var(--column-background-color);
    padding: 0 1.5em;
    box-shadow: 0 0 5px 5px var(--shadow-color);
}

/* Footer */
footer {
    background-color: var(--header-footer-background-color);
    color: var(--footer-text-color);
    padding: 1.3rem 1rem;
}

footer .content {
    max-width: var(--overall-width);
    margin: 0 auto;
}

footer .copyright {
    float: left;
    margin-right: 1rem;
    font-size: 1.05rem;
}

footer nav.links {
    display: flex;
    column-gap: .8rem;
    justify-content: right;
    align-items: flex-end;
    font-size: 1.05rem;
}

/* Portrait gallery */
.portrait-gallery {
    background-color: black;
    padding: .1rem 0 2rem 0;
}

.portrait-gallery h2 {
    /* group name */
    color: var(--header-text-color);
    margin: 3rem 3rem 0 3rem;
}

.portrait-gallery .grid {
    display: flex;
    flex-wrap: wrap;
}

.portrait-gallery .grid .item {
    flex-shrink: 1;
    max-width: 600px;
}

.portrait-gallery .grid .item .name {
    /* person name */
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    color: var(--header-text-color);
    margin-bottom: 1rem;
}

/* Forms */
form input[type="email"], form input[type="text"], form input[type="tel"], form textarea {
    width: min(30rem, 100%);
    padding: .4rem;
    margin-top: .2rem;
    margin-bottom: 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
}

form button[type="submit"] {
    background-color: var(--sidebar-background-color);
    border: none;
    padding: .6rem 1.2rem;
    border-radius: 4px;
    cursor: not-allowed;
    font-size: 1rem;
    margin-bottom: 1rem;
}

form button[type="submit"]:enabled:hover {
    background-color: var(--button-hover-color);
    transition: background-color 0.15s ease;
    cursor: pointer;
}

form textarea {
    resize: vertical;
    font-family: inherit;
    font-size: inherit
}

form input.error, form textarea.error {
    border: 2px solid var(--input-error-border-color);
}

#form-result {
    display: none;
    color: var(--text-color);
    margin-top: 1em;
}

/* Tablet styles (768px - 1024px) */
@media (max-width: 1024px) {
    .hamburger {
        display: flex;
    }

    .main-nav {
        display: block;
        position: absolute;
        top: 132px;
        right: 0;
        width: 20rem;
        z-index: 1000;
        overflow-y: auto;
        opacity: 0;
        transition: opacity 0.3s ease-out;
    }

    .main-nav.active {
        display: block;
        transition: opacity 0.3s ease-in;
        opacity: 1;
    }

    .main-nav:not(.active) {
        pointer-events: none; /* Prevent interaction during fade-out */
    }

    .menu {
        flex-direction: column;
        gap: 0;
        margin: .2rem .2rem;
    }

    .menu li a {
        display: block;
        padding: .8rem;
        text-align: center;
        background-color: #404040e0;
    }

    .menu li a:hover {
        background-color: #404040c0;
        transition: background-color 0.15s ease;
    }
}

/* Smartphone styles (max 767px) */
@media (max-width: 767px) {
    .header-container {
        flex-direction: column;
        align-items: stretch;
    }

    .logo {
        text-align: center;
        margin-bottom: 1rem;
    }

    .logo img {
        margin: 0 auto;
    }

    .hamburger {
        display: flex;
        align-self: center;
    }

    .main-nav {
        top: 191px;
        left: 0;
        right: 0;
        margin: 0 auto;
    }

    .columns > div {
        flex: 1 1 100%;
    }

    main {
        flex-direction: column;
    }

    aside {
        display: flex;
        width: 100%;
        min-width: auto;
        padding-top: 0;
        flex-wrap: wrap;
        justify-content: space-evenly;
    }

    aside .section:not(:last-child) {
        min-width: 120px;
        margin-right: 1rem;
    }

    footer nav.links {
        flex-direction: column;
    }
}
