/* CSS custom properties */
:root {
    color-scheme: light;
    --accent-color: #1e90ff;
    --text-color: #202122;
    --text-muted: #54595d;
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --border-color: #a2a9b1;
    --border-light: #eaecf0;
    --input-bg: #ffffff;
    --header-height: 54px;
    --content-max-width: 1200px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Base */
body {
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
}

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

/* Link styling */
a {
    color: var(--accent-color);
    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 */
#header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-light);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    height: var(--header-height);
    max-width: var(--content-max-width);
    margin: 0 auto;
}

.site-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-color);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.2px;
}

.site-name:hover {
    text-decoration: none;
    opacity: 0.8;
}

.header-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
}

.title-rtl {
    direction: rtl;
}

/* Search form */
#search-form {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
    order: unset;
    margin-top: 0;
}

#search-form input[type="text"],
#search-form select,
#search-form button {
    padding: 0.35rem 0.6rem;
    margin: 0;
    font-size: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--input-bg);
    color: var(--text-color);
    box-sizing: border-box;
    height: 32px;
}

#search-form input[type="text"] {
    flex: 1;
    min-width: 0;
    width: auto;
}

#search-form select {
    flex-shrink: 0;
    max-width: 110px;
}

#search-form button {
    background-color: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    cursor: pointer;
    font-weight: 500;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

#search-form button:hover {
    background-color: #1570cd;
    border-color: #1570cd;
}

/* Page layout */
#content {
    padding: 0;
    overflow-x: hidden;
}

.page-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1.75rem 2rem;
}

/* Headings — offset for sticky header anchors */
h2, h3, h4, h5, h6 {
    scroll-margin-top: calc(var(--header-height) + 0.75rem);
}

h1 {
    font-size: 1.95rem;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 0;
    padding-bottom: 0.3em;
    margin-bottom: 0.8em;
    border-bottom: 1px solid var(--border-light);
}

/* 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;
}

/* Generated table of contents */
#wm-toc {
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    padding: 0.5em 1em;
    margin: 0 1em 1em 0;
    float: left;
    min-width: 180px;
    max-width: 35%;
    box-sizing: border-box;
    font-size: 0.9em;
    line-height: 1.6;
}

#wm-toc.wm-toc-rtl {
    float: right;
    margin: 0 0 1em 1em;
}

.wm-toc-heading {
    font-weight: bold;
    text-align: center;
    display: block;
    padding-bottom: 0.3em;
    border-bottom: 1px solid #ddd;
    margin-bottom: 0.4em;
}

.wm-toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    counter-reset: toc-h2;
}

.wm-toc-h2 {
    counter-increment: toc-h2;
    counter-reset: toc-h3;
}

.wm-toc-h2 > a::before {
    content: counter(toc-h2) ". ";
}

.wm-toc-h3 {
    counter-increment: toc-h3;
    padding-left: 1.5em;
}

.wm-toc-h3 > a::before {
    content: counter(toc-h2) "." counter(toc-h3) " ";
}

.wm-toc-h4 {
    padding-left: 3em;
}

.wm-toc-list li {
    margin: 0.15em 0;
}

.wm-toc-list a {
    color: #1e90ff;
    text-decoration: none;
}

.wm-toc-list a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    #wm-toc {
        float: none;
        max-width: 100%;
        margin: 0.5em 0 1em 0;
    }
}

#footer {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 2rem;
}

.footer-inner {
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1rem 2rem;
    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;
}


/* 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;
}

/* Home page */
.home-hero {
    max-width: 640px;
    margin: 3rem auto 2rem;
    text-align: center;
}

.home-hero h1 {
    font-size: 2.4rem;
    border: none;
    margin-bottom: 0.5rem;
}

.home-tagline {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.home-desc {
    color: var(--text-muted);
    margin: 0;
    line-height: 1.7;
}

.home-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin: 2.5rem 0;
}

.home-feature {
    background: var(--surface-color);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
}

.home-feature h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--accent-color);
}

.home-feature p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Search results */
.search-results {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-result {
    background: var(--surface-color);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 1rem 1.25rem;
    transition: border-color 0.15s ease;
}

.search-result:hover {
    border-color: var(--accent-color);
}

.search-result-title {
    display: block;
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--accent-color);
}

.search-result-snippet {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.search-result-snippet .searchmatch {
    font-weight: 700;
    color: var(--text-color);
}

/* Responsive — tablet and below */
@media (max-width: 768px) {
    #header {
        position: static;
    }

    .header-inner {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 1rem;
        gap: 0.4rem;
    }

    .site-name {
        flex: 1;
    }

    #search-form {
        order: 3;
        flex-basis: 100%;
        padding-bottom: 0.4rem;
    }

    #search-form select {
        max-width: 90px;
    }

    .page-inner {
        padding: 1rem;
    }

    .footer-inner {
        padding: 0.75rem 1rem;
    }

    .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;
    }

    .home-hero {
        margin: 1.5rem auto 1.5rem;
    }

    .home-hero h1 {
        font-size: 1.8rem;
    }
}

/* Responsive — small phones */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5rem;
    }

    .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;
}

/* File page */
#file-page {
    display: flex;
    flex-direction: column;
    gap: 1em;
}

#file-display {
    text-align: center;
}

#file-image {
    max-width: 100%;
    max-height: 70vh;
    height: auto;
    border: 1px solid #ddd;
}

#file-video,
#file-audio {
    max-width: 100%;
}

.file-download {
    display: inline-block;
    padding: 0.5em 1em;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
}

#file-metadata {
    border-collapse: collapse;
    font-size: 0.9em;
    width: fit-content;
}

#file-metadata th,
#file-metadata td {
    padding: 0.4em 0.8em;
    border: 1px solid #ddd;
    text-align: left;
}

#file-metadata th {
    background-color: #f2f2f2;
    font-weight: bold;
    white-space: nowrap;
}

/* Article hover preview tooltip */
#wm-preview {
    position: fixed;
    z-index: 1000;
    max-width: 320px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    font-size: 0.875rem;
    line-height: 1.5;
    pointer-events: auto;
    color: var(--text-color);
}

#wm-preview[hidden] {
    display: none;
}

.wm-preview-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 3px;
    border: 1px solid var(--border-light);
}

.wm-preview-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.wm-preview-title {
    font-weight: 600;
    color: var(--text-color);
    display: block;
}

.wm-preview-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: block;
}

.wm-preview-extract {
    margin: 0.25rem 0 0;
    color: var(--text-color);
    font-size: 0.8rem;
    line-height: 1.4;
}