:root {
    --c-s-stack-left: 58%;
    --y-l-stack-left: 49%;
    --u-stack-left: 48%;
    --i-stack-left: 48%;
    --stack-italic-offset: 0%;
    --l-lateral-normal: -0.2em;
    --l-lateral-italic: -0.03em;
}

html {
    height: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Charis', serif !important;
    line-height: 1.6;
    color: #333;
    background-color: #fff;
}

/* Map page specific styles */
body.map-page {
    height: 100%;
    overflow: hidden;
}


header {
    border-bottom: 1px solid #e0e0e0;
    padding: 0.5rem 2rem;
    background-color: #fafafa;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 1.3rem;
    font-weight: 400;
    color: #2c3e50;
    margin: 0;
}

nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

nav a {
    text-decoration: none;
    color: #666;
    transition: color 0.2s ease;
    font-size: 0.95rem;
}

nav a:hover,
nav a.active {
    color: #2c3e50;
}

main {
    position: relative;
    background-color: #f5f5f5;
}

.map-page main {
    height: calc(100vh - 45px);
}

.zoom-indicator {
    position: absolute;
    bottom: 15px;
    left: 10px;
    color: #000;
    font-size: 0.75rem;
    z-index: 1000;
    pointer-events: none;
}

.etymology-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
}

.etymology-controls label {
    margin-right: 0.5rem;
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
}

#etymology-select {
    padding: 0.25rem 0.5rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    background-color: #fff;
    font-family: 'Charis', serif !important;
    font-size: 0.85rem;
    color: #333;
    cursor: pointer;
}

#etymology-select:focus {
    outline: none;
    border-color: #999;
}

#map-container {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

#map {
    height: 100%;
    width: 100%;
    cursor: default !important;
}


#map canvas {
    cursor: default !important;
}

/* Adjust MapLibre attribution position */
.maplibregl-ctrl-bottom-right,
.mapboxgl-ctrl-bottom-right {
    bottom: 10px !important;
}

#metadata-panel {
    position: absolute;
    right: 10px;
    top: 60px;
    width: auto;
    max-height: calc(100vh - 100px);
    background-color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    z-index: 1000;
    overflow-y: auto;
    font-family: 'Charis', serif !important;
    font-size: 0.85rem;
}

#metadata-panel.hidden {
    display: none;
}

.close-btn {
    position: absolute;
    right: 8px;
    top: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #333;
}

#metadata-content {
    padding: 0.5rem 0;
    font-family: 'Charis', serif !important;
    font-size: 0.85rem;
}

#metadata-content section {
    margin-bottom: 0.75rem;
}

#metadata-content section:last-child {
    margin-bottom: 0;
}

#metadata-content h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e0e0e0;
}

#metadata-content div {
    font-family: 'Charis', serif;
    color: #555;
    font-size: 0.85rem;
}

.metadata-field {
    display: flex;
    margin-bottom: 0.3rem;
}

.metadata-label {
    font-family: 'Charis', serif !important;
    font-weight: 700;
    color: #666;
    min-width: 120px;
    text-align: right;
    padding-right: 0.5rem;
}

.metadata-value {
    font-family: 'Charis', serif !important;
    color: #333;
}

.transcription-text {
    font-family: 'Charis', serif !important;
    font-size: 0.95rem;
    color: #333;
}

.map-attribution {
    display: none;
}

.map-attribution a {
    color: #666;
    text-decoration: none;
}

.map-attribution a:hover {
    text-decoration: underline;
}

.marker-label {
    font-family: 'Charis', serif !important;
    font-size: 14px;
    color: #2c3e50;
}

.about-page {
    height: auto;
    min-height: calc(100vh - 45px);
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem;
    line-height: 1.7;
}

.about-content section {
    margin-bottom: 3rem;
}

.about-content h2 {
    font-size: 1.5rem;
    font-weight: 400;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

.about-content p {
    margin-bottom: 1rem;
    color: #555;
}

.about-content ul {
    margin: 1rem 0;
    padding-left: 2rem;
}

.about-content li {
    margin-bottom: 0.75rem;
    color: #555;
}

.about-content strong {
    color: #2c3e50;
}

.about-content a {
    color: #2c3e50;
    text-decoration: none;
}

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

.char-stack {
    position: relative;
    display: inline-block;
}

.top-char {
    position: absolute;
    top: -0.5em;
    left: calc(50% + var(--stack-italic-offset));
    transform: translate(-50%, 0) scale(0.65);
    transform-origin: center;
    font-family: 'Charis', serif !important;
}

.char-stack.i-dot-stack .top-char {
    transform: translate(-50%, 0) scale(0.8);
    top: -0.6em;
    left: calc(50% + var(--stack-italic-offset));
}

.rendered-text .char-stack.i-dot-stack .top-char,
.marker-label .char-stack.i-dot-stack .top-char,
.map-label .char-stack.i-dot-stack .top-char,
.transcription-text .char-stack.i-dot-stack .top-char {
    left: calc(50% + var(--stack-italic-offset));
}

.char-stack.i-stack .top-char {
    transform: translate(-50%, 0) scale(0.65);
    top: -0.55em;
    left: calc(var(--i-stack-left) + 0%);
}

.rendered-text .char-stack.i-stack .top-char,
.marker-label .char-stack.i-stack .top-char,
.map-label .char-stack.i-stack .top-char,
.transcription-text .char-stack.i-stack .top-char {
    left: calc(var(--i-stack-left) + var(--stack-italic-offset));
}


.char-stack.needs-more-padding .top-char {
    top: -0.6em;
}

.char-stack.u-stack .top-char {
    left: calc(var(--u-stack-left) + var(--stack-italic-offset));
}

.char-stack.c-s-stack .top-char {
    left: calc(var(--c-s-stack-left) + var(--stack-italic-offset));
}

.char-stack.y-l-stack .top-char {
    left: calc(var(--y-l-stack-left) + var(--stack-italic-offset));
}

.char-stack.l-lateral-stack {
    position: relative;
    display: inline;
}

.char-stack.l-lateral-stack .base-char {
    position: relative;
}

.char-stack.l-lateral-stack .top-char {
    position: relative;
    top: -0.4em;
    left: var(--l-lateral-normal);
    transform: scale(0.65);
    display: inline-block;
}

.rendered-text .char-stack.l-lateral-stack .top-char,
.marker-label .char-stack.l-lateral-stack .top-char,
.map-label .char-stack.l-lateral-stack .top-char,
.transcription-text .char-stack.l-lateral-stack .top-char {
    left: var(--l-lateral-italic);
}


.hidden {
    display: none !important;
}

/* Clickable transcription labels */
.map-label {
    transition: transform 0.2s ease;
}

/* Source prefix styling */
.source-prefix {
    font-weight: 600;
    color: #666;
    margin-right: 2px;
}

/* Individual transcription items */
.transcription-item {
    display: inline-block;
    padding: 0 1px;
    border-radius: 3px;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.transcription-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: #1a252f;
    transform: scale(1.05);
    padding: 0 3px;
    margin: 0 -2px;
}

/* Separator styling */
.transcription-separator {
    display: inline-block;
    width: 0.25em;
    text-align: center;
    position: relative;
}

.transcription-separator .punctuation {
    color: #666;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Alternative approach: use before/after for exact spacing */
.comma-separator::before,
.semicolon-separator::before {
    content: '\00a0'; /* non-breaking space */
    width: 0.15em;
}

.comma-separator::after,
.semicolon-separator::after {
    content: '\00a0'; /* non-breaking space */
    width: 0.15em;
}

#metadata-panel::-webkit-scrollbar {
    width: 8px;
}

#metadata-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#metadata-panel::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

#metadata-panel::-webkit-scrollbar-thumb:hover {
    background: #999;
}

* {
    font-family: 'Charis', serif !important;
}

[style*="font-family"] {
    font-family: 'Charis', serif !important;
}

*::before,
*::after,
*::first-letter,
*::first-line,
*::selection {
    font-family: 'Charis', serif !important;
}

.maplibregl-ctrl,
.maplibregl-ctrl button,
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib-inner,
.mapboxgl-ctrl,
.mapboxgl-ctrl button,
.mapboxgl-ctrl-attrib,
.mapboxgl-ctrl-attrib-inner {
    font-family: 'Charis', serif !important;
}

.map-label,
.marker-label,
.transcription-text,
.metadata-field,
.metadata-label,
.metadata-value {
    font-family: 'Charis', serif !important;
}

input, textarea, select, option, button {
    font-family: 'Charis', serif !important;
}

table, thead, tbody, tfoot, tr, th, td {
    font-family: 'Charis', serif !important;
}

@media print {
    * {
        font-family: 'Charis', serif !important;
    }
}

@media (max-width: 1400px) {
    main {
        background-color: #fff;
    }
    
    #map-container {
        max-width: 100%;
        box-shadow: none;
    }
}

