:root{
  --navy:#0b1220;
  --gold:#c9a84c;
  --goldl:#e8cc7a;
  --goldd:#8a6f2e;
  --parch:#ddd3b8;
}
*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;overflow:hidden;font-family:'Comfortaa',serif;background:var(--navy);color:var(--parch);}


/* ── LAYOUT ── */
#app{display:flex;height:100vh;width:100vw;}

/* ══════════════════════════════════════
   LEFT: MAP PANEL
══════════════════════════════════════ */
#map-panel{
  position:relative;
  width:52%;
  flex-shrink:0;
  overflow:hidden;
  background:#060e1c;
}

/* Each map image layer */
.map-layer{
  position:absolute;inset:0;
  background-size:cover;
  background-position:center;
  opacity:0;
  transition:opacity .9s ease;
}
.map-layer.active{opacity:1;}

/* Dark vignette over image so it blends into right panel */
#map-panel::after{
  content:'';
  position:absolute;inset:0;
  background:
    linear-gradient(to right, transparent 55%, var(--navy) 100%),
    linear-gradient(to bottom, rgba(6,14,28,.5) 0%, transparent 20%, transparent 80%, rgba(6,14,28,.6) 100%);
  pointer-events:none;
  z-index:2;
}



/* Map label top-left */
#map-label{
  position:absolute;top:1.8rem;left:2rem;z-index:5;
  font-size:.65rem;letter-spacing:.35em;
  color:rgba(201,168,76,.45);text-transform:uppercase;
}

/* Big year bottom-left */
#map-year{
  position:absolute;bottom:2rem;left:2rem;z-index:5;
  font-weight:900;
  font-size:clamp(3rem,6vw,5.5rem);
  color:var(--gold);opacity:.2;
  line-height:1;pointer-events:none;
  transition:opacity .3s;
}

/* Territory chip top-right */
#map-terr{
  position:absolute;top:1.8rem;right:3.5rem;z-index:5;
  text-align:right;
}
#map-terr span:first-child{
  display:block;
  font-size:.6rem;letter-spacing:.2em;
  color:rgba(201,168,76,.45);margin-bottom:.2rem;
}
#map-terr strong{
  display:block;
  font-size:1rem;font-weight:600;
  color:var(--gold);transition:all .4s;
}

/* ══════════════════════════════════════
   RIGHT: SCROLL PANEL
══════════════════════════════════════ */
#right-panel{
  flex:1;
  display:flex;
  overflow:hidden;
}

/* ── CENTURY BAR ── */
#cent-bar{
  width:2.6rem;flex-shrink:0;
  background:rgba(6,14,28,.7);
  border-right:1px solid rgba(201,168,76,.1);
  position:relative;overflow:hidden;
}
.cent-mark{
  position:absolute;left:0;right:0;
  display:flex;align-items:center;justify-content:center;
  font-size:.55rem;
  letter-spacing:.05em;color:rgba(201,168,76,.35);
  cursor:pointer;transition:color .3s;
  user-select:none;height:1.4rem;margin-left:-.1rem;
}
.cent-mark::before{
  content:'';position:absolute;left:0;top:50%;
  width:5px;height:1px;background:rgba(201,168,76,.25);
}
.cent-mark:hover,.cent-mark.act{color:var(--gold);}
.cent-mark.act::before{background:var(--gold);}

/* ── TIMELINE ── */
#timeline{
  flex:1;
  overflow-y:scroll;overflow-x:hidden;
  padding:0 2.2rem 8rem 2rem;
  scroll-behavior:smooth;
}
#timeline::-webkit-scrollbar{width:3px;}
#timeline::-webkit-scrollbar-thumb{background:rgba(201,168,76,.2);border-radius:2px;}
#timeline::-webkit-scrollbar-track{background:transparent;}

/* vertical line */
#timeline::before{
  content:'';position:absolute;
  left:calc(2.6rem + 2.8rem);
  top:0;bottom:0;width:1px;
  background:linear-gradient(to bottom,transparent,rgba(201,168,76,.2) 8%,rgba(201,168,76,.2) 92%,transparent);
  pointer-events:none;
}

/* ── HEADER ── */
#tl-head{padding:2.8rem 0 3rem 2.8rem;}
#tl-head h1{
  font-weight:900;
  font-size:clamp(1rem,2vw,1.5rem);
  color:var(--gold);letter-spacing:.12em;margin-bottom:.3rem;
}
#tl-head p{font-size:.82rem;font-style:italic;color:rgba(221,211,184,.38);letter-spacing:.05em;}

/* ── CENTURY SEPARATOR ── */
.cent-sep{
  padding:.8rem 0 .6rem 2.8rem;
  font-size:.62rem;letter-spacing:.3em;
  color:rgba(201,168,76,.32);text-transform:uppercase;
  border-bottom:1px solid rgba(201,168,76,.08);
  margin-bottom:.8rem;
}

/* ── RULER BLOCK ── */
.ruler-block{
  position:relative;
  padding:0 0 3rem 2.8rem;
  opacity:0;transform:translateX(14px);
  transition:opacity .5s ease,transform .5s ease;
}
.ruler-block.vis{opacity:1;transform:translateX(0);}

/* dot on line */
.ruler-block::before{
  content:'';
  position:absolute;left:calc(-.1rem - 4px);top:.5rem;
  width:10px;height:10px;border-radius:50%;
  background:var(--navy);
  border:2px solid rgba(201,168,76,.5);
  transition:all .3s;z-index:2;
}
.ruler-block.active::before{
  background:var(--gold);
  border-color:var(--gold);
  box-shadow:0 0 14px rgba(201,168,76,.7);
  transform:scale(1.25);
}

.reign-tag{
  display:inline-flex;align-items:center;gap:.4rem;
  font-size:.6rem;
  letter-spacing:.22em;color:var(--goldd);
  text-transform:uppercase;margin-bottom:.35rem;
}
.reign-tag .material-symbols-rounded{font-size:.8rem;color:var(--gold);}

.ruler-name{
  font-size:clamp(1.15rem,2.3vw,1.65rem);
  font-weight:600;color:#fff;line-height:1.1;margin-bottom:.15rem;
  transition:color .3s;
}
.ruler-block.active .ruler-name{color:var(--goldl);}

.ruler-epi{
  font-size:.85rem;font-style:italic;
  color:rgba(221,211,184,.4);margin-bottom:.85rem;
}
.ruler-desc{
  font-size:.93rem;line-height:1.7;
  color:rgba(221,211,184,.72);max-width:400px;margin-bottom:.9rem;
}

/* events list */
.events{display:flex;flex-direction:column;gap:.5rem;}
.ev{
  display:flex;align-items:flex-start;gap:.6rem;
  font-size:.83rem;color:rgba(221,211,184,.58);
}
.ev-yr{
  font-size:.62rem;
  color:var(--gold);width:2.5rem;flex-shrink:0;
  text-align:right;padding-top:.15rem;
}
.ev-dot{width:4px;height:4px;border-radius:50%;background:rgba(201,168,76,.45);flex-shrink:0;margin-top:.5rem;}
.ev-ic{font-size:.95rem;color:var(--gold);flex-shrink:0;}
.ev-t{flex:1;line-height:1.5;}

/* territory chip */
.terr-chip{
  display:inline-flex;align-items:center;gap:.35rem;
  border:1px solid rgba(201,168,76,.22);
  background:rgba(201,168,76,.06);
  border-radius:2px;padding:.2rem .6rem;
  font-size:.7rem;color:var(--goldl);
  margin-top:.75rem;
}
.terr-chip .material-symbols-rounded{font-size:.8rem;}

/* divider */
.rdiv{
  position:absolute;bottom:1.2rem;left:2.8rem;right:0;
  height:1px;
  background:linear-gradient(to right,rgba(201,168,76,.12),transparent);
}

/* ══════════════════════════════════════
   HOW TO ADD YOUR OWN MAPS
   ─────────────────────────────────────
   1. Put your .jpg files in the same
      folder as this HTML file.
   2. In the DATA array below, set the
      "map" property to the filename,
      e.g.  map: 'asparuh.jpg'
   3. Done — the image will show on the
      left when that ruler is active.
══════════════════════════════════════ */
@media(max-width:800px){
  #app{flex-direction:column;}
  #map-panel{width:100%;height:40vh;flex-shrink:0;}
  #map-panel::after{background:linear-gradient(to bottom,transparent 55%,var(--navy) 100%);}
  #right-panel{height:60vh;}
  #timeline::before{display:none;}
}
