/* ============================================================
   Trees of Morocco — Socratica Design System
   ============================================================ */

/* === LOCAL FONTS === */
@font-face {
    font-family: 'Tiempos Headline';
    src: url('../assets/fonts/tiempos-headline/tiempos-headline-light.woff2') format('woff2');
    font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Tiempos Headline';
    src: url('../assets/fonts/tiempos-headline/tiempos-headline-light-italic.woff2') format('woff2');
    font-weight: 300; font-style: italic; font-display: swap;
}
@font-face {
    font-family: 'Tiempos Headline';
    src: url('../assets/fonts/tiempos-headline/tiempos-headline-bold.woff2') format('woff2');
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Untitled Sans';
    src: url('../assets/fonts/untitled-sans/untitled-sans-regular.woff2') format('woff2');
    font-weight: 400; font-style: normal; font-display: swap;
}

/* === DESIGN TOKENS === */
:root {
    --bg-color: #FBF8EF;                      /* Socratica cream */
    --text-color: #2A2928;                    /* Socratica charcoal */
    --accent-color: #2A2928;
    --accent-rgb: 42, 41, 40;
    --border-color: rgba(0, 0, 0, 0.12);
    --btn-bg: #FBF8EF;
    --font-heading: 'Tiempos Headline', Georgia, 'Times New Roman', serif;
    --font-body: 'Untitled Sans', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.08);
    --transition-slow: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tree-type themes — subtle background tints, keep accent for scale lines */
[data-theme="endemic"]       { --accent-color: #1B4D16; --accent-rgb: 27,77,22;   --bg-shift: #f0f5ee; --bg-shift-rgb: 240,245,238; }
[data-theme="quasi-endemic"] { --accent-color: #6D4C1D; --accent-rgb: 109,76,29;  --bg-shift: #f7f2e8; --bg-shift-rgb: 247,242,232; }
[data-theme="reference"]     { --accent-color: #5D5D5D; --accent-rgb: 93,93,93;   --bg-shift: #f4f4f2; --bg-shift-rgb: 244,244,242; }

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

/* Lock the viewport — critical on iOS Safari where overflow:hidden on body doesn't stop scroll */
html {
    overflow: hidden;
    height: 100%;
    height: 100dvh;
}

body {
    background-color: var(--bg-shift, var(--bg-color));
    color: var(--text-color);
    font-family: var(--font-body);
    overflow: hidden;
    /* iOS hack: position:fixed stops rubber-band scroll */
    position: fixed;
    width: 100%;
    height: 100%;
    height: 100dvh;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 1.2s cubic-bezier(0.1, 0.9, 0.2, 1);
}

/* === OVERLAYS — minimal, Socratica-clean === */
.vignette {
    position: fixed; inset: 0;
    background: radial-gradient(circle, transparent 40%, rgba(0,0,0,0.06) 100%);
    pointer-events: none; z-index: 10;
    transition: background 2.5s ease;
}

.texture-overlay {
    position: fixed; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none; z-index: 11;
    mix-blend-mode: multiply;
}

/* grain-overlay removed — cleaner Socratica aesthetic */
.grain-overlay { display: none; }

/* light-leak removed — Socratica doesn't use this effect */
.light-leak { display: none; }

.container-stripes {
    background-image: repeating-linear-gradient(180deg, rgba(0,0,0,0.015), rgba(0,0,0,0.015) 1px, transparent 0, transparent 40px);
    position: fixed; inset: 0;
    pointer-events: none; z-index: 1;
    display: none; /* hidden on mobile by default for performance */
}

/* border-outline kept minimal — just in case HTML still has div */
.border-outline { display: none; }

/* === TITLE CARD — Socratica left-aligned editorial hero === */
.title-card {
    position: fixed; inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;          /* anchor content to lower half */
    align-items: flex-start;
    z-index: 1000;
    background: var(--bg-color);
    transition: opacity 0.5s ease-out;
    overflow: hidden;
    padding-bottom: clamp(60px, 14vh, 130px);
    padding-left: clamp(28px, 7vw, 88px);
    padding-right: clamp(28px, 7vw, 88px);
}

/* Forest image — covers the right side, fades into the cream on the left */
.title-card::before {
    content: ''; position: absolute;
    top: 0; right: 0; bottom: 0; width: 75%;
    background: url('../assets/home.jpg') no-repeat left center;
    background-size: cover;
    opacity: 0.13;
    z-index: 0;
}

/* Cream gradient that masks the left — ensures text area stays clean */
.title-card::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(
        to right,
        var(--bg-color) 28%,
        rgba(251,248,239,0.55) 60%,
        transparent 100%
    );
    z-index: 1;
}

.title-card.hidden { opacity: 0; pointer-events: none; }

/* Small brand mark — top left, like Socratica */
.title-brand {
    position: absolute;
    top: max(28px, env(safe-area-inset-top, 0px) + 20px);
    left: clamp(28px, 7vw, 88px);
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 300;
    letter-spacing: -0.01em;
    color: var(--text-color);
    opacity: 0.45;
    z-index: 12;
    user-select: none;
}

.title-card-inner {
    text-align: left;
    z-index: 10;
    display: flex; flex-direction: column; align-items: flex-start;
    max-width: min(560px, 80%);
}

.title {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(38px, 6vw, 88px);
    color: var(--text-color);
    letter-spacing: -0.03em;
    line-height: 1.0;
    text-transform: none;
    margin-bottom: 16px;
}

.subtitle {
    font-family: var(--font-body);
    font-size: clamp(13px, 1.8vw, 15px);
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.72;
    margin-bottom: 40px;
    letter-spacing: 0;
    line-height: 1.65;
    max-width: 360px;
}

/* === TITLE CARD STATS STRIP === */
.title-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}
.title-stat {
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.45;
}
.title-stat-sep {
    color: var(--text-color);
    opacity: 0.2;
    font-size: 10px;
}

/* === CTA BUTTON — Socratica dark filled pill (primary action) === */
.btn-enter {
    background: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 9999px;
    padding: 13px 28px;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--bg-color);
    display: flex; align-items: center; gap: 10px;
    transition: background 0.25s ease, opacity 0.2s ease;
    touch-action: manipulation;
}
.btn-enter:hover { background: #3d3c3b; }
.btn-enter:active { opacity: 0.75; }
.btn-enter .arrow-icon { filter: invert(1); }

.arrow-icon { width: 14px; transition: transform 0.2s ease; flex-shrink: 0; }
.btn-enter:hover .arrow-icon { transform: translateX(3px); }
.arrow-icon.inverted { transform: rotate(180deg); }

@keyframes arrowPulse {
    0% { transform: translateX(0); }
    100% { transform: translateX(3px); }
}
.arrow-animated { animation: arrowPulse 1s ease-in-out infinite alternate; }

/* === MAIN APP UI === */
.app-ui {
    position: fixed; inset: 0;   /* fixed so iOS scroll never pushes it away */
    overflow: hidden;
    opacity: 1; transition: opacity 0.5s ease-in; z-index: 5;
}
.app-ui.hidden { opacity: 0; pointer-events: none; }

/* Logo — Tiempos Light, top-left */
.logo {
    position: fixed; top: 32px; left: 36px;
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 16px;
    letter-spacing: -0.01em;
    z-index: 15; cursor: pointer;
    opacity: 0.65; transition: opacity 0.2s;
    color: var(--text-color);
    text-transform: none;
}
.logo:hover { opacity: 1; }

/* === INFO PANEL — clean editorial hierarchy === */
.info-panel {
    position: fixed;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 15;
    pointer-events: none;
    transition: opacity 0.4s ease;
    padding: 0 24px;
    contain: layout style; /* Note: establishes formatting context — absolutely-positioned children will be contained here, not viewport-relative */
}

.tree-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* Tags — Socratica bordered pills with natural colors */
.tree-size, .type-tag {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 10px;
    padding: 4px 12px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border: 1px solid currentColor;
    background: transparent;
    box-shadow: none;
}
.tree-size {
    color: var(--accent-color);
}
.type-tag { color: var(--text-color); opacity: 0.6; }
.type-tag.endemic       { color: #1B4D16; opacity: 1; }
.type-tag.quasi-endemic { color: #6D4C1D; opacity: 1; }

/* Scientific name */
.tree-scientific {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 12px;
    opacity: 0.65;
    color: var(--text-color);
    letter-spacing: 0;
}

/* Tree name — Tiempos Light, natural case */
.tree-name {
    font-family: var(--font-heading);
    font-size: clamp(32px, 7vw, 68px);
    font-weight: 300;
    color: var(--text-color);
    margin: 10px 0;
    text-transform: none;           /* natural case */
    line-height: 1.0;
    letter-spacing: -0.02em;
    transition: color var(--transition-slow);
    white-space: normal;
    word-break: break-word;
}

/* Description — Untitled Sans, generous line height */
.tree-desc {
    max-width: 500px;
    margin-top: 16px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.75;
    color: var(--text-color);
    opacity: 0.65;
    padding: 0 10px;
    letter-spacing: 0;
}

/* Staggered fade-in animation */
.tree-header, .tree-name {
    opacity: 0;
    transform: translateY(14px);
    animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.tree-header { animation-delay: 0.08s; }
.tree-name   { animation-delay: 0.16s; }

/* Description — animated separately only when visible */
.tree-desc {
    opacity: 0;
    transform: translateY(14px);
    animation: none; /* no animation by default (mobile hidden) */
}

.fade-in  { opacity: 1 !important; visibility: visible; }
.fade-out { opacity: 0 !important; visibility: hidden; }

@keyframes fadeInUp {
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* === INSTRUCTION PILL — Socratica style === */
.instruction {
    position: fixed; top: 50%; right: 40px; transform: translateY(-50%);
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    z-index: 15; opacity: 0;
    animation: fadeIn 0.6s linear 2.5s forwards, pulseGlow 2s ease-in-out infinite alternate;
    transition: opacity 0.4s ease;
    pointer-events: none;
    color: var(--text-color);
    background: rgba(251,248,239,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 8px 18px;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
}
.instruction.hidden {
    opacity: 0 !important;
    animation: none;
}

@keyframes pulseGlow {
    0%   { box-shadow: 0 0 0 0 rgba(0,0,0,0.08); }
    100% { box-shadow: 0 0 0 8px rgba(0,0,0,0); }
}

/* === TOP RIGHT UI === */
.top-right-ui {
    position: fixed; top: 30px; right: 36px;
    display: flex; gap: 8px; z-index: 20;
}

.icon-btn {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    box-shadow: none;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-color);
    cursor: pointer;
    transition: box-shadow 0.15s ease, background 0.15s ease;
    touch-action: manipulation;
}
.icon-btn:hover  { box-shadow: var(--shadow-sm); background: #fff; }
.icon-btn:active { opacity: 0.75; }
.icon-btn.active { background: var(--text-color); color: var(--bg-color); border-color: var(--text-color); }

.hidden { display: none !important; }

/* === NAV ARROWS — clean Socratica circles === */
.arrow-nav {
    position: fixed; bottom: 40px; z-index: 20;
}
.prev-arrow { left: 40px; }
.next-arrow { right: 40px; }

.control-button {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 50px; height: 50px;
    outline: none;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: box-shadow 0.15s ease, background 0.15s ease;
    touch-action: manipulation;
}
.control-button:hover:not(:disabled)  { background: #fff; box-shadow: var(--shadow-sm); }
.control-button:active:not(:disabled) { opacity: 0.7; }
.control-button:disabled { opacity: 0.25; cursor: not-allowed; }

/* Arrow icon — desaturated charcoal to match Socratica */
.arrow-icon {
    width: 16px;
    filter: invert(16%) sepia(6%) saturate(300%) hue-rotate(5deg) brightness(95%) contrast(90%);
}
.inverted { transform: rotate(180deg); }

/* === MODAL — Socratica card === */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.25s ease;
}
.modal-overlay.hidden { opacity: 0; pointer-events: none; }

.modal-content {
    background: var(--bg-color);
    padding: 40px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 90%; max-width: 560px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    position: relative;
    font-family: var(--font-body);
    color: var(--text-color);
}
.modal-content.map-active {
    max-width: 720px;
}
.modal-close {
    position: absolute; top: 10px; right: 10px;
    background: none; border: none;
    font-size: 20px; cursor: pointer;
    color: var(--text-color); opacity: 0.4;
    min-width: 44px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.15s;
}
.modal-close:hover { opacity: 1; }
.modal-content h2 {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: 1.5rem;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}
.modal-content p {
    font-size: 13px;
    line-height: 1.7;
    opacity: 0.65;
    margin-bottom: 24px;
}
.modal-links { display: flex; gap: 16px; flex-wrap: wrap; }
.modal-links a {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-color);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    transition: opacity 0.15s;
}
.modal-links a:hover { opacity: 0.55; }

/* === MODAL TABS === */
.modal-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}
.modal-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.45;
    margin-bottom: -1px;
    transition: opacity 0.2s ease;
}
.modal-tab.active {
    opacity: 1;
    border-bottom-color: var(--text-color);
}
.modal-tab:hover { opacity: 0.75; }

/* === MAP (Leaflet/OpenStreetMap) === */
#morocco-map-container {
    height: 380px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}
/* Tooltip styled to match design system */
.map-tooltip {
    font-family: var(--font-body, sans-serif);
    font-size: 12px;
    background: rgba(251,248,239,0.95);
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: #2A2928;
    padding: 6px 10px;
}
.map-tooltip::before { display: none; }
.leaflet-control-attribution {
    font-size: 9px !important;
    background: rgba(255,255,255,0.55) !important;
}
.leaflet-control-zoom {
    border: 1px solid var(--border-color) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}
.leaflet-control-zoom a {
    font-family: var(--font-body) !important;
    font-size: 14px !important;
    color: var(--text-color) !important;
    background: var(--bg-color) !important;
    border-color: var(--border-color) !important;
    line-height: 26px !important;
    width: 26px !important;
    height: 26px !important;
}
.leaflet-control-zoom a:hover {
    background: rgba(0,0,0,0.05) !important;
}
.map-caption {
    font-size: 11px;
    opacity: 0.45;
    text-align: center;
    font-style: italic;
    margin-bottom: 12px;
}
.map-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: center;
    font-size: 11px;
    opacity: 0.6;
    letter-spacing: 0.05em;
}
.map-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.map-legend-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.endemic-dot { background: #1B4D16; }
.quasi-dot { background: #6D4C1D; }

.map-species-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 12px;
}
.map-legend-btn {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    border-radius: 9999px;
    padding: 4px 10px;
    background: transparent;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    opacity: 0.55;
    line-height: 1.4;
}
.map-legend-btn:hover { opacity: 0.85; }
.map-legend-btn.active { opacity: 1; background: rgba(0,0,0,0.06); font-weight: 500; }
.map-legend-btn.endemic-btn { color: #1B4D16; }
.map-legend-btn.quasi-btn  { color: #8B5E34; }

/* === SCALE LINES === */
.scale-ui {
    position: absolute; inset: 0;
    pointer-events: none; z-index: 3; overflow: hidden;
}
.scale-line-ui {
    position: absolute; left: 0; width: 100%;
    border-bottom: 1px dashed rgba(0,0,0,0.08);
    transition: bottom 1s cubic-bezier(0.25,1,0.5,1), opacity 0.5s ease;
}
.scale-line-ui.major { border-bottom: 1px solid rgba(0,0,0,0.14); }
.scale-label-ui {
    position: absolute; left: 28px; bottom: 3px;
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: rgba(0,0,0,0.35);
    text-shadow: 1px 1px 0 var(--bg-color), -1px -1px 0 var(--bg-color),
                 1px -1px 0 var(--bg-color), -1px  1px 0 var(--bg-color);
}

/* === RENDER LAYER === */
.render-container {
    position: absolute; inset: 0;
    z-index: 2; transform-origin: 50% 100%;
    transition: transform 1s cubic-bezier(0.25,1,0.5,1);
    will-change: transform;
}
.camera-layer {
    position: absolute; bottom: 0; left: 50%; width: 0; height: 100%;
    transition: transform 1s cubic-bezier(0.25,1,0.5,1);
    will-change: transform;
}
.ground-line {
    position: absolute; bottom: 0; left: -50vw; width: 200vw; height: 30px;
    background: linear-gradient(to bottom, rgba(var(--accent-rgb), 0.08) 0%, rgba(var(--accent-rgb), 0.16) 100%);
    transition: background 1.2s ease;
    z-index: -1;
}

/* === TREE ENTITIES === */
.entity {
    position: absolute; bottom: 20px;
    transform-origin: bottom center;
    display: flex; align-items: flex-end; justify-content: center;
    overflow: visible;
    transition: opacity 0.5s ease;
}
.entity img {
    height: 100%; width: 100%;
    display: block; max-width: none; max-height: none;
    object-fit: contain;
    /* Sway starts paused — JS enables only on active tree */
    animation: sway 6s ease-in-out infinite paused;
    transform-origin: bottom center;
    will-change: transform;
}
.entity.active      { opacity: 1; }
.entity:not(.active){ opacity: 0.22; }

@keyframes sway {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(0.3deg); }
}

/* === HUMAN COMPANION === */
.human-companion {
    position: absolute;
    bottom: 20px;
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    z-index: 15;
    transition: opacity 0.4s ease;
}
.human-companion img { height: 100%; width: 100%; object-fit: fill; }
.human-companion.active { opacity: 0.25; }

/* === END CARD — editorial === */
.end-card {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    z-index: 1001;
    background: var(--bg-color);
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    overflow-y: auto;
}
.end-card-inner {
    text-align: center;
    width: 90%;
    max-width: 520px;
    padding: 44px 40px 36px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: relative;
    display: flex; flex-direction: column; align-items: center;
    margin: auto;
}

/* Badge — "13 arbres découverts" */
.end-badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.45;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 4px 12px;
    margin-bottom: 22px;
}

.end-title {
    font-family: var(--font-heading);
    font-weight: 300;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    margin-bottom: 12px;
    color: var(--text-color);
    letter-spacing: -0.02em;
    text-transform: none;
}
.end-subtitle {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.7;
    opacity: 0.55;
    margin-bottom: 28px;
    font-style: italic;
    max-width: 380px;
}

/* Stats row */
.end-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 28px;
    overflow: hidden;
}
.end-stat {
    flex: 1;
    display: flex; flex-direction: column; align-items: center;
    padding: 14px 8px;
    gap: 4px;
}
.end-stat-num {
    font-family: var(--font-heading);
    font-size: clamp(1.4rem, 4vw, 2rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-color);
    line-height: 1;
}
.end-stat-label {
    font-family: var(--font-body);
    font-size: 8px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.45;
}
.end-stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
    flex-shrink: 0;
}

/* Quote */
.end-quote {
    border-left: 2px solid var(--border-color);
    padding: 10px 16px;
    margin-bottom: 28px;
    text-align: left;
    width: 100%;
}
.end-quote p {
    font-family: var(--font-body);
    font-size: 12px;
    line-height: 1.65;
    font-style: italic;
    color: var(--text-color);
    opacity: 0.65;
    margin-bottom: 6px;
}
.end-quote cite {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.35;
    font-style: normal;
}

/* Actions row */
.end-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 0;
}

/* Share button — outline pill */
.btn-share {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 12px 28px;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-color);
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background 0.2s, border-color 0.2s;
    touch-action: manipulation;
}
.btn-share:hover { background: rgba(0,0,0,0.04); border-color: var(--text-color); }
.btn-share:active { opacity: 0.7; }

/* Restart button — dark filled pill (same as enter) */
#btn-restart {
    background: var(--text-color);
    border: 1px solid var(--text-color);
    border-radius: 9999px;
    padding: 12px 24px;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bg-color);
    cursor: pointer;
    display: flex; align-items: center; gap: 8px;
    transition: background 0.2s;
    touch-action: manipulation;
}
#btn-restart:hover { background: #3d3c3b; }
#btn-restart .arrow-icon { filter: invert(1); }

.modal-links { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }

/* === PROGRESS COUNTER === */
.progress-counter {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 6px;
    pointer-events: none;
}
#counter-text {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.35;
    letter-spacing: 0.12em;
}
.progress-bar {
    width: 60px; height: 1px;
    background: rgba(0,0,0,0.1); border-radius: 1px; overflow: hidden;
}
.progress-fill {
    height: 100%; width: 7.14%;
    background: var(--threat-color, var(--text-color)); border-radius: 1px;
    transition: width 0.8s cubic-bezier(0.25,1,0.5,1), background-color 0.6s ease;
}

/* IUCN threat badge */
.iucn-badge {
    font-family: var(--font-body);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.10em;
    padding: 4px 12px;
    border-radius: 9999px;
    text-transform: uppercase;
    border: 1px solid currentColor;
    background: transparent;
}
.iucn-badge[data-iucn="LC"] { color: #4A6D23; }
.iucn-badge[data-iucn="VU"] { color: #B08D30; }
.iucn-badge[data-iucn="EN"] { color: #B04A30; }
.iucn-badge[data-iucn="CR"] { color: #8B2020; }

/* "The number" — one sentence that stays */
.the-number {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-color);
    opacity: 1;
    transform: none;
    max-width: 500px;
    margin-top: 12px;
    padding: 12px 10px 0;
    border-top: 1px solid var(--border-color);
    animation: none;
}

/* ============================================================
   RESPONSIVE — Mobile-First
   ============================================================ */

/* Prevent iOS double-tap zoom */
.icon-btn, .control-button, .btn-enter, #btn-restart { touch-action: manipulation; }

/* === MOBILE (< 640px) — Socratica mobile logic === */
.logo { display: none; }

/* Top-right icon buttons — smaller, clear of notch */
.top-right-ui {
    top: max(14px, env(safe-area-inset-top, 0px) + 8px);
    right: max(14px, env(safe-area-inset-right, 0px) + 6px);
    gap: 5px;
}
.icon-btn {
    width: 38px; height: 38px; font-size: 9px;
    background: rgba(251,248,239,0.95);
    box-shadow: 0 1px 8px rgba(0,0,0,0.12);
    border-color: rgba(0,0,0,0.10);
}
.icon-btn svg { width: 15px; height: 15px; }

/* Mobile info panel — solid top strip with description */
.info-panel {
    top: 0; left: 0; transform: none;
    width: 100%; max-width: 100%;
    padding: max(52px, env(safe-area-inset-top, 0px) + 44px) 16px 20px;
    align-items: flex-start; text-align: left;
    max-height: 52vh; /* cap height so tree always has space below */
    overflow: hidden;
    /* Solid gradient fade — no backdrop-filter on mobile */
    background: linear-gradient(to bottom,
        rgba(var(--bg-shift-rgb, 251,248,239), 0.98) 0%,
        rgba(var(--bg-shift-rgb, 251,248,239), 0.96) 70%,
        rgba(var(--bg-shift-rgb, 251,248,239), 0.0) 100%);
}

/* Tags row */
.tree-header {
    gap: 5px;
    justify-content: flex-start;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

/* Tree name — clear, legible on mobile, compact to leave room for description */
.tree-name {
    font-size: clamp(17px, 5vw, 26px);
    margin: 2px 0 0;
    line-height: 1.08;
    letter-spacing: -0.02em;
    white-space: normal;
    word-break: break-word;
}

/* Description — compact on mobile, 3 lines max */
.tree-desc {
    display: block;
    visibility: visible;
    height: auto;
    font-size: 12px;
    line-height: 1.5;
    margin-top: 6px;
    padding: 0;
    max-width: calc(100vw - 32px);
    /* Clamp to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    animation: none !important;
    opacity: 0.7;
}
.tree-scientific { display: none; }
.tree-size, .type-tag { font-size: 9px; padding: 3px 9px; letter-spacing: 0.09em; }
.iucn-badge { font-size: 9px; padding: 3px 9px; letter-spacing: 0.09em; }
.the-number { font-size: 11px; padding: 10px 8px 0; }

/* Instruction hint — bottom center */
.instruction {
    top: auto;
    bottom: max(70px, env(safe-area-inset-bottom, 0px) + 62px);
    right: 50%; transform: translateX(50%);
    font-size: 9px; white-space: nowrap; padding: 6px 14px;
}

.arrow-nav { bottom: max(18px, env(safe-area-inset-bottom, 0px) + 10px); }
.prev-arrow { left: max(14px, env(safe-area-inset-left, 0px) + 8px); }
.next-arrow { right: max(14px, env(safe-area-inset-right, 0px) + 8px); }
.control-button { width: 44px; height: 44px; }

.progress-counter { bottom: max(22px, env(safe-area-inset-bottom, 0px) + 14px); }
#counter-text { font-size: 9px; }
.progress-bar { width: 46px; }

/* === Title card mobile — Socratica mobile hero === */
/* Tighten padding for smaller screens */
.title-card {
    padding-bottom: clamp(48px, 10vh, 90px);
    padding-left: clamp(24px, 6vw, 40px);
    padding-right: clamp(24px, 6vw, 40px);
}
.title-card-inner { max-width: 85%; }
.title    { font-size: clamp(34px, 9vw, 60px); margin-bottom: 12px; letter-spacing: -0.025em; }
.subtitle { font-size: clamp(13px, 3.5vw, 15px); margin-bottom: 32px; max-width: none; }
.btn-enter { font-size: 10px; padding: 12px 22px; }

/* End card mobile */
.end-card-inner  { padding: 28px 20px; }
.end-title       { font-size: clamp(1.6rem, 6vw, 2.5rem); }
.end-subtitle    { font-size: 13px; margin-bottom: 28px; }
.modal-content   { padding: 28px 20px; width: 92%; border-radius: 12px; }
.modal-content.map-active { max-width: 92vw; }

/* === TABLET (>= 640px) — restore full layout === */
@media (min-width: 640px) {
    .logo { display: block; }
    .container-stripes { display: block; }

    /* Restore title card to full desktop editorial layout */
    .title-card {
        padding-bottom: clamp(60px, 14vh, 130px);
        padding-left: clamp(48px, 8vw, 100px);
        padding-right: clamp(48px, 8vw, 100px);
    }
    .title-card-inner { max-width: min(580px, 55%); }
    .title    { font-size: clamp(48px, 6.5vw, 96px); margin-bottom: 18px; letter-spacing: -0.03em; }
    .subtitle { font-size: 15px; margin-bottom: 44px; max-width: 380px; }
    .btn-enter { font-size: 11px; padding: 13px 28px; }

    .top-right-ui { top: 30px; right: 36px; gap: 8px; }
    .icon-btn { width: 44px; height: 44px; font-size: 10px; background: var(--bg-color); box-shadow: none; border-color: var(--border-color); }
    .icon-btn svg { width: 18px; height: 18px; }

    .info-panel {
        top: 10%;
        left: 50%; transform: translateX(-50%);
        width: 90%; max-width: 600px;
        max-height: none; overflow: visible;
        align-items: center; text-align: center; padding: 0 24px;
        background: none; backdrop-filter: none; -webkit-backdrop-filter: none;
    }
    .tree-header { gap: 8px; justify-content: center; margin-bottom: 10px; flex-wrap: wrap; }
    .tree-name { font-size: clamp(32px, 7vw, 68px); margin: 10px 0; letter-spacing: -0.02em; white-space: normal; max-width: none; }
    .tree-desc {
        display: block;
        font-size: 14px; max-width: 500px; margin-top: 16px; padding: 0 10px;
        animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.24s forwards;
    }
    .tree-scientific { display: block; opacity: 0.45; }
    .tree-desc {
        display: block;
        visibility: visible;
        height: auto;
        font-size: 14px;
        line-height: 1.75;
        margin-top: 16px;
        padding: 0 10px;
        max-width: 500px;
        /* Remove mobile clamp */
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
        overflow: visible;
        opacity: 0.65;
        animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.24s forwards;
    }
    .the-number {
        animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) 0.64s both;
    }
    .tree-size, .type-tag { font-size: 10px; padding: 4px 12px; }
    .iucn-badge { font-size: 10px; padding: 4px 12px; }

    .instruction { top: 50%; bottom: auto; right: 40px; transform: translateY(-50%); font-size: 10px; padding: 8px 18px; }
    .arrow-nav { bottom: 40px; }
    .prev-arrow { left: 40px; }
    .next-arrow { right: 40px; }
    .control-button { width: 50px; height: 50px; }
    .progress-counter { bottom: 30px; }
    #counter-text { font-size: 11px; }
    .progress-bar { width: 60px; }
}

/* === DESKTOP (>= 1024px) === */
@media (min-width: 1024px) {
    .top-right-ui { right: 40px; gap: 10px; }
}

/* === LANDSCAPE small screens === */
@media (max-height: 500px) and (orientation: landscape) {
    .info-panel { top: 4%; }
    .tree-name  { font-size: 20px; }
    .tree-desc  { display: none; }
    .instruction { bottom: 16px; }
    .logo { display: none; }
    .progress-counter { bottom: 8px; }
}

/* === VERY SMALL (< 380px) === */
@media (max-width: 380px) {
    .top-right-ui { gap: 4px; right: 12px; }
    .icon-btn  { width: 38px; height: 38px; }
    .prev-arrow { left: 10px; }
    .next-arrow { right: 10px; }
    .control-button { width: 42px; height: 42px; }
    .tree-name { font-size: clamp(20px, 7.5vw, 34px); }
}

/* === DETAIL PANEL (slide-up bottom sheet) === */
.detail-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    border-radius: 16px 16px 0 0;
    padding: 28px 28px 40px;
    z-index: 500;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 65vh;
    overflow-y: auto;
    pointer-events: none; /* hidden state: no interaction */
}
.detail-panel.open {
    transform: translateY(0);
    pointer-events: all;
}
.detail-close {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none;
    font-size: 24px; line-height: 1;
    cursor: pointer; opacity: 0.35;
    color: var(--text-color);
    padding: 4px 8px;
    transition: opacity 0.2s ease;
}
.detail-close:hover { opacity: 0.8; }
.detail-inner {
    padding-top: 8px;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    gap: 16px;
}
.detail-label {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.45;
    flex-shrink: 0;
}
.detail-value {
    font-family: var(--font-body);
    font-size: 14px;
    text-align: right;
    line-height: 1.4;
}
.detail-anecdote {
    margin-top: 20px;
    font-family: var(--font-heading);
    font-weight: 300;
    font-style: italic;
    font-size: 16px;
    line-height: 1.55;
    opacity: 0.72;
}
.detail-trigger {
    display: inline-block;
    margin-top: 8px;
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-color);
    opacity: 0.45;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
    pointer-events: all;
}
.detail-trigger:hover { opacity: 0.85; }

/* Desktop: constrain panel width */
@media (min-width: 640px) {
    .detail-panel {
        max-width: 480px;
        left: clamp(20px, 4vw, 60px);
        right: auto;
        border-radius: 16px 16px 0 0;
    }
}

/* === ACCESSIBILITY — Focus Indicators === */
.icon-btn:focus-visible,
.btn-enter:focus-visible,
.control-button:focus-visible,
.btn-share:focus-visible,
#btn-restart:focus-visible,
.map-legend-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

/* === RTL SUPPORT (Arabic) === */
[dir="rtl"] .info-panel { text-align: right; }
[dir="rtl"] .title-card { align-items: flex-end; }
[dir="rtl"] .title-card-inner { text-align: right; align-items: flex-end; }
[dir="rtl"] .end-actions { flex-direction: row-reverse; }
[dir="rtl"] .end-stats   { flex-direction: row-reverse; }
[dir="rtl"] .tree-header { flex-direction: row-reverse; }
[dir="rtl"] .title-stats { flex-direction: row-reverse; }
[dir="rtl"] .top-right-ui { left: 16px; right: auto; }
[dir="rtl"] .logo { left: auto; right: 20px; }

/* ============================================================
   DOSSIER CARD (upgraded detail panel)
   ============================================================ */

/* Increase panel height for dossier content */
.detail-panel {
    max-height: 82vh;
}

/* Dossier header: tree name + IUCN badge side by side */
.dossier-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-top: 4px;
    padding-right: 36px; /* clear the absolute × close button */
    flex-wrap: wrap;
}
.dossier-name {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 300;
    letter-spacing: -0.01em;
    margin: 0;
    flex: 1;
    min-width: 0;
}

/* Two-column grid: Distribution | Ecosystem */
.dossier-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 480px) {
    .dossier-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Section label (uppercase micro-heading) */
.dossier-section {
    margin-bottom: 20px;
}
.dossier-section-label {
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.4;
    margin: 0 0 10px 0;
}

/* Distribution info rows */
.dossier-distribution-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.dossier-dist-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dossier-dist-label {
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    opacity: 0.4;
}
.dossier-dist-value {
    font-family: var(--font-body);
    font-size: 13px;
    line-height: 1.4;
}
.dossier-threat-text {
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.55;
    opacity: 0.6;
    margin-top: 8px;
    font-style: italic;
}

/* Companion species grid */
.companions-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.companion-chip {
    display: flex;
    align-items: center;
    gap: 8px;
}
.companion-icon {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.companion-info {
    flex: 1;
    min-width: 0;
}
.companion-name {
    font-family: var(--font-body);
    font-size: 12px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.companion-scientific {
    font-family: var(--font-body);
    font-size: 10px;
    font-style: italic;
    opacity: 0.45;
    display: block;
}
.companion-iucn {
    font-size: 8px;
    padding: 2px 6px;
    flex-shrink: 0;
}

/* Timeline bars (surface area over time) */
.dossier-timeline-section {
    margin-bottom: 20px;
}
.timeline-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.timeline-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.timeline-year {
    font-family: var(--font-body);
    font-size: 10px;
    letter-spacing: 0.06em;
    opacity: 0.5;
    width: 34px;
    flex-shrink: 0;
    text-align: right;
}
.timeline-year.projected {
    font-style: italic;
    opacity: 0.35;
}
.timeline-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(0,0,0,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.timeline-bar {
    height: 100%;
    border-radius: 3px;
    background: var(--threat-color, var(--accent-color));
    transition: width 0.6s cubic-bezier(0.25,1,0.5,1);
}
.timeline-bar.projected {
    background: repeating-linear-gradient(
        90deg,
        var(--threat-color, var(--accent-color)) 0px,
        var(--threat-color, var(--accent-color)) 4px,
        transparent 4px,
        transparent 8px
    );
}
.timeline-ha {
    font-family: var(--font-body);
    font-size: 10px;
    opacity: 0.45;
    width: 72px;
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
}
.timeline-ha.projected {
    font-style: italic;
    opacity: 0.3;
}
.timeline-unknown {
    font-family: var(--font-body);
    font-size: 11px;
    font-style: italic;
    opacity: 0.4;
    padding: 8px 0;
}

/* "The Number" quote */
.dossier-number {
    margin: 0;
    padding: 16px 0 0;
    border-top: 1px solid var(--border-color);
    font-family: var(--font-heading);
    font-weight: 300;
    font-style: italic;
    font-size: 15px;
    line-height: 1.65;
    opacity: 0.78;
}

/* Desktop: widen the dossier panel */
@media (min-width: 640px) {
    .detail-panel {
        max-width: 640px;
        left: clamp(20px, 5vw, 80px);
    }
}

/* RTL overrides for dossier card */
[dir="rtl"] .dossier-header   { flex-direction: row-reverse; }
[dir="rtl"] .companion-chip   { flex-direction: row-reverse; }
[dir="rtl"] .timeline-year    { text-align: left; }
[dir="rtl"] .timeline-ha      { text-align: left; }

/* ============================================================
   DOSSIER — Mini-map, Elevation, Trend, Actions, Sources
   ============================================================ */

/* Mini-map container inside dossier card */
.dossier-mini-map {
    width: 100%;
    height: 160px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
    background: rgba(0,0,0,0.04);
}
/* Leaflet attribution inside mini-map: hide to keep it clean */
.dossier-mini-map .leaflet-control-attribution {
    display: none;
}

/* Trend pill (↓↓ Déclin rapide / ↓ Déclin / → Stable / ↑ En récupération) */
.trend-pill {
    font-family: var(--font-body);
    font-size: 10px;
    padding: 3px 9px;
    border-radius: 12px;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
}
.trend-pill[data-trend="declining-fast"] {
    background: rgba(180, 30, 30, 0.1);
    color: #b41e1e;
}
.trend-pill[data-trend="declining"] {
    background: rgba(180, 110, 30, 0.1);
    color: #9a5f00;
}
.trend-pill[data-trend="stable"] {
    background: rgba(100, 100, 100, 0.1);
    color: #555;
}
.trend-pill[data-trend="recovering"] {
    background: rgba(30, 100, 50, 0.1);
    color: #1e6432;
}

/* Elevation gradient track (horizontal bar 0–3200m with highlighted zone) */
.elevation-wrap {
    margin-top: 10px;
}
.elevation-track-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.elevation-edge-label {
    font-family: var(--font-body);
    font-size: 9px;
    opacity: 0.4;
    white-space: nowrap;
    flex-shrink: 0;
}
.elevation-track {
    flex: 1;
    height: 4px;
    background: rgba(0,0,0,0.08);
    border-radius: 2px;
    position: relative;
}
.elevation-zone {
    position: absolute;
    top: 0;
    height: 100%;
    background: var(--accent-color);
    border-radius: 2px;
    opacity: 0.65;
}
.elevation-range-label {
    font-family: var(--font-body);
    font-size: 10px;
    opacity: 0.5;
    margin-top: 3px;
    letter-spacing: 0.03em;
}

/* Conservation actions list */
.dossier-actions-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.dossier-action-item {
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.5;
    padding-left: 12px;
    position: relative;
    opacity: 0.75;
}
.dossier-action-item::before {
    content: "●";
    position: absolute;
    left: 0;
    top: 0;
    font-size: 6px;
    opacity: 0.5;
    line-height: 2;
}

/* Sources section — shared styles for modal (À propos) and end card */
.modal-sources {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}
.modal-sources-label {
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.4;
    margin: 0 0 10px 0;
}
.modal-sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.modal-source-item {
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.45;
    opacity: 0.6;
}
.modal-source-item a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.8;
}
.modal-source-item a:hover { opacity: 1; }

/* End card sources */
.end-sources {
    margin-bottom: 24px;
    text-align: left;
}
.end-sources-label {
    font-family: var(--font-body);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.35;
    margin: 0 0 10px 0;
}
.end-sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.end-source-item {
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.4;
    opacity: 0.5;
}
.end-source-item a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.end-source-item a:hover { opacity: 0.85; }

/* RTL: reverse trend pill position in header */
[dir="rtl"] .dossier-actions-list { padding-right: 0; }
[dir="rtl"] .dossier-action-item { padding-left: 0; padding-right: 12px; }
[dir="rtl"] .dossier-action-item::before { left: auto; right: 0; }
