/* Constants */
:root {
    --font-family-title: "Fondamento", serif;
    --font-family-main: "Montserrat", serif;

    --page-border-bg: #e9eef8;
    --default-bg: white;

    --page-border-radius: 10px;
    --page-box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);    
    --padding-page: 20px;

    --font-size-page-title: 24pt;
    --font-size-game-card-title: large;
    --font-size-game-row: small;
    --font-size-game-row-header: x-small;
    --font-size-game-tag: smaller;
    --font-size-game-alias: smaller;
    --font-size-game-related-link: smaller;

    --horizontal-rule-color: #aaaaaa;
    --horizontal-rule-width: 1px;
    --horizontal-rule-label-color: #aaaaaa;

    --card-border-color: black;
    --card-border-width: 1px;
    --card-border-radius: 5px;

    --color-game-tag-border: #7eaa92;
    --color-game-tag-bg: #cdeedc;

    --unsel-tag-bg: #cccccc;
    --include-tag-bg: #4caf50;
    --exclude-tag-bg: #f44336;

    --color-game-alias-border: #efbfee;

    --color-game-related-link-border: #888eba;
    --color-game-related-link-hover-bg: #a1b7e7;

    --padding-small: 2pt;
    --padding-medium: 5px;
    --padding-large: 10px;

    --tag-border-width: 1px;
    --game-row-indent: 10pt;
}

body {
    font-family: var(--font-family-main);
    font-optical-sizing: auto;
    margin: var(--padding-page);
    background-color: var(--page-border-bg);
}

.inner-body {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--padding-page);
    background-color: var(--default-bg);
    border-radius: var(--page-border-radius);
    box-shadow: var(--page-box-shadow);
}

.inner-body 

.bold {
    font-weight: bold;
}

.italic {
    font-style: italic;
}

.underline {
    text-decoration: underline;
}

.page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12pt;
}

.page-title {
    font-family: var(--font-family-title);
    font-size: var(--font-size-page-title);
    font-weight: 400;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.page-subtitle {
    font-size: xx-small;
    align-items: center;    
}

.logo {
    width: 64px;
    height: 64px;
}

.logo-counterbalance {
    width: 64px;
    height: 64px;
    line-height: 0.5;
    text-align: right;
    align-content: center;
}

.horizontal-rule-with-label {
    font-size: xx-small;
    color: var(--horizontal-rule-label-color); 
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    border-bottom: var(--horizontal-rule-width) solid var(--horizontal-rule-color);
}

.game-letter-rule-line {
    font-size: xx-small;
    color: var(--horizontal-rule-label-color); 
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    border-bottom: var(--horizontal-rule-width) solid var(--horizontal-rule-color);
}

.control-pane {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.search-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.search-textbox {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 400px;
    max-width: 100%;
}

.collapsible-header {
    order: 1;
    background-color: white;
    color: black;
    cursor: pointer;
    border: solid 1px black;
    display: flex;
    width: fit-content;
    border-radius: 10px;
    justify-content: space-between;
    gap: 10px;
    padding: 2pt 0pt 0pt 10pt;
    position: relative;
    top: 1px;
    flex-wrap: wrap;
    align-content: center;
}

.collapsible-header:hover {
    background-color: #f0f0f0;
}

.collapsible-header.active {
    border-radius: 10px 10px 0 0;
    border-width: 1px 1px 0 1px;
}

.collapsible-header:after {
    content: '+';
    font-size: larger;
    font-weight: bold;
    color: black;
    margin-left: 0px;
    width: 1em;
    position: relative;
    top: -1px;
}
  
.collapsible-header.active:after {
    content: '–'; /* em dash */
    top: -3px;
}

.collapsible-content {
    order: 99;
    padding: 0 18px;
    border: solid 1px black;
    display: none;
    overflow: hidden;
    background-color: white;
    border-radius: 0 10px 10px 10px;
}

.collapsible-content.active {
    display: block;
}

.hidden {
    display: none!important;
}

.block {
    display: block;
}

.tag-list {
    margin-bottom: 20px;
}

.tag-button {
    padding: 5px 10px;
    margin: 5px;
    border: 1px solid var(--unsel-tag-bg);
    cursor: pointer;
    border-radius: 5px;
}
.tag-button.checked {
    background-color: var(--include-tag-bg);
    color: white;
}
.tag-button.unchecked {
    background-color: var(--exclude-tag-bg);
    color: white;
}

.lists-container {
    display: flex;
    flex-direction: column;
}

.lists-container .row {
    display: flex;
    flex-direction: row;
}

.list-button {
    background-color: transparent;
    background-repeat: no-repeat;
    background-size:contain;
    border-radius: 5px;
    border: 1px solid var(--unsel-tag-bg);
    cursor: pointer;
    margin: 5px;
    padding: 5px 10px;
    /* Make aspect ration 1:1 */
    width: 30px;
    height: 30px;
}

.list-delete-button {
    background-image: url(./img/icons/trash-red.svg);
}

.list-delete-button:hover {
    background-image: url(./img/icons/trash-black.svg);
}

.list-share-button {
    background-image: url(./img/icons/send-to-black.svg);
}

.list-share-button:hover {
    background-image: url(./img/icons/send-to-blue.svg);
}


.game-list {
    margin-top: 20px;
}
.game-card {
    display: flex;
    flex-direction: column;
    break-inside: avoid;
    padding-bottom: 12pt;
}

.game-card-title {
    font-weight: bold;
    font-size: var(--font-size-game-card-title);
    border: var(--card-border-width) solid var(--card-border-color);
    background-color: var(--default-bg);
    border-radius: var(--card-border-radius) var(--card-border-radius) 0px 0px;
    border-width: var(--card-border-width) var(--card-border-width) 0 var(--card-border-width);
    padding: var(--padding-small) var(--padding-medium);
    order: 1;
    position: relative;
    top: 1px;
    width: max-content;
}

.game-card-content {
    order: 99;
    border: 1px solid black;
    border-radius: 0px 5px 5px 5px;
    background-color: white;
}

.game-card:hover .game-card-title {
    background-color: #f0f0f0;
}

.game-card:hover .game-card-content {
    background-color: #f0f0f0;
}

.game-row {
    text-wrap-mode: wrap;
    font-size: var(--font-size-game-row);
    padding: var(--padding-small);
}

.game-row-header {
    font-size: var(--font-size-game-row-header);
    padding: var(--padding-small) 0 0 0;
    display: flex;
 }

.game-row-desc {
    font-size: small;
    padding: 2pt;
}

.game-row-content {
    padding-left: var(--game-row-indent);
}

.game-row-text {
    font-size: small;
}

.game-row-text p {
    margin-block-start: 0px;
    margin-block-end: 0px;
}

/* A blank line in the source separates blocks (paragraphs, lists); show it as space.
   (:not(:first-child) rather than "* + *" so it outranks the "p" rule above.) */
.game-row-text > :not(:first-child) {
    margin-block-start: 0.75em;
}

/* Put a bullet before the game-row-text-variation */
.game-row-text-variation:before {
    content: "\2023   ";
    color: black;
    font-size: normal;
}
.game-row-container {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 2pt;
    padding-left: var(--game-row-indent);
}

.game-tag {
    font-size: var(--font-size-game-tag);
    padding: var(--padding-small);
    margin: var(--padding-small);
    border: var(--tag-border-width) solid var(--color-game-tag-border);
    background-color: var(--color-game-tag-bg);
    border-radius: 5px;
}

.game-alias {
    font-size: var(--font-size-game-alias);
    padding: var(--padding-small);
    margin: var(--padding-small);
    background-color: var(--default-bg);
    border: var(--tag-border-width) solid var(--color-game-alias-border);
    border-radius: 5px;
}

.game-related-link {
    font-size: var(--font-size-game-related-link);
    padding: var(--padding-small);
    margin: var(--padding-small);
    background-color: var(--default-bg);
    border: var(--tag-border-width) solid var(--color-game-related-link-border);
    border-radius: 5px;
}

.game-related-link:hover {
    background-color: var(--color-game-related-link-hover-bg);
}

/* Notices above the game list: ignored link parameters, or a failed data load. */
.page-notice {
    margin: 10px 0;
    padding: 8px 12px;
    border-left: 4px solid var(--color-game-related-link-border);
    background-color: #f3f4fa;
    font-size: smaller;
}

.page-notice-error {
    border-left-color: var(--exclude-tag-bg);
    background-color: #fdecea;
}

@media print {
    .page-notice {
        display: none;
    }
}

.include-only {
    font-size: var(--font-size-game-tag);
    color: var(--include-tag-bg);
}

.exclude-only {
    font-size: var(--font-size-game-tag);
    color: var(--exclude-tag-bg);
}

.footer-content {
    font-size: x-small;
    display: flex;
    flex-direction: column;
    margin-top: 20px;
}

.footer-content p {
    color: black;
    margin-block-start: 0px;;
}


.card-title-button {
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.25em;
    transition: color 0.3s ease;
    position: relative;
    width: 20px;
    height: 20px;
    padding: 2px 2px;
    margin-left: 5px;
    background-repeat: no-repeat;
    background-size:contain;
    background-color: transparent;
}

/* Add tooltip base style */
.card-title-button[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: white;
    color: black;
    font-size: 0.8rem;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    /* Ensure all borders are visible */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.heart-button {
    background-image: url(./img/icons/heart-gray.svg);
}

.heart-button:hover {
    background-image: url(./img/icons/heart-plus.svg);
}

.heart-button.favorited {
    background-image: url(./img/icons/heart-red.svg)
}

.heart-button.favorited:hover {
    background-image: url(./img/icons/heart-minus.svg)
}

.add-to-list-button {
    background-image: url(./img/icons/add-to-playlist-gray.svg);
}

.add-to-list-button:hover {
    background-image: url(./img/icons/add-to-playlist-black.svg);
}

.share-button {
    background-image: url(./img/icons/send-to-gray.svg);
}

.share-button:hover {
    background-image: url(./img/icons/send-to-blue.svg);
}

.add-to-list-div {
    position: absolute;
    z-index: 1000;
    background-color: white;
    border: 1px solid black;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    display: block;
    max-height: 200px;
    overflow-y: auto;
}

.share-div {
    position: absolute;
    z-index: 1000;
    background-color: white;
    border: 1px solid black;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    min-width: 50%;
    overflow-y: auto;
    display: flex;
    flex-direction: row;
}

.share-div input {
    /* fill width to remain space in parent */
    flex-grow: 1;
}

.add-to-list-menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.add-to-list-menu button {
    /* inherit font from parent */
    font-family: inherit;
    font-size: inherit;

    background: none;
    border: none;
    padding: 5px;
    text-align: left;
    cursor: pointer;
    width: 100%;
}

.menu-checkbox-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
}


/* Show: Games / Variations / Glossary */
.show-section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
}

.show-label {
    font-size: small;
    margin-right: 5px;
}

/* A game listed again under one of its variation's names */
.game-row-variation-of {
    font-size: x-small;
    color: #555555;
    padding: var(--padding-small) var(--padding-medium);
}

.game-row-text-variation-listed {
    background-color: #fff6cc;
    border-radius: 3px;
}

.variation-name {
    font-weight: bold;
}

/* Glossary */
.glossary-section {
    margin-top: 24pt;
}

.glossary-heading {
    font-family: var(--font-family-title);
    font-weight: 400;
    font-size: x-large;
    margin: 0 0 6pt 0;
}

.glossary-empty {
    font-size: small;
    color: #555555;
}

.term-card .game-card-title {
    font-style: italic;
}

/* A glossary term in game text: looks like text with a dashed underline */
.glossary-term {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: help;
    text-decoration: underline dashed;
    text-decoration-color: #7a7a7a;
    text-underline-offset: 3px;
}

.glossary-term:hover,
.glossary-term:focus-visible {
    text-decoration-color: black;
    background-color: #eef3ff;
}

.term-overlay {
    position: absolute;
    z-index: 1100;
    max-width: min(420px, calc(100vw - 16px));
    box-sizing: border-box;
    background-color: white;
    border: 1px solid black;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
    padding: var(--padding-large);
    font-size: small;
}

.term-overlay:focus {
    outline: none;
}

/* On a narrow screen the overlay is a sheet along the bottom of the window */
.term-overlay.term-overlay-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: none;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 10px 10px 0 0;
}

.term-overlay-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.term-overlay-title {
    font-weight: bold;
    font-size: medium;
}

.term-overlay-close {
    background: none;
    border: none;
    font-size: large;
    cursor: pointer;
    padding: 0 4px;
}

.term-overlay-definition {
    margin: 6px 0;
}

.term-overlay-definition p {
    margin-block-start: 0;
    margin-block-end: 4px;
}

.term-overlay-glossary-link {
    display: inline-block;
    margin-top: 6px;
    font-size: x-small;
}

@media print {
    .inner-body {
        margin: 0px;
        padding: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .control-pane,
    .card-title-button,
    .term-overlay {
        display: none;
    }

    .glossary-term {
        text-decoration: none;
    }

    .game-card,
    .term-card {
        break-inside: avoid;
    }

    .glossary-heading {
        break-after: avoid;
    }
}