/* Light/Dark mode switching fixes */
:root {
    color-scheme: light;
    --text-color: #333;
    --bg-color: #f8f9fa;
    --input-bg: #fff;
}

body {
    color: var(--text-color);
    background-color: var(--bg-color);
}

input,
select,
textarea,
button {
    color: var(--text-color);
    background-color: var(--input-bg);
}

/* General styling */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    width: 100%;
    overflow-x:
}

/* Link styling */
a {
    color: #1e90ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

a.new {
    color: #ba0000;
}

a.new::after {
    content: " (page does not exist)";
    font-size: 0.8em;
}

/* Header styling */
#header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
}

.header-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 15px;
}

#header h1 {
    margin: 0;
    font-size: 1.5em;
}

#header h1 a {
    text-decoration: none;
    color: #333;
}

.title-rtl {
    direction: rtl;
}

/* Search styling */
#search-form {
    flex-basis: 100%;
    order: 2;
    margin-top: 10px;
}

#search-form input[type="text"],
#search-form select,
#search-form button {
    flex: 1;
    padding: 5px;
    margin: 5px;
    box-sizing: border-box;
}

#search-form input[type="text"] {
    width: 300px;
    padding: 5px;
}

#search-form select,
#search-form button {
    padding: 5px;
}

/* Content styling */
#content {
    padding: 20px;
    overflow-x: hidden;
}

h1 {
    font-size: 2em;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* General sidebar styling */
.mw-content-rtl .sidebar {
    float: left;
    clear: left;
}

.sidebar {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 10px;
    margin: 10px 0;
    float: right;
    width: 300px;
    min-width: 300px;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    clear: right;
}

.sidebar-title-with-pretitle,
.sidebar-list-title {
    background-color: #ccccff;
    font-size: 1em;
    padding: 0.5em;
    margin: 0.4em 0;
    text-align: center;
}

.sidebar-image {
    text-align: center;
    margin: 1em 0;
}

.sidebar-content {
    font-size: 0.9em;
    line-height: 1.5;
}

.sidebar-content a {
    color: #1e90ff;
    text-decoration: none;
}

.sidebar-content a:hover {
    text-decoration: underline;
}

.sidebar-content ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

/* Collapsible sections */
.sidebar-list {
    position: relative;
}

.sidebar-list-title {
    cursor: pointer;
    background-color: #ddddff;
    text-align: center;
    padding: 0.5em;
    color: var(--color-base);
    border: 1px solid #ccc;
    transition: background-color 0.3s ease;
}

.sidebar-list-title:after {
    content: "\25BC";
    /* Down arrow */
    float: right;
    margin-right: 10px;
    transition: transform 0.3s ease;
}

.sidebar-list:hover .sidebar-list-title:after,
.sidebar-list:focus-within .sidebar-list-title:after {
    transform: rotate(-180deg);
    /* Rotate arrow to point up */
}

.sidebar-list-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-list:hover .sidebar-list-content,
.sidebar-list:focus-within .sidebar-list-content {
    max-height: 1000px;
}


.toc {
    list-style-type: none;
    padding: 0;
}

.toc li {
    margin-bottom: 5px;
}

#footer {
    background-color: #ffffff;
    border-top: 1px solid #a2a9b1;
    padding: 10px;
    text-align: center;
}

.wm-category {
    display: inline;
    font-size: 0.8em;
}

.wm-category::before {
    content: "[";
}

.wm-category::after {
    content: "]";
}

.category-link {
    display: none;
}

/* General table styling */
.table {
    margin: 1em auto;
    font-size: small;
    border-collapse: collapse;
    max-width: 100%;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    display: block;
    overflow-x: auto;
}

.table th {
    background-color: #1e90ff;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 10px;
}

.table td {
    text-align: center;
    padding: 10px;
    border: 1px solid #ddd;
}

.table tr:nth-child(even) {
    background-color: #f2f2f2;
}

.table tr:hover {
    background-color: #ddd;
}

.table td div {
    font-weight: bold;
}

/* Specific class styling */
.succession-box {
    clear: both;
}

.hatnote {
    margin: 1em 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    font-size: small;
    font-style: italic;
}

.ambox {
    margin: 1em 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    font-size: small;
}

.listing-metadata {
    font-size: 0.8em;
    color: #555;
}

/* Evolution charts styling */
.clade {
    overflow-x: auto;
    overflow-y: hidden;
}

.clade p {
    font-size: inherit;
}

.clade {
    border-spacing: 0;
    margin: 0;
    font-size: 100%;
    line-height: 100%;
    border-collapse: separate;
    width: auto;
}

.clade .clade {
    width: 100%;
    line-height: inherit;
}

.clade .clade-label {
    min-width: 0.2em;
    width: 0.1em;
    padding: 0.1em 0.15em;
    vertical-align: bottom;
    text-align: center;
    border-left: 1px solid;
    border-bottom: 1px solid;
    white-space: nowrap;
}

.clade .clade-label::before,
.clade .clade-slabel::before {
    content: "\2060 ";
}

.clade .clade-fixed-width {
    overflow: hidden;
    text-overflow: ellipsis;
}

.clade .clade-fixed-width:hover {
    overflow: visible;
}

.clade .clade-label.first {
    border-left: none;
    border-right: none;
}

.clade .clade-label.reverse {
    border-left: none;
    border-right: 1px solid;
}

.clade .clade-slabel {
    padding: 0 0.15em;
    vertical-align: top;
    text-align: center;
    border-left: 1px solid;
    white-space: nowrap;
}

.clade .clade-slabel:hover {
    overflow: visible;
}

.clade .clade-slabel.last {
    border-left: none;
    border-right: none;
}

.clade .clade-slabel.reverse {
    border-left: none;
    border-right: 1px solid;
}

.clade .clade-bar {
    vertical-align: middle;
    text-align: left;
    padding: 0 0.5em;
    position: relative;
}

.clade .clade-bar.reverse {
    text-align: right;
    position: relative;
}

.clade .clade-leaf {
    border: 0;
    padding: 0;
    text-align: left;
}

.clade .clade-leafR {
    border: 0;
    padding: 0;
    text-align: right;
}

.clade .clade-leaf.reverse {
    text-align: right;
}

.linkA {
    background-color: yellow;
}

.linkB {
    background-color: green;
}


/* Navbox styling */
.navbox {
    padding: 3px;
    background-color: #f9f9f9;
    margin-bottom: 1em;
    font-size: small;
}

.navbox-title,
.navbox-group,
.navbox-abovebelow {
    background-color: #bbddff;
    padding: 10px;
    text-align: center;
}

.navbox-title {
    font-size: 114%;
    margin: 0 4em;
}

.navbox-group {
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.navbox-inner {
    border-spacing: 0;
    background: transparent;
    color: inherit;
}

.navbox-list-with-group {
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #ddd;
    display: flex;
}

.navbar {
    text-align: center;
    padding: 5px;
}

.hlist ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hlist ul li {
    display: inline;
    margin-right: 10px;
}

/* Authority control styling */
.authority-control {
    padding: 3px;
    text-align: left;
    margin-bottom: 1em;
    border: 1px solid #ddd;
}

/* Sidebar styling */
.mw-content-rtl .infobox {
    float: left;
    clear: left;
}

.infobox {
    float: right;
    margin: 1em;
    width: 300px;
    min-width: 300px;
    max-width: 100%;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    font-size: small;
    border-collapse: collapse;
    overflow-x: auto;
    clear: right;
}

.infobox .mw-default-size {
    float: unset;
}

.infobox-title {
    background-color: #1e90ff;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 10px;
}

.infobox-above,
.infobox-header {
    background-color: #1e90ff;
    color: white;
    font-weight: bold;
    text-align: center;
    padding: 10px;
}

.infobox-above a,
.infobox-header a {
    color: white;
}

.infobox-subheader {
    background-color: #bbddff;
    text-align: center;
    padding: 5px;
    font-weight: bold;
}

.infobox-full-data,
.infobox-label,
.infobox-data {
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

.infobox-label {
    background-color: #f2f2f2;
    text-align: left;
    font-weight: bold;
}

.ib-settlement-cols {
    display: flex;
    justify-content: space-around;
    padding: 10px 0;
}

.ib-settlement-caption {
    text-align: center;
    font-style: italic;
    margin-top: 5px;
}

.infobox-image .mw-default-size,
.infobox-signature .mw-file-element {
    max-width: 300px;
    height: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
    float: unset;
}

.infobox-caption {
    text-align: center;
    font-style: italic;
    margin-top: 5px;
    display: block;
}

/* Figure styling */
figure,
.tmulti,
.thumb {
    margin: 1em 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    max-width: 100%;
    display: inline-block;
    overflow-x: auto;
    width: fit-content;
}

figure img,
.tmulti .mw-file-element,
.thumb img {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    padding: 5px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

figcaption,
.thumbcaption {
    margin-top: 10px;
    font-size: small;
    color: #555;
    text-align: center;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.mw-halign-left,
.tleft {
    float: left;
    clear: left;
    margin-right: 1em;
}

.mw-halign-center {
    display: flex;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.mw-halign-right,
.tright {
    float: right;
    clear: right;
    margin-left: 1em;
}

.mw-default-size {
    width: fit-content;
    float: right;
    clear: right;
    max-width: 300px;
}

.mw-file-element {
    max-width: 100%;
    height: auto;
}

/* General styling for gallery */
.mw-gallery-packed {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0;
    list-style-type: none;
    margin: 0;
}

.mw-gallery-packed .gallerybox {
    margin: 5px;
    flex: 0 1 auto;
}

.mw-gallery-packed .thumb {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 5px;
    text-align: center;
}

.mw-gallery-packed .thumb img {
    max-width: 100%;
    height: auto;
    display: block;
}

.mw-gallery-packed .gallerytext {
    text-align: center;
    font-size: 0.9em;
    padding: 5px;
}

.mw-gallery-packed .gallerytext i {
    font-style: italic;
}

.mw-gallery-packed .gallerytext a {
    color: #1e90ff;
    text-decoration: none;
}

.mw-gallery-packed .gallerytext a:hover {
    text-decoration: underline;
}

/* Reference styling */
.reflist-lower-alpha .references {
    list-style-type: lower-alpha;
}

/* Interwiki link styling */
.sister-logo {
    display: inline-block;
}

.sister-link {
    display: inline;
    margin-left: 5px;
}

span {
    display: inline;
}

/* Side box styling */
.side-box {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 10px;
    margin: 10px 0;
    float: right;
    min-width: 300px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    clear: right;
}

.side-box-right {
    float: right;
}

.side-box-flex {
    display: flex;
    align-items: center;
}

.side-box-image {
    flex: 0 0 auto;
    margin-right: 10px;
}

.side-box-image img {
    display: block;
    max-width: 100%;
    height: auto;
}

.side-box-text {
    flex: 1 1 auto;
    font-size: 0.9em;
    line-height: 1.5;
}

.side-box-text a {
    color: #1e90ff;
    text-decoration: none;
}

.side-box-text a:hover {
    text-decoration: underline;
}

/* Media query for larger devices */
@media (min-width: 769px) {
    #content {
        padding-left: 5em;
        padding-right: 5em;
    }
}

/* General styling for Wikisource index container */
#ws-index-container {
    width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

#ws-index-main-cell {
    vertical-align: top;
    padding: 20px;
}

#ws-index-main-table {
    width: 100%;
    border-collapse: collapse;
}

#ws-index-cover-container {
    text-align: center;
    margin-bottom: 20px;
}

#ws-index-cover-container img {
    max-width: 100%;
    height: auto;
}

#ws-index-metadata {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
}

.ws-index-row {
    border-bottom: 1px solid #ddd;
}

.ws-index-label {
    background-color: #f2f2f2;
    text-align: left;
    font-weight: bold;
    padding: 10px;
    width: 30%;
}

.ws-index-value {
    padding: 10px;
    text-align: left;
}

.ws-index-value a {
    color: #1e90ff;
    text-decoration: none;
}

.ws-index-value a:hover {
    text-decoration: underline;
}

/* Styling for collapsible sections */
.mw-collapsible {
    margin-top: 20px;
}

.mw-collapsible em {
    font-weight: bold;
}

#index-pagelist-legend {
    font-size: 0.9em;
    color: #555;
}

.index-pagelist {
    margin-top: 10px;
}

.index-pagelist a {
    display: inline-block;
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
}

.index-pagelist a:hover {
    background-color: #e9e9e9;
}

.prp-index-pagelist-page {
    display: inline-block;
    margin-right: 5px;
    margin-bottom: 5px;
    padding: 5px 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    font-size: 0.9em;
}

.prp-index-pagelist-page:hover {
    background-color: #e9e9e9;
}

/* Styling for Wikisource remarks section */
#ws-index-remarks {
    padding: 20px;
    border-left: 1px solid #ddd;
    vertical-align: top;
}

.wst-center {
    text-align: center;
    margin-bottom: 20px;
}

.wst-center p {
    margin: 0;
}

.toc_list {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.toc_list td {
    padding: 5px;
    border-bottom: 1px solid #ddd;
}

.wst-rule {
    border: none;
    border-top: 1px solid #ddd;
    margin: 10px 0;
}

.wst-rule-center {
    width: 50%;
    margin-left: auto;
    margin-right: auto;
}

.__nop {
    display: none;
}

/* Wikinews comments request

Currently blocked by implementation of comments retrieval in the backend

#commentrequest {
    display: inline-block !important;
    font-size: 0;
}

#commentrequest a::after {
    content: "View comments section";
    font-size: 1rem;
}
*/

/* Footnote weirdness */
.mw-reflink-text.lower-alpha::before {
    content: "[" counter(mw-Ref, lower-alpha) "]";
}

.mw-reflink-text.upper-alpha::before {
    display: inline;
    content: "[" counter(mw-Ref, upper-alpha) "]";
}

.mw-reflink-text.lower-roman::before {
    content: "[" counter(mw-Ref, lower-roman) "]";
}

.mw-reflink-text.upper-roman::before {
    content: "[" counter(mw-Ref, upper-roman) "]";
}

.mw-reflink-text.decimal::before {
    content: "[" counter(mw-Ref, decimal) "]";
    ;
}

.mw-reflink-text::before {
    font-size: 1rem;
}

.mw-reflink-text.lower-alpha,
.mw-reflink-text.upper-alpha,
.mw-reflink-text.lower-roman,
.mw-reflink-text.upper-roman,
.mw-reflink-text.decimal {
    font-size: 0;
}

/* Wikidata content styling */
.wikibase-entityview-main {
    display: flex;
    flex-direction: column;
}

.wikibase-entitytermsview-heading {
    margin-bottom: 20px;
}

.wikibase-entitytermsview-heading-description {
    font-size: 1.1em;
    color: #333;
}

.wikibase-entitytermsview-heading-aliases {
    font-size: 0.9em;
    color: #555;
}

.wikibase-entitytermsview-aliases-alias {
    display: inline-block;
    margin-right: 10px;
}

.wikibase-toolbar-container {
    margin-top: 10px;
}

.wikibase-toolbar-button-edit {
    color: #1e90ff;
    text-decoration: none;
}

.wikibase-statementgrouplistview {
    margin-top: 20px;
}

.wikibase-statementgroupview {
    margin-bottom: 20px;
}

.wikibase-statementgroupview-property-label {
    font-weight: bold;
    color: #333;
}

.wikibase-statementlistview {
    margin-top: 10px;
}

.wikibase-statementview {
    border-top: 1px solid #ddd;
    padding: 10px 0;
}

.wikibase-statementview-mainsnak {
    display: flex;
    align-items: center;
}

.wikibase-snakview-property-container {
    margin-right: 10px;
}

.wikibase-snakview-value-container {
    flex: 1;
}

.wikibase-snakview-value a {
    color: #1e90ff;
    text-decoration: none;
}

.wikibase-snakview-value a:hover {
    text-decoration: underline;
}

.wikibase-statementview-references-container {
    margin-top: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
}

.wikibase-statementview-references-heading {
    font-weight: bold;
    margin-bottom: 5px;
}

.wikibase-statementview-references {
    font-size: 0.9em;
}

.wikibase-statementview-references a {
    color: #1e90ff;
}

.wikibase-sitelinkgrouplistview {
    margin-top: 20px;
}

.wikibase-sitelinkgroupview-heading-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wikibase-sitelinkgroupview-heading {
    font-size: 1.2em;
    font-weight: bold;
}

.wikibase-sitelinkview {
    margin: 5px 0;
}

.wikibase-sitelinkview-siteid {
    font-weight: bold;
    margin-right: 10px;
}

.wikibase-sitelinkview-link a {
    color: #1e90ff;
    text-decoration: none;
}

.wikibase-sitelinkview-link a:hover {
    text-decoration: underline;
}

.wikibase-sitelinkgroupview-counter {
    margin-left: 1em;
}

.wikibase-toolbar-container,
.wikibase-entitytermsview-entitytermsforlanguagelistview {
    display: none;
}

@media (min-width: 992px) {
    #search-form {
        flex-basis: auto;
        flex-grow: 1;
        order: unset;
        margin-top: 0;
        margin-left: 20px;
    }
}

/* Media query for devices with a max width of 768px */
@media (max-width: 768px) {
    #header {
        flex-direction: column;
        align-items: center;
    }

    .header-right {
        margin: 10px 0;
    }

    #search-form {
        width: 100%;
    }

    #header h1 {
        margin-bottom: 10px;
        font-size: 1.2em;
    }

    #content {
        padding: 10px;
    }

    .sidebar,
    .infobox {
        max-width: 100%;
        margin: 10px 0;
        float: none;
        clear: none;
    }

    .table {
        max-width: 100%;
        overflow-x: auto;
    }

    figure,
    .tmulti {
        max-width: 100%;
        display: block;
        margin: 10px 0;
    }

    .side-box {
        max-width: 100%;
        margin: 10px 0;
        float: none;
        clear: none;
    }

    .mw-gallery-packed {
        flex-direction: column;
        align-items: center;
    }

    .mw-gallery-packed .gallerybox {
        width: 100%;
        max-width: 300px;
    }

    .mw-gallery-packed .thumb {
        max-width: 100%;
    }

    #ws-index-container {
        padding: 10px;
    }

    #ws-index-main-cell,
    #ws-index-remarks {
        padding: 10px;
    }

    #ws-index-remarks {
        border-left: none;
        border-top: 1px solid #ddd;
        margin-top: 20px;
    }
}

/* Media query for devices with a max width of 480px */
@media (max-width: 480px) {
    #header {
        padding: 10px;
    }

    #header h1 {
        font-size: 1em;
    }

    #search-form input[type="text"],
    #search-form select,
    #search-form button {
        padding: 10px;
    }

    #content {
        padding: 5px;
    }

    h1 {
        font-size: 1.5em;
    }

    .sidebar,
    .infobox {
        max-width: 100%;
        margin: 5px 0;
        float: none;
        clear: none;
    }

    .sidebar-content {
        font-size: 0.8em;
    }

    .table th,
    .table td {
        padding: 5px;
    }

    figure,
    .tmulti {
        max-width: 100%;
        margin: 5px 0;
    }

    .side-box {
        max-width: 100%;
        margin: 5px 0;
        float: none;
        clear: none;
    }

    .side-box-text {
        font-size: 0.8em;
    }
}

/* Language selector styling */
.language-selector {
    position: relative;
    display: inline-block;
}

.language-selector-toggle {
    display: none;
}

.language-selector-label {
    cursor: pointer;
    display: inline-block;
    padding: 0.5em;
    border: 1px solid #ccc;
    border-radius: 0.25em;
}

.language-selector-label-text {
    display: inline-block;
    margin-right: 0.5em;
}

.language-selector-label-icon {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 0.25em solid transparent;
    border-right: 0.25em solid transparent;
    border-top: 0.25em solid #333;
}

.language-selector-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 0.25em;
}

.language-selector-toggle:checked+.language-selector-label+.language-selector-menu {
    display: block;
}

.language-selector-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
}

.language-selector-item {
    border-top: 1px solid #ccc;
}

.language-selector-link {
    display: block;
    padding: 0.5em;
    text-decoration: none;
    color: #333;
}

.language-selector-link:hover {
    background-color: #f0f0f0;
}

.language-selector-link:active {
    background-color: #e0e0e0;
}

.language-selector-link:focus {
    outline: 1px dotted #333;
    outline: 5px auto -webkit-focus-ring-color;
}

.language-selector-link:active,
.language-selector-link:focus {
    outline: none;
}

.language-selector-link:active,
.language-selector-link:focus {
    outline: none;
}

.badge>img {
    max-height: 1em;
}