:root {
    /* Colors */
    --color-venusian-light: #faf9fb;
    --color-venusian-accent: #c59754;
    --color-venusian-highlight: #c79563;
    --color-venusian-background: #924410d9;
    --color-venusian-foreground: #fde48d;
    --color-venusian-link: #fff8dc;
    --color-venusian-dark: #2a1c10a1;
    --color-transparent: rgba(0, 0, 0, 0);
}


html {
    margin: 0;
    padding: 0;
}

body {
    font-size: calc(1em + .1vw);
    /* font grows 1px for every 100px of viewport width */
    line-height: calc(1.7em + 0.5vw);
    /* leading grows along with font, with an additional 0.1em + 0.5px per 100px of the viewport */
    font-family: "Trebuchet MS", Helvetica, sans-serif;
    font-weight: 200;
    color: var(--color-venusian-foreground);
    align-content: center;
    background-color: rgb(0, 0, 0);
    background-image: url('../images/maat-mons-on-venus1200.png');
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    background-position-y: 225px;
    background-position-x: center;
}
#container {
    /* align-content: center; */
    /* margin: 0 auto; */
    background-color: var(--color-venusian-dark);
    min-height: 1200px;
    max-width: 968px;
}
/* The missions table queries this panel, not the viewport. The article is
   the full width of the center column, which is capped at 968px. */
article {
    container-type: inline-size;
    container-name: panel;
}
#header {
    width: auto;
    background-color: var(--color-transparent);
    height: 300px;
    margin: 0;
    padding: 0 10px;
    background-image: url('../images/mercury-venus-earth-mars900trans.png');
    background-repeat: no-repeat;
    background-size: contain;
    background-position-x: center;
    z-index: 0;
}
#hacker {
    width: 100%;
    margin: 0;
    padding: 0;
    align-content: center;
}
#hacker img {
    margin: 0 auto;
    display: block;
    max-width: 100%;
    width: 100vw;
    position: sticky;
    top: 0;
    opacity: 0.8;
    z-index: 1;
    /* border: solid aliceblue; */
}
#logo {
    width: 100%;
    margin: 0;
    padding: 0;
    align-content: center;
}
#logo img {
    margin: 0 auto;
    padding: 5px;
    display: block;
    max-width: 100%;
    position: sticky;
    top: 0;
    z-index: 3;
}
article p, article ul {
    text-align: justify;
    padding: 1%;
    background-color: var(--color-venusian-background);
    border-radius: 3px;
    list-style-image: url('../images/venusbullet.png');
    z-index: 2;
}
article ul {
    margin-left: 30px;
    padding-left: 15px;
}
article a, article p a:link, article p a:visited, article p a:active,
#footer a, #footer a:link, #footer a:visited, #footer a:active {
    color: var(--color-venusian-link);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}
article a:hover, #footer a:hover {
    color: #ffffff;
    text-decoration-thickness: 2px;
}
article a:focus-visible, #footer a:focus-visible {
    outline: 2px solid var(--color-venusian-link);
    outline-offset: 2px;
}

/* Link Logos and Flags */
.link_logo {
    height: 1em;
    margin: 0;
    padding: 0;
    align-content: center;
}

/* Grid System */


/*  SECTIONS  */

.section {
    clear: both;
    padding: 0px;
    margin: 0px;
}

/*  COLUMN SETUP  */

.col {
    display: block;
    float: left;
    margin: 1% 0 1% 1.6%;
}
.col:first-child {
    margin-left: 0;
}

/*  GROUPING  */

.group:before, .group:after {
    content: "";
    display: table;
}
.group:after {
    clear: both;
}
.group {
    zoom: 1;
    /* For IE 6/7 */
}

/*  GRID OF FIVE  */

.span_3_of_5 {
    width: 59.36%;
    min-width: 768px;
    max-width: 968px;
}
.span_1_of_5 {
    width: 18.72%;
    /* width: calc(calc(100vh - 968px) \ 2); */
}

/*  GO FULL WIDTH BELOW 968 PIXELS */

@media only screen and (max-width: 768px) {
    .col {
        margin: 1% 0 1% 0%;
    }
    .span_1_of_5, .span_2_of_5, .span_3_of_5, .span_4_of_5, .span_5_of_5 {
        width: 100%;
    }
    .span_3_of_5 {
        min-width: 100vmin;
    }
}

/* Table Styles */
/* from:  https://codepen.io/Orangetronic/pen/pJgpXw */
/* 
body {
    padding: 2em;
} */

table {
    width: 100%;
    background-color: var(--color-venusian-background);
    font-size: 1em;
    border-radius: 3px;
}

table th,
table td {
    text-align: left;
    font-size: 0.7em;
    padding: 0.25em;
    word-wrap: normal;
}

table tr:nth-child(odd) {
    background-color: var(--color-venusian-dark);
}

td.edit-buttons {
    text-align: right;
}

button {
    border-radius: 3px;
    border: none;
    margin: 0 0.25em;
    transition: all 0.3s;
}

button:hover {
    box-shadow: 0 0 4px rgba(3, 3, 3, 0.8);
    opacity: 0.9;
}

button.edit {
    background: #6F9;
}

button.delete {
    background: #F69;
}

@media screen and (max-width: 800px) {
    tr {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        margin: 0.5em 0;
        border: 1px solid rgba(3, 3, 3, 0.2);
    }

    td,
    th {
        flex: 1 1 150px;
        border: 0.5px solid rgba(3, 3, 3, 0.2);
    }

    /* td.edit-buttons,
    td.empty {
        /*flex: 1 0 90%;
        text-align: center;
    } */
}

table * {
    box-sizing: border-box;
    font-family: "Trebuchet MS", Helvetica, sans-serif;
}

/* Mission flags. The nation name is the text; the image is decorative.
   Agency logos are dark artwork, so they sit on the existing light Venus color
   and stay readable on the umber table. Country flags keep their own colors. */
img.mission-flag,
img.mission-logo {
    /* 16px matches the old 16x12 flag icons. Table text is 0.7em, so an em
       height would shrink the flags below the size they are drawn at. */
    height: 16px;
    width: auto;
    vertical-align: -2px;
    margin: 0 0.3em 0 0;
}
img.mission-logo {
    background-color: var(--color-venusian-light);
    padding: 0.05em 0.12em;
    border-radius: 2px;
}
article ul.mission-list {
    list-style: none;
    list-style-image: none;
    margin-left: 0;
}
p.mission-note {
    font-size: 0.85em;
}

/* Nine-column mission tables (history and planned).
   Columns, in order: 1 Mission, 2 Date, 3 Vehicle, 4 Nation,
   5 Operator, 6 Outcome, 7 Detail, 8 Notes, 9 Source.
   Nine columns are readable only once the panel is about 1100px wide.
   This page's center column is capped at 968px, so the desktop panel
   uses the stack too. Wider than 1100px, the normal table returns.

   Stacked row:
     1 2 3 4 5 6 9
     7 7 7 7 7 7 7
     8 8 8 8 8 8 8

   Container query watches the panel. The viewport query is the fallback
   for browsers without container queries. 2400px covers ordinary monitors,
   where the panel is still under 968px and nine columns still do not fit. */
table.missions .stack-label {
    /* Hidden while the column headers are on screen. Shown with the stack. */
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

@container panel (max-width: 1100px) {
    table.missions {
        display: block;
        position: relative;
        border-collapse: separate;
        border-spacing: 0;
    }
    /* Keep the header cells in the document for assistive tech, but clip
       them out of the stacked layout. Detail and Notes carry their own labels. */
    table.missions tr:first-child {
        display: block;
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        white-space: nowrap;
        border: 0;
    }
    table.missions tr:not(:first-child) {
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        grid-template-areas:
            "mission date vehicle nation operator outcome source"
            "detail detail detail detail detail detail detail"
            "notes notes notes notes notes notes notes";
        column-gap: 0.45em;
        row-gap: 0.4em;
        margin: 0 0 0.85em;
        padding: 0.55em 0.45em 0.7em;
        border: 0;
        border-bottom: 2px solid var(--color-venusian-foreground);
    }
    table.missions tr:not(:first-child) td {
        display: block;
        flex: none;
        min-width: 0;
        border: 0;
        overflow-wrap: break-word;
    }
    table.missions tr:not(:first-child) td:nth-child(1) { grid-area: mission; }
    table.missions tr:not(:first-child) td:nth-child(2) { grid-area: date; }
    table.missions tr:not(:first-child) td:nth-child(3) { grid-area: vehicle; }
    table.missions tr:not(:first-child) td:nth-child(4) { grid-area: nation; }
    table.missions tr:not(:first-child) td:nth-child(5) { grid-area: operator; }
    table.missions tr:not(:first-child) td:nth-child(6) { grid-area: outcome; }
    table.missions tr:not(:first-child) td:nth-child(7) { grid-area: detail; }
    table.missions tr:not(:first-child) td:nth-child(8) { grid-area: notes; }
    table.missions tr:not(:first-child) td:nth-child(9) { grid-area: source; }
    /* An empty Notes cell would leave a blank full-width band. */
    table.missions tr:not(:first-child) td:nth-child(8):empty {
        display: none;
    }
    table.missions .stack-label {
        position: static;
        width: auto;
        height: auto;
        margin: 0 0 0.15em;
        overflow: visible;
        clip: auto;
        clip-path: none;
        white-space: normal;
        display: block;
        font-weight: bold;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        color: var(--color-venusian-foreground);
    }
}

/* Same stack, for browsers that ignore container queries. */
@supports not (container-type: inline-size) {
    @media screen and (max-width: 2400px) {
        table.missions {
            display: block;
            position: relative;
            border-collapse: separate;
            border-spacing: 0;
        }
        table.missions tr:first-child {
            display: block;
            position: absolute;
            width: 1px;
            height: 1px;
            margin: -1px;
            padding: 0;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            clip-path: inset(50%);
            white-space: nowrap;
            border: 0;
        }
        table.missions tr:not(:first-child) {
            display: grid;
            grid-template-columns: repeat(7, minmax(0, 1fr));
            grid-template-areas:
                "mission date vehicle nation operator outcome source"
                "detail detail detail detail detail detail detail"
                "notes notes notes notes notes notes notes";
            column-gap: 0.45em;
            row-gap: 0.4em;
            margin: 0 0 0.85em;
            padding: 0.55em 0.45em 0.7em;
            border: 0;
            border-bottom: 2px solid var(--color-venusian-foreground);
        }
        table.missions tr:not(:first-child) td {
            display: block;
            flex: none;
            min-width: 0;
            border: 0;
            overflow-wrap: break-word;
        }
        table.missions tr:not(:first-child) td:nth-child(1) { grid-area: mission; }
        table.missions tr:not(:first-child) td:nth-child(2) { grid-area: date; }
        table.missions tr:not(:first-child) td:nth-child(3) { grid-area: vehicle; }
        table.missions tr:not(:first-child) td:nth-child(4) { grid-area: nation; }
        table.missions tr:not(:first-child) td:nth-child(5) { grid-area: operator; }
        table.missions tr:not(:first-child) td:nth-child(6) { grid-area: outcome; }
        table.missions tr:not(:first-child) td:nth-child(7) { grid-area: detail; }
        table.missions tr:not(:first-child) td:nth-child(8) { grid-area: notes; }
        table.missions tr:not(:first-child) td:nth-child(9) { grid-area: source; }
        table.missions tr:not(:first-child) td:nth-child(8):empty {
            display: none;
        }
        table.missions .stack-label {
            position: static;
            width: auto;
            height: auto;
            margin: 0 0 0.15em;
            overflow: visible;
            clip: auto;
            clip-path: none;
            white-space: normal;
            display: block;
            font-weight: bold;
            letter-spacing: 0.04em;
            text-transform: uppercase;
            color: var(--color-venusian-foreground);
        }
    }
}

/* Footer discovery links. #footer is outside #container, so give the
   text column the same umber veil that already meets WCAG AA on the
   Maat Mons background image. */
#footer .span_3_of_5 {
    background-color: var(--color-venusian-dark);
    border-radius: 3px;
    padding: 1%;
}
#footer .span_3_of_5 p {
    margin: 0 0 0.5em;
}
#footer ul.nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25em 1.25em;
}
#footer ul.nav li {
    margin: 0;
    padding: 0;
}
