/* ══════════════════════════════════════════════════════════════
   Gelibolu Revival — Harita Stilleri (v2 — Askeri Kartografi)
   Desatüre, tarihsel, hiyerarşik, neon-free
   ══════════════════════════════════════════════════════════════ */

/* ── Harita Konteyner ── */
.map-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    overflow: visible;
    position: relative;
    background: radial-gradient(ellipse at 50% 40%, #1a2028, #0e1014 70%);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, .4)
}

.map-container svg {
    width: 100%;
    height: 100%;
    max-width: 1600px;
    max-height: calc(100vh - 94px);
    border-radius: 4px;
    filter: contrast(1.02) saturate(.92)
}

/* ── Birlik Tokenleri — mat, kontrollü ── */
.unit-token {
    cursor: pointer;
    transition: transform .34s linear, opacity .3s ease-out, filter .18s;
    transform-box: fill-box;
    transform-origin: center
}

.unit-token.is-moving {
    filter: drop-shadow(var(--trail-x1, 0px) var(--trail-y1, 0px) 3px rgba(100, 80, 60, .35))
           drop-shadow(var(--trail-x2, 0px) var(--trail-y2, 0px) 6px rgba(100, 80, 60, .2))
}

.unit-token.is-muted {
    filter: saturate(.3) brightness(.6);
    opacity: .3 !important
}

.unit-token.is-active {
    filter: brightness(1.15) drop-shadow(0 0 4px rgba(160, 150, 130, .4))
}

.unit-token:hover {
    filter: brightness(1.2) drop-shadow(0 0 5px rgba(180, 170, 150, .3));
    cursor: pointer
}

.battle-effects {
    pointer-events: none
}

.battery-shot {
    stroke: #8a6050;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-dasharray: 4 8;
    opacity: .6;
    animation: shotDash .55s linear infinite;
    animation-delay: var(--shot-delay, 0s)
}

.battery-impact {
    fill: rgba(140, 90, 70, .2);
    stroke: rgba(140, 90, 70, .5);
    stroke-width: .8
}

@keyframes shotDash {
    from { stroke-dashoffset: 0 }
    to { stroke-dashoffset: -18 }
}

.unit-label {
    font-family: var(--mono);
    pointer-events: none;
    opacity: .85;
    font-weight: 600;
    paint-order: stroke;
    stroke: rgba(20, 18, 16, .8);
    stroke-width: 2px
}

/* ── Lokasyon Etiketleri — hiyerarşik, inline'da set ediliyor ── */
.location-label {
    font-family: var(--mono);
    transition: fill .2s ease
}

.location-dot {
    transition: filter .2s ease
}

.location-group {
    transition: opacity .25s ease
}

.location-group:hover .location-dot {
    filter: drop-shadow(0 0 3px rgba(160, 150, 130, .4))
}

.location-group:hover .location-label {
    fill: #d0c8a8 !important
}

.location-group.is-scene-hidden,
.scene-annotation-group.is-scene-hidden {
    opacity: .04
}

.scene-annotation-group {
    transition: opacity .25s ease
}

.scene-focus-line {
    fill: none;
    stroke: rgba(140, 130, 110, .35);
    stroke-width: .8;
    stroke-dasharray: 6 4;
    opacity: .6
}

.scene-ridge {
    fill: none;
    stroke: rgba(120, 118, 100, .35);
    stroke-width: 1;
    stroke-dasharray: 5 3;
    opacity: .6
}

.scene-label {
    font-family: var(--mono);
    font-size: 6px;
    fill: #a09880;
    font-weight: 600;
    letter-spacing: .15em;
    paint-order: stroke;
    stroke: rgba(30, 28, 24, .7);
    stroke-width: 1.5px;
    opacity: .75
}

.scene-label-sub {
    font-size: 5px;
    opacity: .6
}

#minefields.is-scene-dimmed,
#forts.is-scene-dimmed {
    opacity: .15
}

.units-layer {
    transition: opacity .2s ease
}

/* ── Tarih Chip — restrained ── */
.map-date-chip {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, rgba(20, 18, 16, .88), rgba(28, 26, 22, .92));
    border: 1px solid rgba(120, 100, 70, .25);
    border-radius: 999px;
    padding: 7px 18px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .03);
    backdrop-filter: blur(10px);
    z-index: 3
}

.map-date-day {
    font-family: var(--mono);
    font-size: 1.1rem;
    color: #d0c8a8;
    font-weight: 700;
    min-width: 24px;
    text-align: right
}

.map-date-month {
    font-family: var(--mono);
    font-size: .78rem;
    color: #a09880;
    letter-spacing: .08em;
    text-transform: uppercase
}

.map-date-year {
    font-family: var(--mono);
    font-size: .72rem;
    color: #7a7060;
    padding-left: 10px;
    border-left: 1px solid rgba(120, 100, 70, .25)
}

/* ── Anlatım Kutusu ── */
.narration-box {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: linear-gradient(145deg, rgba(20, 18, 16, .92), rgba(28, 26, 22, .95));
    border: 1px solid rgba(80, 75, 60, .3);
    border-left: 3px solid #8b3a3a;
    border-radius: 8px;
    padding: 14px 18px;
    max-width: 460px;
    min-height: 120px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .02);
    transition: border-left-color .3s ease;
    z-index: 4
}

.narration-title {
    font-family: var(--mono);
    font-size: .76rem;
    color: #c4645a;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 6px
}

.narration-icon {
    vertical-align: middle;
    margin-right: 6px;
    opacity: .7;
    filter: brightness(1.05)
}

.narration-text {
    font-size: .88rem;
    color: var(--text);
    line-height: 1.65
}

.narration-transition {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(120, 100, 70, .2);
    font-family: var(--mono);
    font-size: .68rem;
    color: var(--text-dim);
    line-height: 1.4
}

/* ── Romantik Katman — desatüre ── */
.romantic-quote {
    margin-top: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    background: rgba(40, 38, 32, .4);
    border-left: 2px solid rgba(120, 100, 70, .4);
    animation: romanticFadeIn .6s ease-out
}

.romantic-quote.romantic-type-quote {
    border-left-color: rgba(180, 160, 80, .5);
    background: rgba(180, 160, 80, .04)
}

.romantic-quote.romantic-type-letter {
    border-left-color: rgba(100, 130, 150, .5);
    background: rgba(100, 130, 150, .04)
}

.romantic-quote.romantic-type-anecdote {
    border-left-color: rgba(130, 100, 140, .4);
    background: rgba(130, 100, 140, .04)
}

.romantic-quote.romantic-type-witness {
    border-left-color: rgba(100, 130, 100, .4);
    background: rgba(100, 130, 100, .04)
}

.romantic-quote.romantic-type-spirit {
    border-left-color: rgba(140, 80, 70, .5);
    background: rgba(140, 80, 70, .04)
}

.romantic-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px
}

.romantic-emoji {
    font-size: 1rem;
    line-height: 1
}

.romantic-label {
    font-family: var(--mono);
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #a09880;
    opacity: .8
}

.romantic-text {
    font-size: .84rem;
    color: var(--text);
    line-height: 1.65;
    font-style: italic;
    opacity: .88
}

.romantic-source {
    margin-top: 6px;
    font-family: var(--mono);
    font-size: .62rem;
    color: var(--text-dim);
    text-align: right;
    opacity: .6
}

@keyframes romanticFadeIn {
    from { opacity: 0; transform: translateY(6px) }
    to { opacity: 1; transform: translateY(0) }
}

/* ── Frontline & Combat FX — kontrollü, subtil ── */
.frontline-segment {
    stroke: rgba(140, 80, 70, .35);
    stroke-width: 1;
    stroke-dasharray: 5 3;
    fill: none;
    animation: frontlinePulse 3s ease-in-out infinite
}

.frontline-segment[data-intensity="high"] {
    stroke: rgba(140, 80, 70, .55);
    stroke-width: 1.4;
    animation-duration: 1.5s
}

.frontline-segment[data-intensity="low"] {
    stroke: rgba(140, 80, 70, .2);
    stroke-width: .7;
    animation-duration: 5s
}

@keyframes frontlinePulse {
    0%, 100% { opacity: .35 }
    50% { opacity: .6 }
}

.engagement-zone {
    fill: rgba(140, 80, 70, .05);
    stroke: none;
    pointer-events: none
}

.combat-contact-line {
    stroke: rgba(140, 80, 70, .25);
    stroke-width: .8;
    stroke-dasharray: 3 4;
    fill: none;
    pointer-events: none
}

.combat-dust {
    fill: rgba(120, 100, 70, .15);
    pointer-events: none;
    animation: dustFade 2.5s ease-in-out infinite
}

@keyframes dustFade {
    0%, 100% { opacity: .08 }
    50% { opacity: .2 }
}

.combat-muzzle {
    fill: rgba(200, 170, 120, .6);
    pointer-events: none;
    animation: muzzleFlash .25s ease-out forwards
}

@keyframes muzzleFlash {
    0% { opacity: .6; r: 1.5 }
    100% { opacity: 0; r: 3 }
}

.land-combat-fx-group {
    pointer-events: none
}

/* ── Fortification Layer ── */
#layer-fortifications {
    pointer-events: none;
    transition: opacity .3s ease
}

#layer-fortifications.is-scene-dimmed {
    opacity: .06
}

#layer-zones,
#layer-routes,
#layer-combat-fx {
    pointer-events: none
}

/* ── Location Highlight ── */
.location-group.is-highlighted .location-dot {
    fill: #d0c8a8;
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(180, 170, 150, .5))
}

.location-group.is-highlighted .location-label {
    fill: #d0c8a8 !important;
    opacity: 1
}

/* ── Unit Reference ── */
.unit-token.is-referenced {
    filter: brightness(1.2) drop-shadow(0 0 5px rgba(160, 150, 130, .5))
}

/* ── Primary label class (inline SVG) ── */
.label-primary {
    font-family: var(--mono);
    font-weight: 700;
    opacity: .75
}

.label-secondary {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 600;
    opacity: .6;
    paint-order: stroke;
    stroke: rgba(30, 28, 24, .5);
    stroke-width: 1.2px
}

/* ── Mobile Responsive ── */
@media(max-width:768px){
    .map-container{
        min-height:55vh;
        padding:0;
        touch-action:manipulation
    }
    .map-container svg{
        max-height:none;
        height:auto;
        min-height:300px;
        filter:none
    }
    .narration-box{
        position:fixed;
        bottom:0;
        left:0;
        right:0;
        max-width:100%;
        width:100%;
        border-radius:12px 12px 0 0;
        border-left:none;
        border-top:2px solid #8b3a3a;
        padding:14px 18px 18px;
        min-height:auto;
        max-height:40vh;
        overflow-y:auto;
        z-index:5;
        box-shadow:0 -8px 24px rgba(0,0,0,.5)
    }
    .narration-title{font-size:.78rem}
    .narration-text{font-size:.9rem}
    .map-date-chip{
        top:4px;
        padding:5px 12px;
        gap:7px
    }
    .map-date-day{font-size:.92rem}
    .map-date-month,.map-date-year{font-size:.68rem}
}
