/* ============================================
   CSS RESET
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
#root, #__next { isolation: isolate; }

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Colors */
    --navbar-bg: #683329;
    --navbar-current-bg: #770000;
    --navbar-hover-bg: #A31123;
    --title-color: #A31123;
    --hero-bg: #FFFEF3;
    --teal: #2CBAA0;
    --sidebar-bg: #E1D1BC;
    --code-bg: #AED8D8; /* medium teal */
    --episode-audio-bg: #692;
    --table-bg: #AED8D8; /* medium teal */
    --table-header-bg: #29BAA0; /* dark teal */
    --table-even-row-bg: #CEEDEC; /* light teal */
    --table-hover-bg: #29BAA0; /* dark teal */
    --table-border: #444444;
    --blockquote-border: #aaa;
    --card-bg: #FEEFD9;

    /* Spacing */
    --header-height: 2em;
    --spacing-sm: 0.5em;
    --spacing-md: 1em;
    --spacing-lg: 3em;

    /* Sizes */
    --font-size-body: 22px;
    --font-size-code: 13px;
    --font-size-h1: 36px;
    --font-size-episode-number: 36px;
    --font-size-episode-title: 24px;
    --font-size-episode-date: 16px;
    --media-height: 400px;
    --border-radius: 8px;
}

/* ============================================
   FONTS
   ============================================ */
@font-face {
    font-family: 'montagu';
    src: url('/MontaguSlab_24pt-Regular.ttf');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'mono';
    src: url('/JetBrainsMono-VariableFont_wght.ttf');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'outfit';
    src: url('/Outfit-Light.ttf');
    font-style: normal;
}

@font-face {
    font-family: 'outfit';
    src: url('/Outfit-Bold.ttf');
    font-weight: bold;
    font-style: normal;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.left { float: left; margin-right: 2em; }
.right { float: right; margin-left: 2em; }
.underline, .underline * { text-decoration: underline; }
.bold, .bold * { font-weight: bold; }

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

/* ============================================
   BASE STYLES
   ============================================ */
body {
    text-align: justify;
    font-family: outfit;
    font-size: var(--font-size-body);
    background-image: url('/images/graph-paper.png');
    background-repeat: repeat;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body p {
    line-height: 1.3em;
}

p {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

li p {
    margin: 0;
}

ul {
    margin-top: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

a {
    color: var(--teal);
    text-decoration: none;
}

/* ============================================
   HEADINGS
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-family: libertinus;
    letter-spacing: 1px;
    color: var(--title-color);
}

h1 {
    font-size: var(--font-size-h1);
}

.content h1, .content h2, .content h3, .content h4 {
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.fpitem h1, .fpitem h2, .fpitem h3, .fpitem h4 {
    padding: 0;
}

.fpitem h1, .fpitem h2 {
    margin-top: 0;
    padding: var(--spacing-sm) 0 0 0;
}

.fpitem .sidebar h4 {
    margin-top: 0;
    padding-top: 0;
}

/* ============================================
   LAYOUT
   ============================================ */
header, section, footer {
    width: 100%;
}

header, footer {
    height: var(--header-height);
    font-family: montagu;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    background-color: var(--navbar-bg);
    color: white;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    align-items: center;
}

footer {
    margin-top: 1rem;
}

section#body {
    margin: auto;
    max-width: 85ch;
    flex: 1;
}

/* ============================================
   HEADER & FOOTER
   ============================================ */
header .left { width: 10em; }
header .right { width: 30em; }

header a {
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
    margin: auto;
    text-decoration: none;
    height: 100%;
    line-height: var(--header-height);
}

header a:visited, footer a:visited {
    color: white;
}

header a[aria-current="page"] {
    color: white;
    background: var(--navbar-current-bg);
}

header a:hover {
    background: var(--navbar-hover-bg);
}

header img, footer img {
    height: 40px;
    margin: 0 var(--spacing-sm);
}

footer #badges {
    margin: 5px;
    height: 100%;
}

#badges img {
    height: 25px;
}

/* ============================================
   HERO & FRONTPAGE ITEMS
   ============================================ */
.hero, .fpitem {
    background-color: var(--hero-bg);
    display: flex;
    margin: var(--spacing-md) auto;
    padding: var(--spacing-md);
    align-items: center;
}

.hero .media, .fpitem .media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--media-height);
}

.gridpage .media, .gridpage .content {
    width: 50%;
}

.fpitem .content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 1rem;
    padding-right: 1rem;
}

.hero .button, .fpitem .button {
    font-family: montagu;
    font-weight: bold;
    margin-top: var(--spacing-md);
}

#body .hero img {
    max-height: var(--media-height);
}

#body img {
    display: block;
}

.media img {
    height: var(--media-height);
}

.media img.badge {
    height: calc(var(--media-height) / 2);
}

/* ============================================
   EPISODES & ARTICLES
   ============================================ */
.episodes, .articles {
    margin: auto;
    max-width: 1080px;
    display: flex;
    flex-wrap: wrap;
    text-align: center;
    gap: 1rem;
    justify-content: center;
}

.episodes a {
    text-decoration: none;
}

.episodes .episode, .articles .article {
    width: 320px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    padding: var(--spacing-md);
}

.articles2 h2 {
    text-align: center;
}

.articles .article {
    min-height: 320px;
    color: black;
    justify-content: center;
}

.article .title {
    color: var(--teal);
    font-weight: bold;
}

.episodes .episode img {
    margin: auto;
    margin-top: 5px;
    margin-bottom: 5px;
}

.episodes .episode span {
    margin: 0;
}

.episode .number {
    font-size: var(--font-size-episode-number);
    color: var(--title-color);
}
.episode .title { font-size: var(--font-size-episode-title); }
.episode .date { font-size: var(--font-size-episode-date); }

.episode.audio {
    display: flex;
    font-size: var(--font-size-episode-date);
    background-color: var(--hero-bg);
    width: 100%;
    min-height: 200px;
}

.episode.audio img {
    margin-right: var(--spacing-lg);
    height: var(--media-height);
}

.episode audio {
    margin-top: auto;
}

/* ============================================
   PROJECTS
   ============================================ */
.projects {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    justify-content: center;
    margin: var(--spacing-md) 0;
}

.project {
    text-align: center;
}

.project img, .project iframe {
    width: 250px;
    height: 150px;
    margin: var(--spacing-sm) auto 0;
    display: block;
}

.project p {
    margin-top: 0.25em;
    margin-bottom: 0.25em;
}

/* ============================================
   CODE & PREFORMATTED TEXT
   ============================================ */
pre, code {
    font-size: var(--font-size-code);
    background-color: var(--code-bg);
    padding: var(--spacing-sm);
}

/* ============================================
   FORMS & BUTTONS
   ============================================ */
form {
    border: 2px black solid;
    padding: var(--spacing-md);
}

.button {
    display: inline-block;
    margin: auto;
    margin-top: 1rem;
    padding: var(--spacing-md) 4em;
    background-color: var(--teal);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
}

/* ============================================
   TABLES
   ============================================ */
table {
    width: 100%;
    margin: var(--spacing-md) 0;
    border-collapse: collapse;
    padding: var(--spacing-sm);
    white-space: nowrap;
    background-color: var(--table-bg);
    border: 2px var(--table-border) solid;
    overflow: auto;
    text-overflow: ellipsis;
}

table td, table th {
    text-align: left;
    padding: 2px var(--spacing-md);
}

table th {
    color: black;
    background-color: var(--table-header-bg);
    border-bottom: 2px #000000 solid;
    border-right: 2px #000000 solid;
}

table td {
    border-right: 1px #222222 solid;
    border-left: 1px #222222 solid;
}

table tr:nth-child(even) {
    background-color: var(--table-even-row-bg);
}

table tbody tr:hover {
    background-color: var(--table-hover-bg);
}

table thead {
    position: sticky;
    top: 0;
}

table tfoot {
    position: sticky;
    bottom: 0;
}

.outertable {
    overflow: scroll;
    margin: 1.5em 0 1.4em;
}

.outertable table {
    margin: 0 0 0.1em;
}

/* ============================================
   MISC ELEMENTS
   ============================================ */
blockquote {
    border-left: 5px var(--blockquote-border) solid;
    padding-left: var(--spacing-md);
}

hr {
    width: 50%;
    margin: var(--spacing-md) auto;
}

.sidebar {
    padding: var(--spacing-sm) var(--spacing-md);
    background-color: var(--card-bg);
    margin-bottom: 1em;
}

.plot {
    margin: 2em 0;
}

.svgwrap {
    width: 1100px;
    border: 2px solid gray;
}

.svg {
    width: 100%;
    height: 100%;
}

#body .video {
    margin: var(--spacing-md);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
    body {
        text-align: left;
    }

    section#body {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .hero, .fpitem {
        flex-direction: column;
    }

    .hero .media, .fpitem .media {
        width: 100%;
        height: auto;
    }

    .media img {
        width: 100%;
        height: auto;
        max-height: none;
    }

    .media img.badge {
        width: auto;
        height: 200px;
    }

    .hero .content, .fpitem .content {
        width: 100%;
        margin-left: 0;
        padding: var(--spacing-md) 0;
    }

    .gridpage .media, .gridpage .content {
        width: 100%;
    }

    .button {
        padding: var(--spacing-md) 2em;
        display: block;
        text-align: center;
    }

    header .left, header .right {
        width: auto;
    }

    header {
        margin-bottom: var(--spacing-md);
        height: auto;
    }

    footer {
        margin-top: var(--spacing-md);
        flex-direction: column;
        height: auto;
    }

    .episodes, .articles {
        flex-direction: column;
        align-items: stretch;
    }

    .episodes .episode, .articles .article {
        width: 100%;
    }

    .episode.audio {
        flex-direction: column;
        text-align: center;
    }

    .episode.audio .media {
        width: 100%;
        height: auto;
        margin-bottom: var(--spacing-md);
    }

    .episode.audio img {
        width: 100%;
        height: auto;
        max-width: 400px;
        margin-right: 0;
    }

    .episode.audio .content {
        width: 100%;
    }

    .episode.audio audio {
        width: 100%;
    }
}
